Create an Attestation

After determining the Schema and potential Modules to use, and after the deployment and registration of your Portal, you can begin creating Attestations.

Attestation registration

Attestation registration at the Portal level takes 2 parameters, defined as follows:

PropertyDescription

attestationPayload

The payload to attest

validationPayload

The payloads to validate via the modules to issue the attestation

attestationPayload is defined in Solidity as follows:

struct AttestationPayload {
  bytes32 schemaId;
  uint64 expirationDate;
  bytes subject;
  bytes attestationData;
}
PropertyDescription

schemaId

The identifier of the schema this attestation adheres to

expirationDate

The expiration date of the attestation

subject

The ID of the attestee, EVM address, DID, URL etc

attestationData

The attestation data

Manually registering an Attestation in the AttestationRegistry contract

To register an Attestation into the AttestationRegistry contract, you need to go through the Portal you have previously deployed an registered, using the attest function:

function attest(
  AttestationPayload memory attestationPayload,
  bytes[] memory validationPayload
) public payable;

When attesting, the registry performs a set of integrity checks on the new attestation:

  • verifies the schemaId exists

  • verifies the subject field is not blank

  • verifies the attestationData field is not blank

Using a blockchain explorer

Instead of drafting the smart contract call by hand, you can benefit from a chain explorer interface. Let's use the Linea Sepolia explorer, Lineascan.

  1. Retrieve the address of the Portal contract you previously deployed

  2. Access the Portal contract on Lineascan

  3. Got to the "Contract" tab

  4. Got to the "Write" tab

  5. Connect your wallet and fill the attest form with the parameters described above

  6. Send the transaction

Using the official Verax SDK

We have seen rather manual ways to create an Attestation, now let's focus on the easiest way: via the Verax SDK.

Check this page to discover how to instantiate ethe Verax SDK.

Once you have an SDK instance, you can create an Attestation like this:

await veraxSdk.portal.attest(
        "0x2fafe2c217be096e09b64c49825fe46b7c3e33b2",
        {
                schemaId: "0x9ba590dd7fbd5bd1a7d06cdcb4744e20a49b3520560575cd63de17734a408738",
                expirationDate: 1693583329,
                subject: "0x828c9f04D1a07E3b0aBE12A9F8238a3Ff7E57b47",
                attestationData: [{ isBuidler: true }],
        },
        []
);

Attestation Metadata

When creating an attestation, you simply need to specify four properties, as outlined above, however, the attestation registry itself automatically populates the other fields in the attestation metadata at the point at which it is created. The full list of attestation metadata is included below:

PropertyDatatypeDescription

attestationId

bytes32

The unique identifier of the attestation

schemaId

bytes32

The identifier of the schema this attestation adheres to

replacedBy

uint256

The attestation ID that replaces this attestation

attester

address

The address issuing the attestation to the subject

portal

address

The address of the portal that created the attestation

attestedDate

uint64

The date the attestation is issued

expirationDate

uint64

The expiration date of the attestation

revocationDate

uint64

The date when the attestation was revoked

version

uint16

Version of the registry when the attestation was created

revoked

bool

Whether the attestation is revoked or not

revocationDate

uint64

If revoked, the date it was revoked / replaced

subject

bytes

The ID of the attestee e.g. an EVM address, DID, URL etc.

attestationData

bytes

The raw attestation data

The attestationId is derived from an internal auto-incremented counter, converted from uint32 to byte32. This corresponds to the total attestations issued. Moreover, the ID is prefixed with a chain identifier. This way, an attestation issued on Arbitrum cannot have t he same ID as an attestation issued on Linea, which is great in terms of cross-chain discovery!

Once the attestation is successfully created in the registry, an AttestationRegistered event is emitted with the attestation ID, and subsequently picked up by indexers.

Last updated