-
Notifications
You must be signed in to change notification settings - Fork 729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates Service Provider Guide #826
Changes from 4 commits
cc9e477
a82c035
018860f
3c7e1b1
55aa44d
8f9c581
76ab39d
3e603b2
2f940bf
8f9e634
5904635
cd39eb9
9bc239a
53a9bfd
81b203d
7c7080c
417fc70
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,7 +4,6 @@ order: 3 | |||||
|
||||||
# Join the Cosmos Hub Mainnet | ||||||
|
||||||
|
||||||
## Quickstart | ||||||
|
||||||
**Get Ready** | ||||||
|
@@ -36,7 +35,6 @@ Note: If your node is unable to connect to any of the seeds listed here, you ca | |||||
|
||||||
If you'd like to save those seeds to your settings put them in ~/.gaia/config/config.toml in the p2p section under seeds in the same comma-separated list format. | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
|
||||||
## Setting Up a New Node | ||||||
|
||||||
**You need to [install gaia](./installation.md) before you go further** | ||||||
|
@@ -72,7 +70,7 @@ You can edit the `~/.gaia/config/app.toml` file in order to enable the anti spam | |||||
# transaction. A transaction's fees must meet the minimum of any denomination | ||||||
# specified in this config (e.g. 10uatom). | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
minimum-gas-prices = "" | ||||||
minimum-gas-prices = "0.025uatom" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest matching what's written as the example's text, e.g., is "10uatom" written as "10utom"? Is 0.025uatom the official recommendation? If there's an official standard, perhaps a link could be helpful. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it's actually in the same document a few lines below End of chapter There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Speaking about this, we could consider making this default into the bootstrapped |
||||||
``` | ||||||
|
||||||
Your full node has been initialized! | ||||||
|
@@ -132,13 +130,16 @@ The initial recommended `min-gas-prices` is `0.025uatom`, but you might want to | |||||
|
||||||
## Pruning of State | ||||||
|
||||||
There are three strategies for pruning state, please be aware that this is only for state and not for block storage: | ||||||
There are four strategies for pruning state, please be aware that this is only for state and not for block storage. | ||||||
Pruning can be set by either adjusting the `pruning` parameter in the `~/.gaia/config/app.toml` file. | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
The following settings are available | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
1. `PruneEverything`: This means that all saved states will be pruned other than the current. | ||||||
2. `PruneNothing`: This means that all state will be saved and nothing will be deleted. | ||||||
3. `PruneSyncable`: This means that only the state of the last 100 and every 10,000th blocks will be saved. | ||||||
1. `everything`: This means that all saved states will be pruned other than the current. | ||||||
2. `nothing`: This means that all state will be saved and nothing will be deleted. | ||||||
3. `default`: This means that only the state of the last 100 and every 10,000th blocks will be saved. | ||||||
4. `custom`: Pruning settings can be specified through `pruning-keep-recent`, `pruning-keep-every`, and `pruning-interval` | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
By default every node is in `PruneSyncable` mode. If you would like to change your nodes pruning strategy then you must do so when the node is initialized. For example, if you would like to change your node to the `PruneEverything` mode then you can pass the `---pruning everything` flag when you call `gaiad start`. | ||||||
By default every node is in `default` mode. If you would like to change your nodes pruning strategy then you must do so when the node is initialized. Passing a flag when starting `gaia` will always override settings in the `app.toml` file, if you would like to change your node to the `everything` mode then you can pass the `---pruning everything` flag when you call `gaiad start`. | ||||||
|
||||||
> Note: When you are pruning state you will not be able to query the heights that are not in your store. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe that it is possible but only by specifying a node target that has a different pruning strategy. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||
|
||||||
|
@@ -158,6 +159,42 @@ gaiad status | |||||
|
||||||
View the status of the network with the [Cosmos Explorer](https://cosmos.network/launch). | ||||||
|
||||||
## Enable the REST API | ||||||
|
||||||
The REST API can be enabled in the `~/.gaia/config/app.toml` file. | ||||||
By default the REST API is disabled, find the API part in the `app.toml` file and set `enable` to `true` | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
```toml | ||||||
############################################################################### | ||||||
### API Configuration ### | ||||||
############################################################################### | ||||||
[api] | ||||||
# Enable defines if the API server should be enabled. | ||||||
enable = true | ||||||
# Swagger defines if swagger documentation should automatically be registered. | ||||||
swagger = false | ||||||
# Address defines the API server to listen on. | ||||||
address = "tcp://0.0.0.0:1317" | ||||||
``` | ||||||
|
||||||
Optionally you can set to activate swagger with setting `swagger` to `true` or change the port of the REST API in the parameter `address`. | ||||||
After restarting your application, you are able to access the REST API on `YOURNODEIP:1317`. | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
## GRPC Configuration | ||||||
|
||||||
GRPC is enabled by default on port `9090`. You can find the gRPC settings in the `~/.gaia/config/app.toml` file in the gRPC section. Set `enable` to `false` in case you want to disabled the gRPC endpoint, you can change the port with changing the `address` parameter. | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
```toml | ||||||
############################################################################### | ||||||
### gRPC Configuration ### | ||||||
############################################################################### | ||||||
[grpc] | ||||||
# Enable defines if the gRPC server should be enabled. | ||||||
enable = true | ||||||
# Address defines the gRPC server address to bind to. | ||||||
address = "0.0.0.0:9090" | ||||||
``` | ||||||
|
||||||
## Export State | ||||||
|
||||||
Gaia can dump the entire application state to a JSON file, which could be useful for manual analysis and can also be used as the genesis file of a new network. | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
@@ -208,8 +245,4 @@ invariant broken: | |||||
``` | ||||||
|
||||||
When submitting a invariant-broken transaction, transaction fee tokens are not | ||||||
deducted as the blockchain will halt (aka. this is a free transaction). | ||||||
|
||||||
## Upgrade to Validator Node | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Full Node setup should be providing the setup how to create a Full Node. |
||||||
|
||||||
You now have an active full node. What's the next step? You can upgrade your full node to become a Cosmos Validator. The top 125 validators have the ability to propose new blocks to the Cosmos Hub. Continue onto [the Validator Setup](../validators/validator-setup.md). | ||||||
deducted as the blockchain will halt (aka. this is a free transaction). | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,49 +4,103 @@ order: 5 | |||||
|
||||||
# Service Providers | ||||||
|
||||||
We define 'service providers' as entities providing services for end-users that involve some form of interaction with a Cosmos-SDK based blockchain (this includes the Cosmos Hub). More specifically, this document will be focused around interactions with tokens. | ||||||
'Service Providers' are defined as entities providing services for end-users that involve some form of interaction with the Cosmos Hub. More specifically, this document will be focused around interactions with tokens. | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
This section does not concern wallet builders that want to provide Light-Client functionalities. Service providers are expected to act as trusted point of contact to the blockchain for their end-users. | ||||||
This section does not concern wallet builders that want to provide Light-Client functionalities. Service Providers are expected to act as trusted point of contact to the blockchain for their end-users. | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
## High-level description of the architecture | ||||||
## Connection Options | ||||||
|
||||||
There are three main pieces to consider: | ||||||
There are four main technologies to consider, connecting to the Cosmos Hub: | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
- Full-nodes: To interact with the blockchain. | ||||||
- Rest Server: This acts as a relayer for HTTP calls. | ||||||
- Rest API: Define available endpoints for the Rest Server. | ||||||
- Full Nodes: To interact with the blockchain. | ||||||
- REST Server: This acts as a relayer for HTTP calls. | ||||||
- REST API: Define available endpoints for the REST Server. | ||||||
- GRPC: Connect to the Cosmos Hub via gRPC. | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
## Running a Full-Node | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
### 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. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am learning! what do we mean by? (is a full node a replica?)
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||
|
||||||
### Installation and configuration | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
We will describe the steps to run and interact with a full-node for the Cosmos Hub. For other SDK-based blockchain, the process should be similar. | ||||||
We will describe the steps to run and interact with a Full Node for the Cosmos Hub. | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
First, you need to [install the software](../gaia-tutorials/installation.md). | ||||||
|
||||||
Then, you can start [running a full-node](../gaia-tutorials/join-mainnet.md). | ||||||
Consider running your own [Cosmos Hub Full Node](../gaia-tutorials/join-mainnet.md). | ||||||
|
||||||
### Command-Line interface | ||||||
## Command-Line interface | ||||||
|
||||||
## Setting Up `gaiad` | ||||||
The Command-Line Interface (CLI) is the most powerful tool to access the Cosmos Hub and use gaia. | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
You need to install the latest version of `gaia` on your machine in order to use the Command-Line Interface. | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
::: tip | ||||||
**Before setting up `gaiad`, make sure you have set up a way to [access the Cosmos Hub network](#accessing-the-cosmos-hub-network)** | ||||||
::: | ||||||
Compare your version with the [latest release version](https://github.com/cosmos/gaia/releases) | ||||||
|
||||||
::: warning | ||||||
**Please check that you are always using the latest stable release of `gaiad`** | ||||||
::: | ||||||
```bash | ||||||
gaiad version --long | ||||||
``` | ||||||
|
||||||
`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. Let us set it up properly. | ||||||
#### Help | ||||||
|
||||||
In order to set up `gaiad`, use the following command: | ||||||
All available CLI commands will be shown if you just execute `gaiad`: | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
```bash | ||||||
gaiad config <flag> <value> | ||||||
gaiad | ||||||
``` | ||||||
|
||||||
```bash | ||||||
Stargate Cosmos Hub App | ||||||
|
||||||
Usage: | ||||||
gaiad [command] | ||||||
|
||||||
Available Commands: | ||||||
|
||||||
|
||||||
add-genesis-account Add a genesis account to genesis.json | ||||||
collect-gentxs Collect genesis txs and output a genesis.json file | ||||||
debug Tool for helping with debugging your application | ||||||
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 | ||||||
migrate Migrate genesis to a specified target version | ||||||
query Querying subcommands | ||||||
start Run the full node | ||||||
status Query remote node for status | ||||||
tendermint Tendermint subcommands | ||||||
testnet Initialize files for a simapp testnet | ||||||
tx Transactions subcommands | ||||||
unsafe-reset-all Resets the blockchain database, removes address book files, and resets data/priv_validator_state.json to the genesis state | ||||||
validate-genesis validates the genesis file at the default location or at the location passed as an arg | ||||||
version Print the application binary version information | ||||||
|
||||||
Flags: | ||||||
-h, --help help for gaiad | ||||||
--home string directory for config and data (default "/Users/tobias/.gaia") | ||||||
--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 errors | ||||||
|
||||||
Use "gaiad [command] --help" for more information about a command. | ||||||
``` | ||||||
|
||||||
It allows you to set a default value for each given flag. | ||||||
For each displayed command, you can use the `--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. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line could be moved earlier. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how far earlier do you have in mind? Beginning of this chapter or even at the start of the whole article? |
||||||
|
||||||
In order to set up `gaiad` on a local machine and connect to an existing Full Node, use the following command: | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
```bash | ||||||
gaiad config <flag> <value> | ||||||
``` | ||||||
|
||||||
First, set up the address of the full-node you want to connect to: | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
|
@@ -56,25 +110,26 @@ gaiad config node <host>:<port | |||||
// example: gaiad config node https://77.87.106.33:26657 | ||||||
``` | ||||||
|
||||||
If you run your own full-node, just use `tcp://localhost:26657` as the address. | ||||||
If you run your own Full Node locally, use `tcp://localhost:26657` as the address. | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
Then, let us set the default value of the `--trust-node` flag: | ||||||
Set the default value of the `--trust-node` flag: | ||||||
|
||||||
```bash | ||||||
gaiad config trust-node false | ||||||
|
||||||
// Set to true if you run a light-client node, false otherwise | ||||||
// Set to true if you run a light-client node | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
``` | ||||||
|
||||||
Finally, let us set the `chain-id` of the blockchain we want to interact with: | ||||||
Finally, set the `chain-id` of the blockchain you want to interact with: | ||||||
|
||||||
```bash | ||||||
gaiad config chain-id cosmoshub-2 | ||||||
gaiad config chain-id cosmoshub-4 | ||||||
``` | ||||||
|
||||||
Next you will find a few useful CLI commands to interact with the Full-Node. | ||||||
Next you will learn useful CLI commands to interact with the Full Node. | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
You can run these commands as remote control or when you are running it on your local machine. | ||||||
|
||||||
#### Creating a key-pair | ||||||
### How to create a key-pair | ||||||
|
||||||
To generate a new key (default secp256k1 elliptic curve): | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
|
@@ -90,13 +145,13 @@ You will be asked to create a password (at least 8 characters) for this key-pair | |||||
- `PUBKEY`: Your public key. Useful for validators. | ||||||
- `MNEMONIC`: 24-words phrase. **Save this mnemonic somewhere safe**. It is used to recover your private key in case you forget the password. | ||||||
|
||||||
You can see all your available keys by typing: | ||||||
You can see all available keys by typing: | ||||||
|
||||||
```bash | ||||||
gaiad keys list | ||||||
``` | ||||||
|
||||||
#### Checking your balance | ||||||
#### Check your balance | ||||||
|
||||||
After receiving tokens to your address, you can view your account's balance by typing: | ||||||
|
||||||
|
@@ -106,13 +161,13 @@ gaiad query account <YOUR_ADDRESS> | |||||
|
||||||
*Note: When you query an account balance with zero tokens, you will get this error: No account with address <YOUR_ADDRESS> was found in the state. This is expected! We're working on improving our error messages.* | ||||||
|
||||||
#### Sending coins via the CLI | ||||||
#### Send coins using the CLI | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
Here is the command to send coins via the CLI: | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
```bash | ||||||
gaiad tx send <from_key_or_address> <to_address> <amount> \ | ||||||
--chain-id=<name_of_testnet_chain> | ||||||
--chain-id=<your_chain_id> | ||||||
``` | ||||||
|
||||||
Parameters: | ||||||
|
@@ -123,48 +178,12 @@ Parameters: | |||||
|
||||||
Flags: | ||||||
|
||||||
- `--chain-id`: This flag allows you to specify the id of the chain. There will be different ids for different testnet chains and main chain. | ||||||
- `--chain-id`: This flag allows you to specify the id of the chain. There will be different ids for different testnet chains and mainnet chains. | ||||||
|
||||||
#### Help | ||||||
## REST API | ||||||
|
||||||
If you need to do something else, the best command you can run is: | ||||||
|
||||||
```bash | ||||||
gaiad | ||||||
``` | ||||||
|
||||||
It will display all the available commands. For each command, you can use the `--help` flag to get further information. | ||||||
|
||||||
## Setting up the Rest Server | ||||||
|
||||||
The Rest Server acts as an intermediary between the front-end and the full-node. You don't need to run the Rest Server on the same machine as the full-node. | ||||||
|
||||||
To start the Rest server: | ||||||
|
||||||
```bash | ||||||
gaiad rest-server --node=<full_node_address:full_node_port> | ||||||
``` | ||||||
|
||||||
Flags: | ||||||
- `--trust-node`: A boolean. If `true`, light-client verification is disabled. If `false`, it is enabled. For service providers, this should be set to `true`. By default, it set to `false`. | ||||||
- `--node`: This is where you indicate the address and the port of your full-node. The format is `<full_node_address:full_node_port>`. If the full-node is on the same machine, the address should be `tcp://localhost:26657`. | ||||||
- `--laddr`: This flag allows you to specify the address and port for the Rest Server (default `1317`). You will mostly use this flag only to specify the port, in which case just input "localhost" for the address. The format is <rest_server_address:port>. | ||||||
|
||||||
|
||||||
### Listening for incoming transaction | ||||||
|
||||||
The recommended way to listen for incoming transaction is to periodically query the blockchain through the following endpoint of the LCD: | ||||||
|
||||||
[`/bank/balance/{address}`](https://cosmos.network/rpc/#/ICS20/get_bank_balances__address_) | ||||||
|
||||||
## Rest API | ||||||
|
||||||
The Rest API documents all the available endpoints that you can use to interact | ||||||
with your full node. It can be found [here](https://cosmos.network/rpc/). | ||||||
|
||||||
The API is divided into ICS standards for each category of endpoints. For | ||||||
example, the [ICS20](https://cosmos.network/rpc/#/ICS20/) describes the API to | ||||||
interact with tokens. | ||||||
The [REST API documents](https://cosmos.network/rpc/) list all the available endpoints that you can use to interact | ||||||
with your Full Node. | ||||||
|
||||||
To give more flexibility to developers, we have included the ability to | ||||||
generate unsigned transactions, [sign](https://cosmos.network/rpc/#/ICS20/post_tx_sign) | ||||||
|
@@ -176,6 +195,12 @@ In order to generate an unsigned transaction (example with | |||||
[coin transfer](https://cosmos.network/rpc/#/ICS20/post_bank_accounts__address__transfers)), | ||||||
you need to use the field `generate_only` in the body of `base_req`. | ||||||
|
||||||
### Listen for incoming transaction | ||||||
toschdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
The recommended way to listen for incoming transaction is to periodically query the blockchain through the following endpoint of the LCD: | ||||||
|
||||||
[`/cosmos/bank/v1beta1/balances/{address}`](https://cosmos.network/rpc/) | ||||||
|
||||||
## Cosmos SDK Transaction Signing | ||||||
|
||||||
Cosmos SDK transaction signing is a fairly simple process. | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as before, we are on go1.15