Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: halftimepad on July 05, 2015, 04:23:04 PM



Title: Different signatures for the same transaction.
Post by: halftimepad on July 05, 2015, 04:23:04 PM
I'm signing raw transaction with signrawtransaction using bitcoin-cli (Bitcoin Core).

Even if you repeat the same transaction, each signature should be created with a different random value k which gives the first part of the signature (r).

 I'm sure this is what happens once a transaction is sent (otherwise there would be massive theft), but in the command line, when I call signrawtransaction more than once for the same transaction I always get the same signature.  I would like to generate different valid signatures for the same transaction. 

So, when/how does the client decide it is time for a new value of k? Should I create some code to sign my transactions from scratch or is there a way to force a new k using signrawtransaction?


Title: Re: Different signatures for the same transaction.
Post by: tacotime on July 05, 2015, 04:32:42 PM
I believe core version 0.10.0+ uses deterministic k-value generation following the guidelines in RFC6979. The code for this is in the newly used libsecp256k1.

It you want to make random k-values, rollback to a version using openssl, or write your own code.

Note that if you generate R-values or S-values that are too high, the network will or may reject them (as detailed in BIP0062 (https://github.com/bitcoin/bips/blob/master/bip-0062.mediawiki)).


Title: Re: Different signatures for the same transaction.
Post by: halftimepad on July 05, 2015, 05:02:05 PM
I believe core version 0.10.0+ uses deterministic k-value generation following the guidelines in RFC6979. The code for this is in the newly used libsecp256k1.

It you want to make random k-values, rollback to a version using openssl, or write your own code.

Note that if you generate R-values or S-values that are too high, the network will or may reject them (as detailed in BIP0062 (https://github.com/bitcoin/bips/blob/master/bip-0062.mediawiki)).

Thank you! That was interesting!

After reading the RFC I have seen the value of k changes with the message. With that, I could pull a low-effort solution to get different signatures with getrawtransaction by changing the fee by a small amount.