Sunday, December 22, 2024

p2p – Broadcast a sound block to community, with out a native full node

What message might he ship to the node to be assured that his legitimate block will likely be broadcast to the community and appended to the chain?

You’ll be able to by no means be assured. The node you hook up with could also be malicious, malfunctioning, or be badly linked itself. However you’ll be able to actually enhance the percentages of excellent propagation by sending your pal’s block to as many nodes as potential.

What ought to the format/encoding be?

What communication protocol(s) ought to he use?

The Bitcoin P2P protocol has roughly three mechanisms for saying new blocks to the community:

  • The outdated inv / getdata / block mechanism: you’d first ship an inv message, containing an stock merchandise of kind MSG_BLOCK (2), and the block hash. The peer will then presumably request the precise block information (if they do not have it already) utilizing a getdata message containing an analogous stock merchandise with kind MSG_BLOCK or MSG_WITNESS_BLOCK (relying on whether or not they need witness information). You’ll then reply by sending a block message containing the block header plus the transaction vector, in serialized format (the identical format that transaction hashes are computed over). If the kind in getdata was MSG_WITNESS_BLOCK, you’re anticipated to incorporate witnesses within the transactions, utilizing the BIP144 encoding. If the peer does not have the mum or dad of your block but, this will set off fetches for ancestors, utilizing getdata or getheaders (which you will be anticipated to reply to with a headers message).
  • The BIP130 mechanism: when negotiated utilizing the sendheaders message at connection time, blocks could be introduced to friends utilizing a headers message as a substitute of inv. This lets the peer ask for lacking mum or dad headers earlier than truly getting the total block from you. The getdata and information steps of the earlier method stay unchanged in that case.
  • The BIP152 mechanism (compact blocks). The main points of the particular protocol are too intricate to clarify in a paragraph right here, however the tough thought is to solely hand (quick) identifiers for every transaction within the block to the peer, who will then reconstruct the block on their very own, and presumably ask for lacking transactions.

In sure instances, Bitcoin Core can even settle for unsolicited blocks, specifically simply block messages despatched to it with out preceeding getdata. That is the simplest method, however it’s not assured to work.

Would the total node want any particular working system configuration, or extra software program, to facilitate this?

All (trustworthy) full nodes can validate and relay blocks to their friends. Clearly ones with extra processing energy, or better-connected networking, can accomplish that sooner.

By the way, for instance that my pal could be significantly grateful for solutions inside ~10 minutes.

Haha, sorry, too late!

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles