project screenshot 1
project screenshot 2
project screenshot 3

Fuel EVM Signing libraries

Adding EIP-191 and EIP-712 libraries, and an EVM Signature predicate to Sway

Fuel EVM Signing libraries

Created At

HackMoney 2022

Winner of

trophy

🥇 Fuel Labs — Best Use

Project Description

Added an EIP-191 library to the sway std library in order to support EIP-191 compliant message hashes as well as an EIP-712 library that returns the EIP-712 domain separator and a function to return an EIP-712 compliant hash given an already hashed struct. Additionally, I worked on a predicate that would unlock coins if it was given a valid signature (that of the owner of the predicate)

How it's Made

By adding sha256_with_offset and keccak256_with_offset to the sway-std-lib, which are then used for the eip191 library, which returns an eip191 compliant message given some message of type T. As well as for the eip712 library, which returns an eip712 compliant domain separator given a name, version, chainId, and verifying contract. Additionally, the eip712 library can compute a valid message hash given an already hashed struct. Finally, a minor addition to tx.sw that allows one to get a transaction's id can be used in combination to the libraries above to construct a predicate that allows an evm public:private key pair to spend coins on fuel.

background image mobile

Join the mailing list

Get the latest news and updates