Search content
Sort by

Showing 4 of 4 results by myfy
Post
Topic
Board Bitcoin Technical Support
Topic OP
How do I find the information of the Bitcoin protocol version
by
myfy
on 26/04/2024, 13:44:08 UTC
Hello

I want to broadcast Bitcoin transactions using python's sock library.Now I can sign a transaction. But when sock is used to link other nodes, it is not known what information should be transmitted.The node I am linking to is protocol version 70016.I tried to find information on bitcoin.org.

This is the site I was looking for:
https://developer.bitcoin.org/reference/p2p_networking.html#protocol-versions

But it doesn't show how protocol 70016 works.I want to know which website I should visit for the 70016 version of the Bitcoin protocol.
Post
Topic
Board Development & Technical Discussion
Merits 1 from 1 user
Topic OP
How do I find the information of the Bitcoin protocol version
by
myfy
on 26/04/2024, 13:31:52 UTC
⭐ Merited by hugeblack (1)
Hello

I want to broadcast Bitcoin transactions using python's sock library.Now I can sign a transaction. But when sock is used to link other nodes, it is not known what information should be transmitted.The node I am linking to is protocol version 70016.I tried to find information on bitcoin.org.

This is the site I was looking for:
https://developer.bitcoin.org/reference/p2p_networking.html#protocol-versions

But it doesn't show how protocol 70016 works.I want to know which website I should visit for the 70016 version of the Bitcoin protocol
Post
Topic
Board Bitcoin Technical Support
Topic OP
how to sign a message with python code
by
myfy
on 25/04/2024, 09:31:46 UTC
hello

I want to send a transaction with python, but I can't sign rawtransaction.

I want to know which python library I need to learn.
Post
Topic
Board Development & Technical Discussion
Topic OP
how to sign a rawtransaction
by
myfy
on 25/04/2024, 08:32:57 UTC
hello,
I tried a lot of ways to sign a rawtransaction by python,but all way is error.
this is a transaction sended by Bitcoin Core in testnet:
txid: 4a33829b7606d8f3326efdae4580318707c9d68f07b00581209db5308bf491c9
hex: 020000000001017826770251b03004341d1f11f59c2e1aac368cd4f16201e77e2cd38b57abacb30 100000000fdffffff020000000000000000066a04746573748804000000000000160014fa5a153a 8c4d936f990bc54419916c90bb42e92c  024730440220218f29a138304bec8bdc08a74f014a472b5053bcbb1f14f525eb08c8d00884a3022 04c589722a0775fd76227503e8dbf4e4bd51d4dc2745cc5588c23ba7fa2a810f501 21020afccd21b34449bd18b1ee2f5504b5bc4e2faef14a825dc4b6d0e16a79f5e33b00000000

I want to implement transaction signing in python.Now, I can separate the parts:
unsigned transaction: 02000000017826770251b03004341d1f11f59c2e1aac368cd4f16201e77e2cd38b57abacb301000 00000fdffffff020000000000000000066a04746573748804000000000000160014fa5a153a8c4d 936f990bc54419916c90bb42e92c00000000
r:218f29a138304bec8bdc08a74f014a472b5053bcbb1f14f525eb08c8d00884a3
s:4c589722a0775fd76227503e8dbf4e4bd51d4dc2745cc5588c23ba7fa2a810f5
sign_all:01
public_key:21020afccd21b34449bd18b1ee2f5504b5bc4e2faef14a825dc4b6d0e16a79f5e33b

I tried to start by verifing the transaction.This is my python code:
from fastecdsa import curve, ecdsa,point
from hashlib import sha256
txid = '4a33829b7606d8f3326efdae4580318707c9d68f07b00581209db5308bf491c9'
r = '218f29a138304bec8bdc08a74f014a472b5053bcbb1f14f525eb08c8d00884a3'
s = '4c589722a0775fd76227503e8dbf4e4bd51d4dc2745cc5588c23ba7fa2a810f5'
x = '0afccd21b34449bd18b1ee2f5504b5bc4e2faef14a825dc4b6d0e16a79f5e33b'
y = '629be62cbde56f8842fa8fd4a33d2656f77ccfc0ad51d9659a7b34fc6c99d840'
Qa = point.Point(x=int(x,16),y=int(y,16),curve=curve.secp256k1)
valid = ecdsa.verify((int(r,16),int(s,16)),bytes.fromhex(txid),Qa,curve=curve.secp256k1,hashfunc=sha256)
print(valid)

The result is False. I don't know where is wrong.