Relay Service
Given the limitation of smart contracts, they are not self-executing, and require an external force to trigger their functions. Relay is a service to drive LRT network to properly process its own internal states, such as dealing with delegating, undelegating, distributing rewards and calculating the rate between LRT and LST. We introduce era
concept to define how often the smart contract should be called. Most of the time, an era is 24 hours long.
Security is the our first priority when developing Stack, We are thrilled to say that the new era process is permissionless, showcasing the decentralized nature of the StaFi LRT Stack, allowing anyone to trigger the beginning of a new era.
Install build tools
Install make
, gcc
and git
sudo apt update
sudo apt install -y make gcc git build-essential
sudo apt update
sudo apt install -y make gcc git build-essential
Install go
by following the official docs. Remember to set your $PATH
environment variable, for example:
cd $HOME
wget -O go1.22.0.linux-amd64.tar.gz https://go.dev/dl/go1.22.0.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.22.0.linux-amd64.tar.gz && rm go1.22.0.linux-amd64.tar.gz
echo 'export GOROOT=/usr/local/go' >> $HOME/.bashrc
echo 'export GOPATH=$HOME/go' >> $HOME/.bashrc
echo 'export GO111MODULE=on' >> $HOME/.bashrc
echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> $HOME/.bashrc && . $HOME/.bashrc
go version
cd $HOME
wget -O go1.22.0.linux-amd64.tar.gz https://go.dev/dl/go1.22.0.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.22.0.linux-amd64.tar.gz && rm go1.22.0.linux-amd64.tar.gz
echo 'export GOROOT=/usr/local/go' >> $HOME/.bashrc
echo 'export GOPATH=$HOME/go' >> $HOME/.bashrc
echo 'export GO111MODULE=on' >> $HOME/.bashrc
echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> $HOME/.bashrc && . $HOME/.bashrc
go version
Install relay service
git clone https://github.com/stafiprotocol/lrd-relay.git
cd lrd-relay
make install
git clone https://github.com/stafiprotocol/lrd-relay.git
cd lrd-relay
make install
Add account
lrd-relay add-account
config home: /home/ubuntu/.stafi/lrd
keystore path: /home/ubuntu/.stafi/lrd/keystore
password for key:
>
INFO[2024-04-12T11:01:28+08:00] key added address=0xE2E896D5ACB6B192Bb519185287908D2A38C7d3E file=/home/ubuntu/.stafi/lrd/keystore/0xE2E896D5ACB6B192Bb519185287908D2A38C7d3E.key
lrd-relay add-account
config home: /home/ubuntu/.stafi/lrd
keystore path: /home/ubuntu/.stafi/lrd/keystore
password for key:
>
INFO[2024-04-12T11:01:28+08:00] key added address=0xE2E896D5ACB6B192Bb519185287908D2A38C7d3E file=/home/ubuntu/.stafi/lrd/keystore/0xE2E896D5ACB6B192Bb519185287908D2A38C7d3E.key
Or import account
lrd-relay import-account
config home: /home/ubuntu/.stafi/lrd
keystore path: /home/ubuntu/.stafi/lrd/keystore
Enter private key:
>
password for key:
>
INFO[2024-04-12T11:06:01+08:00] key imported address=0x68146ebA486CE6F8D22731c8ECB4d013F34E7114 file=/home/ubuntu/.stafi/lrd/keystore/0x68146ebA486CE6F8D22731c8ECB4d013F34E7114.key
lrd-relay import-account
config home: /home/ubuntu/.stafi/lrd
keystore path: /home/ubuntu/.stafi/lrd/keystore
Enter private key:
>
password for key:
>
INFO[2024-04-12T11:06:01+08:00] key imported address=0x68146ebA486CE6F8D22731c8ECB4d013F34E7114 file=/home/ubuntu/.stafi/lrd/keystore/0x68146ebA486CE6F8D22731c8ECB4d013F34E7114.key
Start relay service
lrd-relay start --stake_manager 0x<your_stake_manager_address> \
--account 0x<imported_account_address> \
--endpoint http://127.0.0.1:8545 \
--log_level info
lrd-relay start --stake_manager 0x<your_stake_manager_address> \
--account 0x<imported_account_address> \
--endpoint http://127.0.0.1:8545 \
--log_level info
Options
option | description | example value |
---|---|---|
stake_manager | the address of StakeManager contract of the LRT network | 0xb77BD2bdE07205AE1926F857c4E8c5B90c6050a3 |
account | the account that has been added or imported | 0x68146ebA486CE6F8D22731c8ECB4d013F34E7114 |
endpoint | RPC endpoint on Ethereum | http://127.0.0.1:8545 |
home | Home path (default "$HOME/.stafi/lrd") | |
log_level | The logging level (trace|debug|info|warn|error|fatal|panic) | info |