1+ name : Run Setup Script
2+
3+ on :
4+ push :
5+ branches :
6+ - main # Trigger on pushes to the main branch
7+
8+ jobs :
9+ bitcoin-setup :
10+ runs-on : ubuntu-latest # Use the latest Ubuntu environment
11+
12+ steps :
13+ - name : Checkout repository
14+ uses : actions/checkout@v4 # Check out the repository code
15+
16+ - name : Cache Bitcoin Core
17+ id : cache-bitcoin
18+ uses : actions/cache@v3
19+ with :
20+ path : |
21+ bitcoin-28.0
22+ bitcoin-28.0-x86_64-linux-gnu.tar.gz
23+ key : bitcoin-core-28.0
24+
25+ - name : Setup Bitcoin Core
26+ run : |
27+ if [ "${{ steps.cache-bitcoin.outputs.cache-hit }}" != 'true' ]; then
28+ wget https://bitcoincore.org/bin/bitcoin-core-28.0/bitcoin-28.0-x86_64-linux-gnu.tar.gz
29+ tar -xzvf bitcoin-28.0-x86_64-linux-gnu.tar.gz
30+ fi
31+ sudo bash .github/setup.sh
32+
33+ - name : Start bitcoind in regtest mode
34+ run : |
35+ bitcoind -regtest -daemon
36+ echo "Waiting for bitcoind to be ready..."
37+
38+ # Wait for bitcoind to start (max 30s)
39+ for i in {1..30}; do
40+ if bitcoin-cli -regtest getblockchaininfo > /dev/null 2>&1; then
41+ echo "bitcoind is ready!"
42+ break
43+ fi
44+ echo "Still waiting for bitcoind..."
45+ sleep 1
46+ done
47+
48+ - name : Verify Bitcoin CLI version
49+ run : |
50+ BITCOIN_VERSION=$(submission/01.sh)
51+ echo "Bitcoin CLI Version: $BITCOIN_VERSION"
52+
53+ if [[ $BITCOIN_VERSION == *"28"* ]]; then
54+ echo "Success: Bitcoin CLI version"
55+ else
56+ echo "Error: Bitcoin CLI version failed"
57+ exit 1
58+ fi
59+
60+ - name : Verify Bitcoin chain
61+ run : |
62+ chmod +x submission/02.sh
63+ CHAIN=$(submission/02.sh)
64+ echo "Bitcoin chain: $CHAIN"
65+ if [[ "$CHAIN" == "regtest" ]]; then
66+ echo "Chain verification passed!"
67+ else
68+ echo "Chain verification failed!"
69+ exit 1
70+ fi
71+
72+ - name : Verify Wallet Creation
73+ run : |
74+ chmod +x submission/03.sh
75+ WALLET=$(submission/03.sh)
76+ if [[ "$WALLET" == *"btrustwallet"* ]]; then
77+ echo "Wallet creation passed!"
78+ else
79+ echo "Wallet creation failed!"
80+ exit 1
81+ fi
82+
83+ - name : Verify Wallet Balance Check
84+ run : |
85+ chmod +x submission/04.sh
86+ BALANCE=$(submission/04.sh)
87+ if [[ "$BALANCE" == "0.00000000" ]]; then
88+ echo "Wallet balance check passed!"
89+ else
90+ echo "Wallet balance check failed!"
91+ exit 1
92+ fi
93+
94+ - name : Verify Legacy Address Generation
95+ run : |
96+ chmod +x submission/05.sh
97+ LEGACY_ADDRESS=$(submission/05.sh)
98+ echo "LEGACY_ADDRESS=$LEGACY_ADDRESS" >> $GITHUB_ENV
99+ if [[ "$LEGACY_ADDRESS" =~ ^[mn][a-km-zA-HJ-NP-Z1-9]{25,34}$ ]]; then
100+ echo "Legacy address generation passed!"
101+ else
102+ echo "Legacy address generation failed!"
103+ exit 1
104+ fi
105+
106+ - name : Verify P2SH Address Generation
107+ run : |
108+ chmod +x submission/06.sh
109+ P2SH_ADDRESS=$(submission/06.sh)
110+ echo "P2SH_ADDRESS=$P2SH_ADDRESS" >> $GITHUB_ENV
111+ if [[ "$P2SH_ADDRESS" =~ ^2[0-9a-zA-Z]{25,34}$ ]]; then
112+ echo "P2SH address generation passed!"
113+ else
114+ echo "P2SH address generation failed!"
115+ exit 1
116+ fi
117+
118+ - name : Verify Native SegWit Address Generation
119+ run : |
120+ chmod +x submission/07.sh
121+ NATIVE_SEGWIT_ADDRESS=$(submission/07.sh)
122+ echo "NATIVE_SEGWIT_ADDRESS=$NATIVE_SEGWIT_ADDRESS" >> $GITHUB_ENV
123+ if [[ "$NATIVE_SEGWIT_ADDRESS" =~ ^bcrt1[ac-hj-np-z02-9]{8,87}$ ]]; then
124+ echo "Native SegWit address generation passed!"
125+ else
126+ echo "Native SegWit address generation failed!"
127+ exit 1
128+ fi
129+
130+ - name : Verify Taproot Address Generation
131+ run : |
132+ chmod +x submission/08.sh
133+ TAPROOT_ADDRESS=$(submission/08.sh)
134+ echo "TAPROOT_ADDRESS=$TAPROOT_ADDRESS" >> $GITHUB_ENV
135+ if [[ "$TAPROOT_ADDRESS" =~ ^bcrt1p[ac-hj-np-z02-9]{8,87}$ ]]; then
136+ echo "Taproot address generation passed!"
137+ else
138+ echo "Taproot address generation failed!"
139+ exit 1
140+ fi
141+
142+ - name : Verify Address Validation
143+ run : |
144+ chmod +x submission/09.sh
145+ VALID=$(submission/09.sh)
146+ if [[ "$VALID" == "false" ]]; then
147+ echo "Address validation passed!"
148+ else
149+ echo "Address validation failed!"
150+ exit 1
151+ fi
152+
153+ - name : Verify Message Signature
154+ run : |
155+ chmod +x submission/10.sh
156+ VALID=$(submission/10.sh)
157+ if [[ "$VALID" == "true" ]]; then
158+ echo "Message verification passed!"
159+ else
160+ echo "Message verification failed!"
161+ exit 1
162+ fi
163+
164+ - name : Verify Taproot Address Using Descriptors
165+ run : |
166+ chmod +x submission/11.sh
167+ ACTUAL_OUTPUT=$(submission/11.sh)
168+ EXPECTED_OUTPUT="bcrt1puuky37nw03r8mzgnmhtvxg2cxxmzvdm5rvn362mtus3rayw6m2zqg5wwca"
169+ if [[ "$ACTUAL_OUTPUT" == "$EXPECTED_OUTPUT" ]]; then
170+ echo "Taproot address verification passed!"
171+ else
172+ echo "Taproot address verification failed!"
173+ exit 1
174+ fi
175+
0 commit comments