Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

listen for new block hashes via ZMQ + fetch block templates via RPC #54

Merged
merged 30 commits into from Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a5186f9
add .idea to .gitignore
bernardoaraujor Oct 6, 2023
82a2cf8
bootstrap template listener
bernardoaraujor Oct 6, 2023
2feaf6a
add mutinynet deployment
bernardoaraujor Oct 6, 2023
45e89b3
rm .idea from .gitignore
bernardoaraujor Oct 7, 2023
0dfff53
remove dev-focused default values from clap
bernardoaraujor Oct 7, 2023
4c1b00d
rename block_template module
bernardoaraujor Oct 7, 2023
4164c76
Revert "add mutinynet deployment"
bernardoaraujor Oct 7, 2023
636cebe
add rpc cli args intructions to REAMDE.md
bernardoaraujor Oct 7, 2023
98e8811
exponential backoff for failed getblocktemplate RPCs
bernardoaraujor Oct 7, 2023
ddc60a3
fmt
bernardoaraujor Oct 7, 2023
bc227cc
use expect for checked_pow
bernardoaraujor Oct 7, 2023
2802171
print getblocktemplate RPC error
bernardoaraujor Oct 7, 2023
8ba9586
listen for hashblock ZMQ notifications
bernardoaraujor Oct 11, 2023
4aa82cd
Merge branch 'main' into template-listener
bernardoaraujor Oct 12, 2023
e937bd8
fmt
bernardoaraujor Oct 12, 2023
8263dda
add env_logger
bernardoaraujor Oct 12, 2023
46eff5a
Merge branch 'main' into template-listener
bernardoaraujor Oct 17, 2023
d4d9e29
use tokio-bitcoincore-zmq
bernardoaraujor Oct 21, 2023
1f027b5
re-modularize
bernardoaraujor Oct 21, 2023
389e52f
cleanup
bernardoaraujor Oct 21, 2023
5f25a7f
use bitcoincore-zmq with async feature
bernardoaraujor Oct 22, 2023
ec6a939
use rust-bitcoincore-zmq main branch
bernardoaraujor Oct 24, 2023
1244cb4
check if rpc is alive
bernardoaraujor Nov 8, 2023
bf2df93
specify zmq hashblock listener
bernardoaraujor Nov 8, 2023
e122da3
add instructions for zmqpubhashblock
bernardoaraujor Nov 9, 2023
b8a5088
fmt
bernardoaraujor Nov 9, 2023
18f7ad7
Get cookie auth working
Dec 11, 2023
2e3ac3c
Merge pull request #2 from mcelrath/template-listener
bernardoaraujor Dec 18, 2023
d05ea99
update Cargo.lock
bernardoaraujor Dec 18, 2023
b6279b7
improve error handling for cookie auth
bernardoaraujor Dec 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -15,4 +15,5 @@ proposal/proposal.bbl
proposal/proposal.blg
simulations/logs/*
simulations/*.toolbox
venv
venv
.idea
bernardoaraujor marked this conversation as resolved.
Show resolved Hide resolved
19 changes: 16 additions & 3 deletions README.md
Expand Up @@ -19,11 +19,24 @@ The goals of the pool are:
miners on the pool.
4. Provide building blocks for enabling a futures market of hash rates.

# Running the node
# Running a mutinynet node

For the moment, the node runs a simple p2p broadcast. To run it you need to do
the usual cargo things
As a strategy to optimize the development workflow, you should use [mutinynet](https://mutinynet.com/) (a modified `signet` with 30s block time). You can
start a local node via
```
cd mutinynet
./run.sh
cd ..
```

The node RPC will be available on `0.0.0.0:38332` with username `braidpooldev` and password `braidpooldev`.

# Running the braidpool node

For the moment, the braidpool node runs a simple p2p broadcast.
It also connects to a bitcoin RPC node to get new block templates.

To run the braidpool node you need to do the usual cargo things:
```
cd node
cargo build
Expand Down
26 changes: 26 additions & 0 deletions mutinynet/Dockerfile
@@ -0,0 +1,26 @@
FROM debian:buster-slim as builder

ARG BITCOIN_VERSION="d8434da3c14e"
ARG TRIPLET=${TRIPLET:-"x86_64-linux-gnu"}

RUN apt-get update && \
apt-get install -qq --no-install-recommends ca-certificates dirmngr gosu wget libc6 procps python3
WORKDIR /tmp

# install bitcoin binaries
RUN BITCOIN_URL="https://github.com/benthecarman/bitcoin/releases/download/custom-signet-blocktime/bitcoin-${BITCOIN_VERSION}-${TRIPLET}.tar.gz" && \
BITCOIN_FILE="bitcoin-${BITCOIN_VERSION}-${TRIPLET}.tar.gz" && \
wget -qO "${BITCOIN_FILE}" "${BITCOIN_URL}" && \
mkdir -p bin && \
tar -xzvf "${BITCOIN_FILE}" -C /tmp/bin --strip-components=2 "bitcoin-${BITCOIN_VERSION}/bin/bitcoin-cli" "bitcoin-${BITCOIN_VERSION}/bin/bitcoind" "bitcoin-${BITCOIN_VERSION}/bin/bitcoin-wallet" "bitcoin-${BITCOIN_VERSION}/bin/bitcoin-util"
RUN mkdir -p /tmp/.bitcoin/signet && wget https://pin.ski/3Q6PXte -O - | tar -C /tmp/.bitcoin/signet -xvf -

FROM debian:buster-slim as custom-signet-bitcoin

ENV BITCOIN_DIR /root/.bitcoin
COPY --from=builder "/tmp/bin" /usr/local/bin
COPY --from=builder "/tmp/.bitcoin" $BITCOIN_DIR

VOLUME $BITCOIN_DIR
EXPOSE 28332 28333 28334 38332 38333 38334
ENTRYPOINT ["bitcoind", "-rpcbind=::", "-rpcbind=0.0.0.0", "-fallbackfee=0.00008", "-signet=1", "-txindex", "-signetchallenge=512102f7561d208dd9ae99bf497273e16f389bdbd6c4742ddb8e6b216e64fa2928ad8f51ae", "-dnsseed=0", "-signetblocktime=30", "-rpcallowip=0.0.0.0/0", "-rpcuser=braidpooldev", "-rpcpassword=braidpooldev" ]
29 changes: 29 additions & 0 deletions mutinynet/run.sh
@@ -0,0 +1,29 @@
#!/bin/sh

# Set the image name and tag
IMAGE_NAME="custom-signet-bitcoin"
IMAGE_TAG="latest"

# Build the Docker image
docker build -t "${IMAGE_NAME}:${IMAGE_TAG}" .

# Check if the build was successful
if [ $? -ne 0 ]; then
echo "Error: Docker image build failed."
exit 1
fi

# Run the Docker container
docker run -d -p 28332:28332 -p 28333:28333 -p 28334:28334 -p 38332:38332 -p 38333:38333 -p 38334:38334 --name custom-signet-node "${IMAGE_NAME}:${IMAGE_TAG}"

# Check if the container is running
if [ $? -eq 0 ]; then
echo "Docker container '${IMAGE_NAME}' is now running."
else
echo "Error: Docker container could not be started."
exit 1
fi

# Display container information
docker ps