Sunday, December 22, 2024

python – broadcasting error for uncooked bitcoin transaction testnet

I’m making an attempt to create a uncooked transaction and ship it to the testnet. I’m utilizing testnet keys and right here is the simplified readable output from my script:

decoded non-public key:  efd0171bc0e1a973c75d97cdf38ecccfb2e70227a23cfcdadfed8d9dd1f198c6dc

testnet non-public ky =  d0171bc0e1a973c75d97cdf38ecccfb2e70227a23cfcdadfed8d9dd1f198c6dc

Receiver public key:   a4842eed5a2c6fd7b71a238632f268d5831dacc0

out1Script:  76a914a4842eed5a2c6fd7b71a238632f268d5831dacc088ac
out1 script size in bytes =  25

My public key:  2431e05399f655c52f2e7ab6227837c94d450312
out2Script:  76a9142431e05399f655c52f2e7ab6227837c94d45031288ac
out2 script size in bytes =  25

Message to signal:  f1c7146e665f9b59a6cce31526d85abb2d76859ba13219e9f8cf8e0d51051e45

my pub ok with out 04 half added:  be13acda02dc89ebd1ab87030750b694563c7dac7ebc53b541178e6d04cda33215d712406ff8b705607312d5fea471e9855dbcb963efb63a54e7efeb36382881
pub ok len:  128 that's 64 byte lengthy

signatureeeee:  30450221008eaa588a4037a1cd87115853ad28fc215b0ba2cfa7b1327675563bbd971939e302204d245c9092f0c28f3f31ad1bcccb4aef5c7fe718d2a20c39a94358eb8b61845c
signature lenght:  142

confirm signatureeeee with pub key with out '04' added that's derived instantly from non-public key:  True

wif pub ky:  2431e05399f655c52f2e7ab6227837c94d450312
pub ky from pr ky:  be13acda02dc89ebd1ab87030750b694563c7dac7ebc53b541178e6d04cda33215d712406ff8b705607312d5fea471e9855dbcb963efb63a54e7efeb36382881

sigscript:  4830450221008eaa588a4037a1cd87115853ad28fc215b0ba2cfa7b1327675563bbd971939e302204d245c9092f0c28f3f31ad1bcccb4aef5c7fe718d2a20c39a94358eb8b61845c014104be13acda02dc89ebd1ab87030750b694563c7dac7ebc53b541178e6d04cda33215d712406ff8b705607312d5fea471e9855dbcb963efb63a54e7efeb36382881
sigscript lennn:  278
pubky len in sigscript:  65

Formatting of actual transaction:

version------------------- 01000000
transaction used---------- 01
transaction out Hex------ 245d84ae31c473495d2ba9b3a57b44196d634acf8a8d689960550345422a01fd
transaction out index----- 00000000
signing script size------- 8b
sigScript----------------- 4830450221008eaa588a4037a1cd87115853ad28fc215b0ba2cfa7b1327675563bbd971939e302204d245c9092f0c28f3f31ad1bcccb4aef5c7fe718d2a20c39a94358eb8b61845c014104be13acda02dc89ebd1ab87030750b694563c7dac7ebc53b541178e6d04cda33215d712406ff8b705607312d5fea471e9855dbcb963efb63a54e7efeb36382881

-----sigscript formatting----

sig size---- 48

signature--- 30450221008eaa588a4037a1cd87115853ad28fc215b0ba2cfa7b1327675563bbd971939e302204d245c9092f0c28f3f31ad1bcccb4aef5c7fe718d2a20c39a94358eb8b61845c

how this script applies----- 01

pub ky len--- 41

pub key-- 04be13acda02dc89ebd1ab87030750b694563c7dac7ebc53b541178e6d04cda33215d712406ff8b705607312d5fea471e9855dbcb963efb63a54e7efeb36382881

this pub secret is 65 byte lengthy dueto '04' added
---end sigscript formatting----

sequence------------------ ffffffff
no. of out trxn----------- 02
out1 value---------------- 00c4090000000000
out1 script len----------- 19
out1 Script--------------- 76a914a4842eed5a2c6fd7b71a238632f268d5831dacc088ac
out2 value---------------- c0cf6a0000000000
out2 script len----------- 19
out2 script--------------- 76a9142431e05399f655c52f2e7ab6227837c94d45031288ac
lock time----------------- 00000000

Transaction of hex string:

0100000001245d84ae31c473495d2ba9b3a57b44196d634acf8a8d689960550345422a01fd000000008b4830450221008eaa588a4037a1cd87115853ad28fc215b0ba2cfa7b1327675563bbd971939e302204d245c9092f0c28f3f31ad1bcccb4aef5c7fe718d2a20c39a94358eb8b61845c014104be13acda02dc89ebd1ab87030750b694563c7dac7ebc53b541178e6d04cda33215d712406ff8b705607312d5fea471e9855dbcb963efb63a54e7efeb36382881ffffffff0200c40900000000001976a914a4842eed5a2c6fd7b71a238632f268d5831dacc088acc0cf6a00000000001976a9142431e05399f655c52f2e7ab6227837c94d45031288ac00000000

I’m utilizing transaction in hex string to broadcast utilizing https://stay.blockcypher.com/btc-testnet/pushtx/
which reveals this error:

Error validating transaction: Error working script for enter 0 referencing fd012a424503556099688d8acf4a636d19447ba5b3a92b5d4973c431ae845d24 at 0: Script was NOT verified efficiently..

The 0 index in that transaction is:

OP_DUP OP_HASH160 2431e05399f655c52f2e7ab6227837c94d450312 OP_EQUALVERIFY OP_CHECKSIG

tried broadcasting utilizing: https://testnet.blockexplorer.com/tx/ship
which reveals this error:

16: mandatory-script-verify-flag-failed (Script evaluated with out error however completed with a false/empty high stack component). Code:-26

Once I decode the transaction utilizing: https://stay.blockcypher.com/btc-testnet/decodetx/
it reveals:

{
    "addresses": [
        "mipLNRZc9oo2fKFzhfwJVNy1t29VsqHRvS", 
        "mvWqTmhjEyMkymTm4VMFWLPQhzGwo6RPGM"
    ], 
    "block_height": -1, 
    "block_index": -1, 
    "confirmations": 0, 
    "double_spend": false, 
    "charges": 6499, 
    "hash": "28aa9b738ec668c62280c7d7cb19c1b907ec10427050902609a54264774c77ca", 
    "inputs": [
        {
            "addresses": [
                "mipLNRZc9oo2fKFzhfwJVNy1t29VsqHRvS"
            ], 
            "age": 1489541, 
            "output_index": 0, 
            "output_value": 7646499, 
            "prev_hash": "fd012a424503556099688d8acf4a636d19447ba5b3a92b5d4973c431ae845d24", 
            "script": "4830450221008eaa588a4037a1cd87115853ad28fc215b0ba2cfa7b1327675563bbd971939e302204d245c9092f0c28f3f31ad1bcccb4aef5c7fe718d2a20c39a94358eb8b61845c014104be13acda02dc89ebd1ab87030750b694563c7dac7ebc53b541178e6d04cda33215d712406ff8b705607312d5fea471e9855dbcb963efb63a54e7efeb36382881", 
            "script_type": "pay-to-pubkey-hash", 
            "sequence": 4294967295
        }
], 
    "outputs": [
        {
            "addresses": [
                "mvWqTmhjEyMkymTm4VMFWLPQhzGwo6RPGM"
            ], 
            "script": "76a914a4842eed5a2c6fd7b71a238632f268d5831dacc088ac", 
            "script_type": "pay-to-pubkey-hash", 
            "worth": 640000
        }, 
        {
            "addresses": [
                "mipLNRZc9oo2fKFzhfwJVNy1t29VsqHRvS"
            ], 
            "script": "76a9142431e05399f655c52f2e7ab6227837c94d45031288ac", 
            "script_type": "pay-to-pubkey-hash", 
            "worth": 7000000
        }
    ], 
    "choice": "low", 
    "acquired": "2019-05-02T00:31:23.148760954Z", 
    "relayed_by": "54.162.99.128", 
    "dimension": 258, 
    "whole": 7640000, 
    "ver": 1, 
    "vin_sz": 1, 
    "vout_sz": 2
}

Up to now what I’ve discovered is there some kind of confusion in sigscript half as a result of the tackle the place cash are despatched is :2431e05399f655c52f2e7ab6227837c94d450312 which is ’04’ added to the pub key and utilized sha256 to this new key after which ripemd160, however signature can solely be verified with the pubkey with out the 04 half.

So now, I’m not certain methods to proceed additional. If anybody wants the code to look I’m joyful to supply it.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles