<p>You are signing a specially modified version of the transaction itself. The modified transaction involves replacing the scriptSig field temporarily with the scriptPubKey from the transaction output being spent, and leaving all other inputs' scriptSigs empty, and then appending a 4 byte signature type code. The transaction is then hashed twice with SHA256 and the final hash is signed.</p>

<p>See this question for more info: <a href="https://bitcoin.stackexchange.com/questions/3374/how-to-redeem-a-basic-tx">How to redeem a basic Tx?</a></p>

CC BY-SA 3.0
2017-12-24T20:43:00.027Z
2017-12-24T20:43:00.027Z
meshcollider
<p>So the scriptsig field in the transaction, is created with the signature and public key. In order to create the signature, we need the R and S values of a ECDSA signature. I figured how to sign a string with Secp256k1, but I haven't figured out exactly what am I signing.</p>

<script><input-script><sighash>
ScriptSig - what am I signing exactly?
user2298995
# ScriptSig - what am I signing exactly?

(Asked by: username_0 on 2017-12-24)

So the scriptsig field in the transaction, is created with the signature and public key. In order to create the signature, we need the R and S values of a ECDSA signature. I figured how to sign a string with Secp256k1, but I haven't figured out exactly what am I signing.

**Tags:** script, input-script, sighash


---

## 1 answers

### Answer by username_1 on 2017-12-24. Score: 1 | Accepted answer

You are signing a specially modified version of the transaction itself. The modified transaction involves replacing the scriptSig field temporarily with the scriptPubKey from the transaction output being spent, and leaving all other inputs' scriptSigs empty, and then appending a 4 byte signature type code. The transaction is then hashed twice with SHA256 and the final hash is signed.

See this question for more info: [How to redeem a basic Tx?](https://bitcoin.stackexchange.com/questions/3374/how-to-redeem-a-basic-tx)


---

