The INFT contract is an intelligent NFT system designed for AI agents. It extends the standard ERC721 functionality to support encrypted metadata, authorization systems, and oracle-based verification for AI agent interactions.
- Encrypted URIs: Store encrypted off-chain data for AI agents
- Metadata Hashes: Cryptographic verification of agent metadata
- Traits Schema: Token URIs contain structured traits for agent capabilities
- Permission-based Access: Grant specific permissions to addresses for token usage
- Flexible Permissions: Custom permission bytes for different use cases
- Owner Control: Only token owners can authorize usage
- Proof Verification: Oracle-based cryptographic proof validation
- Metadata Updates: Secure metadata updates during transfers
- Attestation Support: Cryptographic attestation for operations
function mint(
address to,
string calldata tokenURI_,
string calldata encryptedURI,
bytes32 metadataHash
) external returns (uint256)- Mints new INFT with metadata and encrypted URI
- Returns unique token ID starting from 1
function authorizeUsage(uint256 tokenId, address executor, bytes calldata permissions) external
function isAuthorized(uint256 tokenId, address executor) external view returns (bool)
function getPermissions(uint256 tokenId, address executor) external view returns (bytes memory)- Authorize addresses to use specific tokens
- Check authorization status
- Retrieve permission details
function getMetadataHash(uint256 tokenId) external view returns (bytes32)
function getEncryptedURI(uint256 tokenId) external view returns (string memory)
function tokenURI(uint256 tokenId) public view override returns (string memory)- Access token metadata hash for verification
- Retrieve encrypted URI for off-chain data
- Get token URI with traits schema
- Create NFTs representing AI agents with specific capabilities
- Store encrypted model data or configuration off-chain
- Define agent traits and permissions through metadata
- Grant temporary or permanent usage rights to other addresses
- Implement complex permission systems for AI agent interactions
- Maintain ownership while allowing controlled usage
- Cryptographically verify metadata integrity
- Update metadata securely during transfers
- Protect sensitive AI agent data through encryption
- Ownership Verification: Only token owners can authorize usage
- Input Validation: Zero address and invalid token ID protection
- Reentrancy Protection: Built-in reentrancy guard
- Oracle Verification: Cryptographic proof validation
INFTMinted: Emitted when new INFT is createdUsageAuthorized: Emitted when usage is authorized for an addressMetadataUpdated: Emitted when metadata hash is updated
- Deploy the contract with name, symbol, and oracle address
- Mint INFTs with metadata and encrypted URIs
- Authorize usage for specific addresses as needed
- Use oracle proofs for secure operations
- Standard: ERC721 compliant
- Access Control: OpenZeppelin Ownable
- Security: ReentrancyGuard protection
- Token IDs: Sequential starting from 1
- Metadata: Hash-based verification system
This contract enables the creation of intelligent, secure NFTs suitable for AI agent representation and interaction within decentralized applications.
- The deployment script to deploy contract on chain is:
// On sepolia testnet
forge build
forge test -vvvv
forge script script/INFTAgentV1Script.s.sol:INFTAgentV1Script --rpc-url $SEPOLIA_RPC_URL --private-key $PRIVATE_KEY --broadcast --verify --etherscan-api-key $ETHERSCAN_API_KEY -vvvv
// on 0G Testnet
forge script script/INFTAgentV1Script.s.sol:INFTAgentV1Script --rpc-url $0G_RPC_URL --private-key $PRIVATE_KEY --broadcast --verify --etherscan-api-key $ETHERSCAN_API_KEY -vvvv# Sepolia Testnet
Contract Address: 0x1352aba587ffbbc398d7ecaea31e2948d3afe4fb
# 0G testnet
Contract Address: 0x1352aba587ffbbc398d7ecaea31e2948d3afe4fb