Interacting with Chain through Agence Command (acmd)

We have provided the acmd command line tool to help users interact with the network. Make you have already executed the installation script.

cd ~/.agence/bin

# ws://localhost:9944 will be used if the node rpc parameter is ommitted 
~/.agence/bin/acmd wss://ws.takecopter.cloud.agence.network
Connected to: wss://ws.takecopter.cloud.agence.network
 chain: Takecopter Testnet
 client: Agence Node 0.10.0-a46d67a-x86_64-linux-gnu
 token: [HME]
 token decimals: [18]
 ss58 prefix: 887
agence>

From now on, you can use acmd to query data using an interactive javascript terminal.

You can press tab to show all the possible matches to an api.query:

agence> await api.query. #TAB
api.query.__defineGetter__          api.query.__defineSetter__          api.query.__lookupGetter__          api.query.__lookupSetter__          api.query.__proto__
api.query.constructor               api.query.hasOwnProperty            api.query.isPrototypeOf             api.query.propertyIsEnumerable      api.query.toLocaleString
api.query.toString                  api.query.valueOf

api.query.assets                    api.query.auctions                  api.query.authorship                api.query.babe                      api.query.balances
api.query.council                   api.query.elections                 api.query.forges                    api.query.grandpa                   api.query.imOnline
api.query.indices                   api.query.offences                  api.query.randomnessCollectiveFlip  api.query.recovery                  api.query.session
api.query.staking                   api.query.substrate                 api.query.sudo                      api.query.system                    api.query.timestamp
api.query.transactionPayment        api.query.treasury

Creating an Account

If you want to sign and submit extrinsic to change the state of the chain, you need to create your own account first.

Agence account consists of a public and private key pair, as well as an address which are generated from a group of mnemonic seed phrase.

To get a new phrase, run the commands below in other terminal window:

cd ~/.agence/bin

# ${WORD_COUNT} is 12 by default
./acu key generate ${WORD_COUNT}

It will show following output, please backup and save your secret phrase:

Secret phrase `electric kit dream idea comic trigger simple vanish seek group blade angle` is account:
  Secret seed:      0x7d5a460e2dc8c7cc4921f5f68dd3c7c0ca774c81084c31389cdb3ffbfcaf8238
  Public key (hex): 0x3e681d4d0c49cd928226d95c6f0422ebbb0273fe69cb3a95fc2c50f1b4977117
  Account ID:       0x3e681d4d0c49cd928226d95c6f0422ebbb0273fe69cb3a95fc2c50f1b4977117
  SS58 Address:     SUA2p2buoGnsRe2HVoF9EyP39zwL9Bfacq3nKanYVtdEo5Xb

To insert your newly created keypair into acmd, run the following command, where secret_phrase is the phrase you haved created on last step:

agence> const keypair = this.keyring.addFromUri(secret_phrase, {})

To show your account address in SS58 format, just run:

agence> keypair.address