-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose-via.yml
125 lines (110 loc) · 4.47 KB
/
docker-compose-via.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
version: '3.8'
services:
bitcoind:
image: 'lightninglabs/bitcoin-core:27'
command:
- -regtest
- -server
- -rpcbind=0.0.0.0
- -rpcallowip=0.0.0.0/0
- -rpcuser=rpcuser
- -rpcpassword=rpcpassword
- -fallbackfee=0.0002
- -txindex
- -printtoconsole
- -dustrelayfee=0.0
- -minrelaytxfee=0
ports:
- '18443:18443' # RPC port
- '18444:18444' # P2P port
volumes:
- type: bind
source: ./volumes/bitcoin
target: /home/bitcoin/.bitcoin
environment:
- BITCOIN_DATA=/home/bitcoin/.bitcoin
bitcoin-cli:
image: 'lightninglabs/bitcoin-core:27'
depends_on:
- bitcoind
volumes:
- type: bind
source: ./volumes/bitcoin
target: /home/bitcoin/.bitcoin
entrypoint: /bin/sh
command:
- -c
- |
set -e
apt-get update && apt-get install -y jq
bitcoin-cli $${RPC_ARGS} createwallet Alice
ALICE_ADDRESS=$(bitcoin-cli $${RPC_ARGS} -rpcwallet=Alice getnewaddress)
echo "Alice's address: $${ALICE_ADDRESS}"
bitcoin-cli $${RPC_ARGS} generatetoaddress 201 $${ALICE_ADDRESS}
echo "TEST_ADDRESS: $${TEST_ADDRESS}"
bitcoin-cli $${RPC_ARGS} -rpcwallet=Alice sendtoaddress $${TEST_ADDRESS} 300
echo "Sent 300 BTC to TEST_ADDRESS: $${TEST_ADDRESS}"
echo "VERIFIER_1_ADDRESS: $${VERIFIER_1_ADDRESS}"
bitcoin-cli $${RPC_ARGS} -rpcwallet=Alice sendtoaddress $${VERIFIER_1_ADDRESS} 300
echo "Sent 300 BTC to VERIFIER_1_ADDRESS: $${VERIFIER_1_ADDRESS}"
echo "VERIFIER_2_ADDRESS: $${VERIFIER_2_ADDRESS}"
bitcoin-cli $${RPC_ARGS} -rpcwallet=Alice sendtoaddress $${VERIFIER_2_ADDRESS} 300
echo "Sent 300 BTC to VERIFIER_2_ADDRESS: $${VERIFIER_2_ADDRESS}"
echo "VERIFIER_3_ADDRESS: $${VERIFIER_3_ADDRESS}"
bitcoin-cli $${RPC_ARGS} -rpcwallet=Alice sendtoaddress $${VERIFIER_3_ADDRESS} 300
echo "Sent 300 BTC to VERIFIER_3_ADDRESS: $${VERIFIER_3_ADDRESS}"
bitcoin-cli $${RPC_ARGS} generatetoaddress 6 $${ALICE_ADDRESS}
RAW_DESCRIPTOR=$$(bitcoin-cli $${RPC_ARGS} -rpcwallet=Alice getdescriptorinfo "addr($${TEST_ADDRESS})")
DESCRIPTOR=$$(echo "$${RAW_DESCRIPTOR}" | jq -r ".descriptor")
echo "Descriptor: $${DESCRIPTOR}"
bitcoin-cli $${RPC_ARGS} createwallet Watcher true true "" false true
IMPORT_DESCRIPTOR="[ { \"desc\": \"$${DESCRIPTOR}\", \"timestamp\": \"now\", \"watchonly\": true } ]"
echo "Importing descriptor into Watcher wallet: $${IMPORT_DESCRIPTOR}"
bitcoin-cli $${RPC_ARGS} -rpcwallet=Watcher importdescriptors "$${IMPORT_DESCRIPTOR}"
bitcoin-cli $${RPC_ARGS} -rpcwallet=Watcher rescanblockchain
while true; do
MEMPOOL_COUNT=$(bitcoin-cli $${RPC_ARGS} getmempoolinfo | jq -r '.size')
echo "Mempool transaction count: $${MEMPOOL_COUNT}"
if [ "$${MEMPOOL_COUNT}" -gt 0 ]; then
echo "Transactions found in mempool: $${MEMPOOL_COUNT}. Generating a block..."
bitcoin-cli $${RPC_ARGS} generatetoaddress 1 $${ALICE_ADDRESS}
else
echo "No transactions in mempool. Skipping block generation..."
fi
sleep $${SLEEP_SECONDS} &
wait $!
done
environment:
- BITCOIN_DATA=/home/bitcoin/.bitcoin
- TEST_ADDRESS=bcrt1qx2lk0unukm80qmepjp49hwf9z6xnz0s73k9j56
- VERIFIER_1_ADDRESS=bcrt1qw2mvkvm6alfhe86yf328kgvr7mupdx4vln7kpv
- VERIFIER_2_ADDRESS=bcrt1qk8mkhrmgtq24nylzyzejznfzws6d98g4kmuuh4
- VERIFIER_3_ADDRESS=bcrt1q23lgaa90s85jvtl6dsrkvn0g949cwjkwuyzwdm
- RPC_ARGS=-chain=regtest -rpcconnect=bitcoind -rpcwait -rpcuser=rpcuser -rpcpassword=rpcpassword
- SLEEP_SECONDS=5
postgres:
image: 'postgres:14'
command: postgres -c 'max_connections=200'
ports:
- '127.0.0.1:5432:5432'
volumes:
- type: bind
source: ./volumes/postgres
target: /var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=notsecurepassword
celestia-node:
image: "ghcr.io/celestiaorg/celestia-node:v0.20.2-arabica"
container_name: celestia-node
volumes:
- type: bind
source: ./volumes/celestia
target: /home/celestia
command: celestia light start --core.ip validator-2.celestia-arabica-11.com --p2p.network arabica
ports:
- '26658:26658'
environment:
- NODE_TYPE=light
- P2P_NETWORK=arabica
volumes:
bitcoin_data: