<h2>I have the following raw transaction (basic P2PKH) which I am trying to send to the Bitcoin Testnet 3:</h2>
<p>010000000147551ba3faa22b5c5ee1a063849f24af0e347dd9e7bcda849716539684beb8c8010000008a4730440220b7bfb52963d1ad6da2ac67f18d52c9d2cd6ac58283319a69dd76d3ee4d9bf7780220260f335d75cfdc95f7dc9eb3d404dde65f59e484fcedaeddd6dabe4ee58ac122014104157cb2fdf61362a10869604fb3db1841b424006d3fa4f52300eec9a7fecc3a615deabef656b081f64115ad91e6c780c68e20c0bfcd4aafdf9f52af685d7910deffffffff01c0c62d00000000001976a91435d263246f0c03b1f62aa814142d2f3a08421a1788ac00000000</p>
<p><strong>Sending Address:</strong>
mm6chMVA1WuZBDwp49yXJK9HWBzx96qxZE</p>
<p><strong>Sending Address Private Key:</strong>
82295637717710356959985575716131249482690360273799844241244085665208347300813</p>
<p><strong>Receiving Address:</strong>
mkRY9Bh6Mt1n5UsEHda9yXmgCpJ4Z1BeXs</p>
<h2>On the Blockcypher PushRawTx page (<a href="https://live.blockcypher.com/btc/pushtx/" rel="nofollow noreferrer">https://live.blockcypher.com/btc/pushtx/</a>) I am getting the following error:</h2>
<p>Error validating transaction: Error running script for input 0 referencing c8b8be849653169784dabce7d97d340eaf249f8463a0e15e5c2ba2faa31b5547 at 1: Script was NOT verified successfully..</p>
<h2>On the Blockstream PushRawTx page (<a href="https://blockstream.info/testnet/tx/push" rel="nofollow noreferrer">https://blockstream.info/testnet/tx/push</a>) I am getting the following error:</h2>
<p>sendrawtransaction RPC error: {&quot;code&quot;:-26,&quot;message&quot;:&quot;non-mandatory-script-verify-flag (Non-canonical DER signature) (code 64)&quot;}</p>
<h2>It is unclear what is wrong in the transaction but the errors seem to indicate that it lies in the signature (scriptSig).</h2>
<h2>I have broken down the transaction as follows, it seems that everything is as specified in the standards.</h2>
<p><strong>Transaction:</strong></p>
<ul>
<li>version: 01000000</li>
<li>input count: 01</li>
<li>prev output hash: 47551ba3faa22b5c5ee1a063849f24af0e347dd9e7bcda849716539684beb8c8</li>
<li>prev output index: 01000000</li>
<li>script length: 8a</li>
<li>script sig: 4730440220b7bfb52963d1ad6da2ac67f18d52c9d2cd6ac58283319a69dd76d3ee4d9bf7780220260f335d75cfdc95f7dc9eb3d404dde65f59e484fcedaeddd6dabe4ee58ac122014104157cb2fdf61362a10869604fb3db1841b424006d3fa4f52300eec9a7fecc3a615deabef656b081f64115ad91e6c780c68e20c0bfcd4aafdf9f52af685d7910de</li>
<li>sequence: ffffffff</li>
<li>output count: 01</li>
<li>value: c0c62d0000000000</li>
<li>script length: 19</li>
<li>scriptPubKey: 76a91435d263246f0c03b1f62aa814142d2f3a08421a1788ac</li>
<li>lock time: 00000000</li>
</ul>
<p><strong>ScriptSig BreakDown:</strong></p>
<ul>
<li>signature length: 47</li>
<li>sequence: 30</li>
<li>length: 44</li>
<li>integer: 02</li>
<li>length: 20</li>
<li>R: b7bfb52963d1ad6da2ac67f18d52c9d2cd6ac58283319a69dd76d3ee4d9bf778</li>
<li>integer: 02</li>
<li>length: 20</li>
<li>S: 260f335d75cfdc95f7dc9eb3d404dde65f59e484fcedaeddd6dabe4ee58ac122</li>
<li>Sighash: 01</li>
<li>Length: 41</li>
<li>Type: 04</li>
<li>Pubkey X: 157cb2fdf61362a10869604fb3db1841b424006d3fa4f52300eec9a7fecc3a61</li>
<li>Pubkey Y: 5deabef656b081f64115ad91e6c780c68e20c0bfcd4aafdf9f52af685d7910de</li>
</ul>
<p><strong>scriptPubKey from previous transaction output:</strong></p>
<ul>
<li>76a9143d36696be89aef91cec3d54b4a1f5fe3a79ca08388ac</li>
</ul>
<h1>What is the error here? Are there any tools which may facilitate finding the root cause?</h1>

CC BY-SA 4.0
2019-08-18T11:28:31.843Z
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.
dave_thompson_085
CC BY-SA 4.0
2019-08-24T06:07:25.023Z
Are you actually signing with a base 10 private key? `82295637717710356959985575716131249482690360273799844241244085665208347300813`, have you tried signing with a WIF private key?
m1xolyd1an
<transactions><script><signature><raw-transaction>
Bitcoin Transaction Generation: Signature Verification Error
veda-s4dhak
# Bitcoin Transaction Generation: Signature Verification Error

(Asked by: username_0 on 2019-08-17)

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

010000000147551ba3faa22b5c5ee1a063849f24af0e347dd9e7bcda849716539684beb8c8010000008a4730440220b7bfb52963d1ad6da2ac67f18d52c9d2cd6ac58283319a69dd76d3ee4d9bf7780220260f335d75cfdc95f7dc9eb3d404dde65f59e484fcedaeddd6dabe4ee58ac122014104157cb2fdf61362a10869604fb3db1841b424006d3fa4f52300eec9a7fecc3a615deabef656b081f64115ad91e6c780c68e20c0bfcd4aafdf9f52af685d7910deffffffff01c0c62d00000000001976a91435d263246f0c03b1f62aa814142d2f3a08421a1788ac00000000

**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.

**Transaction:**

* 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?

**Tags:** transactions, script, signature, raw-transaction

> **Comments:**
> **username_1**: 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.  
> **username_2**: Are you actually signing with a base 10 private key? `82295637717710356959985575716131249482690360273799844241244085665208347300813`, have you tried signing with a WIF private key?  

---

## 0 answers

