Bitcoin Forum

Bitcoin => Electrum => Topic started by: darylchua on October 28, 2017, 04:50:09 PM



Title: Understanding Electrum Codes
Post by: darylchua on October 28, 2017, 04:50:09 PM
Hi, I will like to learn in-depth on Electrum's functionalities from the source codes but there isn't much commenting in the .py files.

Will mainly be interested to know:
1. The main .py file to start looking into
2. The functions and a brief description about them
3. How these functions relate to one another

Your help is much appreciated! :)



Title: Re: Understanding Electrum Codes
Post by: achow101 on October 28, 2017, 09:42:32 PM
Your questions are extremely broad. There are thousands of functions in Electrum's source code, we can't possibly explain what they all do to you, that is just too much time with little reward. Start from the program entry point: https://github.com/spesmilo/electrum/blob/master/electrum and read through it. If you have questions about how something works, ask a specific question, not a super general "explain everything to me" question.


Title: Re: Understanding Electrum Codes
Post by: darylchua on October 29, 2017, 02:46:31 AM
Then may I ask on where is the Proof-of-Work functionality that I can look into?


Title: Re: Understanding Electrum Codes
Post by: HCP on October 29, 2017, 11:41:30 AM
Proof of work? Electrum is a light weight SPV wallet... It doesn't do block validation etc. It leaves all the "heavy lifting" to Electrum servers (which generally rely on Bitcoin Core to download and verify the blockchain)

The is some block header validation of that's what you mean: https://github.com/spesmilo/electrum/blob/master/lib/blockchain.py


Title: Re: Understanding Electrum Codes
Post by: darylchua on October 29, 2017, 04:05:14 PM
Oh thank you so much! I'll look into it!


Title: Re: Understanding Electrum Codes
Post by: darylchua on October 30, 2017, 03:25:36 AM
May I enquire on where I can start with if I want to further optimize Electrum's lightweight performance?


Title: Re: Understanding Electrum Codes
Post by: achow101 on October 30, 2017, 03:27:13 AM
May I enquire on where I can start with if I want to further optimize Electrum's lightweight performance?
Performance doing what? Electrum does a lot of things and each has its own "performance". These include things like syncing, network bandwidth, key generation, storage, etc. What kind of performance do you want to optimize?


Title: Re: Understanding Electrum Codes
Post by: darylchua on October 30, 2017, 06:33:34 AM
I'd like to focus on the syncing aspect and will greatly appreciate any help in terms of optimising the performance.
My understanding is that the current lightweight client syncs only the block headers (80 bytes) which prevents downloading of the entire blockchain.
However, I'd wanna try further optimising this to make it sync even faster.


Title: Re: Understanding Electrum Codes
Post by: darylchua on November 01, 2017, 05:43:49 PM
Hi, is there any help from anyone regarding my previous message?


Title: Re: Understanding Electrum Codes
Post by: Abdussamad on November 01, 2017, 06:17:40 PM
You can ask in #electrum on freenode. The devs tend to gather there.


Title: Re: Understanding Electrum Codes
Post by: jonald_fyookball on November 06, 2017, 07:02:41 PM
I'd like to focus on the syncing aspect and will greatly appreciate any help in terms of optimising the performance.
My understanding is that the current lightweight client syncs only the block headers (80 bytes) which prevents downloading of the entire blockchain.
However, I'd wanna try further optimising this to make it sync even faster.

lib/network.py 
lib/blockchain.py

a good place to start looking


Title: Re: Understanding Electrum Codes
Post by: darylchua on November 12, 2017, 02:28:44 AM
I'd like to focus on the syncing aspect and will greatly appreciate any help in terms of optimising the performance.
My understanding is that the current lightweight client syncs only the block headers (80 bytes) which prevents downloading of the entire blockchain.
However, I'd wanna try further optimising this to make it sync even faster.

lib/network.py 
lib/blockchain.py

a good place to start looking

Thanks for the good advice.

I'm now trying to measure the time taken for blockchain_headers to be downloaded during the first sync. However I am unable to find the right place/code to insert into. Do you have any idea on how I can track the time so that I may further optimise it?


Title: Re: Understanding Electrum Codes
Post by: jonald_fyookball on November 12, 2017, 05:31:11 AM
not really. its downloaded from here

https://github.com/spesmilo/electrum/blob/0ecb665b95917459d17ef3f9e47bde4864a2e318/lib/network.py#L959

but not sure how to time it


Title: Re: Understanding Electrum Codes
Post by: darylchua on November 12, 2017, 06:02:58 AM
not really. its downloaded from here

https://github.com/spesmilo/electrum/blob/0ecb665b95917459d17ef3f9e47bde4864a2e318/lib/network.py#L959

but not sure how to time it

Ok sure thanks alot. I'll try to look into it.