Pacchetto codice concatenato struttura token non fungibile
Il framework di token non fungibile utilizza lo standard ERC-721 esteso supportato da Blockchain App Builder.
L'esempio NFT Art Collection Marketplace illustra l'uso del framework generico di token non fungibile, che si basa sullo standard ERC-721 esteso supportato da Blockchain App Builder. Il campione include un codice concatenato per rappresentare un mercato per l'acquisto e la vendita di token non fungibili (NFT) associati a opere d'arte. In questo esempio, i musei possono menta (creare) NFT per opere d'arte nella rete blockchain. I consumatori possono quindi acquistare e poi rivendere NFT dai musei. Il codice concatenato implementa i metodi necessari per gestire il ciclo di vita dei token non fungibili, tra cui l'inizializzazione dei token, le operazioni dell'account, le assegnazioni dei ruoli, il conio, i trasferimenti e la masterizzazione. Fornisce inoltre conti notarili per l'approvazione delle operazioni di coniatura, trasferimento e masterizzazione e supporta la conformità attraverso limiti giornalieri e procedure di audit. Il campione NFT Art Collection Marketplace è progettato per lo sviluppo di codici a catena in TypeScript.
NFTCollectiblesWithERC721.zip, un file di archivio che contiene il codice concatenato in package per la distribuzione.NFTCollectiblesWithERC721-TypeScript.yaml, un file di specifica che è possibile utilizzare con Blockchain App Builder per eseguire lo scaffold del codice concatenatoNFTCollectiblesWithERC721.NFTCollectiblesWithERC721_postman_collection.json, una raccolta Postman che consente di eseguire il test delle API nel codice concatenato.README.md, una guida dettagliata per l'utilizzo del codice concatenato.
Per ottenere il framework dei token fungibili, nella console Asset digitali di Oracle Blockchain Platform fare clic sulla scheda Asset digitali, quindi selezionare Framework token non fungibili.
File specifica
Il file di specifica utilizzato per generare il codice concatenato del marketplace di raccolte d'arte include l'attributo events. La funzione eventi codice concatenato supporta i callback di eventi nei codici concatenati generati per abilitare notifiche in tempo reale e attivare i flussi di lavoro. Per ulteriori informazioni sui file di specifica e sui parametri utilizzati nei file di specifica, vedere File di specifica di input per token non fungibili in Blockchain App Builder for Oracle Blockchain Platform.
#
# Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.
#
# This specification file is an example how to build any whole non-fungible token application.
# For a whole non-fungible token application, art collection marketplace has been used as an example.
# Art collection marketplace is a digital marketplace that uses NFTs to enable the buying, selling, and showcasing of unique art pieces, providing secure ownership, provenance tracking, and exclusive rights for artists and collectors.
assets:
- name: ArtCollection #Asset name
type: token #Asset type
symbol: ART # Token symbol
standard: erc721+ # Token standard
events: true # Supports event code generation for non-GET methods
anatomy:
type: nonfungible # Token type
unit: whole #Token unit
behavior:
- indivisible
- singleton
- mintable:
max_mint_quantity: 20000
- transferable
- lockable
- roles:
minter_role_name: minter
properties: # Custom asset attributes for non-fungible token
- name: Price # Custom asset attribute to set the price of a non-fungible token in the marketplace
type: float
- name: On_Sale_Flag # Custom asset attribute to maintain non-fungible token selling status in the marketplace
type: boolean
metadata: # To maintain the metadata on-chain, this tag will be used. Users won't be able to update the metadata attribute values after an NFT is minted.
- name: Painting_Name # Custom asset attribute to represent the title given to a piece of artwork.
type: string
- name: Description # Custom asset attribute to represent a detailed explanation or interpretation of the painting's concept, style, or message.
type: string
- name: Painter_Name # Custom asset attribute to represent the name of the artist who created the painting.
type: string
customMethods:
- executeQuery
- "post(token_id: string, selling_price: number)" # Post the non-fungible token for selling in the marketplace.
- "buy(from_org_id: string, from_user_id: string, to_org_id: string, to_user_id: string, nonfungible_token_id: string, amount_paid: number)" # Buy the non-fungible token after paying the amount using any payment gateways.Dettagli autore dichiarazione a sostegno in metodi codice catena
Oracle Blockchain Platform Digital Assets Edition aggiunge un parametro di approvazione al payload della richiesta per tutti i metodi setter. Il valore del parametro è endorsers o sameOrgEndorser. Se il parametro sameOrgEndorser è true, le dichiarazioni a sostegno delle transazioni devono provenire dalla stessa organizzazione del richiedente. Il parametro endorsers specifica un elenco di peer che devono approvare la transazione. Per ulteriori informazioni, vedere Supporto dell'approvazione nelle raccolte postman in Blockchain App Builder for Oracle Blockchain Platform. La tabella seguente mostra il tipo di girante per ciascun metodo.
| Metodo | Tipo di sponsor |
|---|---|
activateAccount |
endorsers |
addTokenAdmin |
sameOrgEndorser |
addRole |
endorsers |
addTokenSysRole |
endorsers |
balanceOf |
endorsers |
buy |
endorsers |
createAccount |
endorsers |
createArtCollectionToken |
sameOrgEndorser |
deleteAccount |
endorsers |
getAccountByUser |
endorsers |
getAccountHistory |
endorsers |
getAccountsByRole |
endorsers |
getAccountsByTokenSysRole |
endorsers |
getAccountStatus |
endorsers |
getAccountStatusHistory |
endorsers |
getAccountTransactionHistory |
endorsers |
getAccountTransactionHistoryWithFilters |
endorsers |
getAllAccounts |
endorsers |
getAllLockedNFTs |
endorsers |
getAllTokenAdmins |
endorsers |
getAllTokens |
endorsers |
getAllTokensByUser |
endorsers |
getLockedNFTsByOrg |
endorsers |
getTokenById |
endorsers |
getTokenHistory |
endorsers |
getTransactionById |
endorsers |
getUserByAccountId |
endorsers |
getUsersByRole |
endorsers |
getUsersByTokenSysRole |
endorsers |
init |
endorsers |
isInRole |
endorsers |
isInTokenSysRole |
endorsers |
isNFTLocked |
endorsers |
isTokenAdmin |
endorsers |
lockNFT |
sameOrgEndorser |
name |
endorsers |
ownerOf |
endorsers |
post |
endorsers |
removeRole |
endorsers |
removeTokenAdmin |
sameOrgEndorser |
removeTokenSysRole |
endorsers |
safeTransferFrom |
endorsers |
suspendAccount |
endorsers |
symbol |
endorsers |
tokenURI |
endorsers |
totalNetSupply |
endorsers |
totalSupply |
endorsers |
transferFrom |
endorsers |
transferTokenSysRole |
endorsers |
updateArtCollectionToken |
sameOrgEndorser |