1
I have my ECKey key. In order to create an ECDSASignature object with BitcoinJ, we have to call ECDSASignature mySignature = key.sign(Sha256Hash input).
Is the Sha256Hash input my message? Or is it the result of Sha256(byte[] myArray)?
What if I don't have a message to sign? Is it acceptable to sign the key.getPrivKeyBytes() in order to create an ECDSASignature, or it is unacceptable because it reveals information including in getPrivKeyBytes() and as a result reveal my private key?
And if it is unacceptable what must be my message? Can I can sign whatever I want in order to create my ECDSASignature?
Are you trying to sign a transaction? There are better ways of doing that in bitcoinj. What are you trying to sign? – Nick ODell – 2016-01-09T17:28:14.093
Let's say that first: i am trying to sign a transaction and as a second secnario that i am going to sign a message in the form of String variable.Which are these better ways?Thanks. – gtopal – 2016-01-09T17:34:35.530
1http://bitcoin.stackexchange.com/questions/3374/how-to-redeem-a-basic-tx – amaclin – 2016-01-09T19:09:30.400
Thanks. I will actually create a message (as a String variable) rather than a whole transaction,and finally i will sign this message to fulfill my program's functionality desires. – gtopal – 2016-01-09T20:32:27.770
1@Top If you're trying to sign a transaction, you should use
Wallet.signTransaction(Wallet.SendRequest.forTx(transaction));If you're trying to sign a message, you should hash the message first with SHA256. – Nick ODell – 2016-01-09T21:55:05.047