Web3 Fundamentals · 2 min read
Tokens and NFTs
Fungible tokens vs unique NFTs, ERC-20 and ERC-721 as ideas, and the NEAR standards NEP-141 and NEP-171 — including why a diploma is soulbound.
Two kinds of on-chain assets show up in almost every Web3 app.
Fungible tokens are interchangeable. One USDC is the same as any other USDC. On Ethereum the common interface is ERC-20 (transfer, approve, transferFrom, balanceOf). On NEAR the equivalent standard is NEP-141, with ft_transfer, ft_balance_of, ft_transfer_call, and a storage deposit so the contract can pay for your balance row.
Non-fungible tokens are unique. A diploma, a profile picture, or a ticket is not interchangeable with another. Ethereum uses ERC-721. NEAR uses NEP-171, with nft_token, nft_transfer, and metadata in NEP-177. The Retr0 Academy diploma is a soulbound NEP-171 NFT: the contract refuses nft_transfer, so the credential stays with the account that earned it.
Amounts on NEAR are usually strings of yocto-units (1 NEAR = 10^24 yoctoNEAR). Wallets need strings so 24-decimal values do not get rounded in JavaScript.
You will implement NEP-141 and NEP-171 in the Tokens & NFTs on NEAR course. For now, remember the split: fungible vs unique, standard method names, and why a credential should not be tradable.
<h1>Is this a token or an NFT?</h1>
<p>This view call reads <code>nft_metadata</code> on the diploma contract.</p>
<button type="button" id="go">Read nft_metadata</button>
<pre id="out">Press the button.</pre>Edit this example in the Playground.
Exercise
Open the Playground example and read the diploma metadata. Then write one sentence explaining why this contract is an NFT (NEP-171) and not a fungible token (NEP-141).
Saved in this browser.