Bitcoin Forum
April 27, 2024, 04:41:39 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [initial connection] Some questions at the start of designing a bitcoin client  (Read 189 times)
jackg (OP)
Copper Member
Legendary
*
Offline Offline

Activity: 2856
Merit: 3071


https://bit.ly/387FXHi lightning theory


View Profile
December 17, 2018, 04:16:03 PM
Last edit: December 17, 2018, 04:34:14 PM by jackg
Merited by Coding Enthusiast (1)
 #1

I'm designing a bitcoin client for myself and hopefully to release. I'm trying to make the design and publish it using the waterflow model in the hope that other people will be able to use it and know how bitcoin functions, but I have a few questions.

https://en.bitcoin.it/wiki/Protocol_documentation#version

based on this and this

https://en.bitcoin.it/wiki/Protocol_documentation#Network_address

Is version and block height the same?
Does the user_agent have an unlimited size or should I check the source code? Hypothetically as this will all be in one network packet, it can have an unlimited size I just wanted to check.

What's service number?

Finally, as field size is bits and some of the fields are bigger than what is allowed for, do we just take the end of the values? I.E the nonce is 8 bits but the uint64 is obviously 64 (or are those values in bytes)?

EDIT: Ahhhh, IPv7 got invented, its bytes but does that mean the last 8 bits are set to 1.
1714192899
Hero Member
*
Offline Offline

Posts: 1714192899

View Profile Personal Message (Offline)

Ignore
1714192899
Reply with quote  #2

1714192899
Report to moderator
If you want to be a moderator, report many posts with accuracy. You will be noticed.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714192899
Hero Member
*
Offline Offline

Posts: 1714192899

View Profile Personal Message (Offline)

Ignore
1714192899
Reply with quote  #2

1714192899
Report to moderator
1714192899
Hero Member
*
Offline Offline

Posts: 1714192899

View Profile Personal Message (Offline)

Ignore
1714192899
Reply with quote  #2

1714192899
Report to moderator
1714192899
Hero Member
*
Offline Offline

Posts: 1714192899

View Profile Personal Message (Offline)

Ignore
1714192899
Reply with quote  #2

1714192899
Report to moderator
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3374
Merit: 6535


Just writing some code


View Profile WWW
December 17, 2018, 05:14:21 PM
Merited by jackg (8), Foxpup (2), mikeywith (2), bones261 (2), ABCbits (1), Coding Enthusiast (1)
 #2

Is version and block height the same?
No. There are protocol version numbers which indicate support for various features. Block height is completely unrelated as the p2p protocol is not related to consensus state. A list of protocol version numbers and their descriptions is available here: https://btcinformation.org/en/developer-reference#protocol-versions

Does the user_agent have an unlimited size or should I check the source code? Hypothetically as this will all be in one network packet, it can have an unlimited size I just wanted to check.
It's unlimited but there are size constraints on messages. Don't make it super long.

What's service number?
I assume you mean service bits. Service bits are used to indicate what services a node supports. These include things like NODE_NETWORK (bit 0) which indicates that you support sending the complete blockchain. A list of service bits and their descriptions is found in the code

Finally, as field size is bits and some of the fields are bigger than what is allowed for, do we just take the end of the values? I.E the nonce is 8 bits but the uint64 is obviously 64 (or are those values in bytes)?
The field size is in bytes. 8 bytes is 64 bits. No field has a type that is larger than it's field size or vice versa.

Coding Enthusiast
Legendary
*
Offline Offline

Activity: 1039
Merit: 2783


Bitcoin and C♯ Enthusiast


View Profile WWW
December 18, 2018, 04:51:41 PM
 #3

Don't forget to check out BIP14 for userAgents.

By the way, how is your "code conversion" going?

Projects List+Suggestion box
Donate: 1Q9s or bc1q
|
|
|
FinderOuter(0.19.1)Ann-git
Denovo(0.7.0)Ann-git
Bitcoin.Net(0.26.0)Ann-git
|
|
|
BitcoinTransactionTool(0.11.0)Ann-git
WatchOnlyBitcoinWallet(3.2.1)Ann-git
SharpPusher(0.12.0)Ann-git
jackg (OP)
Copper Member
Legendary
*
Offline Offline

Activity: 2856
Merit: 3071


https://bit.ly/387FXHi lightning theory


View Profile
December 18, 2018, 05:03:41 PM
Last edit: December 18, 2018, 09:11:35 PM by jackg
 #4

Don't forget to check out BIP14 for userAgents.

By the way, how is your "code conversion" going?

I've decided to rewrite a lot of the code taking on people's advice. I'm in the designing stage (of the algorithms and data structure). I want a full design or as close to it as I can possibly get. I started doing some of the more hardcore stuff a few days ago as I was short of direction and motive for a while due to a lot of coursework that was due.

The version messages are probably fine to be completely copied over and I'll work out where they are in the source later (although hopefully I can get some specific ones for my client that can cut corners a bit). I don't actually have a name but I guess I can just chuck anything with it and hope for the best, it's just a name that allows other nodes to blacklist it in case I completely mess up the source and it starts spawning random chain forks Grin.

I'm wanting to use something similar to the electrum seeds and I'm hoping to try to generate an xpub and zpub, derive the native addresses from the zpub and the non-native segwit and legacy addresses from the same seed (I'm thinking of letting people use all three from the same seeds at the same time to make it much easier to make it compatible with other clients that aren't going to include native segwit).

Lightning, dandelion and wimblewomble will have to be ignored for the moment however along with a few other things but hopefully I can add them later.

Also, thanks for the link I'll have to check them all.
I'm hoping once I get a desing that is full and will be updated while I'm writing the code, someone else can easily copy it and put it into a new language fairly easily in comparison to how it is at the moment. Hopefully I can publish a book (I can probably push something to amazon, github and my own site for free but I might have to publish under my own name so might disappear for a few weeks about that time to keep the mystery alive Grin). I'm hoping that someone can come along (maybe me) in a few years and if the document is regularly updated they can put it into Go if that language turns out to be faster than C# by that time or maybe there'll be a new quantum oriented language by that time.


I've never put two and two together before now Sad

Based on that, I'm guessing dots are necessary - I haven't moved onto blocks yet though?
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!