Hi, I’m trying to understand how to produce a sign of a message, looking at for instance the EIP-712.
Online I found an interesting demo (https://weijiekoh.github.io/eip712-signing-demo/index.html) but I didn’t understand when use the function ABI.encode and abi.encodePacked before hashing function.
See the Solidity documentation for 0.5 breaking changes for the difference between abi.encode and abi.encodePacked
The ABI encoder now properly pads byte arrays and strings from calldata (msg.data and external function parameters) when used in external function calls and in abi.encode. For unpadded encoding, use abi.encodePacked.
Looking at the example in EIP-712 (https://github.com/ethereum/EIPs/blob/master/assets/eip-712/Example.js), I see that dynamic arrays/strings are not padded, instead of static types that are encoded with padding. Maybe the reason is that a dynamic array could be always different from another one, instead of a static type that could have the same rappresentation in memory. I don’t find another reason for that.
I’ll try OpenZeppeling sign methods, but for meta-transactions there is some implementations in Openzeppeling Library (other than Gas Network Station)? I am studying eip-712 because I would like to sign externally a message.