Open DeckerSU opened 1 year ago
Also, we can check if serialize(deserialize(verbose_tx)) != verbose_tx
here and throw an error (put the error in the log) to identify all the such cases.
will this https://github.com/spesmilo/electrumx/pull/234 change something?
Dash 0.13 is a fairly old version released in the 2019, there was another CB TX v2 introduced I believe, and there one more ongoing in the Dash v20
Although that could be easier to just pass tx hash, I feel like the proper serialization / deserialization of each known coin will be better in the long run
I eager to provide any necessary help to achieve that regarding Dash protocol changes
I feel like the proper serialization / deserialization of each known coin will be better in the long run
Thank you for your input @pshenmic, we try to support serialization / deserialization for each known coin but new tx formats sometimes lead to problems. We aim to do this for dash too.
I eager to provide any necessary help to achieve that regarding Dash protocol changes
If you can specify what new fields were added and what fields were removed with each tx version, that would be great help. You can also just point us to these changes in code or any other useful resources and we will pick it up from there :)
There is a bug in
mm2
related to DASH coinbase (or not only?) serialization / deserialization. mm2 shows txid of tx 70ce3e63579742f3030e2a263ced5aa7ce606cbacfabdad5718387efac81211a belonged to addressXnsqxQLGQv1FTwXJhakqMYL8MpT1G2tegZ
as6899ce7eff3c19ae827d82c575c2486fc0c6102e274cfe83d94604857587d30a
. I did a small investigation and here is the results:mm2
output onmy_tx_history
for addressXnsqxQLGQv1FTwXJhakqMYL8MpT1G2tegZ
is:As we can see
tx_hash
here is6899ce7eff3c19ae827d82c575c2486fc0c6102e274cfe83d94604857587d30a
, but should be70ce3e63579742f3030e2a263ced5aa7ce606cbacfabdad5718387efac81211a
instead.getrawtransaction
for70ce3e63579742f3030e2a263ced5aa7ce606cbacfabdad5718387efac81211a
got directly fromdashd
isSo, from the first look it corresponds
tx_hex
from mm2 output. But.txid
of this tx manually, for example, let's take sha256d hash of raw tx via simple python script:def doubleSha256(hex): bin = binascii.unhexlify(hex) hash = hashlib.sha256(bin).digest() hash2 = hashlib.sha256(hash).digest() return binascii.hexlify(hash2)
Getting raw transaction data
raw = '03000500010000000000000000000000000000000000000000000000000000000000000000ffffffff5803dca01d04018f0c650cfabe6d6d0000000000000000000000000000000000000000000000000000000000000000010000000000000067f8f92f7f4d620000000000156233626333643837323136306162316236303731320000000002ef67c105000000001976a914e976ec3a46c7c8b65e7914e4257c966265b9e72488ac1c7d0308000000001976a91485b630193f8d9025495f51b4a3f884d32b92fa1d88ac00000000460200dca01d00d54c0324c6bbfa66bc500419a0c69249e70ee476f3ea589dad71616ec187d32dc7955b8b2ef67a6b5eaba5343b7770452553be3d9bfd71e7c67d020171d72655'
Calculating Double-SHA256 hash
hash = doubleSha256(raw)
Converting result to big-endian hex notation
txid = binascii.hexlify(binascii.unhexlify(hash)[::-1]) txid = str(txid,"ascii")
print("Tx_ID:\n "+txid)
{ "id": 1, "method":"blockchain.scripthash.listunspent", "params":["b85136e199d2b5b0bcfa78c7c293e6c01d76581e0f31f402904754da5a1a700f"] }
{"jsonrpc":"2.0","result":[{"tx_hash":"d829ccc4741b9ccc0af4f4d8af66ca6064edff09d7891b351a855cf01714df7e","tx_pos":1,"height":1934382,"value":134438317},{"tx_hash":"75424b78efaa61ce8f0e485bcca80014f3ba20b2f66afec97746264f75a686d7","tx_pos":1,"height":1939138,"value":76054298},{"tx_hash":"70ce3e63579742f3030e2a263ced5aa7ce606cbacfabdad5718387efac81211a","tx_pos":1,"height":1941724,"value":134446364}],"id":1}
03000500010000000000000000000000000000000000000000000000000000000000000000ffffffff5803dca01d04018f0c650cfabe6d6d0000000000000000000000000000000000000000000000000000000000000000010000000000000067f8f92f7f4d620000000000156233626333643837323136306162316236303731320000000002ef67c105000000001976a914e976ec3a46c7c8b65e7914e4257c966265b9e72488ac1c7d0308000000001976a91485b630193f8d9025495f51b4a3f884d32b92fa1d88ac00000000460200dc
03000500010000000000000000000000000000000000000000000000000000000000000000ffffffff5803dca01d04018f0c650cfabe6d6d0000000000000000000000000000000000000000000000000000000000000000010000000000000067f8f92f7f4d620000000000156233626333643837323136306162316236303731320000000002ef67c105000000001976a914e976ec3a46c7c8b65e7914e4257c966265b9e72488ac1c7d0308000000001976a91485b630193f8d9025495f51b4a3f884d32b92fa1d88ac00000000460200dca01d00d54c0324c6bbfa66bc500419a0c69249e70ee476f3ea589dad71616ec187d32dc7955b8b2ef67a6b5eaba5343b7770452553be3d9bfd71e7c67d020171d72655
"extraPayloadSize":,
"extraPayload": …
"extraPayloadSize": 70, "extraPayload": "0200dca01d00d54c0324c6bbfa66bc500419a0c69249e70ee476f3ea589dad71616ec187d32dc7955b8b2ef67a6b5eaba5343b7770452553be3d9bfd71e7c67d020171d72655"