Ledger size and gas fees

Hey,

I want to know how will the ledger size impact the gas fees ?

In the following NFT snippet -

pragma language_version >= 0.16 && <= 0.17;

import CompactStandardLibrary;

// NFT structure
struct NFT {
  tokenId: Unsigned<256>,
  owner: Address,
  metadata: Opaque<"string">,
  createdAt: Unsigned<256>,
  isPrivate: Boolean
}

// Collection metadata
struct Collection {
  name: Opaque<"string">,
  symbol: Opaque<"string">,
  totalSupply: Unsigned<256>,
  baseURI: Opaque<"string">
}

// Public ledger state
export ledger nftCollection: Collection;
export ledger tokenIdCounter: Unsigned<256>;
export ledger publicTokens: Map<Unsigned<256>, NFT>;
export ledger ownershipMap: Map<Address, Vector<Unsigned<256>>>;

How will it effect the gas cost if I want do the following -

  • Batch mint a million NFTs
  • If I want to update the metadata of a single publicToken among the million NFTs that have been minted

Will the gas cost scale with the ledger size as it keeps increasing ?

AFAICT there is no gas model at this time so you will have to wait until this feature is added before a definitive answer can be provided. So far, we’ve been optimizing for circuit size in the @openzeppelin/compact-contracts repo. We have a NFT implementation I encourage you to check out and let us know if you have any feedback! :folded_hands:

2 Likes