Bitcoin Forum
November 11, 2024, 03:01:35 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Understanding Electrum Codes  (Read 535 times)
darylchua (OP)
Newbie
*
Offline Offline

Activity: 11
Merit: 0


View Profile
October 28, 2017, 04:50:09 PM
 #1

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! Smiley

achow101
Staff
Legendary
*
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
October 28, 2017, 09:42:32 PM
 #2

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.

darylchua (OP)
Newbie
*
Offline Offline

Activity: 11
Merit: 0


View Profile
October 29, 2017, 02:46:31 AM
 #3

Then may I ask on where is the Proof-of-Work functionality that I can look into?
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4361

<insert witty quote here>


View Profile
October 29, 2017, 11:41:30 AM
 #4

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

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
darylchua (OP)
Newbie
*
Offline Offline

Activity: 11
Merit: 0


View Profile
October 29, 2017, 04:05:14 PM
 #5

Oh thank you so much! I'll look into it!
darylchua (OP)
Newbie
*
Offline Offline

Activity: 11
Merit: 0


View Profile
October 30, 2017, 03:25:36 AM
 #6

May I enquire on where I can start with if I want to further optimize Electrum's lightweight performance?
achow101
Staff
Legendary
*
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
October 30, 2017, 03:27:13 AM
 #7

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?

darylchua (OP)
Newbie
*
Offline Offline

Activity: 11
Merit: 0


View Profile
October 30, 2017, 06:33:34 AM
 #8

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.
darylchua (OP)
Newbie
*
Offline Offline

Activity: 11
Merit: 0


View Profile
November 01, 2017, 05:43:49 PM
 #9

Hi, is there any help from anyone regarding my previous message?
Abdussamad
Legendary
*
Offline Offline

Activity: 3682
Merit: 1580



View Profile
November 01, 2017, 06:17:40 PM
 #10

You can ask in #electrum on freenode. The devs tend to gather there.
jonald_fyookball
Legendary
*
Offline Offline

Activity: 1302
Merit: 1008


Core dev leaves me neg feedback #abuse #political


View Profile
November 06, 2017, 07:02:41 PM
 #11

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

darylchua (OP)
Newbie
*
Offline Offline

Activity: 11
Merit: 0


View Profile
November 12, 2017, 02:28:44 AM
 #12

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?
jonald_fyookball
Legendary
*
Offline Offline

Activity: 1302
Merit: 1008


Core dev leaves me neg feedback #abuse #political


View Profile
November 12, 2017, 05:31:11 AM
 #13

not really. its downloaded from here

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

but not sure how to time it

darylchua (OP)
Newbie
*
Offline Offline

Activity: 11
Merit: 0


View Profile
November 12, 2017, 06:02:58 AM
 #14


Ok sure thanks alot. I'll try to look into it.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!