Created
March 21, 2019 11:46
-
-
Save isNotOkay/82ba044870a55a40ac2dc4f139a057be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:18.04 | |
RUN apt-get update | |
RUN apt-get install -y --no-install-recommends apt-utils | |
RUN apt-get install software-properties-common -y | |
RUN apt-add-repository ppa:bitcoin/bitcoin | |
RUN apt-get install bitcoind -y | |
ADD entrypoint.sh $HOME/entrypoint.sh | |
CMD ["./entrypoint.sh"] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mkdir regtest | |
cd regtest | |
mkdir node1 node2 | |
echo -e "\nStarting both bitcoin nodes.\n" | |
bitcoind -regtest -port=1111 -datadir=/regtest/node1 -rpcport=1112 --daemon | |
bitcoind -regtest -port=2222 -datadir=/regtest/node2 -rpcport=2223 --daemon | |
echo -e "Created an bitcoin-cli alias for each node:" | |
echo -e " node1: bitcoin-cli -regtest -datadir=/regtest/node1 -rpcport=1112" | |
echo -e " node2: bitcoin-cli -regtest -datadir=/regtest/node1 -rpcport=1112\n" | |
echo -e "You can interact with both nodes via typing their alias followed by a bitcoind RPC-command." | |
echo -e "Example: node1 getblockchaininfo\n" | |
echo -e "(If the shell didn't open, make sure you started the container interactively: 'docker run -it imageName')." | |
# Create aliases for both nodes so it's more comfortable to make RPC calls. | |
# Example: node1 getblockchaininfo | |
function node1(){ | |
bitcoin-cli -regtest -datadir=/regtest/node1 -rpcport=1112 $@ | |
} | |
function node2() { | |
bitcoin-cli -regtest -datadir=/regtest/node2 -rpcport=2223 $@ | |
} | |
export -f node1; | |
export -f node2; | |
/bin/bash "$@" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment