Skip to content

Commit

Permalink
chore: Instructions for fp registration for bbn-test-4 (babylonchain#18)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Rafael Tenfen <[email protected]>
  • Loading branch information
vitsalis and RafilxTenfen authored May 10, 2024
1 parent bcb0dfc commit 7b5c90d
Show file tree
Hide file tree
Showing 5 changed files with 425 additions and 0 deletions.
175 changes: 175 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
version: 2.1

orbs:
go: circleci/[email protected]

jobs:
build-eotsd:
machine:
image: ubuntu-2204:2024.01.1
steps:
- restore_cache:
keys:
- eotsd-ae30623a634450db81ce1755839754cc822bf5e5
- go/install:
version: "1.21.4"
- run:
command: |
if [ ! -f /home/circleci/.go_workspace/bin/eotsd ]; then
git clone https://github.com/babylonchain/finality-provider.git
cd finality-provider
git checkout ae30623a634450db81ce1755839754cc822bf5e5
mkdir -p /home/circleci/go/bin/
make install
fi
- save_cache:
key: eotsd-ae30623a634450db81ce1755839754cc822bf5e5
paths:
- /home/circleci/.go_workspace/bin/eotsd

build-stakercli:
machine:
image: ubuntu-2204:2024.01.1
steps:
- restore_cache:
keys:
- stakercli-f2a83d1c3b00d8de2c8cf7cc3dda9d446201a8ce
- go/install:
version: "1.21.4"
- run:
command: |
if [ ! -f /home/circleci/.go_workspace/bin/stakercli ]; then
git clone https://github.com/babylonchain/btc-staker.git
cd btc-staker
git checkout f2a83d1c3b00d8de2c8cf7cc3dda9d446201a8ce
mkdir -p /home/circleci/go/bin/
make install
fi
- save_cache:
key: stakercli-f2a83d1c3b00d8de2c8cf7cc3dda9d446201a8ce
paths:
- /home/circleci/.go_workspace/bin/stakercli

verify-sig:
machine:
image: ubuntu-2204:2024.01.1
steps:
- checkout
- restore_cache:
keys:
- fpdiff-{{ epoch }}
- eotsd-ae30623a634450db81ce1755839754cc822bf5e5
- run:
command: |
ALL_CHANGED_FILES=$(git diff main --name-only **/finality-providers/registry/)
echo "ALL_CHANGED_FILES" $ALL_CHANGED_FILES
for filePathRegistryFP in ${ALL_CHANGED_FILES}; do
echo "verify" "$filePathRegistryFP"
moniker=$(cat "$filePathRegistryFP" | jq -r '.description.moniker')
echo "fp moniker:" $moniker
if [ ${#moniker} -lt 3 ]; then
echo $moniker "has less than 3 characteres"
exit 1
fi
nickname=$(basename "$filePathRegistryFP" .json)
echo "fp nickname:" $nickname
btcPk=$(cat "$filePathRegistryFP" | jq -r '.btc_pk')
echo "fp btcpk:" $btcPk
baseDir=$(dirname $filePathRegistryFP)
signature=$(cat "$baseDir/../sigs/$nickname.sig" | xargs)
echo "fp signature:" $signature
/home/circleci/.go_workspace/bin/eotsd verify-schnorr-sig "$filePathRegistryFP" --btc-pk $btcPk --signature $signature
echo
echo "✅ '${nickname}' is a valid fp"
done
verify-offchain-signed-tx:
machine:
image: ubuntu-2204:2024.01.1
steps:
- checkout
- restore_cache:
keys:
- stakercli-f2a83d1c3b00d8de2c8cf7cc3dda9d446201a8ce
- run:
command: |
ALL_CHANGED_FILES=$(git diff main --name-only **/finality-providers/registry/)
echo "ALL_CHANGED_FILES" $ALL_CHANGED_FILES
if [ -z "$ALL_CHANGED_FILES" ]; then
echo "No finality provider modified"
else
sudo wget https://github.com/CosmWasm/wasmvm/releases/download/v1.5.2/libwasmvm.x86_64.so \
-O /lib/libwasmvm.x86_64.so
export LD_LIBRARY_PATH=/lib/libwasmvm.x86_64.so:$LD_LIBRARY_PATH
for filePathRegistryFP in ${ALL_CHANGED_FILES}; do
echo "verify" "$filePathRegistryFP"
signedTx=$(cat "$filePathRegistryFP" | jq -r '.deposit.signed_tx')
btcPk=$(cat "$filePathRegistryFP" | jq -r '.btc_pk')
/home/circleci/.go_workspace/bin/stakercli transaction check-phase1-staking-transaction \
--covenant-committee-pks 50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0 --covenant-quorum 1 \
--magic-bytes 62627434 --network signet --staking-transaction $signedTx --finality-provider-pk $btcPk \
--staking-time 52560 --staking-amount=10000000
nickname=$(basename "$filePathRegistryFP" .json)
echo
echo "✅ '${nickname}' has a valid self locking deposit"
done
fi
verify-onchain-BTC-tx:
machine:
image: ubuntu-2204:2024.01.1
steps:
- checkout
- run:
command: |
ALL_CHANGED_FILES=$(git diff main --name-only **/finality-providers/registry/)
echo "ALL_CHANGED_FILES" $ALL_CHANGED_FILES
for filePathRegistryFP in ${ALL_CHANGED_FILES}; do
echo "verify" "$filePathRegistryFP"
signedTx=$(cat "$filePathRegistryFP" | jq -r '.deposit.signed_tx')
txHash=$(cat "$filePathRegistryFP" | jq -r '.deposit.tx_hash')
onchainTx=$(curl https://signet.bitcoinexplorer.org/api/tx/$txHash | jq)
confirmations=$(echo $onchainTx | jq -r '.confirmations')
signedTxOnChain=$(echo $onchainTx | jq -r '.hex')
if [[ "$confirmations" -lt "6" ]]; then
echo "The tx ${txHash} has ${confirmations}, it should have at least 6"
exit 1
fi
if [[ $signedTx != $signedTxOnChain ]]; then
echo "Signed tx in json ${signedTx} is different than signed tx on signet ${signedTxOnChain}"
exit 1
fi
nickname=$(basename "$filePathRegistryFP" .json)
echo
echo "✅ '${nickname}' has a valid on chain btc tx"
done
workflows:
New-FP:
jobs:
- build-eotsd
- build-stakercli
- verify-onchain-BTC-tx
- verify-sig:
requires:
- build-eotsd
- verify-offchain-signed-tx:
requires:
- build-stakercli
20 changes: 20 additions & 0 deletions bbn-test-4/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Bitcoin Staking Registry

The next testnet (`bbn-test-4`) will focus on the security of the
staked Bitcoins by only testing the user’s interaction with the
BTC signet network.
This will be a lock-only network without a Babylon chain operating,
meaning that the only participants of this testnet will be finality providers
and Bitcoin stakers.

This repository serves as an information registry for this system,
since there is no PoS chain to store system information.
Such information includes:
1. [Finality Providers Information](./finality-providers)
which contains additional information about
finality providers participating in the system such as their monikers,
committed commission, and other identifying information.
Finality providers wishing to register more information about them to
display on the testnet web interfaces, should submit their information
there.
2. System parameters: To be released closer to the launch date.
Loading

0 comments on commit 7b5c90d

Please sign in to comment.