Using The CLI for Developers

Pocket offers developers a simple Command Line Interface that will help get you started in setting up a wallet as well as obtaining network resources for your DApp by staking Pocket tokens.

Prerequisites:

Before you get started, you must first download and install:

Creating an Account:

After you have installed Pocket Core CLI on your machine, are going to initiate the CLI and create an application account by entering in:

$  pocket accounts create
(Enter Password) 

# return 
Account generated successfully:
Address: 190E...


Note: After you hit enter, it will prompt you to enter a passphrase. The passphrase can be whatever you like and the passphrase will be used to encrypt your generated key pair.

Once your account has been created, you can view it, along with other pre-generated accounts by entering:

$  pocket accounts list

# example return
(0) 190E...


#example output#

(0) 1B9FF29...B2E
(1) 3023332...281
(2) 41750FF...662

Exporting An Account

If you are using the Application Authorization Token SDK to connect your Application(dApp) to then network, you will need to export your accounts private key so you can sign for a relay. To export your private key, enter:

$ pocket accounts export-raw 48a8...

(enter password)

#return 

Exported Raw Private Key:
4682...

Funding The Wallet:

To fund the wallet, go to the Pocket Faucet and copy your application address into the address field and click Get Testnet POKT:

POKT Faucet

POKT Faucet

Staking POKT for your Application:

Now that we have the wallet funded, we need to register the application account on the Pocket Network by staking it on the pocket network.

$ pocket apps stake <fromAddr> <amount in uPokt> <chains> --node http://<Node URL>:26657

# example line:
pocket apps stake acf123 10000000 abcd --node http://node3.testnet.pokt.network:26657

# Example Return:
Transaction Submitted: 95B64...




Query an Account:

To query your application account, start by entering in the pocket query app commands and provide the application address and the --node flag using one of the dispatchers' address, and change the port to 26657.

$ pocket query app <address> --node="<protocol>://<host>:<port>"

#example 
$ pocket query app abdde123 --node="http://node1.testnet.pokt.network:26657"

# output 
Address:		abdde123...
Public Key:		abcd1234...
Jailed:			false
Chains:			[8cf7f8799c5b30d36c86d18f0f4ca041cf1803e0414ed9e9fd3a19ba2f0938ff]
MaxRelays:		100000000
Status:			Staked
Tokens:			100000000
Unstaking Time:	1970-01-01 00:00:00 +0000 UTC

Updated 25 days ago



Using The CLI for Developers


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.