Skip to content
Permalink
Browse files

Compile turtlecoind for testnet

  • Loading branch information...
funkypenguin committed Apr 28, 2018
1 parent 9c23e7c commit ca43676d65d15fa05f325ccc8efb3c9df457e7b2
Showing with 56 additions and 4 deletions.
  1. +24 −4 Dockerfile.test
  2. +32 −0 testnet.yml
@@ -1,6 +1,7 @@
# WHAT IS THIS FOR?
# This is a copy of Dockerfile, but prior to compiling, will set difficult to 500. Useless for mainnet, but used
# to setup a testnet with bootstrapped blockchain, and not have to spend days mining to get to the next block!
# This is a copy of Dockerfile, but prior to compiling, will set difficult to 500, resets all the
# seed nodes to 127.0.0.1 (to avoid annoying mainnet), changes the daemon name to "TortleCoin, and mixes up the network ID.

This comment has been minimized.

Copy link
@brandonlehmann

brandonlehmann Apr 28, 2018

Collaborator

Is this description accurate? I don’t see where the seeds are set to localhost. The coin name is definitely changed but the daemon name isn’t. That change would be in the cmake targets.

# Useless for mainnet, but used to setup a testnet with checkpoints, and not have to spend days mining to get to the next block!
#
# daemon runs in the background
# run something like tail /var/log/turtlecoind/current to see the status
@@ -15,6 +16,12 @@ RUN tar xzf /tmp/s6-overlay-amd64.tar.gz -C /
ADD https://github.com/just-containers/socklog-overlay/releases/download/v2.1.0-0/socklog-overlay-amd64.tar.gz /tmp/
RUN tar xzf /tmp/socklog-overlay-amd64.tar.gz -C /

# Get the latest checkpoints (we don't care about being _100%_ up-to-date, but we need to be past block 350K for the algo change to CN_lite_v1)
ADD https://raw.githubusercontent.com/turtlecoin/checkpoints/master/checkpoints.csv /tmp/

# In a multi-node testnet, we'll want to have the slave nodes "wait" for the master node to wake up, so let's get ready
ADD https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh /tmp/

ARG TURTLECOIN_VERSION=v0.4.3
ENV TURTLECOIN_VERSION=${TURTLECOIN_VERSION}

@@ -34,6 +41,17 @@ RUN apt-get update && \
cd /src/turtlecoin && \
git checkout $TURTLECOIN_VERSION && \
sed -i '/std::vector<uint64_t> timestamps_o(timestamps);/i \\/*\n Lower difficulty to static 500 for testnet\n The rest of this function is ignored\n*\/\nreturn 500;\n\n' src/CryptoNoteCore/Currency.cpp && \
sed -i -e 's/"104.236.227.176:11897",/"172.16.76.11:11897",/g' src/CryptoNoteConfig.h && \
sed -i -e 's/"46.101.132.184:11897",/"172.16.76.12:11897",/g' src/CryptoNoteConfig.h && \
sed -i -e 's/"163.172.147.52:11897",/"172.16.76.13:11897",/g' src/CryptoNoteConfig.h && \
sed -i -e 's/"51.15.138.214:11897",/"192.168.76.11:11897",/g' src/CryptoNoteConfig.h && \
sed -i -e 's/"51.15.137.77:11897",/"192.168.76.12:11897",/g' src/CryptoNoteConfig.h && \
sed -i -e 's/"174.138.68.141:11897", \/\/\^ rock/"192.168.76.13:11897",/g' src/CryptoNoteConfig.h && \
sed -i -e 's/"145.239.88.119:11999", \/\/cision/"10.0.76.11:11897",/g' src/CryptoNoteConfig.h && \
sed -i -e 's/"142.44.242.106:11897", \/\/tom/"10.0.76.12:11897",/g' src/CryptoNoteConfig.h && \
sed -i -e 's/"165.227.252.132:11897" \/\/iburnmycd/"10.0.76.13:11897",/g' src/CryptoNoteConfig.h && \
sed -i -e 's/TurtleCoin/TortleCoin/' src/CryptoNoteConfig.h && \
sed -i -e 's/0xcf, 0x52, 0x57/0x52, 0xcf, 0x57/' src/P2p/P2pNetworks.h && \
mkdir build && \
cd build && \
cmake -DCMAKE_CXX_FLAGS="-g0 -Os -fPIC -std=gnu++11" .. && \
@@ -71,18 +89,20 @@ RUN useradd -r -s /usr/sbin/nologin -m -d /var/lib/turtlecoind turtlecoind && \
echo "fdmove -c 2 1" >> /etc/services.d/turtlecoind/run && \
echo "cd /var/lib/turtlecoind" >> /etc/services.d/turtlecoind/run && \
echo "export HOME /var/lib/turtlecoind" >> /etc/services.d/turtlecoind/run && \
echo "s6-setuidgid turtlecoind /usr/local/bin/TurtleCoind" >> /etc/services.d/turtlecoind/run && \
echo "s6-setuidgid turtlecoind /usr/local/bin/TurtleCoind --log-level=2" >> /etc/services.d/turtlecoind/run && \
chmod +x /etc/services.d/turtlecoind/run && \
chmod +x /tmp/wait-for-it.sh && \
chown nobody:nogroup /var/log/turtlecoind && \
echo "#!/usr/bin/execlineb" > /etc/services.d/turtlecoind/log/run && \
echo "s6-setuidgid nobody" >> /etc/services.d/turtlecoind/log/run && \
echo "s6-log -bp -- n20 s1000000 /var/log/turtlecoind" >> /etc/services.d/turtlecoind/log/run && \
chmod +x /etc/services.d/turtlecoind/log/run && \
echo "/var/lib/turtlecoind true turtlecoind 0644 0755" > /etc/fix-attrs.d/turtlecoind-home && \
echo "/home/turtlecoin true turtlecoin 0644 0755" > /etc/fix-attrs.d/turtlecoin-home && \
echo "/tmp/checkpoints.csv true turtlecoin 0644 0755" > /etc/fix-attrs.d/turtlecoin-checkpoints && \
echo "/var/log/turtlecoind true nobody 0644 0755" > /etc/fix-attrs.d/turtlecoind-logs

VOLUME ["/var/lib/turtlecoind", "/home/turtlecoin","/var/log/turtlecoind"]

ENTRYPOINT ["/init"]
CMD ["/usr/bin/execlineb", "-P", "-c", "emptyenv cd /home/turtlecoin export HOME /home/turtlecoin s6-setuidgid turtlecoin /bin/bash"]
CMD ["/usr/bin/execlineb", "-P", "-c", "emptyenv cd /home/turtlecoin export HOME /home/turtlecoin s6-setuidgid turtlecoin tail -f /var/log/turtlecoind/current"]
@@ -0,0 +1,32 @@
version: '3'

services:
node1:
image: funkypenguin/turtlecoin
container_name: turtletest-node1
volumes:
- ../turtlecoind:/var/lib/turtlecoind/
networks:
testnet:
ipv4_address: 172.16.76.11

# node2:
# image: funkypenguin/turtlecoin
# container_name: turtletest-node2
# networks:
# testnet:
# ipv4_address: 172.16.76.12

# node3:
# image: funkypenguin/turtlecoin
# container_name: turtletest-node3
# networks:
# testnet:
# ipv4_address: 172.16.76.13

networks:
testnet:
ipam:
config:
- subnet: 172.16.76.0/24

0 comments on commit ca43676

Please sign in to comment.
You can’t perform that action at this time.