I am looking for a solution to emit a dynamique array of signature using event. I thought that signature is a byte32 and it works, but I think is a 65 bytes.

so what is the exact size and how could I emit an event that contains an array of signatures ?

  • Have you read this? Jun 20 '18 at 15:00
  • I read it. my question is how to emit an array of signatures.
    – maroodb
    Jun 20 '18 at 20:58

The important part of the signature consist of three fields

  • r - String: First 32 bytes of the signature
  • s - String: Next 32 bytes of the signature
  • v - String: Recovery value + 27

Originally v was 1 byte, but since EIP 155 it can have an arbitrary number of bytes. For more uses only 1 bit should be enough.

A common approach is to split the signature in those three fields r and s as bytes32 and v as byte and pass them as parameter.

Another option is to pass all of the together as an array of 65 bytes.

There's a new experimental ABI encoder that allows tuples as parameters, you might want to pass around a tuple with those fields.

  • I need a array of signatures so, an array of 65bytes array
    – maroodb
    Jun 21 '18 at 0:42
  • Unfortunately there's no 65 bytes type. If you can use the experimental ABI encoder you can create an array of tuples<r,s,v>, or a bidimensional array of bytes (you have to enforce on the client each item is 65bytes). With the existing ABI the only option is to accept bytes and parse 'by hand' the parameters in your contract.
    – Ismael
    Jun 21 '18 at 2:13
  • 'r' can be lesser than 32 bytes
    – Mightywill
    Mar 21 at 16:33
  • @Mightywill Care to explain?
    – Ismael
    Mar 21 at 17:08
  • I dont know the math behind it but I use Ethereum cryptography in my project and sometimes (quite rare) I get R or S with 31 or 30 bytes length and these are correct values
    – Mightywill
    Mar 21 at 19:00

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.