非代替トークン・フレームワークのチェーンコード・パッケージ
非代替トークン・フレームワークでは、ブロックチェーン・アプリケーション・ビルダーでサポートされている拡張ERC-721標準が使用されます。
NFT Art Collection Marketplaceサンプルは、Blockchain App Builderでサポートされている拡張ERC-721標準に基づく非代替トークン汎用フレームワークの使用を示しています。このサンプルには、アート作品に関連する非代替性トークン(NFT)の購入および販売のマーケットプレイスを表すチェーンコードが含まれています。このサンプルでは、博物館はブロックチェーンネットワークでアートワークのNFTをミント(作成)することができます。消費者は博物館からNFTを購入して再販することができます。チェーンコードは、トークンの初期化、アカウント操作、ロール割当て、ミント、転送、書き込みなど、非代替トークンのライフサイクルを管理するために必要なメソッドを実装します。また、ミント、転送、および書き込み操作を承認するための公証アカウントを提供し、毎日の制限や監査手順によるコンプライアンスをサポートします。NFT Art Collection Marketplaceサンプルは、TypeScriptのチェーンコード開発用に設計されています。
NFTCollectiblesWithERC721.zip
。デプロイメント用のパッケージ・チェーンコードを含むアーカイブ・ファイル。NFTCollectiblesWithERC721-TypeScript.yaml
。ブロックチェーン・アプリケーション・ビルダーでNFTCollectiblesWithERC721
チェーンコードをスキャフォールドするために使用できる仕様ファイルです。NFTCollectiblesWithERC721_postman_collection.json
: チェーンコード内のAPIをテストできるPostmanコレクション。README.md
は、チェーンコードを使用するためのステップバイステップ・ガイドです。
真菌性トークン・フレームワークを取得するには、Oracle Blockchain Platformデジタル・アセット・コンソールで「デジタル・アセット」タブをクリックし、「非真菌性トークン・フレームワーク」を選択します。
仕様ファイル
アート・コレクション・マーケットプレイス・チェーンコードの生成に使用される仕様ファイルには、events
属性が含まれます。チェーンコード・イベント関数は、生成されたチェーンコードのイベント・コールバックをサポートし、リアルタイム通知を有効にしてワークフローをトリガーします。仕様ファイルおよび仕様ファイルで使用されるパラメータの詳細は、Oracle Blockchain Platformの使用の非代替トークンの入力仕様ファイルを参照してください。
#
# Copyright (c) 2024, 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.
チェーンコード・メソッドの裏書者詳細
Oracle Blockchain Platform Digital Assets Editionは、すべてのsetterメソッドのリクエスト・ペイロードにエンドースメント・パラメータを追加します。パラメータの値は、endorsers
またはsameOrgEndorser
です。sameOrgEndorser
パラメータがtrueの場合、トランザクション推薦はリクエスタと同じ組織からのものである必要があります。endorsers
パラメータは、トランザクションを承認する必要があるピアのリストを指定します。詳細は、Postmanコレクションでのエンドースメントのサポートを参照してください。次の表に、各メソッドのエンドサ・タイプを示します。
Method | 裏書者タイプ |
---|---|
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 |