Developer Hub
🔮 For applications
Guides & Tutorials
Advanced integration
Live betting
Implement EIP712 Signature

Implementing EIP712 Signatures

Azuro's migration to the new signature format, EIP712 (opens in a new tab), introduces key changes to the signature process in Live betting.

The new format offers enhanced security and improved user experience as it allows users to understand what they are signing, hence the users are more likely to trust the transactions they’re making through your frontend.

Key changes

  • The affiliate field is now part of the bet object.
  • An attention field is added, requiring a text of user consent. Its maxLength is set to 160 characters.

How to adapt your frontend to support EIP712:

  1. EIP712 Signature Object Structure
    • Domain:
      • name: "Live Betting"
      • version: "1.0.0"
      • chainId: [Your Chain ID]
      • verifyingContract: Live Core Address (also known as ClientCore)
    • Primary Type: "ClientBetData"
    • Types:
      • ClientBetData includes:

        types: {
          ClientBetData: [
            { name: 'attention', type: 'string' },
            { name: 'affiliate', type: 'address' },
            { name: 'core', type: 'address' },
            { name: 'amount', type: 'uint128' },
            { name: 'nonce', type: 'uint256' },
            { name: 'conditionId', type: 'uint256' },
            { name: 'outcomeId', type: 'uint64' },
            { name: 'minOdds', type: 'uint64' },
            { name: 'expiresAt', type: 'uint256' },
            { name: 'chainId', type: 'uint256' },
            { name: 'relayerFeeAmount', type: 'uint256' },
          ],
        },
  2. Message Object:
    • Contains actual values to be signed.

    • Sample structure:

      message: {
        attention: "User Consent Text",
        affiliate: "0x...", // Affiliate Address
        core: "0x...", // LiveCore Contract Address (also known as ClientCore)
        amount: "1000000000000000000", // Bet Amount
        nonce: "1", // Unique identifier, get it from String(Date.now())
        conditionId: "123",
        outcomeId: 1,
        minOdds: "150",
        expiresAt: 1625097600, // Expiry Timestamp
      }
  3. Integration Steps
    • Add a text to capture user consent in the attention field (within 160 chars): for example, “By signing this transaction, I agree to place a bet for a live event on …”
    • Use web3 provider (i.e. MetaMask, etc.) to request a signature from the user.
    • Ensure all fields are correctly formatted and meet the requirements of the EIP712 standard.
    • Send the signed data to the Azuro Live Betting API.