Incognito Command Line Tool

Hey guys,
I want to share instructions to build and use the Incognito command line

PART 1: BUILD
A. Build on Windows:

  1. Download and install golang
  2. Download and extract MinGW64 to use gcc library
  3. Add MinGW64 binary to Windows-PATH
  4. Check out repo incognito-cli, branch development
  5. In windows CMD, go to the source code folder, execute build command
go install
go build -o incognito-cli.exe
  1. Test
PS C:\Users\khanhj\Documents\repo\incognito-cli> .\incognito-cli.exe help
NAME:
   incognito-cli - A simple CLI application for the Incognito network

USAGE:
   incognito-cli.exe [global options] command [command options] [arguments...]

VERSION:
   v0.0.3
...

B. Build on Ubuntu or MACOS:

Summary
  1. Install golang
  2. Clone repo incognito-cli, checkout branch development
  3. Build
go install
go build -o incognito-cli

see more here

PART2: Common command usage

  1. Get keyinfo (payment address, validator key, shard, etc.)
PS C:\Users\khanhj\Documents\repo\incognito-cli> .\incognito-cli.exe keyinfo -p 112t8rnZL9Hy44ZYHKCsDoJG653WtFuDio9KyEwLXHXJFkdqrB8r3GtEk6HtD1F8Yn3SzYJKDN6iwgtrAx5famxiX5Ge69mUA6p5XXXXXXXX
{
        "PrivateKey": "112t8rnZL9Hy44ZYHKCsDoJG653WtFuDio9KyEwLXHXJFkdqrB8r3GtEk6HtD1F8Yn3SzYJKDN6iwgtrAx5famxiX5Ge69mUA6p5XXXXXXXX",
        "PublicKey": "12QUvLVZd38wzgewHY1MzoCQykPFXkxTgrU2WsmhAh7X7mDVP5s",
        "PaymentAddress": "12srjVu18N1rvbavme9wQ2vXVce2UU9UUb6NoU6PN85pBik8HeGqUcS62h6i63vNNS6SypKxesvMf3WNqHmxAbHdcxsrUQkaUr8Sd7X65fbhHHct4zZejVwFWovpbYwWNZUFoN29GGXcEo5iAcq2",
        "ReadOnlyKey": "13hdvwYm2TDMTJK5oHHm6JD3GSKM1AiCSnvqwqzyNKb3jpHnrFXPArxSGbr1mCBzF17ZeS5iCbzQBdJjvdQw89X4P6MR6sCXXXXXXXX",
        "OTAPrivateKey": "14yFX6vfnFHkU1yZRMU7vzByCAMYDBhiZ18fCpfZTGiHfCEC9Mwd9ESt9zbibZVGBMBehR6YdSaTpkQiJVHSFYBwpP3V5SUXXXXXXXX",
        "MiningKey": "12JDFmH5AWQpsj4K9uJ2dJ1fM77Zn9QrJBhZyXQL6iSXXXXXXXX",
        "MiningPublicKey": "121VhftSAygpEJZ6i9jGkQptqeU41BRTXYM8eixG17RYEnuMt4SuRPX4pMhLRfxzZ4iiD3oS4E3DFrAkASwJGwf7jvGSFW4PdbfiKqz6e1LAJeVhntBvXfUH3pFm5fBxTM4E8YJTaTYcX55bxUXFrnR2vKLvEHtPrafs33zzie17eUTYUhucFXPQteNX9gKPdzR9nx4LMVGtD7ynSQX4j5DZmeb7wqiq5NqWo3Eq8F845pxCyid7MDM26LYRmdK8rs9Ci2yg8RDyxQz3PWR5kwQhgqKVd1kFdF2qAhk4YQj4XdJGjSGj9ALhQ23daixup5sEJSqp38NxBwMv7BMwup6rJWXrcmxRMH6HzEMLH6fE3LpKmLg1Cqc5WJZN7S87yxb4yiQRFKBnwjFt5hDKHpddAeJz6731p61uokaPXXXXXXXX",
        "ShardID": 0
}
  1. Get balance all
khanhlh-incognito:incognito-cli khanhlh$ ./incli -c 1 -d 1 account balanceall -p 112t8rnYspTnwYBNVTR6f3rU7xsbJJvwSu5ekNFYVZwTLa3dLUupJDX6Grjwq6ieW3vT86DTyU4dukRX9M5qB4KSRtywrfa5ejEqXXXXXXXX

2022/01/06 11:49:21 GetAllAssetTags FINISHED: 0.673953162
{
	"0000000000000000000000000000000000000000000000000000000000000004": 28845928368,
	"0dfc519d73c1664858ac27111258e0e287f0f6fa900a1ff9d4bb4ad1443092f5": 2640197417,
	"1ff2da446abfebea3ba30385e2ca99b0f0bbeda5c6371f4c23c939672b429a42": 2894467,
	"2a6ba49aed10ec37c042d0c0dd26ad83575c5e7ae93c7327766f532e03d8f2ac": 8988089,
	"2f62b0a8a96bd226769b0594049b08206945291108b809ef4033211952361e44": 15250000000,
	"3cc6388b16298bca139232ed78073d43fb717059084c3595c41a992632628726": 1,
	"716fd1009e2a1669caacc36891e707bfdf02590f96ebd897548e8963c95ebac0": 15098790,
	"b2655152784e8639fa19521a7035f331eea1f1e911b2f3200a507ebb4554387b": 7557371,
	"b832e5d3b1f01a4f0623f7fe91d6673461e1f5d37d91fe78c5c2e6183ff39696": 1220260,
	"be02b225bcd26eeae00d3a51e554ac0adcdcc09de77ad03202904666d427a7e4": 7450026498,
	"c01e7dc1d1aba995c19b257412340b057f8ad1482ccb6a9bb0adce61afbf05d4": 19000000,
	"e5032c083f0da67ca141331b6005e4a3740c50218f151a5e829e9d03227e33e2": 259140261,
	"ffd8d42dc40a8d166ea4848baf8b5f6e912ad79875f4373070b59392b1756c8f": 1186262
}
  1. Send 1 USDT to another address (NOTE: USDT USDC DAI have decimal 6)
./incli -c 1 -d 1 send -p 112t8rnYspTnwYBNVTR6f3rU7xsbJJvwSu5ekNFYVZwTLa3dLUupJDX6Grjwq6ieW3vT86DTyU4dukRX9M5qB4KSRtywrfa5ejEqXXXXXXXXX --address 12srjVu18N1rvbavme9wQ2vXVce2UU9UUb6NoU6PN85pBik8HeGqUcS62h6i63vNNS6SypKxesvMf3WNqHmxAbHdcxsrUQkaUr8Sd7X65fbhHHct4zZejVwFWovpbYwWNZUFoN29GGXcEo5iAcq2 --amount 1000000 --tokenID 716fd1009e2a1669caacc36891e707bfdf02590f96ebd897548e8963c95ebac0

2022/01/06 12:53:56 Found 0 v1 output coins
Success!! TxHash 29440a99d292c1dc92e6590f9b794b06005fe6a5aafe489495b0c4197126f46d
  1. More command here

Feel free to comment below if you have any questions.

10 Likes

I’m still not getting the Validator Public Key that’s in the App. MiningPublicKey is something totally different.

1 Like

We’re working on it and it will be able on the next release. This release is mainly for pDEX v2 Liquidity Provider who wishes to withdraw their contribution because this function is not supported on the app anymore.

Please wait a little more.

3 Likes

Ah cool, I saw an update and pulled it. Saw a new dev/pdex-v3 branch, should we stay in development? What’s main for? :relaxed:

1 Like

Development is for pdex v2. dev/pdex-v3 will be merged to main soon, with a few more functions.

2 Likes

@fredlee the dev/pdex-v3 is safe to use with all of its function (balance, send, shield, stake, trade)

3 Likes

Hi all,

We have just pushed out a release for this purpose: https://github.com/incognitochain/incognito-cli/releases/tag/pdex-v2

Thanks.

4 Likes

development branch fully supports pDEX v3 and thus doesn’t support pDEX v2 anymore. Notice that the commands now are grouped together and some old commands will not work anymore.

If you want to use pDEX v2 commands, check out this tag.

1 Like

1st post updated

The latest version is https://github.com/incognitochain/incognito-cli/tree/v2.0.0-alpha

1 Like

Hello Incognito CLI tool users,

There are a few useful tips that you might not know yet (for those who already knew, just ignore these)

  • If you’ve created transactions with your current CLI executable binary but they kept being rejected by the blockchain then it could be because your CLI is on the old version, please update to the latest one at v2.0.0-alpha.

  • You could switch to another fullnode by specifying the --host fullnode-domain to your running commands, the CLI is pointing to a community fullnode by default. This is helpful when you operate your own fullnode and want to point the CLI to it.

  • Putting --cache 1 to your running commands to cache your account’s coins in your local machine instead of fullnode. Thereby, it doesn’t matter whether the fullnode supports coin indexing for submitted keys or not, you would always be able to use whatever fullnode you like and don’t need to stick with the one to which you earlier submitted the key.

Thanks.

4 Likes