Skip to main content

v1.0.0 to v2.0.0

This guide provides details for the upgrade from v1.0.0 to v2.0.0.
Since the release of BDJuno v2.0.0, certain address-specific data is no longer periodically parsed from the node and stored in the database. Instead, the data is obtained directly from the node when necessary thanks to the Hasura Actions service.

Here's the list of data which is acquired through Hasura Actions:

  • Address/Delegator related data:
    • Account balance
    • Delegation rewards
    • Delegator withdraw address
    • Delegations
    • Total delegations amount
    • Unbonding delegations
    • Total unbonding delegations amount
    • Redelegations
  • Validator related data:
    • Commission amount
    • Validator delegations
    • Validator redelegations
    • Validator unbonding delegations

Update branch to v2

Pull the changes from v2.0.0-stargate (v0.42.x/stargate) or v2.0.0 (v0.44.x and above) tag to your branch depending on the cosmos sdk version being used in your project.

$ git fetch --tags
$ git checkout <your chain base>
$ git checkout -b merge/v2.0.0-stargate
$ git merge base-v2.0.0-stargate

Fix all merge conflicts and then install the latest BDJuno version

$ make install

Start Hasura Actions

To activate Hasura actions, simply run:

$ bdjuno hasura-actions

By default hasura-actions will listen to rpc and grpc on 127.0.0.1:26657 and 127.0.0.1:9090 ports. To pass custom address run

$ bdjuno hasura-actions --rpc <custom-rpc-address> --grpc <custom grpc address>

It is also recommended to run Hasura Actions as a system service:

$ sudo tee /etc/systemd/system/hasura-actions.service > /dev/null <<EOF
[Unit]
Description=BDJuno Hasura Actions
After=network-online.target

[Service]
User=$USER
ExecStart=$GOPATH/bin/bdjuno hasura-actions
Restart=always
RestartSec=3
LimitNOFILE=4096

[Install]
WantedBy=multi-user.target
EOF
Include flags

Remember to include your custom configurations as flags at the ExecStart line if any. Run bdjuno hasura-actions --help for more information.

Update hasura metadata

Change to hasura directory inside bdjuno repository and re-apply the metadata to include the hasura actions:

$ cd /path/to/bdjuno/hasura
$ hasura metadata apply --endpoint <your-endpoint> --admin-secret <hasura_password>

Restart services

Restart the bdjuno service, and start the hasura actions service

$ sudo systemctl restart bdjuno
$ sudo systemctl start hasura-actions

Once the bdjuno and hasura actions are working properly, optionally you could drop the below DB tables along with the functions which will no longer be updated in the latest BDJuno version:

Tables

  • account_balance
  • delegation
  • redelegation
  • unbonding_delegation
  • delegators_to_refresh
  • validator_commission_amount
  • delegation_reward

Functions

  • self_delegations
  • is_delegation_self_delegate
  • account_balance_tokens_prices