# Creating an Attestation (Solidity)

Now that you have created your schema with a schema hook address set, you must provide attestation data in the correct format that you set in your schema, or else verification will fail. If you are using the NPM SDK, we perform validation for you before the transaction call is sent. However, none of these safeguards exist when interacting with Sign Protocol directly from solidity.

Our simple schema only needs a `uint256`. We will use `abi.encode` to encode this number. Make sure that variables are provided in the same order they are set in the schema, which is the same order they will be decoded in your schema hook and on the SignScan attestation explorer.

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { ISP } from "@ethsign/sign-protocol-evm/src/interfaces/ISP.sol";
import { Attestation } from "@ethsign/sign-protocol-evm/src/models/Attestation.sol";
import { DataLocation } from "@ethsign/sign-protocol-evm/src/models/DataLocation.sol";

contract DataAttester is Ownable {
    ISP public spInstance;
    uint64 public schemaId;

    constructor() Ownable(_msgSender()) { }

    function setSPInstance(address instance) external onlyOwner {
        spInstance = ISP(instance);
    }

    function setSchemaID(uint64 schemaId_) external onlyOwner {
        schemaId = schemaId_;
    }

    function attest(address recipient, uint256 someNumber) external onlyOwner returns (uint64) {
        bytes[] memory recipients = new bytes[](1);
        recipients[0] = abi.encode(recipient);
        Attestation memory a = Attestation({
            schemaId: schemaId,
            linkedAttestationId: 0,
            attestTimestamp: 0,
            revokeTimestamp: 0,
            attester: address(this),
            validUntil: 0,
            dataLocation: DataLocation.ONCHAIN,
            revoked: false,
            recipients: recipients,
            data: abi.encode(someNumber)
        });
        return spInstance.attest(a, "", "", "");
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sign.global/for-builders/advanced-topics/schema-hooks/tutorial-checking-attestation-data/creating-an-attestation-solidity.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
