Skip to content

Assign an NFT for your provenance claim

Users can assign an NFT to one of their existing provenance claims, by issuing a transaction to ProvenanceGateway, under these conditions:

  • The provenance claim must exist and not have an NFT assigned to it yet.
  • The NFT must exist.
  • The NFT must be owned by the originatorโ€™s custody address.
  • The NFT must not be attached to any other provenance claim.
  • The NFT must be on the same blockchain as the Royal Protocol (Base ๐Ÿ”—).

This is the process:

  1. The user creates the NFT with the appropriate metadata, on any NFT contract on Base.

  2. The user gets the provenanceClaimId. You can use the indexer ๐Ÿ”— to get this value if you forgot it.

  3. The user sends a transaction to the assignNft function ๐Ÿ”—.

  4. The assignNft function ๐Ÿ”— runs some checks and then calls the ProvenanceRegistry assignNft function ๐Ÿ”—

  5. That assignNft function ๐Ÿ”— runs more checks and then assigns the provenance claim to the NFT.

Step by step directions

  1. Set up environment variables.

    VariableMeaningHow to get it
    PRIVATE_KEYYour private keyYou can usually get it from the wallet
    CLAIM_IDThe ID for your provenance claimUse the indexer ๐Ÿ”—
    NFT_ADDRThe address of your NFT contract
    TOKEN_IDThe token ID of your NFT within that contract
  2. If necessary, install Foundry ๐Ÿ”—.

  3. Run these commands to use the cast command ๐Ÿ”—.

    Terminal window
    PROVENANCE_GATEWAY=0x000000456Bb9Fd42ADd75F4b5c2247f47D45a0A2
    ENDPOINT=https://mainnet.base.org
    cast send --rpc-url $ENDPOINT \
    --private-key $PRIVATE_KEY $PROVENANCE_GATEWAY \
    "assignNft(uint256, address, uint256)" \
    `cast to-uint256 $CLAIM_ID` $NFT_ADDR `cast to-uint256 $TOKEN_ID`
  4. When you get the transaction hash, you can use a block explorer ๐Ÿ”— to see the log entry with your assigned NFT.