Hey everyone
I'm trying to send Bitcoin transactions using Python's socket library. I’ve got the transaction signing part down, but I’m stuck on what info I need to send when connecting to other nodes. The node I’m trying to connect to is on protocol version 70016. I checked out bitcoin.org for details.
Here's the link I found:
https://developer.bitcoin.org/reference/p2p_networking.html#protocol-versions
But it doesn’t really explain how protocol 70016 operates. Can anyone point me to the right site or resource for understanding the 70016 version of the Bitcoin protocol?
How to find details about Bitcoin protocol version
2 replies 165 views
Sorry, if my post is sort of off-topic when you ask such a specific question. I'm no Python coder but there should be some already existing libraries and modules to do that. Do you have specific needs to use the socket lib?
A non-extensive search gave me some hits that look promissing (I had a quick look into each search result, but not more than that):
https://medium.com/coinmonks/how-to-make-a-bitcoin-transaction-with-python-450d7d3db864 --- seems incomplete
https://github.com/slush0/sendtx
https://bitcoinlib.readthedocs.io/en/latest/ --- you need a Bitcoin node, preferably local
A from-scratch tour of Bitcoin in Python --- maybe worth looking into how tx are actually send out
...
There's certainly more to find. I don't see this as my duty, improve your searching skills. Have a look at this thread as another find, I'm pretty confident there're more sources in this forum, too:
Make a bitcoin transaction with python?
If that's all you want to do, you need not concern yourself with the protocol version. Majority of these versions are defining stuff that concerns a full node not what you want to do.
The process you're looking for is like it's always been:
1. Open socket and connect to the peer using its IP address and port
2. Perform handshare (Send version, receive version and verack, send verack)
3. Push your tx in a tx message
The three message types and their structures on explained in the link you shared.
https://developer.bitcoin.org/reference/p2p_networking.html#version
https://developer.bitcoin.org/reference/p2p_networking.html#verack
https://developer.bitcoin.org/reference/p2p_networking.html#tx
FWIW protocol version 70016 introduced wtxid-based relay and nodes that have that version support this feature.
Related topics
- Erlay seems to have some issues here’s a better proposal for a bitcoin protocol without invites 3
- Introducing cBTC: A Bitcoin-Backed Monetary Protocol Concept Seeking Feedback 19
- Curious about the 'Services' section in the peers of Bitcoin Core 6
- Bitcoin Core displaying coins (UTXOs) in a new tab 13
- Are you in favor of BIP-110? Let's get a Bitcoin poll going. 0
- Ways to earn some sats by contributing to bitcoin core development 5