Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: ventelo on January 29, 2018, 01:21:40 PM



Title: Understand source code of bitcoin
Post by: ventelo on January 29, 2018, 01:21:40 PM
As i am new of this market and i have some knowledge of programing, i wish if i can understand :
The source code of bitcoin, where i can start, if there video or explain the code is better.
I have a lot of question, like what is the different between coins working in blockchain.



Title: Re: Understand source code of bitcoin
Post by: cellard on January 29, 2018, 05:22:59 PM
As i am new of this market and i have some knowledge of programing, i wish if i can understand :
The source code of bitcoin, where i can start, if there video or explain the code is better.
I have a lot of question, like what is the different between coins working in blockchain.



Bitcoin was originally written in C++, looks like satoshi was programing under a windows environment and not linux which was surprising to find out to me.

So for starters, you would need a very high level of C++ to even pretend to start looking at the code.

Once you have adquired an high level of C++, you will need an high level of cryptography to understand the context of what everything is doing and why.

Once you are good in both C++ and cryptography you will be able to look at the code yourself. No amount of youtube videos briefly explaining the code will help if you aren't versed in the programing language used for Bitcoin and cryptography.


Title: Re: Understand source code of bitcoin
Post by: hugeblack on January 29, 2018, 05:41:35 PM
Bitcoin is blockchain protocol (C++ and python implementations). "You must have a background about C++".
I learned from:https://bitcoin.stackexchange.com (https://bitcoin.stackexchange.com)

python implementations ----> https://bitcointalk.org/index.php?topic=94645.0 (https://bitcointalk.org/index.php?topic=94645.0).
Mastering Bitcoin [Reading]------> http://chimera.labs.oreilly.com/books/1234000001802/index.html (http://chimera.labs.oreilly.com/books/1234000001802/index.html)
Youtube ------> https://www.youtube.com/watch?v=fOMVZXLjKYo (https://www.youtube.com/watch?v=fOMVZXLjKYo)
Online ------> https://bitcoin.stackexchange.com (https://bitcoin.stackexchange.com)
you can ask here or reddit.com (http://reddit.com)





Hugeblack


Title: Re: Understand source code of bitcoin
Post by: ahmad21 on January 29, 2018, 06:14:03 PM
Ofcourse the whole project of bitcoin and its blockchain is conceptualized on C++ Language. It was the most popular programming language in 2005-10. But what most of people don't know is that there is one of the implementation done in Java named as bitcoinj which is primarily for the thin bitcoin clients like the Multibit wallet etc. Moreover as huge black said that there are python implementations too. So the resource libraries today are available in almost all languages but the roots deep down lay in C++ itself. Difference between different coins working in blockchain is the difference of source code itself. You can get more info about bitcoin's original language at https://bitcoin.org/en/development itself.


Title: Re: Understand source code of bitcoin
Post by: ventelo on January 29, 2018, 09:57:28 PM
As i am new of this market and i have some knowledge of programing, i wish if i can understand :
The source code of bitcoin, where i can start, if there video or explain the code is better.
I have a lot of question, like what is the different between coins working in blockchain.



Bitcoin was originally written in C++, looks like satoshi was programing under a windows environment and not linux which was surprising to find out to me.

So for starters, you would need a very high level of C++ to even pretend to start looking at the code.

Once you have adquired an high level of C++, you will need an high level of cryptography to understand the context of what everything is doing and why.

Once you are good in both C++ and cryptography you will be able to look at the code yourself. No amount of youtube videos briefly explaining the code will help if you aren't versed in the programing language used for Bitcoin and cryptography.
Thanks for this information, from where i can understand cryptography ?


Title: Re: Understand source code of bitcoin
Post by: ventelo on January 29, 2018, 10:09:41 PM
Bitcoin is blockchain protocol (C++ and python implementations). "You must have a background about C++".
I learned from:https://bitcoin.stackexchange.com (https://bitcoin.stackexchange.com)

python implementations ----> https://bitcointalk.org/index.php?topic=94645.0 (https://bitcointalk.org/index.php?topic=94645.0).
Mastering Bitcoin [Reading]------> http://chimera.labs.oreilly.com/books/1234000001802/index.html (http://chimera.labs.oreilly.com/books/1234000001802/index.html)
Youtube ------> https://www.youtube.com/watch?v=fOMVZXLjKYo (https://www.youtube.com/watch?v=fOMVZXLjKYo)
Online ------> https://bitcoin.stackexchange.com (https://bitcoin.stackexchange.com)
you can ask here or reddit.com (http://reddit.com)





Hugeblack
Very thanks, links is very useful.


Title: Re: Understand source code of bitcoin
Post by: robertlegault on January 29, 2018, 10:40:04 PM
Everything is open source.


Title: Re: Understand source code of bitcoin
Post by: samson on January 30, 2018, 10:07:40 AM
As i am new of this market and i have some knowledge of programing, i wish if i can understand :
The source code of bitcoin, where i can start, if there video or explain the code is better.
I have a lot of question, like what is the different between coins working in blockchain.



Bitcoin was originally written in C++, looks like satoshi was programing under a windows environment and not linux which was surprising to find out to me.

So for starters, you would need a very high level of C++ to even pretend to start looking at the code.

Once you have adquired an high level of C++, you will need an high level of cryptography to understand the context of what everything is doing and why.

Once you are good in both C++ and cryptography you will be able to look at the code yourself. No amount of youtube videos briefly explaining the code will help if you aren't versed in the programing language used for Bitcoin and cryptography.
Thanks for this information, from where i can understand cryptography ?


You don't need to learn that much about using cryptography, just hashes and digital signaures using the secp256k1 curve.

The wallet is encrypted but that's just a minor detail really as it doesn't have to be.

So you need to learn about the following :

sha256 hashes
ripemd160 hashes
How to create a keypair on the secp256k1 curve
Sign something (I suggest an sha256 hash of something) with an secp256k1 private key and then verify the signature with the public key

Once you know the above that covers pretty much all of the cryptographic primitives used and you can then start looking into how these functions are used inside Bitcoin.

I would suggest downloading a library like libsecp256k1 and writing some test programs do do the above.



Title: Re: Understand source code of bitcoin
Post by: Anti-Cen on January 30, 2018, 11:36:14 AM
How to create a keypair on the secp256k1 curve

Well I downloaded C# code "secp256k1.Core" but messageSigner.Verify(signedMessage); always returns false from the
test code so I gave in trying to see what went wrong and started to roll my own

https://bitcointalk.org/index.php?topic=2849443.0

RSACryptoServiceProvider that comes with windows is not to be trusted I don't think

EDIT to add


I found the bug in secp256k1 that stopped the signature from Verifying and you just need to change
the code in MessageSignerVerifier from

var signedMessage = new SignedMessage(message, publicKey.GetBitcoinAddress(), signatureBytes);
to
var signedMessage = new SignedMessage(message, publicKey.GetBitcoinAddress(false), signatureBytes);

The project will work from VS.2010 on framework 4 if you copy the .cs files to a new  C#.dll project
if anyone is interested




Title: Re: Understand source code of bitcoin
Post by: ventelo on January 30, 2018, 04:47:21 PM
As i am new of this market and i have some knowledge of programing, i wish if i can understand :
The source code of bitcoin, where i can start, if there video or explain the code is better.
I have a lot of question, like what is the different between coins working in blockchain.



Bitcoin was originally written in C++, looks like satoshi was programing under a windows environment and not linux which was surprising to find out to me.

So for starters, you would need a very high level of C++ to even pretend to start looking at the code.

Once you have adquired an high level of C++, you will need an high level of cryptography to understand the context of what everything is doing and why.

Once you are good in both C++ and cryptography you will be able to look at the code yourself. No amount of youtube videos briefly explaining the code will help if you aren't versed in the programing language used for Bitcoin and cryptography.
Thanks for this information, from where i can understand cryptography ?


You don't need to learn that much about using cryptography, just hashes and digital signaures using the secp256k1 curve.

The wallet is encrypted but that's just a minor detail really as it doesn't have to be.

So you need to learn about the following :

sha256 hashes
ripemd160 hashes
How to create a keypair on the secp256k1 curve
Sign something (I suggest an sha256 hash of something) with an secp256k1 private key and then verify the signature with the public key

Once you know the above that covers pretty much all of the cryptographic primitives used and you can then start looking into how these functions are used inside Bitcoin.

I would suggest downloading a library like libsecp256k1 and writing some test programs do do the above.


Thanks, where i can find information about private key?