ERC-271

The most widely known and used ERC token standards are ERC-20 and ERC-271. ERC-20 is used for fungible tokens while ERC-271 is used for non-fungible tokens, such as digital collectibles or gaming items.

For example, CryptoKitties is a popular game that uses ERC-271 tokens to represent unique digital cats that can be collected, bred, and traded on the Ethereum blockchain. Each CryptoKitty is represented by a unique ERC-271 token, which contains specific attributes and characteristics that make them distinct from other CryptoKitties.

Here is a simple code example for creating an ERC-271 token contract using the Solidity programming language:

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC271/ERC271.sol";

contract MyToken is ERC271 {
    constructor() ERC271("MyToken", "MTK") {
    }

    function mint(address to, uint256 tokenId) public {
        _safeMint(to, tokenId);
    }
}

This contract inherits from the ERC271 token standard provided by the OpenZeppelin library and creates a new token called “MyToken” with the symbol “MTK”. The mint function can be called to mint a new token with a specific ID and assign it to a given address.

Pro Upgrade1. 3-Day Free Trial2. Unrestricted Access3.

Try HaasOnline Cloud Pro for 3-days and discover opportunities you've been missing.
Start 3-day free trial ›
1 TradeServer Cloud Pro offers a 3-day trial of our premium subscription.
2 During the 3-day TradeServer Cloud Pro trial you will not be required to pay to access Pro plan features. Subscription automatically renews unless auto-renewal is disabled or if you opt for manual payments.
3 Access to premium features within TradeServer Cloud does not include third-party restrictions or unforeseen issues.