NFT token contract: Difference between revisions
No edit summary |
|||
| Line 7: | Line 7: | ||
[[File:Nft_contract3.jpg |700px]] | [[File:Nft_contract3.jpg |700px]] | ||
Scroll down to the number 19 item: uri (0x0e89341c) | Scroll down to the number 19 item: uri (0x0e89341c) In the <input> (uint256) field input the token ID (in this case token ID = 1), and click query. | ||
This returns the URI | |||
[[File:Nft_metadata_01.jpg |600px]] | [[File:Nft_metadata_01.jpg |600px]] | ||
Latest revision as of 19:11, 18 November 2025
Interacting Directly with the NFT TOKEN CONTRACT
In the About NFTs page we visited the TOKEN CONTRACT PAGE, clicked on "Contract", and then: "Read Contract as Proxy"
https://polygonscan.com/address/0x06467d54aab2a538675ff30605fe60ee49cb5c79#readContract
Scroll down to the number 19 item: uri (0x0e89341c) In the <input> (uint256) field input the token ID (in this case token ID = 1), and click query. This returns the URI
The uri (Uniform resource identifier) is the string:
ipfs://bafybeiatkrp5s7cg3hjv6v6t47vpyryclczcounwz5iikkhrq3jypz44zq/{id}
The Content Identifier CID is the bafyeia...44zq part, and {id} in our case = 1
In order to find the content in the ipfs system we need to connect to a node of the system.
One way is to have our own node running, and another way is to use a website that allows us to access the IPFS file system.
View the Content in the IPFS file system
If we don't run an IPFS node in our computers, we can use a public IPFS gateway, like ipfs.io
With the CID and Token id found in the TOKEN CONTRACT we can retrieve the information like this:
https://ipfs.io/ipfs/bafybeiatkrp5s7cg3hjv6v6t47vpyryclczcounwz5iikkhrq3jypz44zq/1
Amazin... right?
At least we found where the image is stored:
image: "ipfs://bafybeigebep5wcghzkecixpfyrai3aslvhiiik3imubcwxcelx6xwqlp7q/1"
Again, let's use the Public IPFS gateway and write the address like this:
https://ipfs.io/ipfs/bafybeigebep5wcghzkecixpfyrai3aslvhiiik3imubcwxcelx6xwqlp7q/1
Congratulations!!
Now you know more about NFTs than 99.999999... of all human population!!
Send the NFT without OpenSea
Now let's use the TOKEN CONTRACT directly to send our NFT to somebody else. Off course don't send it if you want to lose it!!!
But this is how you would do it in case you want to transfer it to another Polygon address:
Click on the connect to Web3 button and confirm in your wallet:
Select the Write Contract as Proxy tab and scroll down to item number 10 safeTransferFrom:
With your wallet connected, fill in the safeTransferFrom fields:
- from: 0xYourWalletAddress
- to: 0xRecipientWalletAddress
- id (uint256): 1 (This is the Token ID)
- amount: 1 (The number of NFTs to transfer)
- data (bytes): 0x (NFT transfer don't need this field but you have to enter 0x to be able to click "write")
Then confirm in your wallet if you want to send the NFT.
When you "confirm" the NFT is transferred from the 0xFOE to the 0xA41 address.
There are many more things you can do but this is enough to illustrate how to interact directly with a smart contract.