NFT 101
From an easy technical perspective
(work in progress)
Disclaimer
There are a lot details that I don’t know :)
Table of contents
1) Non-Fungible Token
2) Smart contract
3) Blockchain basic
4) Watch face as NFT: thoughts
Executive summary
Hire/train an Etherum developer for contract development and deployment
App team will learn Etherum client API to talk to Etherum network
Note: Etherum network now fully supports NFTs
NFT
A token: a 256-bits (64 bytes) integer associated with metadata
A blockchain based network (e.g. Ethereum) provides infrastructure to:
- Generate the token (from the metadata) and its initial owner, store the token
in the network (i.e. mint the token)
- Where to store token's meta data? On-chain vs Off-chain solution
- Change ownership of the token
- Verify ownership of the token
- Retrieve the URI of the meta data associated with the token (offline)
Etherum smart contract ?
Smart contract is similar to “cloud application” - code that will be executed
when there is a “message" sent to it
EVM : Etherum virtual machine powered by gas ( ~ $$$ )
High-level language: Solidity
NFT standards
interface ERC721 {
function ownerOf(uint256 _tokenId) external view returns (address);
function transferFrom(address _from, address _to, uint256 _tokenId) external
payable;
interface ERC1155 {
function balanceOf(address _owner, uint256 _id) external view returns
(address);
function transferFrom(address _from, address _to, uint256 _id, uint256
quantity) external payable;
}
Blockchain basic
Central trusted organization
Central data center
Central database
Account
ID: 123456
Name: Prasanna
Balance: 10,000,001
Blockchain basic
- NO identity Everything is public and
- NO real balance decentralized
- NO central trusted organization
- NO central database
- NO central data center
There is really no “GOD” here
HOW EVEN IS IT POSSIBLE?
Before Satoshi Nakamoto published
his/her/their(!) paper in May 2009,
nobody on Earth actually believes this is
possible
http://bitcoin.org/bitcoin.pdf
Blockchain basic
Account balance is just the result of all transactions
From: Prasanna - To: Wife - Amount: 5.02
From: _ - To: Prasanna - Amount : 12 << Money generating transaction /
“deposit”
From: Prasanna - To: _ - Amount : 2 << Withdraw transaction ( not
applicable here )
So, we only need to store transactions, not balance
Blockchain basic
Transactions are grouped into block(s) that are linked together
The global, shared database of transactions is called blockchain
Blockchain is public and almost linear (hence “chain")
Mining nodes are servers that are responsible to verify and add blocks into the
blockchain.
Editing, deleting are not allowed. Just add. Fork is possible
Node that can successfully add a block to blockchain is rewarded with one
“deposit” transaction.
Blockchain basic
Unconfirmed
transactions
01 Bitcoin
generating
transaction Genesis block
Mining nodes
Unminded block Blockchain
Blockchain basic
Verifying and adding transactions are really piece of
cake by today’s computing standard
Mining nodes can create almost unlimited number of
transactions out of thin air without any backing value.
Proof of work - key invention!!!
In order for a block (created by a node) to be
accepted by all other nodes. That block miner has to
provide a proof-of-work
Find a Nonce - so that, for example:
SHA256(SHA256(block + Nonce)) < T
The less T is, the harder it is to find Nonce
Proof of work
266 Number of grains of sand on the earth.
276 Number of stars in the visible universe.
296 Number of atoms in a cubic meter of water.
2190 Number of atoms in the Sun
All “people” in the known Universe have machines that are 1000 times more
powerful than Google, running non-stop for 37 billions years to have a chance
of 1/4 billionth to crack a full SHA256
Proof of work
0 2256
T
SHA256(block + Nonce) < T
The easiest target ( 32 zero bits ) Difficulty level = 1
0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Proof of work
Proof of work
Proof of work creates the backing value for the generated block : hardware +
energy cost
Transaction reward creates the incentive for people to build servers to power
the system
All nodes mine blocks at the same time, NO way to guarantee which node is
the one who is going to finish first. Just like lottery
Regulation
Difficulty level is adjusted after 2016 blocks to maintain ~10-mins block
creation rate
Block reward is down by half after 210,000 blocks created. Max 64 times. Now
is the second time ( 50 > 25 > 12.5 ). Est end : 2020
Max 21,000,000 Bitcoins will be created
Transaction has fee - after all BTC are mined, miners will live by transaction
fee
Double spending protection
Simple rule: Miners only work at the longest chain ( greatest effort to build )
Double spending protection
Binh to Teo: 2 BTC A normal user has zero chance to cheat the system
Teo to Ti : 2 BTC
Teo to Chanh : 2 BTC
Cancelled
Chanh is actually Teo :)
Double spending protection
Binh to Teo: 2 BTC What if Teo is also a miner ?
Teo to Ti : 2 BTC He has to control at least 51% of computing power
of the whole system
Teo to Chanh : 2BTC
Mined by Teo
But Ti already sent Teo
Cancelled something tada!!
Merkle tree
Watch faces as NFT
- How a watch face verifies its true owner?
- Phoenix: WF Id => NFT
- Phoenix account AND Etherum address association (?)
- Public WF store
- Conform to certain NFT standard so that WF can be displayed on-chain