DeFi on Bitcoin Part 2: NFT and Marketplace

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

Non-Fungible Tokens

In a basic setup, an NFT contract is simply a table with two columns: 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 the fungible token contract we have developed. The most notable difference is the token table at Line 6, mapping ID to its owner, instead of owner to token balance.

Sell NFT

Let us sell some NFTs in exchange for bitcoins. This is akin to swapping fungible tokens. Instead, we swap an NFT for bitcoins.

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

NFT Sale

Extensions

There are a variety of ways to extend the sale. We list a few examples:

  • sell NFT in exchange for other tokens: the second output of tx2 should contain the payment to Alice in tokens (fungible or not), not bitcoins, which is funded by a different tx1.
  • platform fee: a third output can be added to tx2 that pays the marketplace a fee, say, 3% of the amount of the second output.

--

--

--

sCrypt Inc (https://scrypt.io) is a company with a mission to provide integrated on-chain smart contracting solutions using the original BitCoin Protocol on BSV

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

ANKR — ONX AMA HIGHLIGHTS

How StaFi Protocol Is Delivering The Best User Experience In Staking Solutions

[XT] Daily Blockchain Newsfeed, Thursday, October 29th

ProBit Exchange Lists Neuromorphic.io (NMP)

CoinDCX- A review of India’s Best Crypto Exchange

The Engineering and Philosophy Behind Small Blocks. Part 1 of ?.

It’s going to be Messi …

Thought of the Day #10/2021 It’s going to be Messi … Crypto is becoming mainstream, and here is why.

Categories of Cryptocurrencies and their uses.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
sCrypt

sCrypt

sCrypt Inc (https://scrypt.io) is a company with a mission to provide integrated on-chain smart contracting solutions using the original BitCoin Protocol on BSV

More from Medium

Choosing the right chain: additional functions, future development, and other factors

How the Tinyman Exploit can Strengthen Algorand

Filecoin News 14: Gitcoin GR9 Hackathon, Chainlink Hackathon, NFT Hackathon, and More

Crypto price thankful for the Fed