Skip to content

Instantly share code, notes, and snippets.

@0xbas3d
Created March 3, 2023 18:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0xbas3d/f9f806b4dca350db8027d190c9a8ea58 to your computer and use it in GitHub Desktop.
Save 0xbas3d/f9f806b4dca350db8027d190c9a8ea58 to your computer and use it in GitHub Desktop.

x/deposit


CLI

deposit

The deposit query allows users to query deposit by specific address

sentinelhub query vpn deposit [address] [flags]

Example

cmd
sentinelhub query vpn deposit sent1q0aaezutj5kkdxjhf2wdjtaxdd7k3zlv7a47nw
output
deposit:
  address: sent1q0aaezutj5kkdxjhf2wdjtaxdd7k3zlv7a47nw
  coins:
  - amount: "2357824481"
    denom: udvpn

deposits

The deposits query allows users to query all deposits

sentinelhub query vpn deposits [flags]

Example

cmd
sentinelhub query vpn deposits
output
- address: sent1q06dsdz50adra40fq6ngv4hnanhvd6lkzy6q2z
  coins:
  - amount: "1415096985"
    denom: udvpn
- address: sent1q0a9c2hp5whgzgy0hhrmf5apceyaqken6tupnw
  coins:
  - amount: "6345710"
    denom: udvpn
- address: sent1q0aaezutj5kkdxjhf2wdjtaxdd7k3zlv7a47nw
  coins:
  - amount: "2357824481"
    denom: udvpn
pagination:
  next_key: FAP8tQtd7zAD6YgYNHaCOgn1g2bd
  total: "0"

x/node


CLI

node

The node query allows users to query nodes by specific node address

sentinelhub query vpn node [address] [flags]

Example

cmd
sentinelhub query vpn node sentnode1qvjg5378l0pphf8nmxmnuj8tj863fs46r7xurq
output
node:
  address: sentnode1qvjg5378l0pphf8nmxmnuj8tj863fs46r7xurq
  price:
  - amount: "105000"
    denom: ibc/31FEE1A2A9F9C01113F90BD0BBCCE8FD6BBB8585FAF109A2101827DD1D5B95B8
  - amount: "6000"
    denom: ibc/A8C2D23A1E6F95DA4E48BA349667E322BD7A6C996D8A4AAE8BA72E190F3D1477
  - amount: "5000000"
    denom: ibc/B1C0DDB14F25279A2026BC8794E12B259F8BDA546A3C5132CCAEE4431CE36783
  - amount: "80000"
    denom: ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518
  - amount: "150000000"
    denom: udvpn
  provider: ""
  remote_url: https://137.184.195.137:33374
  status: STATUS_INACTIVE
  status_at: "2022-09-09T20:26:02.397229373Z"

nodes

The nodes query allows users to query all nodes

sentinelhub query vpn nodes [flags]

Example

cmd
sentinelhub query vpn nodes
output
- address: sentnode1qv32f02qd93cpr0q8kvx9262lwezj24pj8nsqq
  price:
  - amount: "105000"
    denom: ibc/31FEE1A2A9F9C01113F90BD0BBCCE8FD6BBB8585FAF109A2101827DD1D5B95B8
  - amount: "6000"
    denom: ibc/A8C2D23A1E6F95DA4E48BA349667E322BD7A6C996D8A4AAE8BA72E190F3D1477
  - amount: "5000000"
    denom: ibc/B1C0DDB14F25279A2026BC8794E12B259F8BDA546A3C5132CCAEE4431CE36783
  - amount: "80000"
    denom: ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518
  - amount: "150000000"
    denom: udvpn
  provider: ""
  remote_url: https://83.136.255.146:50239
  status: STATUS_INACTIVE
  status_at: "2022-11-14T22:02:58.280719606Z"
- address: sentnode1qvjg5378l0pphf8nmxmnuj8tj863fs46r7xurq
  price:
  - amount: "105000"
    denom: ibc/31FEE1A2A9F9C01113F90BD0BBCCE8FD6BBB8585FAF109A2101827DD1D5B95B8
  - amount: "6000"
    denom: ibc/A8C2D23A1E6F95DA4E48BA349667E322BD7A6C996D8A4AAE8BA72E190F3D1477
  - amount: "5000000"
    denom: ibc/B1C0DDB14F25279A2026BC8794E12B259F8BDA546A3C5132CCAEE4431CE36783
  - amount: "80000"
    denom: ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518
  - amount: "150000000"
    denom: udvpn
  provider: ""
  remote_url: https://137.184.195.137:33374
  status: STATUS_INACTIVE
  status_at: "2022-09-09T20:26:02.397229373Z"
pagination:
  next_key: FAMyis74gBHnnJyfz5C2getCSdYj
  total: "0"

node-params

The node-params query allows users to query the x/node module parameters

sentinelhub query vpn node-params [flags]

Example

cmd
sentinelhub query vpn node-params
output
params:
  deposit:
    amount: "0"
    denom: udvpn
  inactive_duration: 3600s
  max_price:
  - amount: "7000000"
    denom: ibc/31FEE1A2A9F9C01113F90BD0BBCCE8FD6BBB8585FAF109A2101827DD1D5B95B8
  - amount: "390000"
    denom: ibc/A8C2D23A1E6F95DA4E48BA349667E322BD7A6C996D8A4AAE8BA72E190F3D1477
  - amount: "525000000"
    denom: ibc/B1C0DDB14F25279A2026BC8794E12B259F8BDA546A3C5132CCAEE4431CE36783
  - amount: "5250000"
    denom: ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518
  - amount: "7000000000"
    denom: udvpn
  min_price:
  - amount: "105000"
    denom: ibc/31FEE1A2A9F9C01113F90BD0BBCCE8FD6BBB8585FAF109A2101827DD1D5B95B8
  - amount: "6000"
    denom: ibc/A8C2D23A1E6F95DA4E48BA349667E322BD7A6C996D8A4AAE8BA72E190F3D1477
  - amount: "800000"
    denom: ibc/B1C0DDB14F25279A2026BC8794E12B259F8BDA546A3C5132CCAEE4431CE36783
  - amount: "80000"
    denom: ibc/ED07A3391A112B175915CD8FAF43A2DA8E4790EDE12566649D0C2F97716B8518
  - amount: "11000000"
    denom: udvpn
  staking_share: "0.200000000000000000"

x/plan


CLI

plan

The plan query allows users to query plans by specific plan id

sentinelhub query vpn plan [id] [flags]

Example

cmd
sentinelhub query vpn plan 1
output
plan:
  bytes: "250000000000"
  id: "1"
  price:
  - amount: "25000000"
    denom: udvpn
  provider: sentprov1aaaa4gxkfjntrerurznyhcm4saeegynrhq6zmk
  status: STATUS_ACTIVE
  status_at: "2021-10-07T16:47:32.763349394Z"
  validity: 2160000s

plans

The plans query allows users to query all plans

sentinelhub query vpn plans [flags]

Example

cmd
sentinelhub query vpn plans
output
- bytes: "250000000000"
  id: "1"
  price:
  - amount: "25000000"
    denom: udvpn
  provider: sentprov1aaaa4gxkfjntrerurznyhcm4saeegynrhq6zmk
  status: STATUS_ACTIVE
  status_at: "2021-10-07T16:47:32.763349394Z"
  validity: 2160000s
- bytes: "250000000000"
  id: "2"
  price:
  - amount: "25000000"
    denom: udvpn
  provider: sentprov1gjkdw8arm54sv7xdhjxnx30lcya4alhfktuxyy
  status: STATUS_ACTIVE
  status_at: "2022-02-08T18:19:23.817707915Z"
  validity: 2160000s
...

x/provider


CLI

provider

The provider query allows users to query providers by specific provider address

sentinelhub query vpn provider [address] [flags]

Example

cmd
sentinelhub query vpn provider sentprov1gjkdw8arm54sv7xdhjxnx30lcya4alhfktuxyy
output
plan:
  bytes: "250000000000"
  id: "1"
  price:
  - amount: "25000000"
    denom: udvpn
  provider: sentprov1aaaa4gxkfjntrerurznyhcm4saeegynrhq6zmk
  status: STATUS_ACTIVE
  status_at: "2021-10-07T16:47:32.763349394Z"
  validity: 2160000s

providers

The providers query allows users to query all providers

sentinelhub query vpn providers [flags]

Example

cmd
sentinelhub query vpn providers
output
- address: sentprov1gjkdw8arm54sv7xdhjxnx30lcya4alhfktuxyy
  description: SOLAR dVPN
  identity: 6257A55EA42BA680
  name: SOLAR dVPN
  website: https://labs.solar
- address: sentprov1aaaa4gxkfjntrerurznyhcm4saeegynrhq6zmk
  description: Operate your dVPN node under this provider to get upcoming incentives
  identity: 045D374A62F15B56
  name: Sentinel Node Incentives
  website: https://sentinel.co

provider-params

The provider-params query allows users to query the x/provider module parameters

sentinelhub query vpn provider-params [flags]

Example

cmd
sentinelhub query vpn provider-params
output
params:
  deposit:
    amount: "25000000000"
    denom: udvpn
  staking_share: "0.200000000000000000"

x/session


CLI

session

The session query allows users to query sessions by specific session id

sentinelhub query vpn session [id] [flags]

Example

cmd
sentinelhub query vpn session 583829
output
session:
  address: sent1r0q85cszgz6d0lcdeuyp95ww5yt58h3mx66cwq
  bandwidth:
    download: "188784452"
    upload: "15466460"
  duration: 209551.647845923s
  id: "583829"
  node: sentnode1x6z8nmvul422l2wdlqxunxrxhahgx77tapwda8
  status: STATUS_ACTIVE
  status_at: "2023-03-03T11:39:42.291995683Z"
  subscription: "196765"

sessions

The sessions query allows users to query all sessions

sentinelhub query vpn sessions [flags]

Example

cmd
sentinelhub query vpn sessions
output
- address: sent1r0q85cszgz6d0lcdeuyp95ww5yt58h3mx66cwq
  bandwidth:
    download: "188784452"
    upload: "15466460"
  duration: 209551.647845923s
  id: "583829"
  node: sentnode1x6z8nmvul422l2wdlqxunxrxhahgx77tapwda8
  status: STATUS_ACTIVE
  status_at: "2023-03-03T11:39:42.291995683Z"
  subscription: "196765"
- address: sent1pvanpexrpacdy42dmlp7pn4wxf7nzgsz6k6u2z
  bandwidth:
    download: "346972"
    upload: "54836"
  duration: 2584.092292858s
  id: "583835"
  node: sentnode18y8pfd78ay2d509rsv7hr9ht7tqk8pvt5kvj0g
  status: STATUS_INACTIVE_PENDING
  status_at: "2023-03-03T11:13:43.641908314Z"
  subscription: "196762"
...

session-params

The session-params query allows users to query the x/session module parameters

sentinelhub query vpn session-params [flags]

Example

cmd
sentinelhub query vpn session-params
output
params:
  inactive_duration: 7200s
  proof_verification_enabled: false

x/subscription


CLI

subscription

The subscription query allows users to query sessions by specific subscription id

sentinelhub query vpn subscription [id] [flags]

Example

cmd
sentinelhub query vpn subscription 119
output
subscription:
  denom: ""
  deposit:
    amount: "510000"
    denom: udvpn
  expiry: "0001-01-01T00:00:00Z"
  free: "0"
  id: "119"
  node: sentnode1q5z3lqq3argvf9cyesgx4lpac2d3y9qgsvuszl
  owner: sent1gnrxpxnr7mv85ahsmfz65a7ksz63xx5dpjz04m
  plan: "0"
  price:
    amount: "100000"
    denom: udvpn
  status: STATUS_ACTIVE
  status_at: "2021-08-23T21:05:24.895162912Z"

subscriptions

The subscriptions query allows users to query all subscriptions

sentinelhub query vpn subscriptions [flags]

Example

cmd
sentinelhub query vpn subscriptions
output
- denom: ""
  deposit:
    amount: "110000"
    denom: udvpn
  expiry: "0001-01-01T00:00:00Z"
  free: "0"
  id: "118"
  node: sentnode1q5z3lqq3argvf9cyesgx4lpac2d3y9qgsvuszl
  owner: sent1gnrxpxnr7mv85ahsmfz65a7ksz63xx5dpjz04m
  plan: "0"
  price:
    amount: "100000"
    denom: udvpn
  status: STATUS_ACTIVE
  status_at: "2021-08-23T00:09:38.825468358Z"
- denom: ""
  deposit:
    amount: "510000"
    denom: udvpn
  expiry: "0001-01-01T00:00:00Z"
  free: "0"
  id: "119"
  node: sentnode1q5z3lqq3argvf9cyesgx4lpac2d3y9qgsvuszl
  owner: sent1gnrxpxnr7mv85ahsmfz65a7ksz63xx5dpjz04m
  plan: "0"
  price:
    amount: "100000"
    denom: udvpn
  status: STATUS_ACTIVE
  status_at: "2021-08-23T21:05:24.895162912Z"
...

quota

The quota query allows users to query sessions by specific subscription id and user address

sentinelhub query vpn quota [subscription] [address] [flags]

Example

cmd
sentinelhub query vpn quota 118 sent1gnrxpxnr7mv85ahsmfz65a7ksz63xx5dpjz04m
output
quota:
  address: sent1gnrxpxnr7mv85ahsmfz65a7ksz63xx5dpjz04m
  allocated: "1100000000"
  consumed: "335070000"

quotas

The quotas query allows users to query quotas by subscription id

sentinelhub query vpn quotas [id] [flags]

Example

cmd
sentinelhub query vpn quotas 118
output
pagination:
  next_key: null
  total: "0"
quotas:
- address: sent1gnrxpxnr7mv85ahsmfz65a7ksz63xx5dpjz04m
  allocated: "1100000000"
  consumed: "335070000"

subscription-params

The subscription-params query allows users to query the x/subscription module parameters

sentinelhub query vpn subscription-params [flags]

Example

cmd
sentinelhub query vpn subscription-params
output
params:
  inactive_duration: 14400s

State Sync


Install Dependencies

Update and Upgrade System

sudo apt update
sudo apt upgrade

Install golang

sudo snap install go --classic
# Test Installation
go version

Install apt packages

sudo apt-get install --yes git gcc make curl unzip jq

Install sentinelhub

git clone https://github.com/sentinel-official/hub.git
cd hub
git checkout 0.10.1
make install
sudo mv $HOME/go/bin/sentinelhub /usr/bin/
# Test Installation
sentinelhub version --log_level error --long |& head -n6

Setup env variables

CHAIN_ID=sentinelhub-2
MONIKER=<enter_moniker_name>

Initialize sentinelhub

sentinelhub init ${MONIKER} --chain-id ${CHAIN_ID}
rm ${HOME}/.sentinelhub/config/genesis.json

curl -fsLS https://raw.githubusercontent.com/sentinel-official/networks/main/${CHAIN_ID}/genesis.zip -o ${HOME}/genesis.zip
unzip ${HOME}/genesis.zip -d ${HOME}/.sentinelhub/config/
rm ${HOME}/genesis.zip

Set node config

Get config params from https://cosmos.directory/sentinel/nodes

Set config.toml

vim ${HOME}/.sentinelhub/config/config.toml

# Add peers to persistent_peers list. This is under the P2P section.
persistent_peers = "<persistent_peer_ids>"
# Add seeds to seeds list.
seeds = "<seed_ids>"

# IF NEEDED: Can enable prometheus. This is under the Instrumentation section.
prometheus = true
# Metrics exposed on Port: 26660

Set app.toml

Get minimum gas prices from, curl -fsLS https://raw.githubusercontent.com/sentinel-official/networks/main/${CHAIN_ID}/minimum-gas-prices.txt

vim ${HOME}/.sentinelhub/config/app.toml

# Set minimum-gas-prices
minimum-gas-prices = "<minimum_gas_price>"

# IF NEEDED: Can setup unpruned node. This is under the Base Configuration section.
pruning = "nothing"

Setup State sync

If syncing node through state sync, run the following commands:

SNAP_RPC="https://rpc.sentinel.co:443";
LATEST_HEIGHT=$(curl -s "$SNAP_RPC/block" | jq -r .result.block.header.height);
BLOCK_HEIGHT=$((LATEST_HEIGHT - 1800));
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash);

# Check block height and trusted hash
echo ${BLOCK_HEIGHT}
echo ${TRUST_HASH}
export SENTINELHUB_P2P_MAX_NUM_OUTBOUND_PEERS=200
export SENTINELHUB_STATESYNC_ENABLE=true
export SENTINELHUB_STATESYNC_RPC_SERVERS="https://sentinel-rpc.badgerbite.io:443,https://rpc.mathnodes.com:443,https://rpc.sentinel.co:443"
export SENTINELHUB_STATESYNC_TRUST_HEIGHT=${BLOCK_HEIGHT}
export SENTINELHUB_STATESYNC_TRUST_HASH=${TRUST_HASH}

# Check if all exported variables present
printenv

Setup Systemd

# Create systemd service
sudo vim /etc/systemd/system/sentinelhub.service
# Paste below text
[Unit]
Description=Sentinel Hub Node
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/root
ExecStart=/usr/bin/sentinelhub start --x-crisis-skip-assert-invariants
Restart=on-failure
StartLimitInterval=0
RestartSec=3
LimitNOFILE=65535
LimitMEMLOCK=209715200

[Install]
WantedBy=multi-user.target
# Close and Save file

# Reload the service files
sudo systemctl daemon-reload
# Create the symlinlk
sudo systemctl enable sentinelhub.service

Run Node

Start Node

sudo systemctl start sentinelhub
# Watch logs
journalctl -u sentinelhub -f

Chain Upgrade

# Stop Node
sudo systemctl stop sentinelhub

# Inside Canto repository
git checkout <version_tag>
sudo rm /usr/bin/sentinelhub
make install
sudo mv $HOME/go/bin/sentinelhub /usr/bin/

# Restart Node
sentinelhub version --log_level error --long | head -n6
sudo systemctl start sentinelhub

x/node


CLI

register

The register tx allows users to register a node

sentinelhub tx vpn node register [remote-url] [flags]

update

The update tx allows users to update a node

sentinelhub tx vpn node update [flags]

status-set

The status-set tx allows users to set status of node

sentinelhub tx vpn node status-set [status] [flags]

x/plan


CLI

add

The add tx allows users to register add a plan

sentinelhub tx vpn plan add [bytes] [price] [validity] [flags]

node-add

The node-add tx allows users to add a node to a plan

sentinelhub tx vpn plan node-add [id] [node] [flags]

node-remove

The node-remove tx allows users to remove a node from a plan

sentinelhub tx vpn plan node-remove [id] [node] [flags]

status-set

The status-set tx allows users to set status of plan

sentinelhub tx vpn plan status-set [id] [status] [flags]

x/provider


CLI

register

The register tx allows users to register a new provider

sentinelhub tx vpn provider register [name] [flags]

update

The update tx allows users to update a providers details

sentinelhub tx vpn provider update [flags]

x/session


CLI

start

The start tx allows users to start a new session with a node

sentinelhub tx vpn session start [id] [node] [flags]

update

The update tx allows users to update session details

sentinelhub tx vpn session update [id] [upload] [download] [duration] [flags]

end

The end tx allows users to end a specific session

sentinelhub tx vpn session end [id] [flags]

x/subscription


CLI

subscribe-to-node

The subscribe-to-node tx allows users to subscribe to a node

sentinelhub tx vpn subscription subscribe-to-node [node] [deposit] [flags]

subscribe-to-plan

The subscribe-to-plan tx allows users to subscribe to a plan

sentinelhub tx vpn subscription subscribe-to-plan [plan] [denom] [flags]

quota-add

The quota-add tx allows users to add a quota for a subscription

sentinelhub tx vpn subscription quota-add [subscription] [address] [bytes] [flags]

quota-update

The quota-update tx allows users to update the quota for a subscription

sentinelhub tx vpn subscription quota-update [subscription] [address] [bytes] [flags]

cancel

The cancel tx allows users to cancel a subscription

sentinelhub tx vpn subscription cancel [id]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment