Skip to content

ISP

ISP is the interface of the Sign Protocol contract (SP), version 1.1.4. It extends IVersionable. The source is in EthSign/sign-protocol-evm.

Delegated signatures

Every write function takes a delegateSignature. Leave it empty ("" or 0x) when the caller is the attester or registrant. To let another account, such as your backend or contract, submit on the attester's behalf, the attester signs an authorization and the submitter passes it as delegateSignature.

Since version 1.1.4, a delegated signature is the ABI encoding of (uint256 nonce, uint64 deadline, bytes signature):

  1. Get the action hash from the matching getDelegated*Hash function, for example getDelegatedAttestHash(attestation).
  2. Read the attester's current nonce with delegationNonces(attester).
  3. Choose a deadline: the last Unix timestamp at which the signature can be used.
  4. Have the attester sign the EIP-712 typed data DelegatedAuthorization(address delegateAttester,bytes32 actionHash,uint256 nonce,uint64 deadline), for example with viem's signTypedData or eth_signTypedData_v4. The domain is { name: "Sign Protocol", version, chainId, verifyingContract }, where version is the contract's version() (currently "1.1.4") and verifyingContract is the SP proxy address on that chain. getDelegatedAuthorizationDigest(attester, actionHash, nonce, deadline) returns the digest the contract checks, which is useful for testing. Contract wallets can sign through ERC-1271.
  5. Pass abi.encode(nonce, deadline, signature) as delegateSignature.

Each signature can be used once: a successful call increments the attester's nonce. A signature used after its deadline reverts with DelegationExpired. A wrong nonce or signer reverts with InvalidDelegateSignature, and so does a signature in the pre-1.1.4 format, which is a bare signature over the action hash.

Warning

Version 1.2.7 of the NPM SDK still produces pre-1.1.4 signatures from delegateSignAttestation, delegateSignRevokeAttestation and delegateSignSchema, which version 1.1.4 contracts reject. Until the SDK supports the new format, build delegated signatures as described above.

Events

SchemaRegistered

event SchemaRegistered(uint64 schemaId)

AttestationMade

event AttestationMade(uint64 attestationId, string indexingKey)

AttestationRevoked

event AttestationRevoked(uint64 attestationId, string reason)

OffchainAttestationMade

event OffchainAttestationMade(string attestationId)

OffchainAttestationRevoked

event OffchainAttestationRevoked(string attestationId, string reason)

Errors

Paused

error Paused()

0x9e87fac8

SchemaNonexistent

error SchemaNonexistent()

0x38f8c6c4

SchemaWrongRegistrant

error SchemaWrongRegistrant()

0x71984561

AttestationIrrevocable

error AttestationIrrevocable()

0x8ac42f49

AttestationNonexistent

error AttestationNonexistent()

0x54681a13

AttestationInvalidDuration

error AttestationInvalidDuration()

0xa65e02ed

AttestationAlreadyRevoked

error AttestationAlreadyRevoked()

0xd8c3da86

AttestationWrongAttester

error AttestationWrongAttester()

0xa9ad2007

OffchainAttestationExists

error OffchainAttestationExists()

0xc83e3cdf

OffchainAttestationNonexistent

error OffchainAttestationNonexistent()

0xa006519a

OffchainAttestationAlreadyRevoked

error OffchainAttestationAlreadyRevoked()

0xa0671d20

InvalidDelegateSignature

error InvalidDelegateSignature()

0xfdf4e6f9

DelegationExpired

error DelegationExpired()

0x30d3ba07

LegacySPRequired

error LegacySPRequired()

0x5c34b9cc

Functions

register

function register(struct Schema schema, bytes delegateSignature) external returns (uint64 schemaId)

Registers a Schema.

Emits SchemaRegistered.

Parameters

Name Type Description
schema struct Schema See Schema.
delegateSignature bytes Optional delegated signature for a delegated attestation. Use "" or 0x otherwise.

Return values

Name Type Description
schemaId uint64 The assigned ID of the registered schema.

attest

function attest(struct Attestation attestation, string indexingKey, bytes delegateSignature, bytes extraData) external returns (uint64 attestationId)

Makes an attestation.

Emits AttestationMade.

Parameters

Name Type Description
attestation struct Attestation See Attestation.
indexingKey string Used by the indexer and frontends to look up the attestation.
delegateSignature bytes Optional delegated signature for a delegated attestation. Use "" or 0x otherwise.
extraData bytes Forwarded directly to the schema hook.

Return values

Name Type Description
attestationId uint64 The assigned ID of the attestation.

attest

function attest(struct Attestation attestation, uint256 resolverFeesETH, string indexingKey, bytes delegateSignature, bytes extraData) external payable returns (uint64 attestationId)

Makes an attestation where the schema hook expects ETH payment.

Emits AttestationMade.

Parameters

Name Type Description
attestation struct Attestation See Attestation.
resolverFeesETH uint256 Amount of funds to send to the hook.
indexingKey string Used by the indexer and frontends to look up the attestation.
delegateSignature bytes Optional delegated signature for a delegated attestation. Use "" or 0x otherwise.
extraData bytes Forwarded directly to the schema hook.

Return values

Name Type Description
attestationId uint64 The assigned ID of the attestation.

attest

function attest(struct Attestation attestation, contract IERC20 resolverFeesERC20Token, uint256 resolverFeesERC20Amount, string indexingKey, bytes delegateSignature, bytes extraData) external returns (uint64 attestationId)

Makes an attestation where the schema hook expects ERC20 payment.

Emits AttestationMade.

Parameters

Name Type Description
attestation struct Attestation See Attestation.
resolverFeesERC20Token contract IERC20 ERC20 token address used for payment.
resolverFeesERC20Amount uint256 Amount of funds to send to the hook.
indexingKey string Used by the indexer and frontends to look up the attestation.
delegateSignature bytes Optional delegated signature for a delegated attestation. Use "" or 0x otherwise.
extraData bytes Forwarded directly to the schema hook.

Return values

Name Type Description
attestationId uint64 The assigned ID of the attestation.

attestOffchain

function attestOffchain(string offchainAttestationId, address delegateAttester, bytes delegateSignature) external

Timestamps an off-chain data ID.

Emits OffchainAttestationMade.

Parameters

Name Type Description
offchainAttestationId string The off-chain data ID.
delegateAttester address For a delegated attestation, the attester who authorized the caller. Use address(0) otherwise.
delegateSignature bytes Optional delegated signature for a delegated attestation. Use "" or 0x otherwise.

revoke

function revoke(uint64 attestationId, string reason, bytes delegateSignature, bytes extraData) external

Revokes an existing revocable attestation.

Emits AttestationRevoked. Must be called by the attester.

Parameters

Name Type Description
attestationId uint64 An existing attestation ID.
reason string The revocation reason. Only emitted as an event, to save gas.
delegateSignature bytes Optional delegated signature for a delegated revocation. Use "" or 0x otherwise.
extraData bytes Forwarded directly to the schema hook.

revoke

function revoke(uint64 attestationId, string reason, uint256 resolverFeesETH, bytes delegateSignature, bytes extraData) external payable

Revokes an existing revocable attestation where the schema hook expects ETH payment.

Emits AttestationRevoked. Must be called by the attester.

Parameters

Name Type Description
attestationId uint64 An existing attestation ID.
reason string The revocation reason. Only emitted as an event, to save gas.
resolverFeesETH uint256 Amount of funds to send to the hook.
delegateSignature bytes Optional delegated signature for a delegated revocation. Use "" or 0x otherwise.
extraData bytes Forwarded directly to the schema hook.

revoke

function revoke(uint64 attestationId, string reason, contract IERC20 resolverFeesERC20Token, uint256 resolverFeesERC20Amount, bytes delegateSignature, bytes extraData) external

Revokes an existing revocable attestation where the schema hook expects ERC20 payment.

Emits AttestationRevoked. Must be called by the attester.

Parameters

Name Type Description
attestationId uint64 An existing attestation ID.
reason string The revocation reason. Only emitted as an event, to save gas.
resolverFeesERC20Token contract IERC20 ERC20 token address used for payment.
resolverFeesERC20Amount uint256 Amount of funds to send to the hook.
delegateSignature bytes Optional delegated signature for a delegated revocation. Use "" or 0x otherwise.
extraData bytes Forwarded directly to the schema hook.

revokeOffchain

function revokeOffchain(string offchainAttestationId, string reason, bytes delegateSignature) external

Revokes an existing offchain attestation.

Emits OffchainAttestationRevoked. Must be called by the attester.

Parameters

Name Type Description
offchainAttestationId string An existing attestation ID.
reason string The revocation reason. Only emitted as an event, to save gas.
delegateSignature bytes Optional delegated signature for a delegated revocation. Use "" or 0x otherwise.

attestBatch

function attestBatch(struct Attestation[] attestations, string[] indexingKeys, bytes delegateSignature, bytes extraData) external returns (uint64[] attestationIds)

Batch attests.

attestBatch

function attestBatch(struct Attestation[] attestations, uint256[] resolverFeesETH, string[] indexingKeys, bytes delegateSignature, bytes extraData) external payable returns (uint64[] attestationIds)

Batch attests where the schema hook expects ETH payment.

attestBatch

function attestBatch(struct Attestation[] attestations, contract IERC20[] resolverFeesERC20Tokens, uint256[] resolverFeesERC20Amount, string[] indexingKeys, bytes delegateSignature, bytes extraData) external returns (uint64[] attestationIds)

Batch attests where the schema hook expects ERC20 payment.

attestOffchainBatch

function attestOffchainBatch(string[] offchainAttestationIds, address delegateAttester, bytes delegateSignature) external

Batch timestamps off-chain data IDs.

revokeBatch

function revokeBatch(uint64[] attestationIds, string[] reasons, bytes delegateSignature, bytes extraData) external

Batch revokes revocable on-chain attestations.

revokeBatch

function revokeBatch(uint64[] attestationIds, string[] reasons, uint256[] resolverFeesETH, bytes delegateSignature, bytes extraData) external payable

Batch revokes revocable on-chain attestations where the schema hook expects ETH payment.

revokeBatch

function revokeBatch(uint64[] attestationIds, string[] reasons, contract IERC20[] resolverFeesERC20Tokens, uint256[] resolverFeesERC20Amount, bytes delegateSignature, bytes extraData) external

Batch revokes revocable on-chain attestations where the schema hook expects ERC20 payment.

revokeOffchainBatch

function revokeOffchainBatch(string[] offchainAttestationIds, string[] reasons, bytes delegateSignature) external

Batch revokes off-chain attestations.

getSchema

function getSchema(uint64 schemaId) external view returns (struct Schema)

Returns the specified Schema.

getAttestation

function getAttestation(uint64 attestationId) external view returns (struct Attestation)

Returns the specified Attestation.

getOffchainAttestation

function getOffchainAttestation(string offchainAttestationId) external view returns (struct OffchainAttestation)

Returns the specified OffchainAttestation.

getDelegatedRegisterHash

function getDelegatedRegisterHash(struct Schema schema) external pure returns (bytes32)

Returns the action hash used to authorize a delegated registration.

getDelegatedAttestHash

function getDelegatedAttestHash(struct Attestation attestation) external pure returns (bytes32)

Returns the action hash used to authorize a delegated attestation.

getDelegatedAttestBatchHash

function getDelegatedAttestBatchHash(struct Attestation[] attestations) external pure returns (bytes32)

Returns the action hash used to authorize a delegated batch attestation.

getDelegatedOffchainAttestHash

function getDelegatedOffchainAttestHash(string offchainAttestationId) external pure returns (bytes32)

Returns the action hash used to authorize a delegated offchain attestation.

getDelegatedOffchainAttestBatchHash

function getDelegatedOffchainAttestBatchHash(string[] offchainAttestationIds) external pure returns (bytes32)

Returns the action hash used to authorize a delegated batch offchain attestation.

getDelegatedRevokeHash

function getDelegatedRevokeHash(uint64 attestationId, string reason) external pure returns (bytes32)

Returns the action hash used to authorize a delegated revocation.

getDelegatedRevokeBatchHash

function getDelegatedRevokeBatchHash(uint64[] attestationIds, string[] reasons) external pure returns (bytes32)

Returns the action hash used to authorize a delegated batch revocation.

getDelegatedOffchainRevokeHash

function getDelegatedOffchainRevokeHash(string offchainAttestationId, string reason) external pure returns (bytes32)

Returns the action hash used to authorize a delegated offchain revocation.

getDelegatedOffchainRevokeBatchHash

function getDelegatedOffchainRevokeBatchHash(string[] offchainAttestationIds, string[] reasons) external pure returns (bytes32)

Returns the action hash used to authorize a delegated batch offchain revocation.

delegationNonces

function delegationNonces(address delegateAttester) external view returns (uint256)

Returns the next delegated authorization nonce for an attester.

getDelegatedAuthorizationDigest

function getDelegatedAuthorizationDigest(address delegateAttester, bytes32 actionHash, uint256 nonce, uint64 deadline) external view returns (bytes32)

Returns the EIP-712 digest that a delegated attester must sign.

Parameters

Name Type Description
delegateAttester address The account authorizing the delegated action.
actionHash bytes32 The action-specific hash returned by one of the getDelegated*Hash functions.
nonce uint256 The current value returned by delegationNonces(delegateAttester).
deadline uint64 The last timestamp at which the delegated signature can be used.

schemaCounter

function schemaCounter() external view returns (uint64)

Returns the current schema counter. This is incremented for each Schema registered.

attestationCounter

function attestationCounter() external view returns (uint64)

Returns the current on-chain attestation counter. This is incremented for each Attestation made.