Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Getting Started" Docs to repo #39

Open
dechdev opened this issue Mar 31, 2022 · 1 comment
Open

Add "Getting Started" Docs to repo #39

dechdev opened this issue Mar 31, 2022 · 1 comment
Assignees
Milestone

Comments

@dechdev
Copy link
Contributor

dechdev commented Mar 31, 2022

No description provided.

@dechdev dechdev added this to the v1.0.0 milestone Mar 31, 2022
@jimthematrix
Copy link
Contributor

jimthematrix commented Mar 31, 2022

  1. install the latest FireFly CLI:
$ go install github.com/hyperledger/firefly-cli/ff@latest
  1. initialize the FireFly stack using Ethereum as the underlying blockchain, and load the ERC20/ERC721 token connector:
$ ff init -t erc20_erc721
  1. start the stack named "digital-assets"
$ ff start digital-assets
  1. 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 [email protected]:hyperledger/firefly-tokens-erc20-erc721.git
$ cd firefly-tokens-erc20-erc721
$ cd solidity
$ npm install
$ truffle migrate
  1. copy the contract address for the deployed ERC20 token contract (highlighted below in the sample output), to use in the next step
Starting migrations...
======================
> Network name:    'development'
> Network id:      2021
> Block gas limit: 4722986 (0x48112a)


1_initial_migration.js
======================

   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
  1. 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):

image

  1. Now you can start using FireFly APIs to manage the new token contract: mint/transfer/burn.

  2. 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_newAccount","params":["passw0rd"]}' http://localhost:5100 | jq
{
  "jsonrpc": "2.0",
  "id": "1",
  "result": "0xfd5d5d96879a700c693da5092e2a6ef5ed399684"
}

$ 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
}
  1. Try the minting API using the POST /namespaces/{ns}/tokens/mint endpoint:

image

  1. 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):

image

  1. Connect metamask (to be continued)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants