1

a quick beginner's question... is it possible to sign a message twice with web3? For example Alice creates a message and signs it. Then it is sent to Bob. Can Bob sign the message before he executes the transaction to make sure that the message was accepted by both of them?

Thanks a lot!

  • You can always sign a message multiple times. What do you want to do with the signatures? – Ismael Feb 4 at 7:47
0

Just take the signed message of Alice and use it as a message to sign by Bob

var alice_signature;
var message = "Some Text ";
web3.personal.sign( web3.fromUtf8( message), <Alice> , function( err, signature ) {
      alice_signature = signature;
      send_to_bob(signature,message);
})

And then, for example

var message = message_from_alice + signature_from alice
web3.personal.sign( web3.fromUtf8( message ), <Bob> , function( err, signature ) {
      console.log(signature);
})
  • With resulting signature you cannot verify the message was signed by alice. – Ismael Feb 4 at 7:45
  • 1
    @Ismael why not? – P_F Feb 4 at 11:05
  • @Ismael what? Yes you can! You can verify a signature with the recover functionality in web3js, even in solidity web3js.readthedocs.io/en/1.0/web3-eth-accounts.html#recover, and you can verify that Alice signed the message if you have bob_signature and bob_message, as alice_message and alice_signature are both inside bob_message – waytosay Feb 4 at 12:47
  • @P_F If you call recover with last signature and message you will recover Bob address. With message_from_alice and signature_from_alice you will recover Alice address. But you are using two different messages. – Ismael Feb 4 at 19:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.