Pocket Core offers a Command Line Interface (CLI) that you will need to manage your node's wallet, stake tokens, start your Pocket Node, and other services to help maintain your Node. You can begin using the Pocket Core CLI after you have downloaded and configured it on your computer (or server) by either downloading the Binary or Docker file to configure your environment.
On a Mac or Linux, to install Pocket-Core using Homebrew just run the following commands in your terminal:
$ brew tap pokt-network/pocket-core $ brew install pokt-network/pocket-core/pocket # (Optional) # Once installed, refresh your terminal screen to incorporate the installation
And that's it! To see a quick example on how to interact with the CLI, click here.
Before we download the binary, you'll need to install the cleveldb dependency:
# For linux: $ apt-get update && apt-get install -y libleveldb-dev build-essential # For mac OSX $ brew install leveldb
Open up your shell(or terminal) and download the Pocket Core repo from GitHub in the destination directory of your choosing.
# using git clone: $ git clone https://github.com/pokt-network/pocket-core.git # using curl: $ curl -LJO https://github.com/pokt-network/pocket-core.git # using wget: $ wget --no-check-certificate --content-disposition https://github.com/pokt-network/pocket-core
After the repo has been downloaded, go into the pocket-core folder and swap the latest release candidate:
$ git checkout tags/RC-0.5.1
After you have swapped to the latest release candidate, build your binary and add it to your PATH down below.
# First make sure you have $GOPATH setup echo $GOPATH # Example output on MacOS /Users/<your username>/go # Inside the pocket-core folder, build your pocket binary and put it in the $GOPATH/bin directory go build -tags cleveldb -o $GOPATH/bin/pocket ./app/cmd/pocket_core/main.go
Last, we're going to navigate to our
$HOME directory and run:
mkdir -p .pocket/config && cd .pocket/config; curl -O https://raw.githubusercontent.com/pokt-network/pocket-network-genesis/master/testnet/genesis.json
Your CLI is now built and ready to go!
To test your installation, we are going to check our CLI version. In the terminal, enter:
$ Pocket Version # returns RC-0.5.1
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.
Every application needs an account in order to send relays to its desired blockchain through the network. To create or import an account, enter:
$ pocket accounts create (Enter Password) # return Account generated successfully: Address: 190E...
$ pocket accounts import-raw <private key>
Whether you've created or imported an account, it will prompt you to enter a passphrase that will be used to locally encrypt your private key and generate a success message(see below):
Account generated successfully: Address: 45D50DB64E90C0109C778DAAB7EF36676FC03866
Account imported successfully: 45d50db64e90c0109c778daab7ef36676fc03866
You can view your accounts that you have created or imported using the list command:
$ pocket accounts list # example return (0) 45D50DB64E90C0109C778DAAB7EF36676FC03866
If you are using the Application Authorization Token SDK to connect your Application(dApp) to the Pocket blockchain, you will need to export your accounts private key so you can sign your relays. To export your private key, enter:
$ pocket accounts export-raw 45D50DB64E90C0109C778DAAB7EF36676FC03866 (enter password) #return Exported Raw Private Key: a91974c6a20839f52...e92729052998e85bd8b
Funding your wallet is different for Testnet and mainnet:
To fund your wallet, you're going to use the faucet to send test POKT tokens to your validator account. While your node is running, open a new terminal window and do the following:
pocket accounts get-validator
- Copy your validator address and paste it in your validator address below. and click Get Testnet POKT
It is recommended to wait 15 minutes before you go to the next step to ensure the staking transaction goes through and propagates throughout the network.
Before you can purchase POKT, visit the Pocket Dashboard and follow the instructions on how to register your account.
Stake your application on the Pocket blockchain by entering:
# Staking Command $ pocket apps stake <fromAddr> <amount> <chains> --remoteCLIURL https://<Node URL> # example command w/ dummy values connecting to multiple blockchains pocket nodes stake 45D50DB64E90C0109C778DAAB7EF36676FC03866 50000000 0020,0021,0022,0023,0031,0032 --remoteCLIURL <testnet or mainnet>
To query your application account, start by entering in the
pocket query app commands and provide the application address and the
--remoteCLIURL flag using one of the Testnet dispatchers address for testnet or the Mainnet Dispatcher and Seed List ]
Updated 29 days ago