Non-Fungible Tokens, or NFTs in short, have recently gained significant popularity due to the rising trend in the blockchain gaming space. Ever since their inception, NFTs became really popular among the crypto community, thanks to successful projects like Cryptokitties and CryptoPunks, etc.
Cryptokitties is one of the most hyped NFT projects within the DeFi and blockchain gaming space. CryptoKitties are digital, collectible cats built on the Ethereum blockchain, and they can be bought and sold using Ethereum, and bred to create new cats with several traits and varying characteristics.
CryptoKitties is basically a digital pet community centred around collecting, training, raising, and battling fantasy creatures that are known as ‘CryptoEnter’. Each CryptoEnter has unique genetic data stored on Opera.
A CryptoEnter can possess two different genes with different body parts. This smart contract serves as an example, and can be a good starting point for anyone who is looking to build NFT based products on the Enter blockchain platform.
Prerequisite
To Run these examples please follow the following steps:
You can either import the mnemonic into metamask or at least the first account (you should have the private key) into Metamask.
Then deploy our contract by running this command:
$trufflemigrate--networktestrpc--reset
You should get this output:
Compilingyourcontracts...===========================✔Fetchingsolcversionlistfromsolc-bin.Attempt#1> Everything is up to date, there is nothing to compile.Startingmigrations...======================> Network name: 'testrpc'> Network id: 1337> Block gas limit: 6721975 (0x6691b7)1_initial_migration.js======================Replacing'Migrations'---------------------->transactionhash:0x28099872c6feeceab4033e63e9a3c48e73f315e2c61feef4a5bf7ac947c3329e>Blocks:0Seconds:0>contractaddress:0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab>blocknumber:1>blocktimestamp:1608736619>account:0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1>balance:99.99665588>gasused:167206 (0x28d26)>gasprice:20gwei>valuesent:0ETH>totalcost:0.00334412ETH>Savingmigrationtochain.>Savingartifacts------------------------------------->Totalcost:0.00334412ETH2_deploy_contracts.js=====================Replacing'CryptoEnter'------------------------>transactionhash:0x8a3dd0bc5d57a8f6dcba777ded4b0a2038fe6f8c7c6684e8546cd49a40220a9d>Blocks:0Seconds:0>contractaddress:0xCfEB869F69431e42cdB54A4F4f105C19C080A601>blocknumber:3>blocktimestamp:1608736619>account:0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1>balance:99.9661064>gasused:1485231 (0x16a9af)>gasprice:20gwei>valuesent:0ETH>totalcost:0.02970462ETH>Savingmigrationtochain.>Savingartifacts------------------------------------->Totalcost:0.02970462ETHSummary=======> Total deployments: 2> Final cost: 0.03304874 ETH
You may encounter some problems with the current version of Metamask which does not detect the correct nonce, you can switch from network to Mainnet and then back to Local that solves most of the issues until a correction is made.