Skip to content
Creates a new schema that defines the structure and validation rules for attestations. This instruction allows credential authorities to create schemas that specify what fields an attestation should contain and how they should be formatted.

​Parameters

ParameterTypeDescription
payerTransactionSignerThe account that will pay for the transaction
authorityTransactionSignerThe authority of the credential
credentialAddressThe credential account this schema will be associated with
schemaAddressThe schema account to create
systemProgramAddressThe System Program account (defaults to ‘11111111111111111111111111111111’)
namestringThe name of the schema
descriptionstringA detailed description of the schema’s purpose
layoutUint8ArrayThe binary layout definition of the schema
fieldNamesstring[]The names of fields in the schema

​Returns

Returns an Instruction ({ accounts, data, programAddress }). Add it to a transaction and send it with your client, for example client.sendTransaction(instruction). There is no sendAndConfirm() method. Create a Client sets up client, payerSigner, and authoritySigner.

​Example

​Important Notes

  • The payer must be a signer of the transaction
  • The authority must be a signer of the transaction and must be the authority of the credential
  • The schema account must be writable
  • The credential account must be readable
  • This operation requires the System Program for rent exemption calculations
  • The schema name should be descriptive and unique within the credential
  • The description should provide clear information about the schema’s purpose and usage
  • The layout must be a valid binary format that defines the structure of attestation data
  • The fieldNames array must match the fields defined in the layout
  • The schema can be paused later if needed
  • The schema can be versioned to support evolution of the data structure
  • All attestations created under this schema must conform to its structure