1. Requirements
Go 1.21 or above. Follow the instructions on the Golang page to do that.
2. Deploy Local Testnet
2.1. Build Lorenzo
Please clone the Lorenzo blockchain source code from github:
git clone git@github.com:Lorenzo-Protocol/lorenzo.git -b release/v1.0.0
make build
The binary will then be available at ./build/lorenzod
2.2. Generate local node genesis config
Create a bitcoin.conf file on your local server (please refer to the file path in different operating systems), and using the following sample config:
signet=1
rpcconnect=btc-rpc-signet.lorenzo-protocol.xyz
rpcport=38332
rpcuser=sbgdevuser
rpcpassword=sbgpassw0rd
best_height=$(bitcoin-cli getblockcount)
genesis_blk_height=$(echo "(($best_height - 6) / 2016) * 2016" | bc)
genesis_blk_hash=$(bitcoin-cli getblockhash $genesis_blk_height)
genesis_blk_header_bytes=$(bitcoin-cli getblockheader $genesis_blk_hash false)
genesis_blk_difficulty=$(bitcoin-cli getblockheader $genesis_blk_hash | jq .difficulty -r)
printf '{"header": "%s","hash": "%s","height": "%s","work": "%0.0f"}' $genesis_blk_header_bytes $genesis_blk_hash $genesis_blk_height $genesis_blk_difficulty
Sample output:
{
"header": "00000020c8710c5662ab0a4680963697765a390cba4814f95f0556fc5fb3b446b2000000fa9b80e52653455e5d4a4648fbe1f62854a07dbec0633a42ef595431de9be36dccb64366934f011ef3d98200",
"hash": "0000006ef8eb3d3d964cc401790776d11150c4a81116340a9b0e9ec8636b7431",
"height": "195552",
"work": "0"
}
2.4. Initialize the local node config file
lorenzod testnet init-files --v 1 \
--output-dir ./.testnet \
--chain-id lorenzo_83291-1 \
--btc-network signet \
--btc-staking-params '{"receivers":{"lorenzo":{"name":"lorenzo","addr":"tb1p97g0dpmsm2fxkmkw9w7mpasmxprsye3k0v49qknwmclwxj78rfjqu6nacq"}},"btc_confirmations_depth":3}' \
--base-btc-header '{"header":"00000020c8710c5662ab0a4680963697765a390cba4814f95f0556fc5fb3b446b2000000fa9b80e52653455e5d4a4648fbe1f62854a07dbec0633a42ef595431de9be36dccb64366934f011ef3d98200","hash":"0000006ef8eb3d3d964cc401790776d11150c4a81116340a9b0e9ec8636b7431","height":"195552","work":"0"}' \
--btc-lightclient-params '{"insert_headers_allow_list":[]}' \
--keyring-backend file
Please replace the bitcoin staking address to your own address, and replace the BTC header according to the output of the above step.
2.5. Start the chain
lorenzod start --home .testnet/node0/lorenzod
3. Deploy Lorenzo Relayer
3.1. Build Lorenzo relayer
Please clone the Lorenzo relayer source code from github:
git clone git@github.com:Lorenzo-Protocol/lorenzo-relayer.git -b dev
make build
The binary will then be available at ./build/lrzrelayer
3.2. Setup relayer account
lorenzod keys add --keyring-dir ./.keys/ --keyring-backend test relayer
relayer=$(lorenzod keys show relayer --keyring-dir .keys/ --keyring-backend test -a)
lorenzod tx bank send node0 $relayer 10alrz -y -b sync --keyring-dir .testnet/node0/lorenzod/ --chain-id lorenzo_83291-1 --keyring-backend file
3.3. Create the config file lrz-relayer.yml
common:
log-format: "auto"
log-level: "debug"
retry-sleep-time: 5s
max-retry-sleep-time: 5m
btc:
no-client-tls: true
endpoint: btc-rpc-signet.lorenzo-protocol.xyz:38332
net-params: signet
username: sbgdevuser
password: sbgpassw0rd
reconnect-attempts: 3
btc-backend: bitcoind
zmq-seq-endpoint: tcp://btc-rpc-signet.lorenzo-protocol.xyz:28332
lorenzo:
key: relayer
key-directory: ../lorenzo/.keys/
keyring-backend: test
chain-id: lorenzo_83291-1
rpc-addr: http://localhost:26657
account-prefix: lrz
gas-adjustment: 1.5
gas-prices: 0alrz
debug: true
timeout: 20s
output-format: json
sign-mode: direct
metrics:
host: 0.0.0.0
server-port: 2112
reporter:
netparams: signet
btc_cache_size: 1000
max_headers_in_msg: 100
delay_blocks: 1
3.4. Start the relayer
lrzrelayer reporter --config lrz-relayer.yml
4. Deploy Lorenzo Submitter
4.1. Build Lorenzo submitte
Please clone the Lorenzo submitter source code from github:
git clone git@github.com:Lorenzo-Protocol/lorenzo-btcstaking-submitter.git -b dev
make build
The binary will then be available at ./build/lrz-btcstaking-submitter
4.2. Setup relayer account
lorenzod keys add --keyring-dir ./.keys/ --keyring-backend test submitter
submitter=$(lorenzod keys show submitter --keyring-dir .keys/ --keyring-backend test -a)
lorenzod tx bank send node0 $submitter 10alrz -y -b sync --keyring-dir .testnet/node0/lorenzod/ --chain-id lorenzo_83291-1 --keyring-backend file
4.3 Setup database
Run an instance of MySQL database on your server.
Create a db with name lorenzo
Run the script ./db/schema.sql
to create related tables
Add the following entry into the config table:
name: submitter/btc-sync-point
value: $(starting bitcoin signet block height you want to sync from)
4.4. Create the config file lrz-submitter.yml
tx-relayer:
confirmationDepth: 1
netParams: signet
database:
host: 127.0.0.1
port: 3306
username: admin
password: admin
dbname: lorenzo
lorenzo:
key: submitter
key-directory: ../lorenzo/.keys/
keyring-backend: test
chain-id: lorenzo_83291-1
rpc-addr: http://localhost:26657
account-prefix: lrz
gas-adjustment: 1.5
gas-prices: 0alrz
debug: true
timeout: 20s
output-format: json
sign-mode: direct
Please replace the above mysql connection params to your own.
4.5. Start the submitter
lrz-btcstaking-submitter -config ./lrz-submitter.yml
Last updated