Solana DocumentationInstructions
Creates a new attestation under a specific credential and schema. This instruction allows authorized signers to create attestations that contain verified data and have a defined expiration time.
Parameters
| Parameter | Type | Description |
|---|---|---|
payer | Signer | The account that will pay for the transaction |
authority | Signer | The authorized signer of the credential |
credential | PublicKey | Pda | The credential account associated with the schema |
schema | PublicKey | Pda | The schema account that defines the attestation structure |
attestation | PublicKey | Pda | The attestation account to create |
systemProgram | PublicKey | Pda | The System Program account (defaults to '11111111111111111111111111111111') |
nonce | Address | A unique identifier for the attestation |
data | ReadonlyUint8Array | The attestation data that must conform to the schema |
expiry | number | bigint | The expiration timestamp for the attestation |
Returns
Returns a TransactionBuilder that can be used to build and send the
transaction.
Example
import { getCreateAttestationInstruction } from "sas-lib";const transaction = getCreateAttestationInstruction({payer: payerSigner,authority: authoritySigner,credential: credentialPublicKey,schema: schemaPublicKey,attestation: attestationPublicKey,systemProgram: systemProgramPublicKey,nonce: noncePublicKey,data: attestationData,expiry: expiryTimestamp});// Send the transactionawait transaction.sendAndConfirm();
Important Notes
- Only authorized signers of the credential can create attestations
- The authority must be a signer of the transaction
- The payer must be a signer of the transaction
- The attestation account must be writable
- The credential and schema accounts must be readable
- This operation requires the System Program for rent exemption calculations
- The schema must not be paused
- The data must conform to the schema's structure and validation rules
- The nonce must be unique for each attestation
- The expiry timestamp must be in the future
- The attestation will be invalid after the expiry timestamp
- The credential must be associated with the schema
Is this page helpful?