To help with the FireFly evaluation, especially how it makes digital assets management easy by supporting token standards (ERC20, ERC721, ERC1155, and other standard contracts or your custom implementations via extensions) with REST APIs and event streams, we have a minimal tutorial that you can set up locally on your laptop. Please give it a try and let us know if you have any questions.
initialize the FireFly stack using Ethereum as the underlying blockchain, and load the ERC20/ERC721 token connector:
1
$ ff init -t erc20_erc721
start the stack named “digital-assets”
1
$ ff start digital-assets
deploy the token contract. the easiest way is using Truffle. The Hyperledger implementation of the token connector has sample ERC20 and ERC721 contracts you can use to deploy to Ethereum:
Deploying 'Migrations' \---------------------- ⠋ Blocks: 0 Seconds: 0 > transaction hash: 0xb81c60fd920bf28775bd8610271c60a40380e278af97ccd18458efafe852dc99 \> Blocks: 0 Seconds: 0 \> contract address: 0x0C2c9222835692912b3999D6DAE955a9d306393d \> block number: 6 \> block timestamp: 1648585628 \> account: 0x1eAecAb9D796Ee765865f47a78De13735619c914 \> balance: 904625697166532776746648320380374280103671755200316906558.262375061821325312 \> gas used: 272788 (0x42994) \> gas price: 0 gwei \> value sent: 0 ETH \> total cost: 0 ETH
\> Saving migration to chain. \> Saving artifacts \------------------------------------- \> Total cost: 0 ETH
2_deploy_contracts.js
Deploying 'ERC20WithData' \------------------------- ⠋ Blocks: 0 Seconds: 0 > transaction hash: 0x748a60953ceacda47431210752c2a9991f77b552d19397827500feef086fc3cf \> Blocks: 0 Seconds: 0 \> contract address: **0xB6728020f998f32afb4936f9CEcE04B1d3951895** \> block number: 8 \> block timestamp: 1648585628 \> account: 0x1eAecAb9D796Ee765865f47a78De13735619c914 \> balance: 904625697166532776746648320380374280103671755200316906558.262375061821325312 \> gas used: 1948804 (0x1dbc84) \> gas price: 0 gwei \> value sent: 0 ETH \> total cost: 0 ETH
\> Saving migration to chain. \> Saving artifacts \------------------------------------- \> Total cost: 0 ETH
Summary
> Total deployments: 2 > Final cost: 0 ETH
teach FireFly about the token contract so that it can start tracking transactions on the contract. For this step you can use the Swagger UI that comes with FireFly. Open http://localhost:5000/api, and expand the request entry POST /namespaces/{ns}/tokens/pools. Plugin the values as shown below (you can delete all the other optional properties in the payload):
Now you can start using FireFly APIs to manage the new token contract: mint/transfer/burn.
You can use the following JSON RPC command to create additional Ethereum addresses in the go-ethereum node’s built-in wallet:
Try the minting API using the POST /namespaces/{ns}/tokens/mint endpoint:
check the result of the minting transaction in the FireFly UI at http://localhost:5000/ui (for org0) and http//localhost:5001/ui (for org1):
That’s it! Now you have a local setup to explore the many features of FireFly.
connect with metamask as below. by the way, the para when you add a network for firefly , please refer the info at ~/.firefly/stacks/oh/blockchain/genesis.json, here you can cat genesis block info.