Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.predicate.io/llms.txt

Use this file to discover all available pages before exploring further.

After deploying your contract and adding it to the dashboard, update your offchain integration to target your contract address and pass attestations onchain.
1

Update API requests

Replace verification_hash with to (your contract address).
2

Pass attestations to your contract

Include the attestation struct when calling predicated functions.

Backend Changes

Replace verification_hash with your contract address in the to field.
app.post('/api/predicate/attestation', async (req, res) => {
  const { userAddress, contractAddress } = req.body;

  const response = await fetch('https://api.predicate.io/v2/attestation', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': process.env.PREDICATE_API_KEY,
    },
    body: JSON.stringify({
      to: contractAddress,
      from: userAddress,
      chain: 'base',
    }),
  });

  const result = await response.json();

  if (!result.is_compliant) {
    return res.status(403).json({ error: 'Not compliant' });
  }

  res.json({ attestation: result.attestation });
});

Request Parameters

FieldDescription
toYour deployed contract address
fromThe user’s wallet address
chainChain name (e.g., base, ethereum, arbitrum)

Frontend Changes

Fetch the attestation and pass it to your contract function.
// 1) Fetch attestation from your backend
const { attestation } = await fetch('/api/predicate/attestation', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    userAddress: account,
    contractAddress: VAULT_ADDRESS,
  }),
}).then(r => r.json());

// 2) Call your contract with the attestation
const tx = await vault.deposit(
  {
    uuid: attestation.uuid,
    expiration: attestation.expiration,
    attester: attestation.attester,
    signature: attestation.signature,
  },
  { value: depositAmount }
);

Attestation Struct

FieldTypeDescription
uuidbytes16Unique identifier for replay protection
expirationuint256Unix timestamp when the attestation expires
attesteraddressAddress of the Predicate attester that signed
signaturebytesECDSA signature over the attestation