MetacoSA / NBitcoin

Comprehensive Bitcoin library for the .NET framework.
MIT License
1.87k stars 846 forks source link

Getting md32 of each input using NBitcoin #660

Open sigHash opened 5 years ago

sigHash commented 5 years ago

If I have a script coin to spend and I create an unsigned transaction, how can I generate "m" for each input where m is data to be signed as in ECDSA math:

S = k-1 (Hash(m) + dA * R) mod p

I have an ultra thin client that uses secp256k1_ecdsa_sign to sign.

NicolasDorier commented 5 years ago

var hash = tx.GetSignatureHash(coinToSpend);

NicolasDorier commented 5 years ago

you have a wrapper of secp256k1_ecdsa_sign somewhere?

sigHash commented 5 years ago

you have a wrapper of secp256k1_ecdsa_sign somewhere?

I don't, but these guys do: https://github.com/breadwallet/breadwallet-core

You could make it even more lightweight if you get rid of all SPV stuff.