Re: Considering starting a toy full-node implementation. Any advice?

Re: Considering starting a toy full-node implementation. Any advice?
From: rze @ 2018-11-06 21:21 UTC (permalink / raw)
  To: bitcoin-dev

Hello,

I'm considering to start developing a toy full validating node implementation (no wallet, no mining) for educational purposes.

Some questions:

1) which resource do you suggest for as a reference for the protocol?
2) which part do you suggest to start with?
3) I was thinking to use btcd as a reference since I'm not familiar with C++ (bitcoind)
4) are there any other general advice or tips for such endeavours?

Thanks in advance.



 permalink raw reply	[|nested]


  2018-11-07 16:19   ` John C. Vernaleo
  
From: Артём Литвинович @ 2018-11-07 13:20 UTC (permalink / raw)
  To: bitcoin-dev

Hi there.

Been there, done that.

-Don't try to set big goals at once.
Start small and aim for small steps, i.e. by connecting to nodes, then
getting some data from them, then downloading blocks, then parsing
blocks, then building an UTXO set, etc.
My first long term goal was to simply compute the balance of an address.

-Expect to work with huge and varied sets of data.
You'll have to build and use tens of Gb of indexes, for example.
Early transactions also have all sorts of non-standard scripts, and
testnet have all sorts of weird non-standard scripts, so plan
accordingly.

-Don't write off making a wallet or mining.
The latter is easy to do on CPU on testnet and learning to make valid
blocks helps a lot in understanding how things work.
A wallet, on the other hand, gives you good understanding of keys and
transactions, especially if you want to try doing all the EC math
yourself.
I also wrote things to be generic between several forks and chains,
like Litecoin, Doge, Zcash and a bunch of now-dead alts - there is so
little difference between many of them that all it takes is a
parameter or two. Helps with perspective.
Naturally, stay away from mainnets and real money if you do your own
wallet and crypto.

-Don't get too excited when you'd see exploitable signatures.
All of them were plundered years ago, and by now no one makes mistakes
like that.
Also, there are plenty of bots which are constantly scanning the chain
for weak keys and signatures, any new ones will be gone in a few
seconds.

-Expect cthulhus. There used to be plenty of artwork and puzzles in
the early blockchain.
Here is a short write up with a few of the things i found: https www
dot ribbonfarm dot
com/2017/07/20/the-ominouslier-roar-of-the-bitcoin-wave/


For references, good ones i found and used were:
https bitcoin dot org/en/developer-reference
https en dot bitcoin dot it/wiki/Protocol_documentation
Also, BIPs contain a lot of specific details: https github dot com/bitcoin/bips
That should get you started, and by the time you get into the devilish
details you'll have to look at the code for reference.

No idea about 3), haven't looked at it.

Good luck and have fun.
-Artem

ср, 7 нояб. 2018 г. в 15:01, <bitcoin-dev-request@lists•linuxfoundation.org>:
>
> Date: Tue, 6 Nov 2018 23:21:11 +0200
> From: rze <rzeqeu@gmail•com>
> To: bitcoin-dev@lists•linuxfoundation.org
> Subject: [bitcoin-dev] Considering starting a toy full-node implementation. Any advice?
>
> Hello,
>
> I'm considering to start developing a toy full validating node implementation (no wallet, no mining) for educational purposes.
>
> Some questions:
>
> 1) which resource do you suggest for as a reference for the protocol?
> 2) which part do you suggest to start with?
> 3) I was thinking to use btcd as a reference since I'm not familiar with C++ (bitcoind)
> 4) are there any other general advice or tips for such endeavours?
>
> Thanks in advance.
>


 permalink raw reply	[|nested]
2018-11-07 13:20 ` [bitcoin-dev] Considering starting a toy full-node implementation. Any advice? Артём Литвинович

  
From: John C. Vernaleo @ 2018-11-07 16:19 UTC ( / )
  To: Артём
	Литвинович,
	Bitcoin Protocol Discussion



One point on the dataset issue that I learned early on in the btcd days:
you will be downloading the blockchain over and over again and that is not 
good for an ssd or even worse an sd card.  I broke more than one sd card 
making sure btcd worked on a raspberry pi.

-------------------------------------------------------
John C. Vernaleo, Ph.D.
www.netpurgatory.com
john@netpurgatory•com
-------------------------------------------------------

On Wed, 7 Nov 2018, Артём Литвинович via bitcoin-dev wrote:

> Hi there.
>
> Been there, done that.
>
> -Don't try to set big goals at once.
> Start small and aim for small steps, i.e. by connecting to nodes, then
> getting some data from them, then downloading blocks, then parsing
> blocks, then building an UTXO set, etc.
> My first long term goal was to simply compute the balance of an address.
>
> -Expect to work with huge and varied sets of data.
> You'll have to build and use tens of Gb of indexes, for example.
> Early transactions also have all sorts of non-standard scripts, and
> testnet have all sorts of weird non-standard scripts, so plan
> accordingly.
>
> -Don't write off making a wallet or mining.
> The latter is easy to do on CPU on testnet and learning to make valid
> blocks helps a lot in understanding how things work.
> A wallet, on the other hand, gives you good understanding of keys and
> transactions, especially if you want to try doing all the EC math
> yourself.
> I also wrote things to be generic between several forks and chains,
> like Litecoin, Doge, Zcash and a bunch of now-dead alts - there is so
> little difference between many of them that all it takes is a
> parameter or two. Helps with perspective.
> Naturally, stay away from mainnets and real money if you do your own
> wallet and crypto.
>
> -Don't get too excited when you'd see exploitable signatures.
> All of them were plundered years ago, and by now no one makes mistakes
> like that.
> Also, there are plenty of bots which are constantly scanning the chain
> for weak keys and signatures, any new ones will be gone in a few
> seconds.
>
> -Expect cthulhus. There used to be plenty of artwork and puzzles in
> the early blockchain.
> Here is a short write up with a few of the things i found: https www
> dot ribbonfarm dot
> com/2017/07/20/the-ominouslier-roar-of-the-bitcoin-wave/
>
>
> For references, good ones i found and used were:
> https bitcoin dot org/en/developer-reference
> https en dot bitcoin dot it/wiki/Protocol_documentation
> Also, BIPs contain a lot of specific details: https github dot com/bitcoin/bips
> That should get you started, and by the time you get into the devilish
> details you'll have to look at the code for reference.
>
> No idea about 3), haven't looked at it.
>
> Good luck and have fun.
> -Artem
>
> ср, 7 нояб. 2018 г. в 15:01, <bitcoin-dev-request@lists•linuxfoundation.org>:
>>
>> Date: Tue, 6 Nov 2018 23:21:11 +0200
>> From: rze <rzeqeu@gmail•com>
>> To: bitcoin-dev@lists•linuxfoundation.org
>> Subject: [bitcoin-dev] Considering starting a toy full-node implementation. Any advice?
>>
>> Hello,
>>
>> I'm considering to start developing a toy full validating node implementation (no wallet, no mining) for educational purposes.
>>
>> Some questions:
>>
>> 1) which resource do you suggest for as a reference for the protocol?
>> 2) which part do you suggest to start with?
>> 3) I was thinking to use btcd as a reference since I'm not familiar with C++ (bitcoind)
>> 4) are there any other general advice or tips for such endeavours?
>>
>> Thanks in advance.
>>
> _______________________________________________
> bitcoin-dev mailing list
> bitcoin-dev@lists•linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev