I have the following raw transaction (basic P2PKH) which I am trying to send to the Bitcoin Testnet 3:


Sending Address: mm6chMVA1WuZBDwp49yXJK9HWBzx96qxZE

Sending Address Private Key: 82295637717710356959985575716131249482690360273799844241244085665208347300813

Receiving Address: mkRY9Bh6Mt1n5UsEHda9yXmgCpJ4Z1BeXs

On the Blockcypher PushRawTx page (https://live.blockcypher.com/btc/pushtx/) I am getting the following error:

Error validating transaction: Error running script for input 0 referencing c8b8be849653169784dabce7d97d340eaf249f8463a0e15e5c2ba2faa31b5547 at 1: Script was NOT verified successfully..

On the Blockstream PushRawTx page (https://blockstream.info/testnet/tx/push) I am getting the following error:

sendrawtransaction RPC error: {"code":-26,"message":"non-mandatory-script-verify-flag (Non-canonical DER signature) (code 64)"}

It is unclear what is wrong in the transaction but the errors seem to indicate that it lies in the signature (scriptSig).

I have broken down the transaction as follows, it seems that everything is as specified in the standards.


  • version: 01000000
  • input count: 01
  • prev output hash: 47551ba3faa22b5c5ee1a063849f24af0e347dd9e7bcda849716539684beb8c8
  • prev output index: 01000000
  • script length: 8a
  • script sig: 4730440220b7bfb52963d1ad6da2ac67f18d52c9d2cd6ac58283319a69dd76d3ee4d9bf7780220260f335d75cfdc95f7dc9eb3d404dde65f59e484fcedaeddd6dabe4ee58ac122014104157cb2fdf61362a10869604fb3db1841b424006d3fa4f52300eec9a7fecc3a615deabef656b081f64115ad91e6c780c68e20c0bfcd4aafdf9f52af685d7910de
  • sequence: ffffffff
  • output count: 01
  • value: c0c62d0000000000
  • script length: 19
  • scriptPubKey: 76a91435d263246f0c03b1f62aa814142d2f3a08421a1788ac
  • lock time: 00000000

ScriptSig BreakDown:

  • signature length: 47
  • sequence: 30
  • length: 44
  • integer: 02
  • length: 20
  • R: b7bfb52963d1ad6da2ac67f18d52c9d2cd6ac58283319a69dd76d3ee4d9bf778
  • integer: 02
  • length: 20
  • S: 260f335d75cfdc95f7dc9eb3d404dde65f59e484fcedaeddd6dabe4ee58ac122
  • Sighash: 01
  • Length: 41
  • Type: 04
  • Pubkey X: 157cb2fdf61362a10869604fb3db1841b424006d3fa4f52300eec9a7fecc3a61
  • Pubkey Y: 5deabef656b081f64115ad91e6c780c68e20c0bfcd4aafdf9f52af685d7910de

scriptPubKey from previous transaction output:

  • 76a9143d36696be89aef91cec3d54b4a1f5fe3a79ca08388ac

What is the error here? Are there any tools which may facilitate finding the root cause?

  • The error message tells you, although it rather understates the problem; what you have for the signature is not just non-canonical DER but invalid and wrong DER. Specifically, r and s in ECDSA-sig must be positive integers (less than the group order), but 02 20 b7bf... is the DER encoding of a negative integer and thus invalid and prohibited for an ECDSA-sig. Whatever software (or person) created this signature encoding is broken and should be replaced. Aug 18 '19 at 11:28
  • Are you actually signing with a base 10 private key? 82295637717710356959985575716131249482690360273799844241244085665208347300813, have you tried signing with a WIF private key?
    – m1xolyd1an
    Aug 24 '19 at 6:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.