- Docs
- Developers
- Archway daemon
Archwayd CLI
The Archwayd CLI is a tool that empowers you to interact seamlessly with the Archway protocol. Leveraging the archwayd core daemon, it allows you to execute a wide array of operations, from sending transactions to querying the blockchain's state and beyond.
The Archwayd CLI is not strictly limited to those running their own nodes. You can engage with the network even without hosting a node personally. You can utilize the Archwayd CLI to submit transactions or probe the network's state via RPC. This opens up opportunities for a variety of users to interact with the Archway blockchain network, making it a versatile tool for a range of operations.
Please note that even if you can use the Archwayd CLI to store, instantiate and manage contracts, it is recommended to use the Developer CLI for these purposes, as it provides a smoother developer experience.
Info
Since the release of Archway CLI v2, archwayd is no longer a dependency for the Developer CLI.
Installation
You can download the latest release of the pre-built binary from the releases page.
For Linux, and depending on your architecture:
amd64
arm64
wget https://github.com/archway-network/archway/releases/download/v4.0.2/archwayd_linux_amd64
You can now verify the download by generating the sha256 hash for the downloaded file:
amd64
arm64
sha256sum archwayd_linux_amd64
Using the sha256sum should give you a string (i.e. 04fac46745579a7e8b22fc3b1f83dcf5c1aa2b03e303823eb54d2328e7c1fa05).
You can then download the sha256 checksum file relative to the release file:
wget archwaysha256.txt https://github.com/archway-network/archway/releases/download/v4.0.2/archwayd_v4.0.2_checksums.txt
and you can compare that the sha256 hash strings match, By doing so, you are ensuring that the downloaded file matches the actual release file.
Scope
=======
The full scope of archwayd commands can be viewed using the command archwayd --help:
archwayd --help# Outputs:Archway Daemon (server)Usage: archwayd [command]Available Commands: add-genesis-account Add a genesis account to genesis.json add-wasm-genesis-message Wasm genesis subcommands collect-gentxs Collect genesis txs and output a genesis.json file config Create or query an application CLI configuration file debug Tool for helping with debugging your application ensure-binary ensures the binary is correctly built export Export state to JSON gentx Generate a genesis tx carrying a self delegation help Help about any command init Initialize private validator, p2p, genesis, and application configuration files keys Manage your application's keys query Querying subcommands rollback rollback cosmos-sdk and tendermint state by one height start Run the full node status Query remote node for status tendermint Tendermint subcommands tx Transactions subcommands validate-genesis validates the genesis file at the default location or at the location passed as an arg version Print the application binary version informationFlags: -h, --help help for archwayd --home string directory for config and data (default "/Users/adrianthompson/.archway") --log_format string The logging format (json|plain) (default "plain") --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info") --trace print out full stack trace on errorsUse "archwayd [command] --help" for more information about a command.
Archwayd for Developers
If you require functionality not available in the Developer CLI, you may need to rely on archwayd to complete your task. Below are some examples of common queries and commands that can help guide you.
Query account balance
For querying an account balance, use the bank module:
mainnet
testnet
archwayd query bank balances <account-address> --node "https://rpc.mainnet.archway.io:443" --chain-id archway-1
Deploy a contract
Transactions use the tx module. Ideally, deployments will include three transactions:
- Storing the wasm on-chain
- Instantiating the stored wasm
- Setting the contract metadata.
Upload and store the wasm on-chain:
mainnet
testnet
archwayd tx wasm store path_to_wasm/my_wasm_file.wasm --gas auto --gas-prices $(archwayd q rewards estimate-fees 1 --node 'https://rpc.mainnet.archway.io:443' --output json | jq -r '.gas_unit_price | (.amount + .denom)') --gas-adjustment 1.4 --from <wallet-label> --chain-id archway-1 --node https://rpc.mainnet.archway.io:443 --broadcast-mode sync --output json -y
by replacing <wallet-label> with your own value.
The response from storing wasm will give you the Code ID required for instantiating the contract.
Then instantiate it:
mainnet
testnet
archwayd tx wasm instantiate <code.id> '{"entrypoint":"value"}' --from <wallet-label> --label "A human readable label for this deployment" --gas auto --gas-prices $(archwayd q rewards estimate-fees 1 --node 'https://rpc.mainnet.archway.io:443' --output json | jq -r '.gas_unit_price | (.amount + .denom)') --gas-adjustment 1.4 --chain-id archway-1 --node https://rpc.mainnet.archway.io:443 --broadcast-mode sync --output json -y
by replacing <code-id>, {"entrypoint":"value"}, <wallet-label> and "A human readable label for this deployment with your own values.
The response from instantiating the contract will give you the Contract Address required for setting metadata on the contract instance.
Setting metadata on the contract instance:
mainnet
testnet
archwayd tx gastracker set-contract-metadata <contract-address> '{ "owner_address": <admin-address>, "reward_address": <rewards-receiver-address>, "collect_premium": false, "premium_percentage_charged": 0, "gas_rebate_to_user": false }' --gas auto --gas-prices $(archwayd q rewards estimate-fees 1 --node 'https://rpc.mainnet.archway.io:443' --output json | jq -r '.gas_unit_price | (.amount + .denom)') --gas-adjustment 1.4 --from <wallet-label> --chain-id archway-1 --node https://rpc.mainnet.archway.io:443 --broadcast-mode sync --output json -y
by replacing <contract-address>, <wallet-label>, and <admin-address>, <rewards-receiver-address> and the other JSON values with your own values.
Transaction filtering
Searching transactions with custom filters is a powerful feature. To do this we use the tx module with the --events filter. See below for common filtered queries that are helpful.
View all transactions to a specific contract:
Use filter key wasm._contract_address
Example:
mainnet
testnet
archwayd query txs --events 'wasm._contract_address=<contract-address>' --node "https://rpc.mainnet.archway.io:443" --chain-id archway-1
by replacing <contract-address> with your own value.
View all contracts deployed by a specific developer:
User filter keys message.sender and message.action
Example:
mainnet
testnet
archwayd query txs --events 'message.sender=<developer-wallet-address>&message.action=/cosmwasm.wasm.v1.MsgInstantiateContract' --node https://rpc.mainnet.archway.io:443 --chain-id archway-1
by replacing <developer-wallet-address> with your own value.
Code IDs and contract metadata:
Contract data and metadata queries use the wasm query module.
Find the Code ID of a specific contract:
mainnet
testnet
archwayd query wasm contract <contract-address> --node https://rpc.mainnet.archway.io:443 --chain-id archway-1
by replacing <contract-address> with your own value.
Check if a contract's code was ever updated:
by replacing <contract-address> with your own value.
mainnet
testnet
archwayd query wasm contract-history <contract-address> --node https://rpc.mainnet.archway.io:443 --chain-id archway-1
Find the contract address of a specific Code ID:
by replacing <code-id> with your own value.
mainnet
testnet
archwayd query wasm list-contract-by-code <code-id> --node https://rpc.mainnet.archway.io:443 --chain-id archway-1