Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ RUST_LOG=debug
# required
ACTOR=Verifier

# optional, positive integer; must be identical on all participating nodes.
# Applies to newly created graphs only. Existing finalized graphs keep their original verifier slots.
MIN_REQUIRED_VERIFIER=1

# required
GOAT_GATEWAY_CONTRACT_ADDRESS=

Expand All @@ -25,4 +29,4 @@ GOAT_ADDRESS=
PROTO_NAME=bitvmt3

# setup bootnodes, separate multiple nodes by comma ",".
BOOTNODES=
BOOTNODES=
3 changes: 3 additions & 0 deletions deployment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ Create a `.env` file and include necessary environment variables:
| `GOAT_SWAP_EVENT_THE_GRAPH_URL` | The Graph URL for querying Swap events | Optional |
| `BOOTNODES` | Multiaddr of bootnodes for P2P discovery | Optional |
| `NODE_NAME` | The name of the node | Optional |
| `MIN_REQUIRED_VERIFIER` | Positive verifier-slot count for newly created graphs (default: `1`); must be identical on all participating nodes | Optional |

`MIN_REQUIRED_VERIFIER` changes the transaction topology of newly created graphs. It does not add Verifier slots to existing finalized graphs, which continue to use the slots embedded when they were created. Configure the same value on every Operator, Verifier, Committee, Watchtower, and Relayer node before creating new graphs.

## Roles Deployment

Expand Down
3 changes: 2 additions & 1 deletion deployment/regtest/bitvm-noded/committee_0/.env.committee_0
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ GOAT_CHAIN_URL=https://rpc.testnet3.goat.network
ENABLE_UPDATE_SPV_CONTRACT=true

# the graph config
MIN_REQUIRED_VERIFIER=1
GOAT_GATEWAY_CONTRACT_ADDRESS=
GOAT_GATEWAY_EVENT_THE_GRAPH_URL=
# block number to start filtering events from
Expand All @@ -32,4 +33,4 @@ GENESIS_SEQUENCER_COMMIT_TXID=

# libp2p config
PEER_KEY=
PROTO_NAME=bitvm_regtest
PROTO_NAME=bitvm_regtest
3 changes: 2 additions & 1 deletion deployment/regtest/bitvm-noded/committee_1/.env.committee_1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ BTC_CHAIN_URL=http://127.0.0.1:3002
GOAT_CHAIN_URL=https://rpc.testnet3.goat.network

# the graph config
MIN_REQUIRED_VERIFIER=1
GOAT_GATEWAY_CONTRACT_ADDRESS=
GOAT_GATEWAY_EVENT_THE_GRAPH_URL=
# block number to start filtering events from
Expand All @@ -28,4 +29,4 @@ GENESIS_SEQUENCER_COMMIT_TXID=
# libp2p config
PEER_KEY=
BOOTNODES=/ip4/127.0.0.1/tcp/8444/p2p/12D3KooWKmAQDFCibTTpKTi6Kwk9SmtLGDXhv5fEsc9gr1Vdcu4j
PROTO_NAME=bitvm_regtest
PROTO_NAME=bitvm_regtest
3 changes: 2 additions & 1 deletion deployment/regtest/bitvm-noded/operator_0/.env.operator_0
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ BTC_CHAIN_URL=http://127.0.0.1:3002
GOAT_CHAIN_URL=https://rpc.testnet3.goat.network

# the graph config
MIN_REQUIRED_VERIFIER=1
GOAT_GATEWAY_CONTRACT_ADDRESS=
GOAT_GATEWAY_EVENT_THE_GRAPH_URL=
# block number to start filtering events from
Expand Down Expand Up @@ -52,4 +53,4 @@ FGC_COMPACT_OUT_INDICES_PATH=
SGC_COMPACT_GATES_PATH=
SGC_COMPACT_OUT_INDICES_PATH=

ENABLE_BABE_SETUP_STATE_CLEANUP=true
ENABLE_BABE_SETUP_STATE_CLEANUP=true
3 changes: 2 additions & 1 deletion deployment/regtest/bitvm-noded/verifier_0/.env.verifier_0
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ BTC_CHAIN_URL=http://127.0.0.1:3002
GOAT_CHAIN_URL=https://rpc.testnet3.goat.network

# the graph config
MIN_REQUIRED_VERIFIER=1
GOAT_GATEWAY_CONTRACT_ADDRESS=
GOAT_GATEWAY_EVENT_THE_GRAPH_URL=
GOAT_GATEWAY_EVENT_FILTER_FROM=
Expand Down Expand Up @@ -47,4 +48,4 @@ FGC_COMPACT_OUT_INDICES_PATH=
SGC_COMPACT_GATES_PATH=
SGC_COMPACT_OUT_INDICES_PATH=

ENABLE_BABE_SETUP_STATE_CLEANUP=true
ENABLE_BABE_SETUP_STATE_CLEANUP=true
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ GOAT_CHAIN_URL=https://rpc.testnet3.goat.network
GOAT_PROOF_BUILD_URL=

# the graph config
MIN_REQUIRED_VERIFIER=1
GOAT_GATEWAY_CONTRACT_ADDRESS=
GOAT_GATEWAY_EVENT_THE_GRAPH_URL=
GOAT_GATEWAY_EVENT_FILTER_FROM=
Expand All @@ -26,4 +27,4 @@ PEER_KEY=
BOOTNODES=/ip4/127.0.0.1/tcp/8444/p2p/12D3KooWKmAQDFCibTTpKTi6Kwk9SmtLGDXhv5fEsc9gr1Vdcu4j
PROTO_NAME=bitvm_regtest

GENESIS_SEQUENCER_COMMIT_TXID=
GENESIS_SEQUENCER_COMMIT_TXID=
3 changes: 2 additions & 1 deletion deployment/testnet4/bitvm-noded/committee_0/.env.committee_0
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ GOAT_CHAIN_URL=https://rpc.testnet3.goat.network
ENABLE_UPDATE_SPV_CONTRACT=true

# the graph config
MIN_REQUIRED_VERIFIER=2
GOAT_GATEWAY_CONTRACT_ADDRESS=0x60a5b099eE011018DD064F9eBD50d381C37b5e8b
GOAT_GATEWAY_EVENT_THE_GRAPH_URL=https://graph.goat.network/subgraphs/name/bitvmt4_gateway_0x60a5
GOAT_GATEWAY_EVENT_FILTER_FROM=15908000
Expand All @@ -30,4 +31,4 @@ GOAT_PRIVATE_KEY=
PEER_KEY=
PROTO_NAME=bitvmt4

GENESIS_SEQUENCER_COMMIT_TXID=c2d816940391da550af23c7924f8d9ecd276cdf6a22a164fc44443f5eba6d4b5
GENESIS_SEQUENCER_COMMIT_TXID=c2d816940391da550af23c7924f8d9ecd276cdf6a22a164fc44443f5eba6d4b5
3 changes: 2 additions & 1 deletion deployment/testnet4/bitvm-noded/committee_1/.env.committee_1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ BTC_CHAIN_URL=https://mempool.space/testnet4/api
GOAT_CHAIN_URL=https://rpc.testnet3.goat.network

# the graph config
MIN_REQUIRED_VERIFIER=2
GOAT_GATEWAY_CONTRACT_ADDRESS=0x60a5b099eE011018DD064F9eBD50d381C37b5e8b
GOAT_GATEWAY_EVENT_THE_GRAPH_URL=https://graph.goat.network/subgraphs/name/bitvmt4_gateway_0x60a5
GOAT_GATEWAY_EVENT_FILTER_FROM=15908000
Expand All @@ -26,4 +27,4 @@ PEER_KEY=
BOOTNODES=/ip4/16.146.8.146/tcp/8445/p2p/12D3KooWCrPTAmhFdC5DBGgkxZvJi6iuSeiDWKRL87isrt4iMHXv
PROTO_NAME=bitvmt4

GENESIS_SEQUENCER_COMMIT_TXID=c2d816940391da550af23c7924f8d9ecd276cdf6a22a164fc44443f5eba6d4b5
GENESIS_SEQUENCER_COMMIT_TXID=c2d816940391da550af23c7924f8d9ecd276cdf6a22a164fc44443f5eba6d4b5
3 changes: 2 additions & 1 deletion deployment/testnet4/bitvm-noded/operator_0/.env.operator_0
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ GOAT_PROOF_BUILD_URL=
GOAT_CHAIN_URL=https://rpc.testnet3.goat.network

# the graph config
MIN_REQUIRED_VERIFIER=2
GOAT_GATEWAY_CONTRACT_ADDRESS=0x60a5b099eE011018DD064F9eBD50d381C37b5e8b
GOAT_GATEWAY_EVENT_THE_GRAPH_URL=https://graph.goat.network/subgraphs/name/bitvmt4_gateway_0x60a5
GOAT_GATEWAY_EVENT_FILTER_FROM=15908000
Expand Down Expand Up @@ -47,4 +48,4 @@ FGC_COMPACT_OUT_INDICES_PATH=
SGC_COMPACT_GATES_PATH=
SGC_COMPACT_OUT_INDICES_PATH=

ENABLE_BABE_SETUP_STATE_CLEANUP=true
ENABLE_BABE_SETUP_STATE_CLEANUP=true
3 changes: 2 additions & 1 deletion deployment/testnet4/bitvm-noded/verifier_0/.env.verifier_0
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ BTC_CHAIN_URL=https://mempool.space/testnet4/api
GOAT_CHAIN_URL=https://rpc.testnet3.goat.network

# the graph config
MIN_REQUIRED_VERIFIER=2
GOAT_GATEWAY_CONTRACT_ADDRESS=0x60a5b099eE011018DD064F9eBD50d381C37b5e8b
GOAT_GATEWAY_EVENT_THE_GRAPH_URL=https://graph.goat.network/subgraphs/name/bitvmt4_gateway_0x60a5
GOAT_GATEWAY_EVENT_FILTER_FROM=15908000
Expand Down Expand Up @@ -48,4 +49,4 @@ FGC_COMPACT_OUT_INDICES_PATH=
SGC_COMPACT_GATES_PATH=
SGC_COMPACT_OUT_INDICES_PATH=

ENABLE_BABE_SETUP_STATE_CLEANUP=true
ENABLE_BABE_SETUP_STATE_CLEANUP=true
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ GOAT_CHAIN_URL=https://rpc.testnet3.goat.network
GOAT_PROOF_BUILD_URL=

# the graph config
MIN_REQUIRED_VERIFIER=2
GOAT_GATEWAY_CONTRACT_ADDRESS=0x60a5b099eE011018DD064F9eBD50d381C37b5e8b
GOAT_GATEWAY_EVENT_THE_GRAPH_URL=https://graph.goat.network/subgraphs/name/bitvmt4_gateway_0x60a5
GOAT_GATEWAY_EVENT_FILTER_FROM=15908000
Expand All @@ -26,4 +27,4 @@ PEER_KEY=
BOOTNODES=/ip4/16.146.8.146/tcp/8445/p2p/12D3KooWCrPTAmhFdC5DBGgkxZvJi6iuSeiDWKRL87isrt4iMHXv
PROTO_NAME=bitvmt4

GENESIS_SEQUENCER_COMMIT_TXID=c2d816940391da550af23c7924f8d9ecd276cdf6a22a164fc44443f5eba6d4b5
GENESIS_SEQUENCER_COMMIT_TXID=c2d816940391da550af23c7924f8d9ecd276cdf6a22a164fc44443f5eba6d4b5
12 changes: 12 additions & 0 deletions node/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ pub const ENV_PROOF_SEVER_URL: &str = "PROOF_SEVER_URL";
pub const ENV_ACTOR: &str = "ACTOR";
pub const ENV_IPFS_ENDPOINT: &str = "IPFS_ENDPOINT";
pub const ENV_COMMITTEE_NUM: &str = "COMMITTEE_NUM";
pub const ENV_MIN_REQUIRED_VERIFIER: &str = "MIN_REQUIRED_VERIFIER";
pub const ENV_EXTERNAL_SOCKET_ADDR: &str = "EXTERNAL_SOCKET_ADDR";
pub const COMMITTEE_INSTANCE_KEYS_DIR: &str = "cache/committee-instance-keys/";
pub const SCRIPT_CACHE_FILE_NAME: &str = "cache/partial_script.bin";
Expand All @@ -69,6 +70,7 @@ pub const DUST_AMOUNT: u64 = goat::transactions::base::DUST_AMOUNT;
pub const MAX_CUSTOM_INPUTS: usize = 100;

pub const DEFAULT_CONFIRMATION_TARGET: u16 = 1;
pub const DEFAULT_MIN_REQUIRED_VERIFIER: usize = 1;

pub const ENV_BITCOIN_NETWORK: &str = "BITCOIN_NETWORK";
pub const ENV_GOAT_NETWORK: &str = "GOAT_NETWORK";
Expand Down Expand Up @@ -577,6 +579,16 @@ pub fn get_operator_proof_wait_secs() -> usize {
.unwrap_or(DEFAULT_OPERATOR_PROOF_WAIT_SECS)
}

pub fn get_min_required_verifier() -> anyhow::Result<usize> {
match std::env::var(ENV_MIN_REQUIRED_VERIFIER) {
Err(std::env::VarError::NotPresent) => Ok(DEFAULT_MIN_REQUIRED_VERIFIER),
Err(error) => Err(anyhow::anyhow!("failed to read {ENV_MIN_REQUIRED_VERIFIER}: {error}")),
Ok(value) => value.parse::<usize>().ok().filter(|value| *value > 0).ok_or_else(|| {
anyhow::anyhow!("{ENV_MIN_REQUIRED_VERIFIER} must be a positive integer, got {value:?}")
}),
}
}

pub fn get_soldering_proof_payload_store_path() -> anyhow::Result<String> {
let value = std::env::var(ENV_SOLDERING_PROOF_PAYLOAD_STORE_PATH)
.map_err(|_| anyhow::anyhow!("{ENV_SOLDERING_PROOF_PAYLOAD_STORE_PATH} needs to be set"))?;
Expand Down
Loading
Loading