ERC-721 Niezamienny standard tokena | ethereum.org (2024)

Ostatnia edycja:, Nieprawidłowa data/godzina

Wstęp

Co to jest niezamienny token?

Non-Fungible Token (NFT) służy do identyfikacji czegoś lub kogoś w unikalny sposób. Ten typ Tokena doskonale nadaje się do wykorzystania na platformach oferujących przedmioty kolekcjonerskie, klucze dostępu, bilety na loterię, numerowane miejsca na koncerty, mecze sportowe itp. Ten specjalny rodzaj Tokena ma niesamowite możliwości, więc zasługuje na odpowiedni Standard, do którego trafił ERC-721 rozwiązać to!

Co to jest ERC-721?

ERC-721 wprowadza standard dla NFT, innymi słowy, ten typ Tokena jest unikalny i może mieć inną wartość niż inny Token z tego samego Smart Contracta, być może ze względu na jego wiek, rzadkość lub nawet coś innego, jak jego wygląd. wizualny?

Tak! Wszystkie NFT mająuint256zmienna tzwIdentyfikator tokena, więc dla dowolnego kontraktu ERC-721 paraadres kontraktu, uint256 tokenIdmusi być globalnie unikalny. To powiedziawszy, dapp może mieć „konwerter”, który używaIdentyfikator tokenajako dane wejściowe i wyjściowe obraz czegoś fajnego, na przykład zombie, broń, umiejętności lub niesamowite kotki!

Wymagania wstępne

  • Konta
  • Inteligentne kontrakty
  • Standardy tokenów

Ciało

ERC-721 (Ethereum Request for Comments 721), zaproponowany przez Williama Entrikena, Dietera Shirleya, Jacoba Evansa, Nastassię Sachs w styczniu 2018 r., to standard tokenów niezamiennych, który implementuje interfejs API dla tokenów w ramach inteligentnych kontraktów.

Zapewnia takie funkcjonalności, jak przenoszenie tokenów z jednego konta na drugie, uzyskiwanie aktualnego salda tokenów na koncie, uzyskiwanie właściciela konkretnego tokena, a także całkowitej podaży tokena dostępnego w sieci. Oprócz tego posiada również kilka innych funkcjonalności takie jak zatwierdzanie, że ilość tokena z konta może zostać pobrana przez konto osoby trzeciej.

Jeśli Smart Contract implementuje następujące metody i zdarzenia, można go nazwać kontraktem ERC-721 Non-Fungible Token Contract, a po wdrożeniu będzie odpowiedzialny za śledzenie utworzonych tokenów w Ethereum.

ZEIP-721(otwiera się w nowej karcie)↗:

Metody

1

funkcja balanceOf(address _owner) zwraca widok zewnętrzny (uint256);

2funkcja OwnerOf(uint256 _tokenId) zwraca widok zewnętrzny (adres);

3funkcja safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes data) zewnętrzna płatna;

4funkcja safeTransferFrom(adres _from, adres _to, uint256 _tokenId) zewnętrzna płatna;

5funkcja transferFrom(adres _from, adres _to, uint256 _tokenId) zewnętrzna płatna;

6funkcja zatwierdzenie(adres _approved, uint256 _tokenId) zewnętrzne płatne;

7funkcja setApprovalForAll(address _operator, bool _approved) zewnętrzna;

8funkcja getApproved(uint256 _tokenId) zwraca widok zewnętrzny (adres);

9funkcja isApprovedForAll(address _owner, address _operator) zwraca widok zewnętrzny (bool);

10

Pokaż wszystko

ERC-721 Niezamienny standard tokena | ethereum.org (1)

Kopiuj

Wydarzenia

1transfer zdarzenia (adres indeksowany _from, adres indeksowany _to, uint256 indeksowany _tokenId);

2zatwierdzenie zdarzenia (adres indeksowany _właściciel, adres indeksowany _zatwierdzony, uint256 indeksowany _tokenId);

3event ApprovalForAll(adres indeksowany _właściciel, adres indeksowany _operator, bool _zatwierdzony);

4

ERC-721 Niezamienny standard tokena | ethereum.org (2)

Kopiuj

Przykłady

Zobaczmy, w jaki sposób standard jest tak ważny, aby ułatwić nam kontrolę dowolnego kontraktu tokena ERC-721 w Ethereum. Potrzebujemy tylko binarnego interfejsu aplikacji kontraktu (ABI), aby utworzyć interfejs do dowolnego tokena ERC-721. Jak widać poniżej, użyjemy uproszczonego ABI, aby był to przykład o niskim współczynniku tarcia.

Web3.py Przykład

Najpierw upewnij się, że zainstalowałeśWeb3.py(otwiera się w nowej karcie)Biblioteka Pythona:

1pip zainstaluj web3

2

1zweb3importWeb3

2zweb3._utils.wydarzeniaimportget_event_data

3

4

5w3=Web3(Web3.Dostawca HTTP(„https://cloudflare-eth.com”))

6

7ck_token_addr= "0x06012c8cf97BEaD5deAe237070F9587f8E7A266d" # Umowa CryptoKitties

8

9adres_akta= "0xb1690C08E213a35Ed9bAb7B318DE14420FB57d8C" # Aukcja sprzedaży CryptoKitties

10

11# To jest uproszczony interfejs binarny aplikacji kontraktowej (ABI) kontraktu ERC-721 NFT.

12# Ujawni tylko metody: balanceOf(address), name(), OwnerOf(tokenId), symbol(), totalSupply()

13uproszczony_abi= [

14 {

15 „wejścia”: [{„Typ wewnętrzny”: 'adres', 'nazwa': 'właściciel', 'typ': 'adres'}],

16 'nazwa': „bilans”,

17 „wyjścia”: [{„Typ wewnętrzny”: 'uint256', 'nazwa': '', 'typ': 'uint256'}],

18 'płatny': FAŁSZ, „zmienność stanu”: 'pogląd', 'typ': 'funkcjonować', 'stały': PRAWDA

19 },

20 {

21 „wejścia”: [],

22 'nazwa': 'nazwa',

23 „wyjścia”: [{„Typ wewnętrzny”: 'strunowy', 'nazwa': '', 'typ': 'strunowy'}],

24 „zmienność stanu”: 'pogląd', 'typ': 'funkcjonować', 'stały': PRAWDA

25 },

26 {

27 „wejścia”: [{„Typ wewnętrzny”: 'uint256', 'nazwa': „identyfikator tokena”, 'typ': 'uint256'}],

28 'nazwa': 'właściciel',

29 „wyjścia”: [{„Typ wewnętrzny”: 'adres', 'nazwa': '', 'typ': 'adres'}],

30 'płatny': FAŁSZ, „zmienność stanu”: 'pogląd', 'typ': 'funkcjonować', 'stały': PRAWDA

31 },

32 {

33 „wejścia”: [],

34 'nazwa': 'symbol',

35 „wyjścia”: [{„Typ wewnętrzny”: 'strunowy', 'nazwa': '', 'typ': 'strunowy'}],

36 „zmienność stanu”: 'pogląd', 'typ': 'funkcjonować', 'stały': PRAWDA

37 },

38 {

39 „wejścia”: [],

40 'nazwa': „całkowita podaż”,

41 „wyjścia”: [{„Typ wewnętrzny”: 'uint256', 'nazwa': '', 'typ': 'uint256'}],

42 „zmienność stanu”: 'pogląd', 'typ': 'funkcjonować', 'stały': PRAWDA

43 },

44]

45

46ck_extra_abi= [

47 {

48 „wejścia”: [],

49 'nazwa': „ciężarne kotki”,

50 „wyjścia”: [{'nazwa': '', 'typ': 'uint256'}],

51 'płatny': FAŁSZ, „zmienność stanu”: 'pogląd', 'typ': 'funkcjonować', 'stały': PRAWDA

52 },

53 {

54 „wejścia”: [{'nazwa': „_identyfikator kotka”, 'typ': 'uint256'}],

55 'nazwa': 'jest w ciąży',

56 „wyjścia”: [{'nazwa': '', 'typ': „bool”}],

57 'płatny': FAŁSZ, „zmienność stanu”: 'pogląd', 'typ': 'funkcjonować', 'stały': PRAWDA

58 }

59]

60

61ck_kontrakt=w3.et.kontrakt(adres=w3.adres_sumy_kontrolnej(ck_token_addr),abi=uproszczony_abi+ck_extra_abi)

62nazwa=ck_kontrakt.Funkcje.nazwa().dzwonić()

63symbol=ck_kontrakt.Funkcje.symbol().dzwonić()

64aukcje_koci=ck_kontrakt.Funkcje.bilansZ(adres_akta).dzwonić()

65wydrukować(F"{nazwa}[{symbol}] NFT na aukcjach:{aukcje_koci}")

66

67kotki w ciąży=ck_kontrakt.Funkcje.kotki w ciąży().dzwonić()

68wydrukować(F"{nazwa}[{symbol}] NFT Ciąża:{kotki w ciąży}")

69

70# Korzystanie z ABI zdarzenia transferu w celu uzyskania informacji o przeniesionych kotkach.

71tx_event_abi= {

72 'anonimowy': FAŁSZ,

73 „wejścia”: [

74 {„indeksowane”: FAŁSZ, 'nazwa': 'z', 'typ': 'adres'},

75 {„indeksowane”: FAŁSZ, 'nazwa': 'Do', 'typ': 'adres'},

76 {„indeksowane”: FAŁSZ, 'nazwa': „identyfikator tokena”, 'typ': 'uint256'}],

77 'nazwa': 'Przenosić',

78 'typ': 'wydarzenie'

79}

80

81# Potrzebujemy podpisu zdarzenia, aby przefiltrować dzienniki

82sygnatura_zdarzenia=w3.keccak(tekst="Transfer(adres,adres,uint256)").klątwa()

83

84logi=w3.et.get_logs({

85 „z bloku”:w3.et.zablokuj numer- 120,

86 "adres":w3.adres_sumy_kontrolnej(ck_token_addr),

87 „tematy”: [sygnatura_zdarzenia]

88})

89

90# Uwagi:

91# - Zwiększ liczbę bloków ze 120, jeśli nie zostanie zwrócone żadne zdarzenie Transfer.

92# - Jeśli nie znalazłeś żadnego zdarzenia Transfer, możesz również spróbować uzyskać identyfikator tokena pod adresem:

93# https://etherscan.io/address/0x06012c8cf97BEaD5deAe237070F9587f8E7A266d#events

94# Kliknij, aby rozwinąć dzienniki zdarzenia i skopiować jego argument „tokenId”.

95ostatnie_tx= [get_event_data(w3.kodek,tx_event_abi,dziennik)[„argumenty”] DodziennikWlogi]

96

97Jeśliostatnie_tx:

98kotek_identyfikator=ostatnie_tx[0][„identyfikator tokena”] # Wklej tutaj „tokenId” z powyższego łącza

99jest w ciąży=ck_kontrakt.Funkcje.jest w ciąży(kotek_identyfikator).dzwonić()

100 wydrukować(F"{nazwa}[{symbol}] NFT{kotek_identyfikator}jest w ciąży:{jest w ciąży}")

101

Pokaż wszystko

ERC-721 Niezamienny standard tokena | ethereum.org (3)

Kopiuj

Kontrakt CryptoKitties ma kilka interesujących wydarzeń innych niż standardowe.

Sprawdźmy dwa z nich,W ciążyINarodziny.

1# Korzystanie z ABI wydarzeń związanych z ciążą i porodem, aby uzyskać informacje o nowych kotkach.

2ck_extra_events_abi= [

3 {

4 'anonimowy': FAŁSZ,

5 „wejścia”: [

6 {„indeksowane”: FAŁSZ, 'nazwa': 'właściciel', 'typ': 'adres'},

7 {„indeksowane”: FAŁSZ, 'nazwa': „identyfikator przełożonej”, 'typ': 'uint256'},

8 {„indeksowane”: FAŁSZ, 'nazwa': „identyfikator ojca”, 'typ': 'uint256'},

9 {„indeksowane”: FAŁSZ, 'nazwa': „Ochłodzenie EndBlock”, 'typ': 'uint256'}],

10 'nazwa': 'W ciąży',

11 'typ': 'wydarzenie'

12 },

13 {

14 'anonimowy': FAŁSZ,

15 „wejścia”: [

16 {„indeksowane”: FAŁSZ, 'nazwa': 'właściciel', 'typ': 'adres'},

17 {„indeksowane”: FAŁSZ, 'nazwa': „identyfikator kotka”, 'typ': 'uint256'},

18 {„indeksowane”: FAŁSZ, 'nazwa': „identyfikator przełożonej”, 'typ': 'uint256'},

19 {„indeksowane”: FAŁSZ, 'nazwa': „identyfikator ojca”, 'typ': 'uint256'},

20 {„indeksowane”: FAŁSZ, 'nazwa': „geny”, 'typ': 'uint256'}],

21 'nazwa': 'Narodziny',

22 'typ': 'wydarzenie'

23 }]

24

25# Potrzebujemy podpisu zdarzenia, aby przefiltrować dzienniki

26ck_event_signatures= [

27w3.keccak(tekst="W ciąży (adres, uint256, uint256, uint256)").klątwa(),

28w3.keccak(tekst="Narodziny (adres, uint256, uint256, uint256, uint256)").klątwa(),

29]

30

31# Oto wydarzenie w ciąży:

32# - https://etherscan.io/tx/0xc97eb514a41004acc447ac9d0d6a27ea6da305ac8b877dff37e49db42e1f8cef#eventlog

33dzienniki ciąży=w3.et.get_logs({

34 „z bloku”:w3.et.zablokuj numer- 120,

35 "adres":w3.adres_sumy_kontrolnej(ck_token_addr),

36 „tematy”: [ck_event_signatures[0]]

37})

38

39ostatnie_ciąży= [get_event_data(w3.kodek,ck_extra_events_abi[0],dziennik)[„argumenty”] DodziennikWdzienniki ciąży]

40

41# Oto wydarzenie narodzin:

42# - https://etherscan.io/tx/0x3978028e08a25bb4c44f7877eb3573b9644309c044bf087e335397f16356340a

43dzienniki_narodzin=w3.et.get_logs({

44 „z bloku”:w3.et.zablokuj numer- 120,

45 "adres":w3.adres_sumy_kontrolnej(ck_token_addr),

46 „tematy”: [ck_event_signatures[1]]

47})

48

49ostatnie_narodziny= [get_event_data(w3.kodek,ck_extra_events_abi[1],dziennik)[„argumenty”] DodziennikWdzienniki_narodzin]

50

Pokaż wszystko

ERC-721 Niezamienny standard tokena | ethereum.org (4)

Kopiuj

Popularne NFT

Dalsza lektura

Powrót do góry ↑

Czy ten artykuł był pomocny?

ERC-721 Niezamienny standard tokena | ethereum.org (2024)

FAQs

What is the ERC721 token standard? ›

The ERC-721 token standard has been used in the context of digital art, where artists can create unique pieces of art as NFTs, providing them with a new avenue for their work. The ERC-721 token standard is used in the gaming industry, where game developers can create unique in-game items as NFTs.

What is an example of ERC-721 token? ›

The ERC-721 token smart contract demonstrates how to create and transfer non-fungible tokens. Non-fungible tokens represent ownership over digital or physical assets. Example assets are artworks, houses, tickets, etc. Non-fungible tokens are distinguishable and we can track the ownership of each one separately.

What is the importance of the ERC721 standard in the context of NFTs? ›

Advantages of ERC-721 Standard for NFTs

Unique Identification: ERC-721 tokens assign a distinct identifier to each token, ensuring each one is unique and individually trackable. This feature is vital for representing unique digital assets like artworks, collectibles, and in-game items.

What is tokenuri in ERC-721? ›

Token URI in ERC Standards

ERC721 Token URIThe ERC721 standard, a blueprint for creating NFTs, utilizes Token URI to link each unique token to its corresponding metadata. The metadata often includes details like the name, description, and image of the token.

What is the most popular ERC token standard? ›

ERC-20 is the most widely used token standard and is used to create fungible tokens, while ERC-721 is used to create non-fungible tokens (NFTs). Other ERC standards, such as ERC-777 and ERC-1155, provide additional features and functions for creating more complex tokens.

What is the difference between an NFT and a standard token? ›

Non-fungible tokens (NFTs) are assets like a piece of art, digital content, or video that have been tokenized via a blockchain. Tokens are unique identification codes created from metadata via an encryption function. These tokens are then stored on a blockchain, while the assets themselves are stored in other places.

What is the difference between ERC-721 and ERC 721A? ›

ERC-721A is better optimized for generative artwork NFT collections. Unlike the ERC-721 standard, ERC-721A has allowed token ownership at the transferring stage rather than the minting stage. This token standard also has better metadata management.

Does each ERC721 token have its own address? ›

ERC-721 Functions​

ownerOf: This function returns the address of the owner of a specific token. Each ERC721 token is unique, represented by an ID. This function allows users or applications to determine the owner of the token based on its unique ID.

What are the benefits of ERC-721? ›

In short, ERC-721 tokens allow for the creation and management of unique digital assets on the Ethereum blockchain, making it possible to create games, collectibles, and other applications that leverage the benefits of blockchain technology.

What is minting in ERC-721? ›

ERC-721 contracts:

The mint function takes in a token ID and the address of the user to which to mint the tokens to. 2. It will then attempt to update mapping token ID -> address . 3. If the token ID already exists in the mapping (which means that a token has already been minted), then minting will fail.

What is ERC721 token? ›

ERC-721 is a standard for “non-fungible” tokens. A non-fungible token is the type of token that is unique. These are cryptographic assets on a blockchain that has a unique code and metadata differentiating them from one another.

How do I send ERC-721 tokens? ›

First, we create a new object where we specify the type of token, which will be, in this case, ”ERC721”. Next up, we will also specify the receiver address, which is where you would like to transfer the ERC721 token. Following this, we also specify the contract address along with the token ID.

What is the ERC 777 token standard? ›

ERC-777 tokens are an advanced token standard proposed as an improvement over ERC-20 tokens on the Ethereum blockchain. Developed to address limitations in token functionality and expand use cases, ERC-777 introduces several innovative features while maintaining backward compatibility with ERC-20 tokens.

What is a token standard? ›

Token standards are the set of rules that run crypto tokens on the blockchain. From ERC-20 to ERC-721, learn what they are. Feb 02, 2022.

What is the difference between ERC-20 and ERC-721 tokens? ›

Token type: ERC20 is a fungible token standard, meaning each token is interchangeable and has the same value. ERC 721 is a non-fungible token standard, meaning each token is unique and has its own value. Token creation: ERC20 tokens can be created in bulk, while ERC 721 tokens are created individually.

What is the new NFT token standard? ›

ERC-6551, a token standard introduced on the Ethereum mainnet on May 7, 2023, aims to enhance the functionality of NFTs by adding smart contract capabilities. Implementation of this token standard assigns an Ethereum account to the NFT, setting up a token-bound account (TBA).

Top Articles
A Gentle Introduction to Gas Fee in NFT | Analytics Steps
Gasoline price fluctuations - U.S. Energy Information Administration (EIA)
Cooking Chutney | Ask Nigella.com
Fat People Falling Gif
Belle Meade Barbershop | Uncle Classic Barbershop | Nashville Barbers
Falgout Funeral Home Obituaries Houma
Chase Bank Operating Hours
Es.cvs.com/Otchs/Devoted
How to know if a financial advisor is good?
Red Wing Care Guide | Fat Buddha Store
Roblox Character Added
10 Best Places to Go and Things to Know for a Trip to the Hickory M...
Apus.edu Login
Zack Fairhurst Snapchat
2024 INFINITI Q50 Specs, Trims, Dimensions & Prices
Panic! At The Disco - Spotify Top Songs
Gayla Glenn Harris County Texas Update
Sea To Dallas Google Flights
Universal Stone Llc - Slab Warehouse & Fabrication
Pecos Valley Sunland Park Menu
Certain Red Dye Nyt Crossword
Best Sports Bars In Schaumburg Il
Reser Funeral Home Obituaries
Weldmotor Vehicle.com
Does Hunter Schafer Have A Dick
3Movierulz
University Of Michigan Paging System
Arlington Museum of Art to show shining, shimmering, splendid costumes from Disney Archives
Copper Pint Chaska
Is Henry Dicarlo Leaving Ktla
Black Lion Backpack And Glider Voucher
Bend Missed Connections
Publix Daily Soup Menu
Kristen Hanby Sister Name
Springfield.craigslist
Marine Forecast Sandy Hook To Manasquan Inlet
Cox Outage in Bentonville, Arkansas
Review: T-Mobile's Unlimited 4G voor Thuis | Consumentenbond
Wayne State Academica Login
RECAP: Resilient Football rallies to claim rollercoaster 24-21 victory over Clarion - Shippensburg University Athletics
Gregory (Five Nights at Freddy's)
Celsius Claims Agent
Iman Fashion Clearance
Dyi Urban Dictionary
Canada Life Insurance Comparison Ivari Vs Sun Life
Madden 23 Can't Hire Offensive Coordinator
Mytmoclaim Tracking
Pronósticos Gulfstream Park Nicoletti
Tanger Outlets Sevierville Directory Map
Law Students
One Facing Life Maybe Crossword
Latest Posts
Article information

Author: Rev. Porsche Oberbrunner

Last Updated:

Views: 5832

Rating: 4.2 / 5 (53 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Rev. Porsche Oberbrunner

Birthday: 1994-06-25

Address: Suite 153 582 Lubowitz Walks, Port Alfredoborough, IN 72879-2838

Phone: +128413562823324

Job: IT Strategist

Hobby: Video gaming, Basketball, Web surfing, Book restoration, Jogging, Shooting, Fishing

Introduction: My name is Rev. Porsche Oberbrunner, I am a zany, graceful, talented, witty, determined, shiny, enchanting person who loves writing and wants to share my knowledge and understanding with you.