Color NFT
A simple ERC721 non-fungible token (NFT).
References
ERC721
Standard: https://eips.ethereum.org/EIPS/eip-721
Implementation library: https://github.com/OpenZeppelin/openzeppelin-contracts
IPFS
Image files and metadata files are stored on IPFS.
Go repo: https://github.com/ipfs/go-ipfs
Usage as a library example: https://github.com/ipfs/go-ipfs/tree/master/docs/examples/go-ipfs-as-a-library
Go Etherem
Go Ethereum Book: https://goethereumbook.org/en/
Go Ethereum native bindings: https://geth.ethereum.org/docs/dapp/native-bindings
Console: https://geth.ethereum.org/docs/rpc/server
Guide
Development
-
Start development Ethereum node.
geth --dev console --http --http.port 3334 --allow-insecure-unlock
-
Setup account on the node. See Managing Accounts for details.
-
Compile the contract.
go run ./compile
-
Deploy the contract.
go run ./deploy
-
Create tokens using the main package.
go run main.go
-
Query the contract.
go build -o interact.exe ./interact # this one takes a while to compile so `go run` is not recommended
./interact.exe -t 1
Managing Accounts
Use the account
package to create a new Ethereum account, this will print the address and private key for the account. An existing account may be used instead.
To set up the account in development mode:
geth --dev console --http --http.port 3334 --allow-insecure-unlock
And follow the account/dev-setup.js
script.
Deployment
Create an account with geth
:
geth account new
Fund the account at: https://faucet.ropsten.be or https://faucet.dimensions.network
Run local node:
geth --ropsten --http --http.port 3334
Run deploy script (deploy/deploy.go
).