Connection Options
There are four main technologies to consider to connect to the Cosmos Hub:- Full Nodes: Interact with the blockchain.
- REST Server: Serves for HTTP calls.
- REST API: Use available endpoints for the REST Server.
- GRPC: Connect to the Cosmos Hub using gRPC.
Running a Full Node
What is a Full Node?
A Full Node is a network node that syncs up with the state of the blockchain. It provides blockchain data to others by using RESTful APIs, a replica of the database by exposing data with interfaces. A Full Node keeps in syncs with the rest of the blockchain nodes and stores the state on disk. If the full node does not have the queried block on disk the full node can go find the blockchain where the queried data lives.Installation and Configuration
This section describes the steps to run and interact with a full node for the Cosmos Hub. First, you need to install the software. Consider running your own Cosmos Hub Full Node.Command-Line Interface
The command-line interface (CLI) is the most powerful tool to access the Cosmos Hub and use gaia. To use the CLI, you must install the latest version ofgaia on your machine.
Compare your version with the latest release version
Available Commands
All available CLI commands are shown when you run thegaiad command:
--help flag to get further information.
Remote Access to gaiad
When choosing to remote access a Full Node and gaiad, you need a Full Node running and gaia installed on your local machine.gaiad is the tool that enables you to interact with the node that runs on the Cosmos Hub network, whether you run it yourself or not.
To set up gaiad on a local machine and connect to an existing full node, use the following command:
tcp://localhost:26657 as the address.
Finally, set the chain-id of the blockchain you want to interact with:
Create a Key Pair
The default key issecp256k1 elliptic curve. Use the gaiad keys command to list the keys and generate a new key.
NAME: Name of your keyTYPE: Type of your key, alwayslocal.ADDRESS: Your address. Used to receive funds.PUBKEY: Your public key. Useful for validators.MNEMONIC: 24-word phrase. Save this mnemonic somewhere safe. This phrase is required to recover your private key in case you forget the password. The mnemonic is displayed at the end of the output.
--recover flag to add a key that imports a mnemonic to your keyring.
Check your Account
You can view your account by using thequery account command.
Check your Balance
Query the account balance with the command:balances and pagination.
Each balances entry contains an amount held, connected to a denom identifier.
The typical $ATOM token is identified by the denom uatom. Where 1 uatom is 0.000001 ATOM.
balances entry is shown as an empty array.
Send Coins Using the CLI
To send coins using the CLI:<from_key_or_address>: Key name or address of sending account.<to_address>: Address of the recipient.<amount>: This parameter accepts the format<value|coinName>, such as1000000uatom.
--chain-id: This flag allows you to specify the id of the chain. There are different ids for different testnet chains and mainnet chains.--gas-prices: This flag allows you to specify the gas prices you pay for the transaction. The format is used as0.0025uatom
REST API
The REST API documents list all the available endpoints that you can use to interact with your full node. Learn how to enable the REST API on your full node.Listen for Incoming Transactions
The recommended way to listen for incoming transactions is to periodically query the blockchain by using the following HTTP endpoint:/cosmos/bank/v1beta1/balances/{address}