0

I am currently using web3.py on a backend, I want to generate eth_signTypedDataV4 signature with web3.py, I am using Infura as a provider. which web3 method is available or any other library, when it comes to javascript there is https://www.npmjs.com/package/eth-sig-util library, could not find simmilar library for python.

0

EIP712 signatures can generated using the https://eth-account.readthedocs.io/en/stable/eth_account.html#eth_account.messages.encode_structured_data function to encode the EIP712 message, and use web3 to sign it.

    msg = { "types": 
    { "EIP712Domain": [], "Type":  []},
      "domain":domain,
      "primaryType": 'Type',
      "message":message }

encoded_data=encode_structured_data(msg)

web3.eth.account.sign_message(encoded_data,privateKey)

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.