• NEC Website
  • GitHub
  • Discord Community

Quick Start

  • Get Started

Staking

  • Quick Start
  • Overview
  • Stake on NCOG
  • Run NCOGEarthChain
  • Run Validator Node
  • Running Testnet
  • Operating a private network (fakenet)
  • Running the demo
  • Run a Read-only node
  • Testnet Faucet
  • Run a Full node
  • Run a Testnet read node

API

  • Public API End Points
  • Getting Started
  • Installation
  • GraphQL Schema Basics
  • Schema Structure
  • Implementation Details and Notes

Tutorials

  • Create a ERC721 Contract
  • Deploy a Smart Contract
  • Verify a Deployed Smart Contract
  • Setup MetaMask Wallet
  • Import NFT
  • Create a Local Test Network

Technology

  • Overview
  • Forest Protocal
  • Tolerance to Byzantine Fault (BFT)
  • Proof of Stake
  • Transaction Fees
  • FAQ

Best Practices

  • MANAGE NEC ASSETS WITH LEDGER NANO S
  • How to Navigate NCOG NEC
  • How to Check Your Account Balance
  • How to Receive NCOG Assets
  • How to Send NCOG Assets
  • Leager FAQ
  • Home
  • Docs
  • Tutorials
  • Create a ERC721 Contract

Create a ERC721 Contract

Table of Contents
  • ERC721 Standard Features:
    • 1. Token Identification (Token ID):
    • 2. Ownership and Transfer:
    • 3. Approvals and Operators:
    • 4. Metadata and URI:
    • 5. Events:
    • 6. Enumerable Tokens:
    • 7. Interface Compliance:
    • 8. Security Considerations:
    • 9. Customizable:
    • Compile
    • Deploy
    • Check
    • Mint

ERC-721 is a standard interface for non-fungible tokens (NFTs) on the Ethereum blockchain. The term “ERC” stands for Ethereum Request for Comment, and “721” is the proposal identifier.

ERC721 Standard Features: #

1. Token Identification (Token ID): #

  • ERC721 tokens are uniquely identified by a token ID within a specific contract.
  • Each token ID represents a distinct, non-fungible asset.

2. Ownership and Transfer: #

  • `transferFrom(address from, address to, uint256 tokenId)`: Transfers ownership of a specific token from one address to another.
  • `safeTransferFrom(address from, address to, uint256 tokenId)`: Similar to `transferFrom`, but includes a safety check to prevent accidentally sending tokens to a contract that does not support ERC721.

3. Approvals and Operators: #

  • `approve(address to, uint256 tokenId)`: Grants approval for a specific address to manage the token.
  • `getApproved(uint256 tokenId)`: Returns the address approved for a specific token.
  • `setApprovalForAll(address operator, bool approved)`: Grants or revokes approval for an operator to manage all tokens on behalf of the owner.
  • `isApprovedForAll(address owner, address operator)`: Returns whether an operator is approved to manage all tokens for a specific owner.

4. Metadata and URI: #

  • `tokenURI(uint256 tokenId)`: Retrieves the URI (Uniform Resource Identifier) for a specific token.
  • Tokens may have associated metadata, such as name and symbol, which can be defined in the inheriting contract.

5. Events: #

  • `Transfer(address from, address to, uint256 tokenId)`: Event emitted when ownership of a token changes.
  • `Approval(address owner, address approved, uint256 tokenId)`: Event emitted when approval for a token is granted or revoked.
  • `ApprovalForAll(address owner, address operator, bool approved)`: Event emitted when an operator’s approval to manage all tokens is changed.

6. Enumerable Tokens: #

  • `totalSupply()`: Returns the total number of tokens in existence.
  • `balanceOf(address owner)`: Returns the number of tokens owned by a specific address.
  • `tokenOfOwnerByIndex(address owner, uint256 index)`: Returns the token ID of the token at a given index in the owner’s list of tokens.
  • `tokenByIndex(uint256 index)`: Returns the token ID of the token at a given index in the list of all tokens.

7. Interface Compliance: #

  • Implements the ERC721 interface, ensuring compatibility with other contracts and platforms that support the ERC721 standard.

8. Security Considerations: #

  • Includes various checks and validations to ensure the security of token transfers and approvals.

9. Customizable: #

  • Developers can extend and customize this contract to include additional functionality or modify existing behavior to suit specific use cases.

Compile #

Compile your code into bytecode to allow it to run on a virtual machine or interpreter. This process involves translating your sophisticated code into a lower-level representation that is easier for computers to grasp. Moreover, you may optimize your code for better efficiency during compilation.

Deploy #

Send your code to the NEC network in a transaction to deploy your Variable-cap asset. Users on the NEC network will be able to access your Variable-cap Asset once it has been launched. This enables people to engage with and make use of the features your code offers.

Check #

To verify that your token has been created, go to the explorer. Locate the area in the explorer that shows the tokens you have created. This will verify if the creation of your token was successful.

Mint #

Additional token units can be created by using the mint function. In blockchain networks, the mint function is usually used to create new tokens or currencies. It facilitates more activity and transactions within the network and contributes to the token’s increased supply.

What are your Feelings
Share This Article :
  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
Still stuck? How can we help?

How can we help?

Updated on November 23, 2023
Deploy a Smart Contract

Powered by BetterDocs

Table of Contents
  • ERC721 Standard Features:
    • 1. Token Identification (Token ID):
    • 2. Ownership and Transfer:
    • 3. Approvals and Operators:
    • 4. Metadata and URI:
    • 5. Events:
    • 6. Enumerable Tokens:
    • 7. Interface Compliance:
    • 8. Security Considerations:
    • 9. Customizable:
    • Compile
    • Deploy
    • Check
    • Mint
© 2023. NCOG Earth Chain. All Rights Reserved.