$ go install github.com/hyperledger/firefly-cli/ff@latest
initialize the FireFly stack using Ethereum as the underlying blockchain, and load the ERC20/ERC721 token connector:
$ ff init -t erc20_erc721
start the stack named "digital-assets"
$ 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:
$ git clone git@github.com:hyperledger/firefly-tokens-erc20-erc721.git
$ cd firefly-tokens-erc20-erc721
$ cd solidity
$ npm install
$ truffle migrate
copy the contract address for the deployed ERC20 token contract (highlighted below in the sample output), to use in the next step
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:
10. Try the minting API using the POST /namespaces/{ns}/tokens/mint endpoint:
![image](https://user-images.githubusercontent.com/5289853/161083896-f68a8c9d-aede-4580-b35f-228e82dafd2a.png)
11. check the result of the minting transaction in the FireFly UI at [http://localhost:5000/ui](http://localhost:5000/ui) (for org0) and [http//localhost:5001/ui](http//localhost:5001/ui) (for org1):
![image](https://user-images.githubusercontent.com/5289853/161084052-051fa144-9b56-4f14-bdea-43802398b031.png)
12. Connect metamask (to be continued)
install the latest FireFly CLI:
initialize the FireFly stack using Ethereum as the underlying blockchain, and load the ERC20/ERC721 token connector:
start the stack named "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:
copy the contract address for the deployed ERC20 token contract (highlighted below in the sample output), to use in the next step
1_initial_migration.js
Deploying 'Migrations'
⠋ Blocks: 0 Seconds: 0 > transaction hash: 0xb81c60fd920bf28775bd8610271c60a40380e278af97ccd18458efafe852dc99
2_deploy_contracts.js
Deploying 'ERC20WithData'
⠋ Blocks: 0 Seconds: 0 > transaction hash: 0x748a60953ceacda47431210752c2a9991f77b552d19397827500feef086fc3cf
Summary
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:
$ curl -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":"1","method":"personal_unlockAccount","params":["0xfd5d5d96879a700c693da5092e2a6ef5ed399684","passw0rd",0]}' http://localhost:5100 |jq { "jsonrpc": "2.0", "id": "1", "result": true }