<p>When signing the transaction, a sha256 hash of the transaction data is taken, and a ECDSA signature of this hash is generated using the private key.</p>
<p>When validating the signature, we first generate the sha256 hash of the transaction data the same way, then we validate the signature using the ECDSA algorithm by passing in the signature, the public key, and the transaction hash.</p>

CC BY-SA 4.0
2020-11-22T23:04:44.413Z
2020-11-22T23:04:44.413Z
ieatpizza
<p>If someone wants to make a transaction, they need to sign the transaction data with their private key. For example Sign(transactionData, privateKey) creates the signature. What is exactly this Sign function and what happens inside this function? And how can be verified that a signature is valid with a public key? For example Verify(signature, publicKey), what happens inside this function?</p>

CC BY-SA 4.0
2020-11-21T01:48:39.253Z
You should ask this on https://crypto.stackexchange.com.
Pieter Wuille
<transactions><private-key><public-key><signature><transaction-verification>
How can be proven that a signature is valid with it's public key
Stijn de Vries
# How can be proven that a signature is valid with it's public key

(Asked by: username_0 on 2020-11-21)

If someone wants to make a transaction, they need to sign the transaction data with their private key. For example Sign(transactionData, privateKey) creates the signature. What is exactly this Sign function and what happens inside this function? And how can be verified that a signature is valid with a public key? For example Verify(signature, publicKey), what happens inside this function?

**Tags:** transactions, private-key, public-key, signature, transaction-verification

> **Comments:**
> **username_1**: You should ask this on https://crypto.stackexchange.com.  

---

## 1 answers

### Answer by username_2 on 2020-11-22. Score: 1

When signing the transaction, a sha256 hash of the transaction data is taken, and a ECDSA signature of this hash is generated using the private key.

When validating the signature, we first generate the sha256 hash of the transaction data the same way, then we validate the signature using the ECDSA algorithm by passing in the signature, the public key, and the transaction hash.


---

