title: Code sample for parsing metadata for Solana NFT and updating the metadata
body: <p>On Solana, NFT metadata is stored in accounts which are owned by the shared contract Token Metadata Program at address <code>metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s</code>.</p>
  <p>I need a clear, concise code example for how I can use some existing library to obtain the metadata for a particular NFT. Let's use this NFT for example: a SolStone <code>4itgFt6tSotypyVAaUkLJzpGQ5KXsJNhwpKBANMv49mf</code></p>
  <p>The furthest I've gotten so far is copying over the metaplex library and using a call like so</p>
  <pre><code> await getProgramAccounts(connection, METADATA_PROGRAM_ID, 'finalized');
  </code></pre>
  <p>however this will load the metadata for all NFTs in existence. I instead need to use some filter instead of <code>'finalized'</code> as the commitment argument.</p>
  <p>In the <a href="https://github.com/metaplex-foundation/metaplex/blob/master/js/packages/web/src/contexts/meta/loadAccounts.ts#L166" rel="nofollow noreferrer">metaplex codebase</a> they have an example of filtering by creator's address I believe.</p>
  <pre><code>filters: [
      {
          memcmp: {
              offset:
              1 + // key
              32 + // update auth
              32 + // mint
              4 + // name string length
              MAX_NAME_LENGTH + // name
              4 + // uri string length
              MAX_URI_LENGTH + // uri
              4 + // symbol string length
              MAX_SYMBOL_LENGTH + // symbol
              2 + // seller fee basis points
              1 + // whether or not there is a creators vec
              4 + // creators vec length
              i * MAX_CREATOR_LEN,
              bytes: whitelistedCreators[j].info.address,
          }
      }
  ]
  </code></pre>
  <p>So in theory I should be able to update this filter to instead filter by the NFT's own address, but I'm not sure how to get the bit offset correct here to make the filter accurate.</p>
  <p>After I am able to read the nft metadata, next I need a code example for updating the metadata. Specifically the URI field.</p>