From c8e6dab4bc78d5467ab21573ffa4a64fc6176d74 Mon Sep 17 00:00:00 2001 From: Elyan Date: Fri, 16 Feb 2024 11:53:08 -0800 Subject: [PATCH] Added custom Signet setup & update Readme.md --- Dockerfile | 3 +++ README.md | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++- bitcoin.conf | 3 ++- 3 files changed, 72 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index d0778ce..cafc8e3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,9 @@ RUN make COPY generate_signet.sh . RUN chmod +x generate_signet.sh +# Copy Bitcoin.conf file +COPY bitcoin.conf /root/.bitcoin/bitcoin.conf + # Copy the generate.py script from the Bitcoin core source COPY --from=0 /bitcoin/contrib/signet/generate.py /usr/local/bin/ RUN chmod +x /usr/local/bin/generate.py diff --git a/README.md b/README.md index d41a0b4..df62ba1 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,68 @@ # easepay-custom-signet-script -Custom signet creation script + +## Custom Bitcoin Signet Docker Setup + +# Overview + +This repository contains a Docker setup for running a custom Bitcoin Signet. Signet is a test network (testnet) for Bitcoin, allowing developers to test Bitcoin applications and experiments without risking real funds and without the unpredictability of the public testnet. + +The provided Dockerfile and scripts automate the process of setting up a custom Signet, generating necessary keys and configuration, and running a Bitcoin node configured for this custom Signet. + +# Features + +* Custom Signet Configuration: Allows the creation of a private Signet with custom consensus rules. +* Automated Key and Script Generation: Automatically generates the necessary keys and block script for the Signet. +* Dockerized Environment: Ensures a consistent and isolated environment for running the Bitcoin node. +* Block Mining Capabilities: Includes scripts to mine blocks on the custom Signet. + +## Prerequisites + +* Docker +* Git (for cloning the repository) + +# Repository Contents +* `Dockerfile`: Instructions for building the Docker image with Bitcoin Core and necessary dependencies. +* `generate_signet.sh`: Shell script to set up the custom Signet, generate keys, define the block script, and start the Bitcoin node. + +* `generate.py`: Python script used for mining blocks on the custom Signet. + + +# Setup and Usage + +## Building the Docker Image + +1. Clone this repository. +2. Navigate to the repository directory. +3. Build the Docker image: + + +```docker build -t bitcoin-signet .``` + +## Running the Custom Signet Node + +```docker run -d -p 38333:38333 -p 38332:38332 bitcoin-signet``` + +The generate_signet.sh script will execute within the container, setting up the custom Signet and starting the Bitcoin node. + +** NOTE **: the signet challenge parameter (pubkey) should be generated before building +the docker image. this can be done in your local machine. This approach would mean you would have a fixed public key for your Signet, which isn't such a big deal for testing. its also possible to update the `generate_script.sh` script to dynamically create the bitcoin.conf after generating the public key. i ran into some issues trying to do this, you may have the time, so Knock yourself out and create a PR if you get it done. +## POINTERS +* The script would first start bitcoind in regtest mode, generate the key pair, construct the signetchallenge with the new public key, +* create the bitcoin.conf with this signetchallenge, and then restart bitcoind in Signet mode with the new configuration. + +`Warning`: This approach is more complex but allows for a fresh public key each time you build and run the container. + +## Accessing the Node +* The Bitcoin node's JSON-RPC interface will be available on port 38332 of the host machine.. This would be deployed for easy connection for all team members that needs to interact with it. + +* The Bitcoin P2P network for this Signet operates on port 38333. + +## Customizing the Signet +You can modify the generate_signet.sh script to change the Signet parameters, such as the block signing keys or other consensus rules. + +## Security Considerations +This setup is intended for development and testing purposes only. Do not use it with real funds or sensitive data. +it is your responsibility to Ensure appropriate security measures are in place if exposing the node to public networks. + +## Contributing +Contributions to this project are welcome. Please ensure that any changes are tested with the Docker setup before submitting a pull request. \ No newline at end of file diff --git a/bitcoin.conf b/bitcoin.conf index 70af028..079ee50 100644 --- a/bitcoin.conf +++ b/bitcoin.conf @@ -1,4 +1,5 @@ signet=1 [signet] daemon=1 -# we would add our custom signet parameters here \ No newline at end of file +# we would add our custom signet parameters here(currently generic parameters are used) +signetchallenge=512151ae \ No newline at end of file