diff --git a/.docs/config.md b/.docs/config.md deleted file mode 100644 index c4431d6..0000000 --- a/.docs/config.md +++ /dev/null @@ -1,141 +0,0 @@ -## Configuration -The default `config.toml` file should look like the following: - -
- -Default config.toml file - -```toml -[cosmos] -modules = [] -prefix = "cosmos" - -[rpc] -address = "http://localhost:26657" -client_name = "juno" - -[grpc] -address = "localhost:9090" -insecure = true - -[parsing] -fast_sync = true -listen_new_blocks = true -parse_genesis = true -parse_old_blocks = true -start_height = 1 -workers = 1 - -[database] -host = "localhost" -max_idle_connections = 0 -max_open_connections = 0 -name = "database-name" -password = "password" -port = 5432 -schema = "public" -ssl_mode = "" -user = "user" - -[pruning] -interval = 10 -keep_every = 500 -keep_recent = 100 - -[logging] -format = "text" -level = "debug" -``` - -
- -Let's see what each section refers to: - -- [`cosmos`](#cosmos) -- [`rpc`](#rpc) -- [`grpc`](#grpc) -- [`parsing`](#parsing) -- [`database`](#database) -- [`pruning`](#pruning) -- [`logging`](#logging) - -## `cosmos` -This section contains the details of the chain configuration regarding the Cosmos SDK. - -| Attribute | Type | Description | Example | -| :-------: | :---: | :--------- | :------ | -| `modules` | `array` | List of modules that should be enabled | `[ "auth", "bank", "distribution" ]` | -| -| `prefix` | `string` | Bech 32 prefix of the addresses | `cosmos` | - -### Supported modules -Currently we support the followings Cosmos modules: -- `auth` to parse the `x/auth` data -- `bank` to parse the `x/bank` data -- `consensus` to parse the consensus data -- `distribution` to parse the `x/distribution` data -- `gov` to parse the `x/gox` data -- `mint` to parse the `x/mint` data -- `modules` to get the list of enabled modules inside BDJuno -- `pricefeed` to get the token prices -- `slashing` to parse the `x/slashing` data -- `staking` to parse the `x/staking` data - -## `rpc` -This section contains the details of the chain RPC to which BDJuno will connect. - -| Attribute | Type | Description | Example | -| :-------: | :---: | :--------- | :------ | -| `address` | `string` | Address of the RPC endpoint | `http://localhost:26657` | -| `client_name` | `string` | Client name used when subscribing to the Tendermint websocket | `bdjuno` | - -## `grpc` -This section contains the details of the gRPC endpoint that BDJuno will use to query the data. - -| Attribute | Type | Description | Example | -| :-------: | :---: | :--------- | :------ | -| `address` | `string` | Address of the gRPC endpoint | `localhost:9090` | -| `insecure` | `boolean` | Whether the gRPC endpoint is insecure or not | `false` | - -## `parsing` - -| Attribute | Type | Description | Example | -| :-------: | :---: | :--------- | :------ | -| `fast_sync` | `boolean` | Whether BDJuno should use the fast sync abilities of different modules when enabled | `false` | -| `listen_new_blocks` | `boolean` | Whether BDJuno should parse new blocks as soon as they get created | `true` | -| `parse_genesis` | `boolean` | Whether BDJuno needs to parse the genesis state or not | `true` | -| `parse_old_blocks` | `boolean` | Whether BDJuno should parse old chain blocks or not | `true` | -| `start_height` | `integer` | Height at which BDJuno should start parsing old blocks | `250000` | -| `workers` | `integer` | Number of works that will be used to fetch the data and store it inside the database | `5` | - -## `database` -This section contains all the different configuration related to the PostgreSQL database where BDJuno will write the data. - -| Attribute | Type | Description | Example | -| :-------: | :---: | :--------- | :------ | -| `host` | `string` | Host where the database is found | `localhost` | -| `port` | `integer` | Port to be used to connect to the PostgreSQL instance | `5432` | -| `name` | `string` | Name of the database to which connect to | `bdjuno` | -| `user` | `string` | Name of the user to use when connecting to the database. This user must have read/write access to all the database. | `bdjuno` | -| `password` | `string` | Password to be used to connect to the database instance | `password` | -| `schema` | `string` | Schema to be used inside the database (default: `public`) | `public` | -| `ssl_mode` | `string` | [PostgreSQL SSL mode](https://www.postgresql.org/docs/9.1/libpq-ssl.html) to be used when connecting to the database. If not set, `disable` will be used. | `verify-ca` | -| `max_idle_connections` | `integer` | Max number of idle connections that should be kept open (default: `1`) | `10` | -| `max_open_connections` | `integer` | Max number of open connections at any time (default: `1`) | `15` | - -## `pruning` -This section contains the configuration about the pruning options of the database. Note that this will have effect only if you add the `"pruning"` entry to the `modules` field of the [`cosmos` config](#cosmos). - -| Attribute | Type | Description | Example | -| :-------: | :---: | :--------- | :------ | -| `interval` | `integer` | Number of blocks that should pass between one pruning and the other (default: prune every `10` blocks) | `100` | -| `keep_every` | `integer` | Keep the state every `nth` block, even if it should have been pruned | `500` | -| `keep_recent` | `integer` | Do not prune this amount of recent states | `100` | - -## `logging` -This section allows to configure the logging details of BDJuno. - -| Attribute | Type | Description | Example | -| :-------: | :---: | :--------- | :------ | -| `format` | `string` | Format in which the logs should be output (either `json` or `text`) | `json` | -| `level` | `string` | Level of the log (either `verbose`, `debug`, `info`, `warn` or `error`) | `error` | diff --git a/.docs/database.md b/.docs/database.md deleted file mode 100644 index 25d948b..0000000 --- a/.docs/database.md +++ /dev/null @@ -1,7 +0,0 @@ -# Database -Since BDJuno relies on a PostgreSQL database in order to store the parsed data, one of the most important things is to create such database. To do this the first thing you need to do is install [PostgreSQL](https://www.postgresql.org/). - -Once installed you need to create a new database, and a new user that is going to read and write data inside it. -Then, once that's one, you need to run the SQL queries that you can find inside the [`database/schema` folder](../database/schema). - -Once that's done, you are ready to [continue the setup](setup.md). \ No newline at end of file diff --git a/.docs/hasura.md b/.docs/hasura.md deleted file mode 100644 index a70f089..0000000 --- a/.docs/hasura.md +++ /dev/null @@ -1,37 +0,0 @@ -# Setting up Hasura -Once you have successfully started BDJuno, the last step that you can do is set up [Hasura](https://hasura.io/) to expose the parsed data using a GraphQL endpoint. To do this you have to: - -1. Install Hasura -2. Import the metadata we provide you with - -## Installing Hasura -The easiest way to install Hasura is to follow the [official guide](https://hasura.io/docs/latest/graphql/core/getting-started/docker-simple.html). This will allow you to have an Hasura instance up and running in matter of minutes. - -**Note** -When starting Hasura make sure you specified the following environmental variable: -``` -HASURA_GRAPHQL_UNAUTHORIZED_ROLE="anonymous" -``` - -This will make sure that even non-authenticated users will be able to access the endpoint correctly. - -Once this is done, you will also need to install [Hasura CLI](https://hasura.io/docs/latest/graphql/core/hasura-cli/install-hasura-cli.html#install-hasura-cli) on the same machine where you cloned the BDJuno repository. - -## Importing the metadata -When you have installed both Hasura and Hasura CLI, you are now ready to import the metadata. This will allow you to easily set up all the queries that BigDipper will later need. To do this, you can simply run the following commands: - -```shell -# Move into the hasura folder inside the root of BDJuno -$ cd /path/to/BDJuno/hasura - -# Import the metadata into the remote server -$ hasura metadata apply --endpoint --secret -``` - -**Note** -Make sure that `` represents your full GraphQL endpoint (eg. `http://localhost:8080/v1/graphql`) and `` matches the console secret you specified while starting Hasura. If you did not use a secret, then you can remove the flag. - -Once the metadata is successfully applied, you will be able to start using it properly. - -**Warning** -If Hasura is complaining about metadata not being valid after importing them, please head into the _Metadata status_ page, delete all the metadata and try re-importing them. This should fix all the issues. \ No newline at end of file diff --git a/.docs/setup.md b/.docs/setup.md deleted file mode 100644 index a9c1b0f..0000000 --- a/.docs/setup.md +++ /dev/null @@ -1,108 +0,0 @@ -# Setup -Setting up BDJuno is pretty straightforward. It requires three things to be done: -1. Install BDJuno. -1. Initialize the configuration. -2. Start the parser. - -## Installing BDJuno -In order to install BDJuno you are required to have [Go 1.15+](https://golang.org/dl/) installed on your machine. Once you have it, the first thing to do is to clone the GitHub repository. To do this you can run - -```shell -$ git clone https://github.com/forbole/bdjuno.git -``` - -Then, you need to install the binary. To do this, run - -```shell -$ make install -``` - -This will put the `bdjuno` binary inside your `$GOPATH/bin` folder. You should now be able to run `bdjuno` to make sure it's installed: - -```shell -$ bdjuno -A Cosmos chain data aggregator. It improves the chain's data accessibility -by providing an indexed database exposing aggregated resources and models such as blocks, validators, pre-commits, -transactions, and various aspects of the governance module. -bdjuno is meant to run with a GraphQL layer on top so that it even further eases the ability for developers and -downstream clients to answer queries such as "What is the average gas cost of a block?" while also allowing -them to compose more aggregate and complex queries. - -Usage: - bdjuno [command] - -Available Commands: - help Help about any command - init Initializes the configuration files - parse Start parsing the blockchain data - version Print the version information - -Flags: - -h, --help help for bdjuno - --home string Set the home folder of the application, where all files will be stored (default "/home/riccardo/.bdjuno") - -Use "bdjuno [command] --help" for more information about a command. -``` - -## Initializing the configuration -In order to correctly parse and store the data based on your requirements, BDJuno allows you to customize its behavior via a TOML file called `config.toml`. In order to create the first instance of the `config.toml` file you can run - -```shell -$ bdjuno init -``` - -This will create such file inside the `~/.bdjuno` folder. -Note that if you want to change the folder used by BDJuno you can do this using the `--home` flag: - -```shell -$ bdjuno init --home /path/to/my/folder -``` - -Once the file is created, you are required to edit it and change the different values. To do this you can run - -```shell -$ nano ~/.bdjuno/config.toml -``` - -For a better understanding of what each section and field refers to, please read the [config reference](config.md). - -## Running BDJuno -Once the configuration file has been setup, you can run BDJuno using the following command: - -```shell -$ bdjuno parse -``` - -If you are using a custom folder for the configuration file, please specify it using the `--home` flag: - - -```shell -$ bdjuno parse --home /path/to/my/config/folder -``` - -We highly suggest you running BDJuno as a system service so that it can be restarted automatically in the case it stops. To do this you can run: - -```shell -$ sudo tee /etc/systemd/system/bdjuno.service > /dev/null <