Skip to main content

The Power CLI

Introduction​

The tp CLI utility will help you to:

  • generate keys (secp256k1 and ed25519);
  • register your IP address;
  • form the transactions from a JSON-formatted template;
  • signing (including signing using multiple keys).

Prerequisites​

You need to have Erlang version 24 installed on your machine, and escript interpreter should be included into paths.

Installation​

To install tp CLI:

  1. Download the tool.

    caution

    Please, ensure that you have the latest version of the tool.

  2. Move the file to /usr/local/bin:

    mv /usr/local/bin
  3. Change the file execution mode:

    chmod a+x

Utility description and usage​

The tp CLI utility consists of two parts:

  • generic: this part of utility will help you work with keys and transactions;
  • storage: this part of utility will help you work with smart contracts.

Usage examples​

  1. For example, you can use the following command to form, sign, and view a transaction:

    tp -k mykey.key --construct tx1.json --sign --showtx
  2. If you need to sign and send a transaction, specify an address for a node you intend to work with:

    tp -h https://node.address.com:00000/  -k mykey.key --construct tx1.json --ss
  3. --example key now generates three following examples:

    • example_deploy.json — deployment of a smart contract;
    • example_generic.json — generic transaction;
    • example_evmcall.json — evm call example.

Generic part commands​

CommandDescription
-h, --hostTpnode's base address, use httpsi as a protocol for ssl without certificate verification [default: http://127.0.0.1:49841]
--hexkeyKeyfile. You can specifiy a key in HEX format (as it is stored in the keyfile) in the command line
-k, --keyfilePath to a key file
--ed25519Use ed25519 for keys generation. ed25519 MUST be used as a node key format. For wallet keys you can also use the old secp256k1 key. Note: generate the old-formatted keys for wallets, if you want to use this address for the WEB-wallet at the moment. Our WEB-services will support ed25519 keys for wallets in future releases
--genkeyGenerate a key. The generated kay will be saved into tpcli.key or another file specified with -k key
--exportkeyExport a key into PEM
--exportpwPassword for export
--exportwifExport a key to wif (Only for secp256k1 keys to use them in other services)
--importwifImport a key from wif
--pingPing a node
--get_settingsGet chain settings from a node
--get_ledgerGet ledger state for specified address
--get_codeGet ledger's contract code for an address
--registerRun address registration on a chain. The address will be saved to a file
--exampleSave transaction examples to the files in this directory
--constructConstruct a tx (transaction) from JSON <filename>
--evmcallCall EVM contract function, take arguments from <filename>. The call is made locally on the deployed contract with the address and the state specified. There is no actions being performed in blockchain during this operation
--abiContract's ABI for result decoding. It means that this command interprets the result of EVM call using the ABI-file
--callrespSave evmcall result to <filename> (add .hex extension to save the file in HEX format, .b64 to save the file in Base64. If there is no extension specified, it will be saved in raw binary)
--saveSave a constructed or loaded tx to <filename> in binary format
--loadLoad a prepaired tx from <filename> in binary format
--gaspriceCalculate gas price. It shows the tokens, you can buy it for, as well as the gas price in those tokens
--estimateEstimate fee and gas. The command executes the contract locally
--showtxDisplay a tx
--signSign a transaction
--submitSend a transaction to the node
--ssSign and submit by one command

Storage part commands​

CommandDescription
-h, --hostTpnode's base address, use httpsi as a protocol for ssl without certificate verification [default: http://127.0.0.1:49841]
--hexkeyKeyfile. You can specifiy a key in HEX format (as it is stored in the keyfile) in the command line
-k, --keyfilePath to a key file
--mkmanifestMake manifest.json for a specified directory
--newstoragetaskCreate a new storage task <bucket name> (specify a contract name to work with)
--manifestSpecify another manifest filename [default: manifest.json]
--intervalStore interval for a newstoragetask [default: 1 year]. The following intervals are supported:
- year (365 days);
- mon (30 days);
- week (7 days);
- day;
- hour;
- min;
- sec.
You can group several intervals into one, for example: 1 year 3 mon 2 week 3 min
--transferTransfer amount and currency for a newstoragetask, for example: 10 SK
--gasSpecify gas manually
--get_taskGet task info for a task by <task id>
--newproviderCreate new storage provider with <baseurl> or <baseurl,uploadurl> as arguments
--showtxDisplay a tx
--signSign a transaction
--submitSend a transaction to the node
--ssSign and submit by one command
<address>Storage contract address