1

I have created a raw transaction and am now trying to push the hex format into testnet3. I have used following two ways and both are giving me two different errors, first one:

curl -d '{"hex":"TX_HASH"}' http://tbtc.blockr.io/api/v1/tx/push

I get this error:

{"status":"fail","data":"Could not push your transaction!","code":500,"message":"Did you sign your transaction?"}

and second one using this link:

https://test.webbtc.com/relay_tx

gives me this error:

Testnet3 - Error - Request took too long.

Not sure if signature is really the problem here. I used decode api from blockr.io to check my message - it seems well formed and is 226 bytes in length. I played around with fee wondering if that was an issue, but I think i have ruled that out as well.

I have also checked the validity of signature in the code (inspired by David De Rosa's guide). Any tips on how can I verify the validity of my transaction?

Thanks.

Edit: Now I am getting this very descriptive error message from blockr:

{"status":"error","data":"NULL","message":"It's looking like you may have taken a wrong turn. Don't worry... it happens to the best of us.","code":404}

Wish these guys didn't employ their sense of humour in error messages :(

used blockcypher api to push the raw transaction. This is the error message I get:

Error sending transaction: Error running script for input 0 referencing 87ce205d61e4bf63c0bcc42db1a58c36a2cac0048df32e470f3dc1bd39741367 at 0: Script was NOT verified successfully..

After signing the transaction, I checked for signature verification using ECDSA_verify(0,digest, sizeof(digest), sig, sig_len, key) and this function call returns 1 - So I assumed my signature is correct. Am I wrong in assuming this? Am I missing something big here?

2
  • What are you passing as digest? Commented Feb 16, 2017 at 9:56
  • Can you provide the serialized tx in order to check the correctness?
    – sr_gi
    Commented Feb 16, 2017 at 13:36

1 Answer 1

1

Found the error!

I am using OpenSSL library and was signing using the function: ECDSA_Sign

The parameter unsigned int *siglen passed to this function is supposed to be filled with signature length. I was using the signature(parameter sig) and the length from parameter siglen to serialize the data. Turns out, although the signature being generated was always 72 bytes, the siglen parameter was filled seemingly randomly with 70, 71 or 72. And hence the number of bytes of signature that was being copied into my txn was not correct. Interestingly, if I call ECDSA_size(key) after making call to ECDSA_Sign(), i would get correct 72 value back.

AAAAh! Has anyone experienced this issue before with ECDSA_Sign? I haven't found anything on google yet.

But successfully posted the raw signed transaction using blockcypher's web tool/api.

1
  • Can you elaborate on how you solved the issue?
    – Maros
    Commented Mar 4, 2018 at 5:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.