2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Raribleを使ったERC721とERC1155トークンの作成手順

Last updated at Posted at 2021-07-02

はじめに

RaribleでのNFTの作成ケースを作っており、その覚書を残しておきます。

特徴

Raribleは、ERC721とERC1155を基本としたトークンを作成し、マーケットで売買できることが特徴になっています。
コントラクト自体はEthereumのSmartContractで作られており、下記の記述を読むとOpenZeppelinのupgradableなコントラクトによって作られているとのことで、
おそらくこのあたりのコードによって作られているのではないかと推測します。

Rarible exchange smart contracts are built using OpenZeppelin's upgradeable smart contracts library. So the smart contract code can be updated to support new features, fix bugs, etc.Smart contracts are heavily tested, tests are provided in the test folder.Functionality is divided into parts (each responsible for the part of the algorithm).Essentially, ExchangeV2 is a smart contract for the decentralized exchan

もう一つの特徴は、RaribleのRoyalitiesの設定に関する規格です。

コントラクト上に配置されており、
https://github.com/rariblecom/protocol-contracts/blob/57043e3f9e93223ef9d65dae351d3c55b34e5bf1/tokens/contracts/erc-721/ERC721Lazy.sol#L12

都度、そのアイテムのロイヤリティを参照することが可能となっています。
NFTのマーケットにおいて、セカンダリマーケットプレイスでのロイヤリティについては非常に議論になることが多いのではないかと思いますが、RaribleのRoyalitiesSchemaは非常に参考になると思います。

raribleのコントラクトは下記にまとめられています。
https://docs.rarible.com/contract-addresses

mintの手順

基本的にwebコンソールに従って、商品を登録するだけ。
画像や動画などがコンテンツと選べるようです。

スクリーンショット 2021-06-28 17.30.36.png

スクリーンショット 2021-06-28 17.31.28.png

api連携

(事例)

Ownerアドレスが保有しているアイテムを全て取得
https://api-reference.rarible.com/#operation/getItemsByOwner
>curl --location --request GET 'https://api.rarible.com/protocol/v0.1/ethereum/nft/items/byOwner?owner=(wallet address)'
{"total":7,"items":[]}

特定のアイテムの情報を取得
>curl --location --request GET 'https://api.rarible.com/protocol/v0.1/ethereum/nft/items/0xd07dc4262bcdbf85190c01c996b4c06a461d2430:625409'
{"id":"0xd07dc4262bcdbf85190...".....}

特定のアイテムのメタデータを取得する

>curl --location --request GET 'https://api.rarible.com/protocol/v0.1/ethereum/nft/items/0xd07dc4262bcdbf85190c01c996b4c06a461d2430:625409/meta'
{"name":"Axe","description":"It is an item that...","attributes":[],"image":{"url":{"ORIGINAL":"ipfs://ipfs/..../image.png",...}

api更新(flow,tezosが追加)

Base URL Network
Rarible Protocol
https://api.rarible.org/v0.1/doc
Ethereum
https://ethereum-api.rarible.org/v0.1/doc
Flow
https://flow-api.rarible.com/v0.1/doc
Tezos
https://tezos-api.rarible.org

(例)Rarible
curl --location --request GET 'https://flow-api.rarible.com/v0.1/items/A.01ab36aaf654a13e.RaribleNFT:3224'

curl --location --request GET 'flow-api.rarible.com/v0.1/items/meta/A.01ab36aaf654a13e.RaribleNFT:3224'

curl --location --request GET 'https://flow-api.rarible.com/v0.1/items/byAccount?address={address}&size=5'

Walletとの連携

RaribleProtocol

参考

https://docs.rarible.com/
https://www.npmjs.com/package/rarible-sdk
https://api-reference.rarible.com/#operation/getItemsByOwner

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?