Discover Packages
github.com/thanhn-inc/debugtool
module
Version:
v0.0.0-...-6729ccb
Opens a new window with list of versions in this module.
Published: Mar 5, 2021
License: MIT
Opens a new window with license information.
README
README
¶
This repo is a command-line tool that provides basic functionalities for interacting with the Incognito blockchain. Developers with deep knowledge of the Incognito network are warmly welcomed to modify the source code to favor their needs.
Usage
cd main
go get -v
go run *.go
Functions
port
Description: switch the port of the current environment
How to use: port PORT_NUMBER
Examples: port 9334
inittestnet
Description: init the param to the testnet environment
How to use: inittestnet
initmainnet
Description: init the param to the mainnet environment
How to use: initmainnet
initdevnet
Description: init the param to the devnet environment
How to use: inittestnet [PORT_NUMBER]
PORT_NUMBER (optional): the port number , default is 8334
Examples:
initdevnet
initdevnet 3334
initlocal
Description: init the param to the local node
How to use: initlocal [PORT_NUMBER]
PORT_NUMBER (optional): the port number , default is 9334
Examples:
outcoin
Description: get the list of PRV output coins (TXOs) for a given user
How to use: outcoin PRIVATE_KEY [BEACON_HEIGHT]
PRIVATE_KEY: the private key of the user (index or full string)
BEACON_HEIGHT (optional): the beacon height at which you want to retrieve the output coins, default is 0
Examples:
outcoin 0
outcoin 0 1000
outcoin 112t8rnZDRztVgPjbYQiXS7mJgaTzn66NvHD7Vus2SrhSAY611AzADsPFzKjKQCKWTgbkgYrCPo9atvSMoCf9KT23Sc7Js9RKhzbNJkxpJU6
outcoin 112t8rnZDRztVgPjbYQiXS7mJgaTzn66NvHD7Vus2SrhSAY611AzADsPFzKjKQCKWTgbkgYrCPo9atvSMoCf9KT23Sc7Js9RKhzbNJkxpJU6 1000
uot
Description: get the list of unspent output coin (UTXOs) of a given user
How to use: uot PRIVATE_KEY [TOKEN_ID]
PRIVATE_KEY: the private key of the user (index or full string)
TOKEN_ID (optional): the tokenID of the needed coins, default is PRV
Examples:
uot 0
uot 0 ffd8d42dc40a8d166ea4848baf8b5f6e912ad79875f4373070b59392b1756c8f
uot 112t8rnZDRztVgPjbYQiXS7mJgaTzn66NvHD7Vus2SrhSAY611AzADsPFzKjKQCKWTgbkgYrCPo9atvSMoCf9KT23Sc7Js9RKhzbNJkxpJU6
uot 112t8rnZDRztVgPjbYQiXS7mJgaTzn66NvHD7Vus2SrhSAY611AzADsPFzKjKQCKWTgbkgYrCPo9atvSMoCf9KT23Sc7Js9RKhzbNJkxpJU6 ETH
balance
Description: get the balance of a given user
How to use: balance PRIVATE_KEY [TOKEN_ID]
PRIVATE_KEY: the private key of the user (index or full string)
TOKEN_ID (optional): the id of the needed coins, default is PRV
Examples:
balance 0
balance 0 ffd8d42dc40a8d166ea4848baf8b5f6e912ad79875f4373070b59392b1756c8f
balance 112t8rnZDRztVgPjbYQiXS7mJgaTzn66NvHD7Vus2SrhSAY611AzADsPFzKjKQCKWTgbkgYrCPo9atvSMoCf9KT23Sc7Js9RKhzbNJkxpJU6
balance 112t8rnZDRztVgPjbYQiXS7mJgaTzn66NvHD7Vus2SrhSAY611AzADsPFzKjKQCKWTgbkgYrCPo9atvSMoCf9KT23Sc7Js9RKhzbNJkxpJU6 ETH
transfer
Description: perform a PRV transferring transaction
How to use: transfer PRIVATE_KEY ADDRESS AMOUNT [TX_VERSION]
PRIVATE_KEY: the private key of the user (index or full string)
ADDRESS: the receiver address
AMOUNT: the transacted amount (unit: nano)
TX_VERSION (optional): the version of the transaction (1
or 2
), the default value is -1
(try either of the version if possible)
Examples:
transfer 0 1 1000000
transfer 0 1 1000000 1
transfer 112t8rnZDRztVgPjbYQiXS7mJgaTzn66NvHD7Vus2SrhSAY611AzADsPFzKjKQCKWTgbkgYrCPo9atvSMoCf9KT23Sc7Js9RKhzbNJkxpJU6 12S5Lrs1XeQLbqN4ySyKtjAjd2d7sBP2tjFijzmp6avrrkQCNFMpkXm3FPzj2Wcu2ZNqJEmh9JriVuRErVwhuQnLmWSaggobEWsBEci 1000000
transfertoken
Description: perform a token transferring transaction
How to use: transfertoken PRIVATE_KEY ADDRESS TOKEN_ID AMOUNT [TX_VERSION]
PRIVATE_KEY: the private key of the user (index or full string)
ADDRESS: the receiver address
TOKEN_ID: the id of the transacted asset
AMOUNT: the transacted amount (unit: nano)
TX_VERSION (optional): the version of the transaction (1
or 2
), the default value is -1
(try either of the version if possible)
Examples:
transfertoken 0 1 ETH 1000000
transfertoken 0 1 ffd8d42dc40a8d166ea4848baf8b5f6e912ad79875f4373070b59392b1756c8f 1000000 1
transfertoken 112t8rnZDRztVgPjbYQiXS7mJgaTzn66NvHD7Vus2SrhSAY611AzADsPFzKjKQCKWTgbkgYrCPo9atvSMoCf9KT23Sc7Js9RKhzbNJkxpJU6 12S5Lrs1XeQLbqN4ySyKtjAjd2d7sBP2tjFijzmp6avrrkQCNFMpkXm3FPzj2Wcu2ZNqJEmh9JriVuRErVwhuQnLmWSaggobEWsBEci ffd8d42dc40a8d166ea4848baf8b5f6e912ad79875f4373070b59392b1756c8f 1000000
outtoken
Description: get the list of output tokens for a given user
How to use: outtoken PRIVATE_KEY TOKEN_ID [BEACON_HEIGHT]
PRIVATE_KEY: the private key of the user (index or full string)
TOKEN_ID: the id of the needed coins
BEACON_HEIGHT (optional): the beacon height at which you want to retrieve the output coins, default is 0
Examples:
outtoken 0 ETH
outtoken 0 ETH 1000
outtoken 112t8rnZDRztVgPjbYQiXS7mJgaTzn66NvHD7Vus2SrhSAY611AzADsPFzKjKQCKWTgbkgYrCPo9atvSMoCf9KT23Sc7Js9RKhzbNJkxpJU6 ETH
outtoken 112t8rnZDRztVgPjbYQiXS7mJgaTzn66NvHD7Vus2SrhSAY611AzADsPFzKjKQCKWTgbkgYrCPo9atvSMoCf9KT23Sc7Js9RKhzbNJkxpJU6 ETH 1000
convert
Description: convert all UTXOs version 1 to a UTXO version 2
How to use: convert PRIVATE_KEY [TOKEN_ID]
PRIVATE_KEY: the private key of the user (index or full string)
TOKEN_ID (optional): the id of the transacted asset, default is PRV
Examples:
convert 0
convert 0 ETH
convert 112t8rnZDRztVgPjbYQiXS7mJgaTzn66NvHD7Vus2SrhSAY611AzADsPFzKjKQCKWTgbkgYrCPo9atvSMoCf9KT23Sc7Js9RKhzbNJkxpJU6 ffd8d42dc40a8d166ea4848baf8b5f6e912ad79875f4373070b59392b1756c8f
pdetradeprv
Description: perform a PRV trading transaction
How to use: pdetradeprv PRIVATE_KEY TOKEN_TO_BUY AMOUNT
PRIVATE_KEY: the private key of the user (index or full string)
TOKEN_TO_BUY: the id of the token being traded to
AMOUNT: the PRV selling amount
Examples:
pdetradeprv 0 ETH 100000000000
pdetradeprv 0 ffd8d42dc40a8d166ea4848baf8b5f6e912ad79875f4373070b59392b1756c8f 100000000000
pdetradeprv 112t8rnZDRztVgPjbYQiXS7mJgaTzn66NvHD7Vus2SrhSAY611AzADsPFzKjKQCKWTgbkgYrCPo9atvSMoCf9KT23Sc7Js9RKhzbNJkxpJU6 ffd8d42dc40a8d166ea4848baf8b5f6e912ad79875f4373070b59392b1756c8f 100000000000
pdetradetoken
Description: perform a token trading transaction
How to use: pdetradetoken PRIVATE_KEY TOKEN_TO_SELL TOKEN_TO_BUY AMOUNT
PRIVATE_KEY: the private key of the user (index or full string)
TOKEN_TO_SELL: the id of the token being traded from
TOKEN_TO_BUY: the id of the token being traded to
AMOUNT: the selling amount
Examples:
pdetradeprv 0 ETH PRV 100000000000
pdetradeprv 0 ETH USDT 100000000000
pdecontribute
Description: contribute PRV or tokens to the current pDEX
How to use: pdecontribute PRIVATE_KEY AMOUNT [TOKEN_ID]
PRIVATE_KEY: the private key of the user (index or full string)
AMOUNT: the contributed amount
TOKEN_ID (optional): the id of the transacted asset, default is PRV
Examples:
pdecontribute 0 100000000000
pdecontribute 0 100000000000 ETH
pdewithdraw
Description: contribute PRV or tokens to the current pDEX
How to use: pdewithdraw PRIVATE_KEY TOKEN_ID1 TOKEN_ID2 SHARED_AMOUNT
PRIVATE_KEY: the private key of the user (index or full string)
TOKEN_ID1: the id of the first asset (any order is acceptable)
TOKEN_ID2: the id of the second asset (any order is acceptable)
SHARED_AMOUNT: the shared amount in need of withdrawing
Examples:
pdewithdraw 0 PRV ETH 100000
pdewithdraw 0 ETH PRV 100000
pdestate
Description: get the pDEX state of the blockchain
How to use: pdestate [BEACON_HEIGHT]
BEACON_HEIGHT: the beacon height at which you want to retrieve the pDEX state, default is the latest beacon height
Examples:
poolpairs
Description: get all the pool pairs on the pDEX
How to use: poolpairs [BEACON_HEIGHT]
BEACON_HEIGHT: the beacon height at which you want to retrieve pool pairs, default is the latest beacon height
Examples:
poolpairs
poolpairs 10000
pool
Description: get the detail of a pool on the pDEX
How to use: pool TOKEN_ID1 TOKEN_ID2 [BEACON_HEIGHT]
TOKEN_ID1: the id of the first asset (any order is acceptable)
TOKEN_ID2: the id of the second asset (any order is acceptable)
BEACON_HEIGHT: the beacon height at which you want to retrieve the pool detail, default is the latest beacon height
Examples:
pool PRV ETH
poll PRV ETH 10000
checkprice
Description: check the current trading value
How to use: checkprice TOKEN_TO_SELL TOKEN_TO_BUY AMOUNT
TOKEN_TO_SELL: the id of the token being traded from
TOKEN_TO_BUY: the id of the token being traded to
AMOUNT: the selling amount, notice that different amounts result in different trading rates since the pDEX is using UniSwap
Examples:
checkprice PRV ETH 100000
checkprice ETH BTC 100000
tradestatus
Description: check the status of a given trade transaction
How to use: tradestatus TX_HASH
TX_HASH: the transaction id
Examples:
tradestatus 80e96c92032505a12b20fe7b15b9bf379bac903dbbc2ef4063f84d38b7f4cfc1
staking
Description: perform a staking transaction
How to use: staking PRIVATE_KEY [IS_AUTO_RESTAKING]
PRIVATE_KEY: the private key of the user (index or full string)
IS_AUTO_RESTAKING (optional): indicate whether you want to automatically re-stake after swapped, default is true
Examples:
staking 0
staking 0 false
unstaking
Description: perform an un-staking transaction
How to use: unstaking PRIVATE_KEY [ADDR]
PRIVATE_KEY: the private key of the user (index or full string)
ADDR (optional): the committee candidate payment address supplied when staking, default is the address associated with the PRIVATE_KEY
Examples:
unstaking 0
unstaking 0 12S5Lrs1XeQLbqN4ySyKtjAjd2d7sBP2tjFijzmp6avrrkQCNFMpkXm3FPzj2Wcu2ZNqJEmh9JriVuRErVwhuQnLmWSaggobEWsBEci
reward
Description: withdraw the reward of a given user
How to use: reward PRIVATE_KEY [ADDR]
PRIVATE_KEY: the private key of the user (index or full string)
ADDR (optional): the reward-receiving payment address supplied when staking, default is the address associated with the PRIVATE_KEY
Examples:
reward 0
reward 0 12S5Lrs1XeQLbqN4ySyKtjAjd2d7sBP2tjFijzmp6avrrkQCNFMpkXm3FPzj2Wcu2ZNqJEmh9JriVuRErVwhuQnLmWSaggobEWsBEci
listreward
Description: list the detail of the current reward on the blockchain
How to use: listreward
info
Description: get the current info of the blockchain
How to use: info
beaconstate
Description: get the current beacon state detail of the blockchain
How to use: beaconstate
shardstate
Description: get the current shard state detail of the blockchain
How to use: shardstate SHARD_ID
SHARD_ID: the shard id number
Examples:
shardstate 0
shardstate 1
bestblock
Description: get the latest blocks (beacon + shard blocks) of the blockchain
How to use: bestblock
mempool
Description: get the current mempool info of the blockchain node
How to use: mempool
txhash
Description: get the detail of a transaction
How to use: txhash TX_HASH
TX_HASH: the transaction id
Examples:
txhash 80e96c92032505a12b20fe7b15b9bf379bac903dbbc2ef4063f84d38b7f4cfc1
listtoken
Description: list all tokens currently present in the blockchain environment
How to use: listtoken
payment
Description: get the payment address from the private key
How to use: payment PRIVATE_KEY
PRIVATE_KEY: the private key of the user (index or full string)
Examples:
payment 0
payment 112t8rnZDRztVgPjbYQiXS7mJgaTzn66NvHD7Vus2SrhSAY611AzADsPFzKjKQCKWTgbkgYrCPo9atvSMoCf9KT23Sc7Js9RKhzbNJkxpJU6
public
Description: get the public key from the private key
How to use: public PRIVATE_KEY
PRIVATE_KEY: the private key of the user (index or full string)
Examples:
public 0
public 112t8rnZDRztVgPjbYQiXS7mJgaTzn66NvHD7Vus2SrhSAY611AzADsPFzKjKQCKWTgbkgYrCPo9atvSMoCf9KT23Sc7Js9RKhzbNJkxpJU6
ota
Description: get the privateOTA key from the private key
How to use: ota PRIVATE_KEY
PRIVATE_KEY: the private key of the user (index or full string)
Examples:
ota 0
ota 112t8rnZDRztVgPjbYQiXS7mJgaTzn66NvHD7Vus2SrhSAY611AzADsPFzKjKQCKWTgbkgYrCPo9atvSMoCf9KT23Sc7Js9RKhzbNJkxpJU6
sub
Description: submit the privateOTA key for full-node indexing
How to use: sub PRIVATE_KEY
PRIVATE_KEY: the private key of the user (index or full string)
Examples:
sub 0
sub 112t8rnZDRztVgPjbYQiXS7mJgaTzn66NvHD7Vus2SrhSAY611AzADsPFzKjKQCKWTgbkgYrCPo9atvSMoCf9KT23Sc7Js9RKhzbNJkxpJU6
cmkey
Description: generate a committee key from a private key
How to use: cmkey PRIVATE_KEY
PRIVATE_KEY: the private key of the user (index or full string)
Examples:
cmkey 0
cmkey 112t8rnZDRztVgPjbYQiXS7mJgaTzn66NvHD7Vus2SrhSAY611AzADsPFzKjKQCKWTgbkgYrCPo9atvSMoCf9KT23Sc7Js9RKhzbNJkxpJU6
Notes
To use the old payment address, change the variable b58Version
in the function Base58CheckSerialize
to 0
.
Expand ▾
Collapse ▴
Directories
¶
transaction
Click to show internal directories.
Click to hide internal directories.