Skip to content

Commit 0c3f9b5

Browse files
committed
first commit
0 parents  commit 0c3f9b5

26 files changed

Lines changed: 222 additions & 0 deletions

.github/setup.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
wget https://bitcoincore.org/bin/bitcoin-core-28.0/bitcoin-28.0-x86_64-linux-gnu.tar.gz
2+
tar -xzvf bitcoin-28.0-x86_64-linux-gnu.tar.gz
3+
ln -s $PWD/bitcoin-28.0/bin/* /usr/local/bin/
4+
mkdir -p ~/.bitcoin
5+
echo "rpcconnect=165.22.121.70" >> ~/.bitcoin/bitcoin.conf
6+
echo "rpcuser=btrustbuildersrpc" >> ~/.bitcoin/bitcoin.conf
7+
echo "rpcpassword=btrustbuilderspass" >> ~/.bitcoin/bitcoin.conf
8+
echo $(bitcoin-cli --version)

.github/workflows/main.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
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: Setup Bitcoin Core
17+
run: |
18+
sudo bash .github/setup.sh
19+
20+
- name: Get latest block in signet mode
21+
run: |
22+
bitcoin-cli getblockhash 243833
23+
24+
- name: 01.sh - Verify Hash Block
25+
run: |
26+
chmod +x submission/01.sh
27+
HASH=$(submission/01.sh)
28+
if [[ "$HASH" == "000000b024f11595795f0be5974229f786df389c8b92e92b61890e9e3c6b8d8a" ]]; then
29+
echo "✅ Success: Verify Hash Block passed!"
30+
else
31+
echo "❌ Error: Verify Hash Block failed!"
32+
exit 1
33+
fi
34+
35+
- name: 02.sh - Verify Input Count
36+
run: |
37+
chmod +x submission/02.sh
38+
COUNT=$(submission/02.sh)
39+
if [[ "$COUNT" == "442" ]]; then
40+
echo "✅ Success: Input Count verification passed!"
41+
else
42+
echo "❌ Error: Input Count verification failed!"
43+
exit 1
44+
fi
45+
46+
- name: 03.sh - Verify Transaction
47+
run: |
48+
chmod +x submission/03.sh
49+
TX=$(submission/03.sh)
50+
EXPECTED=0e302b600d32b86c3362647f422e5605165a1e5c89c760d0d972e102f390c84e
51+
if [[ "$TX" == "$EXPECTED" ]]; then
52+
echo "✅ Success: Transaction verification passed!"
53+
else
54+
echo "❌ Error: Transaction verification failed!"
55+
exit 1
56+
fi
57+
58+
- name: 04.sh - Verify Public Key Signer
59+
run: |
60+
chmod +x submission/04.sh
61+
PUBKEY=$(submission/04.sh)
62+
EXPECTED_OUTPUT=02c6c9306ade30f9711c9503cdaa94094efc025acb9be7845acc49e1cb475952c6
63+
if [[ "$PUBKEY" == "$EXPECTED_OUTPUT" ]]; then
64+
echo "✅ Success: Public Key Signer verification passed!"
65+
else
66+
echo "❌ Error: Public Key Signer verification failed!"
67+
exit 1
68+
fi
69+
70+
- name: 05.sh - Verify TX Fee
71+
run: |
72+
chmod +x submission/05.sh
73+
FEE=$(submission/05.sh)
74+
if [[ "$FEE" == "696" ]]; then
75+
echo "✅ Success: TX Fee verification passed!"
76+
else
77+
echo "❌ Error: TX Fee verification failed!"
78+
exit 1
79+
fi
80+
81+
- name: 06.sh - Verify TX Fee
82+
run: |
83+
chmod +x submission/06.sh
84+
FEE=$(submission/06.sh)
85+
if [[ "$FEE" == "696" ]]; then
86+
echo "✅ Success: TX Fee verification passed!"
87+
else
88+
echo "❌ Error: TX Fee verification failed!"
89+
exit 1
90+
fi
91+
92+
- name: 07.sh - Verify Coinbase TX
93+
run: |
94+
chmod +x submission/07.sh
95+
COINBASE=$(submission/07.sh)
96+
EXPECTED_OUTPUT=7ab200e41b53d974f757535c01a715aae6b1322a30753c1d2b0ea201500bc060
97+
if [[ "$COINBASE" == "$EXPECTED_OUTPUT" ]]; then
98+
echo "✅ Success: Coinbase TX verification passed!"
99+
else
100+
echo "❌ Error: Coinbase TX verification failed!"
101+
exit 1
102+
fi
103+
104+
- name: 08.sh - Verify TX Block Height
105+
run: |
106+
chmod +x submission/08.sh
107+
HEIGHT=$(submission/08.sh)
108+
if [[ "$HEIGHT" == "243859" ]]; then
109+
echo "✅ Success: TX Block Height verification passed!"
110+
else
111+
echo "❌ Error: TX Block Height verification failed!"
112+
exit 1
113+
fi

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Btrust Builders: LBCLI Final Capstone Exercise
2+
3+
## Instructions
4+
5+
Exercise should be done using the [Signet](https://mempool.space/signet) test network.
6+
7+
A remote Signet node has been created for this exercise, all you have to do is to send bitcoin-cli commands to it.
8+
9+
You need to add these lines to your `bitcoin.conf` file to connect to it:
10+
11+
```
12+
signet=1
13+
[signet]
14+
rpcuser=btrustbuildersrpc
15+
rpcpassword=btrustbuilderspass
16+
rpcconnect=165.22.121.70
17+
```
18+
19+
...and then execute `bitcoin-cli -signet getblockchaininfo`.
20+
21+
Using the command above with return an object containing various state info regarding the blockchain on Signet which you can confirm on `https://mempool.space/signet`.
22+
23+
*HINT*: Use `bitcoin-cli help` and `bitcoin-cli help <command name>` to learn what commands are available and what they do.
24+
You can also check out [Bitcoin Core RPC API Reference docs](https://developer.bitcoin.org/reference/rpc/index.html)
25+
26+
*NOTE*: You don't need to start a local bitcoin daemon, just use the `bitcoin-cli` command to execute RPC commands to the remote Signet node.
27+
28+
29+
## Expected submissions
30+
31+
1. Fork this repository.
32+
2. Go to the `Actions` tab and enable github workflow for your repository by clicking `I understand my ...`
33+
34+
<img src="https://github.com/btrust-builders/lbcli-final-capstone-project/blob/main/enable-github-actions.png" width="500" />
35+
36+
3. Clone your fork to your local computer.
37+
4. Add your bitcoin cli commands to the script files: `01.sh to 09.sh` in the `submission` folder. Example:
38+
```sh
39+
$ bitcoin-cli -signet getblockcount
40+
```
41+
5. Commit and push your changes to the `main` branch of your remote fork.
42+
43+
6. Confirm your forked repository has a green check mark.
44+
45+
<img src="https://github.com/btrust-builders/lbcli-final-capstone-project/blob/main/success.png" width="1000" />
46+
47+
7. For the final exercise, follow instructions in `FINAL-TASK.TXT` file and update all other `xxx.txt` files.
48+
49+
8. Submit your solution to this form: [Google form](https://forms.gle/eDRGAJXpLqRxEExR6).
50+
51+
PS: You can commit and push as often as you like and GitHub Actions will re-evaluate your code every time.
52+
You will need to look through the auto-grader logs (in the "Actions" tab) to see what exactly you got right or wrong.

enable-github-actions.png

47.8 KB
Loading

submission/01.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# What is the hash of block 243,833?

submission/02.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# How many new outputs were created by block 243,825?

submission/03.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Which tx in block 216,351 spends the coinbase output of block 216,128?

submission/04.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Which public key signed input 0 in this tx: d948454ceab1ad56982b11cf6f7157b91d3c6c5640e05c041cd17db6fff698f7

submission/05.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# How many satoshis did this transaction pay for fee?: b71fb9ab7707407cc7265591e0c0d47d07afede654f91de1f63c0cb522914bcb

submission/06.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Only one tx in block 243,821 signals opt-in RBF. What is its txid?

0 commit comments

Comments
 (0)