EIP-712
EIP-712 为以人类可读格式签署“类型化数据”引入了一套标准。该标准使用户更容易理解自己正在签署的数据,并提供了更安全的数据签署方式,因为它更不容易受到钓鱼攻击。EIP-712 并不是一种以太坊交易类型,而是一种用于签署结构化数据的方法,可用于身份认证以及对程序逻辑产生间接影响。 为了支持 Cosmos 交易签名,Cosmos EVM 使用 EIP-712 协议将 Cosmos 交易编码为以太坊签名器能够理解和处理的格式,其中包括 Ledger 硬件钱包。该方法有助于克服以太坊签名设备的限制,因为出于安全原因,这类设备通常不支持对任意字节进行签名。 其过程如下:- 将 Cosmos 交易表示为 JSON sign-doc。
- 将 JSON sign-doc 转换为 EIP-712 对象,该对象由 types 和 messages 组成。
- 使用以太坊签名器对 EIP-712 对象进行签名,例如 MetaMask 或 Ledger 硬件设备。
- 节点端会执行相同的过程来验证签名。
There are different methods for signing, but one of the most commonly used methods is the EIP-712 standard. Cosmos EVM leverages EIP-712 to homogenize the interaction between the EVM and Cosmos.
EIP-712
EIP-712 introduces a standard for signing “typed-data” in a human-readable format. This standard allowed users to understand the data they are signing more easily and provides a more secure way to sign data, as it is less susceptible to phishing attacks. EIP-712 is not an Ethereum transaction type, but a method for signing structured data that can be used for authentication and indirect influence on program logic. To support signing Cosmos transactions, Cosmos EVM utilizes the EIP-712 protocol for encoding Cosmos transactions in a format that can be understood and processed by Ethereum signers, including Ledger hardware wallets. This approach helps to overcome the limitations of Ethereum signing devices, which often do not support signing arbitrary bytes for security reasons. The process works as follows:- A Cosmos transaction is represented as a JSON sign-doc.
- The JSON sign-doc is converted to an EIP-712 object, which consists of types and messages.
- The EIP-712 object is signed using an Ethereum signer, such as MetaMask or a Ledger hardware device.
- The same process is performed on the node to verify the signature.