DeFi on Bitcoin Part 2: NFT and Marketplace

0

This post was first published on Average. Read DeFi on Bitcoin Part 1: Fungible Tokens and Token Exchange and DeFi on Bitcoin Part 3: Uniswap.

In part 2 of the series, we illustrate how to build non-fungible tokens (NFTs) and sell them directly on Bitcoin.

Non-fungible tokens

In a basic configuration, an NFT contract is simply a two-column table: an ID, uniquely representing a non-fungible asset, and its rightful owner.


NFT table

The following contract implements such a basic NFT contract, similar to ERC721 token standard in Ethereum.

ERC721 contract

It is very similar to fungible token contract we have developed. The most notable difference is the token table in line 6, mapping ID to its owner, instead of owner to token balance.

Sell ​​NFTs

Let’s sell NFTs in exchange for bitcoins. It looks like swap fungible tokens. Instead, we to exchange an NFT for bitcoins.

In the following example, Alice signs only if the payment amount matches her price requirement, in the second output of tx2. Bob only signs if he becomes the new owner of NFT with identifier 1, in the first release of tx2. Again, the sale is non-custodial and atomic.

NFT Sales Chart
NFT Sale

Extensions

There are several ways to extend the sale. We list some examples:

  • sell NFT in exchange for other tokens: the second release of tx2 must contain the payment to Alice in tokens (fungible or not), and not in bitcoins, which is financed by another tx1.
  • platform fee: a third exit can be added to tx2 who pays the market a fee, say, 3% of the amount of the second production.

Watch: CoinGeek New York Panel, Licensing IP for NFTs: Graphic Novels, Comics and Trademarks

New to Bitcoin? Discover CoinGeek bitcoin for beginners section, the ultimate resource guide to learn about bitcoin – as originally envisioned by Satoshi Nakamoto – and blockchain.

Share.

Comments are closed.