hyperledger / iroha-2-docs

https://hyperledger.github.io/iroha-2-docs/
Apache License 2.0
6 stars 26 forks source link

Bash guide: provide an example for iroha_client_cli with a JSON flag #339

Open 6r1d opened 1 year ago

6r1d commented 1 year ago

How does iroha_client_cli json flag behave?

Is it iroha_client_cli json file.json or does it use a pipeline like cat file.json | iroha_client_cli json?

Requested in the community today by Harini Ravikumar.

6r1d commented 1 year ago

According to @astrokov7, the initial issue related to this task is https://github.com/hyperledger/iroha/issues/3274

pesterev commented 1 year ago

You should use a pipeline-like way:

cat file.json | ./iroha_client_cli json

For example, to register an account, file.json should contain the following instruction:

[
  {
    "Register": {
      "Identifiable": {
        "NewAccount": {
          "id": "bob123@wonderland",
          "signatories": [
            "ed01208260645dbbf5de1e2db4d7fd7d174b9a90298cb7ec425bf1728b943032727591"
          ],
          "metadata": {}
        }
      }
    }
  }
]

If you're using the LTS version, you can try kagami examples to generate some instructions. For example, to generate an instruction that registers an account, use the following:

kagami examples create-account --account-id 'some_name_here@wonderland'`

To get more information about options, use the following:

kagami examples help
appetrosyan commented 1 year ago

Consider creating a separate JSON-only guide