From 1477748dcb6411e9e3ceafe0656b266649fd4c88 Mon Sep 17 00:00:00 2001 From: jeremy-then Date: Wed, 10 Apr 2024 01:59:32 -0400 Subject: [PATCH 1/6] Updates README.md to make it easier to setup the powpeg node. --- README.md | 97 +++++++++++++++----- src/main/resources/config/logback-sample.xml | 42 +++++++++ 2 files changed, 117 insertions(+), 22 deletions(-) create mode 100644 src/main/resources/config/logback-sample.xml diff --git a/README.md b/README.md index 4be7b5555..387d73e0e 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,71 @@ This node is used by Rootstock PowPeg signatories to interact with the Bridge co ## Software installation help Disclaimer: this documentation will be specific for macOS operating system. -### **Java JDK 1.8** +### Quick Setup + +1. Install Java OpenJDK 1.8 from the binaries (if it is not installed yet) + 1. You can download it from here: `https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u-2021-05-08-08-14/OpenJDK8U-jdk_x64_mac_hotspot_2021-05-08-08-14.tar.gz` + 1. `cd` to the directory where you want to download it. It could be like `cd /Library/Java/JavaVirtualMachines/` + 2. Download it like this: `sudo curl -o adoptopenjdk-8.tar.gz -L https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u-2021-05-08-08-14/OpenJDK8U-jdk_x64_mac_hotspot_2021-05-08-08-14.tar.gz` + 3. Unzip it like this: `sudo tar -zxvf adoptopenjdk-8.tar.gz` + 4. The unzipped directory could be named like this `jdk8u302-b01`. Run an `ls` command to see it. + 2. Add it to the `.bash_profile`. + 1. Open the `.bash_profile` file with `nano` like this `nano ~/.bash_profile` and add the following 2 `export` lines: + 2. `export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk8u302-b01/Contents/Home/bin` + 3. `export PATH="$JAVA_HOME/bin:$PATH"` + 4. Save it and run the command: `source ~/.bash_profile` and restart the terminal. After this, the `java -version` command should return info. +2. Install bitcoind + 1. `cd` to the directory where you want to download it. It could be `/Library/Bitcoin` (if it doesn't exit, you can create it running the command `sudo mkdir /Library/Bitcoin`) + 2. You can download version 0.18.1 (ideal for regtest) from here: `https://bitcoincore.org/bin/bitcoin-core-0.18.1/bitcoin-0.18.1-osx64.tar.gz` + 3. You can download version 24.0.1 `https://bitcoincore.org/bin/bitcoin-core-24.0.1/bitcoin-24.0.1-x86_64-apple-darwin.tar.gz` + 4. Download it like this: `sudo curl -o bitcoind18.tar.gz -L https://bitcoincore.org/bin/bitcoin-core-0.18.1/bitcoin-0.18.1-osx64.tar.gz` + 5. Unzip it like this: `sudo tar -zxvf bitcoind18.tar.gz` + 6. Run the `ls` command to see the actual name of the unzipped directory. It should be like `bitcoin-0.18.1` + 7. Add the path `export PATH="$PATH:/Library/Bitcoin/bitcoin-0.18.1/bin"` to the `/.zshrc` file + 1. Open the `.zshrc` file with nano like this: `nano ~/.zshrc` and add the following line in it and save it: `export PATH="$PATH:/Library/Bitcoin/bitcoin-0.18.1/bin"` + 8. Run `source ~/.zshrc` command, close and reopen the terminal. + 9. Running an instance of bitcoind + 1. To run it in regtest mode, run this command: `bitcoind -deprecatedrpc=generate -addresstype=legacy -regtest -printtoconsole -server -rpcuser=rsk -rpcpassword=rsk -rpcport=18332 -txindex -datadir=/Library/Bitcoin/data` + 2. You can also put this command into an `bitcoin-regtest.sh` file, make it executable with `sudo chmod +x bitcoin-regtest.sh` and run it like `./bitcoin-regtest.sh` + 3. To run it in regular mode, simply run the command: `bitcoind` + 10. Generate some blocks + 1. To generate, for example, 200 regtest bitcoin blocks, run: `./btc-regtest.sh generate 200` +3. Create a `powpeg-project` folder anywhere you like + 1. For example: `mkdir /Library/powpeg-project` +4. Setup the rskj project + 1. `cd` to the `powpeg-project` directory: `cd /Library/powpeg-project` + 2. Clone it from here: `https://github.com/rsksmart/rskj` + 1. `git clone https://github.com/rsksmart/rskj.git` + 2. `cd` to the cloned `rskj` directory: `cd rskj` + 3. Run the `configure.sh` + 1. You will probably have to make it executable first with: `sudo chmod +x configure.sh` + 2. And run it from a terminal like this: `./configure.sh` +5. Setup this project (powpeg-node: `https://github.com/rsksmart/powpeg-node`) + 1. `cd` to the `powpeg-project` directory: `cd /Library/powpeg-project` + 2. `git clone https://github.com/rsksmart/powpeg-node.git` + 3. `cd` to the cloned `powpeg-node` directory: `cd powpeg-node` + 4. Run the `configure.sh` file present in the root directory + 1. You will probably have to make it executable with: `sudo chmod +x configure.sh` + 2. And run it from a terminal like this: `./configure.sh` + 5. Make a copy of the `development-settings.gradle.sample` file and rename it to `DONT-COMMIT-settings.gradle` + 1. Remove the line `# Sample configuration to build rskj from the directory /home/user/another/dir/rskj` + 2. Remove the line `# Rename it to DONT-COMMIT-settings.gradle for use in your local environment` + 3. Replace the `'/home/user/another/dir/rskj/'` with the relative or absolute path where the `rskj` project is, for example: `/Library/powpeg-project/rskj` + 6. Create a `fed.conf` file and set it up + 1. Check the config file sample in `src/main/resources/config/fed-sample.conf`, copy it, rename it to `fed.conf` and update it as you need. + 7. Optionally create a `logback.xml` file for the logging + 1. Check the config file sample in `src/main/resources/config/logback-sample.xml`, copy it, rename it to `logback.xml` and update it as you need, adding or removing classes and their log level. + 8. Build the powpeg project + 1. Run: `./gradlew clean build` + 2. To build it without running the tests, run: `./gradlew clean build -x test` + 3. `cd` into `/Library/powpeg-project/powpeg-node/build/libs/` directory to see the version of the `federate-node-SNAPSHOT--all.jar` file, so you can run it in the following step. + 9. Run the project + 1. Resetting the rsk db (replace `` with the actual version of the `.jar`): `java -cp /Library/powpeg-project/powpeg-node/build/libs/federate-node-SNAPSHOT--all.jar -Drsk.conf.file=/Library/powpeg-project/powpeg-node/src/main/resources/config/fed-sample.conf -Dlogback.configurationFile=/Library/powpeg-project/powpeg-node/logback.xml co.rsk.federate.FederateRunner --regtest --reset` + 2. Without resetting the rsk db (replace `` with the actual version of the `.jar`): `java -cp /Library/powpeg-project/powpeg-node/build/libs/federate-node-SNAPSHOT--all.jar -Drsk.conf.file=/Library/powpeg-project/powpeg-node/src/main/resources/config/fed-sample.conf -Dlogback.configurationFile=/Library/powpeg-project/powpeg-node/logback.xml co.rsk.federate.FederateRunner --regtest` + +### Setup Details + +#### **Java JDK 1.8** Although optional we recommend to install jenv to manage different Java versions, to do that run: `brew install jenv` @@ -49,7 +113,7 @@ Java HotSpot(TM) 64-Bit Server VM (build 25.351-b10, mixed mode) *If not, try closing the terminal and open a new one cause sometimes it stays cached.* -### Bitcoind +#### Bitcoind To install version `24.0.1` follow instructions listed [here](https://bitcoincore.org/en/releases/24.0.1/) @@ -59,12 +123,10 @@ It should output ```Bitcoin server starting``` Run `bitcoin-cli stop` afterwards. - - -## Setting up the project +#### Setting up the project Create a directory (for example, “powpeg-project”) to hold the rskj node, the powpeg node and further configurations. -### Fetch the code +##### Fetch the code Inside the `powpeg-project` directory clone the powpeg-node repository. @@ -76,7 +138,7 @@ git clone https://github.com/rsksmart/powpeg-node cd powpeg-node ``` -### [Optional] Verify the code +##### [Optional] Verify the code Before anything, you must ensure the security chain of the source code. For that, you must go through the following steps. For Linux based OS (Ubuntu for example) it’s recommended to install `gnupg-curl` to download the key through HTTPS. @@ -141,7 +203,7 @@ configure.sh: OK sha256sum: WARNING: 19 lines are improperly formatted ``` -### Configure +##### Configure Run configure script to configure secure environment. @@ -149,10 +211,7 @@ Run configure script to configure secure environment. ./configure.sh ``` - - -### Required configurations - +##### Required configurations **1. Pegnatory private key** @@ -164,7 +223,6 @@ Set the desired value to it. (For example, `String generator = “federator1”; - Run the class to generate a privateKey, publicKey, publicKeyCompressed, address and nodeId - You should get an output like the following: ``` @@ -255,16 +313,11 @@ includeBuild('') { } ``` - - -### [Optional] Import and configure the project +##### [Optional] Import and configure the project To import the project to IntelliJ IDEA go to `File > New > Project from existing sources...` Select `powpeg-node/build.gradle` and import. - - - -### Build +##### Build Then clean and build project using: @@ -272,7 +325,7 @@ Then clean and build project using: ./gradlew clean build ``` -### Run bitcoind +##### Run bitcoind Create a new directory called datadir inside powpeg-project. In the next step you need to replace `` with this directory absolute path. @@ -320,7 +373,7 @@ This should return an integer. - For more references, check **[https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line](https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line)** -### Run PowPeg node! +##### Run PowPeg node! You can run it either with the FedRunner configuration from IntelliJ or manually from the command line. diff --git a/src/main/resources/config/logback-sample.xml b/src/main/resources/config/logback-sample.xml new file mode 100644 index 000000000..42236d884 --- /dev/null +++ b/src/main/resources/config/logback-sample.xml @@ -0,0 +1,42 @@ + + + + + System.out + + %date{yyyy-MM-dd-HH:mm:ss.SSSS} %p [%c{1}] %m%n + + + + + /Users/your-user/path_to_logs/logs/rsk.log + + + %date{yyyy-MM-dd-HH:mm:ss.SSS} %p [%c{1}] %m%n + + + + ./logs/rskj-%d{yyyy-MM-dd}.%i.log.gz + 100MB + 7 + 1GB + + + + + + + + + + + + + + + + + + + From 7f531cc3f82b7e94efb4de1de4e07af1207788a1 Mon Sep 17 00:00:00 2001 From: jeremy-then Date: Tue, 16 Apr 2024 00:57:09 -0400 Subject: [PATCH 2/6] Moves the quick setup guide to new folder --- README.md | 64 +---------------- .../quck_setup_for_macos_x64.md | 68 +++++++++++++++++++ 2 files changed, 70 insertions(+), 62 deletions(-) create mode 100644 quick_setup_samples/quck_setup_for_macos_x64.md diff --git a/README.md b/README.md index 387d73e0e..5f40f8419 100644 --- a/README.md +++ b/README.md @@ -21,70 +21,10 @@ This node is used by Rootstock PowPeg signatories to interact with the Bridge co ## Software installation help Disclaimer: this documentation will be specific for macOS operating system. -### Quick Setup - -1. Install Java OpenJDK 1.8 from the binaries (if it is not installed yet) - 1. You can download it from here: `https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u-2021-05-08-08-14/OpenJDK8U-jdk_x64_mac_hotspot_2021-05-08-08-14.tar.gz` - 1. `cd` to the directory where you want to download it. It could be like `cd /Library/Java/JavaVirtualMachines/` - 2. Download it like this: `sudo curl -o adoptopenjdk-8.tar.gz -L https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u-2021-05-08-08-14/OpenJDK8U-jdk_x64_mac_hotspot_2021-05-08-08-14.tar.gz` - 3. Unzip it like this: `sudo tar -zxvf adoptopenjdk-8.tar.gz` - 4. The unzipped directory could be named like this `jdk8u302-b01`. Run an `ls` command to see it. - 2. Add it to the `.bash_profile`. - 1. Open the `.bash_profile` file with `nano` like this `nano ~/.bash_profile` and add the following 2 `export` lines: - 2. `export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk8u302-b01/Contents/Home/bin` - 3. `export PATH="$JAVA_HOME/bin:$PATH"` - 4. Save it and run the command: `source ~/.bash_profile` and restart the terminal. After this, the `java -version` command should return info. -2. Install bitcoind - 1. `cd` to the directory where you want to download it. It could be `/Library/Bitcoin` (if it doesn't exit, you can create it running the command `sudo mkdir /Library/Bitcoin`) - 2. You can download version 0.18.1 (ideal for regtest) from here: `https://bitcoincore.org/bin/bitcoin-core-0.18.1/bitcoin-0.18.1-osx64.tar.gz` - 3. You can download version 24.0.1 `https://bitcoincore.org/bin/bitcoin-core-24.0.1/bitcoin-24.0.1-x86_64-apple-darwin.tar.gz` - 4. Download it like this: `sudo curl -o bitcoind18.tar.gz -L https://bitcoincore.org/bin/bitcoin-core-0.18.1/bitcoin-0.18.1-osx64.tar.gz` - 5. Unzip it like this: `sudo tar -zxvf bitcoind18.tar.gz` - 6. Run the `ls` command to see the actual name of the unzipped directory. It should be like `bitcoin-0.18.1` - 7. Add the path `export PATH="$PATH:/Library/Bitcoin/bitcoin-0.18.1/bin"` to the `/.zshrc` file - 1. Open the `.zshrc` file with nano like this: `nano ~/.zshrc` and add the following line in it and save it: `export PATH="$PATH:/Library/Bitcoin/bitcoin-0.18.1/bin"` - 8. Run `source ~/.zshrc` command, close and reopen the terminal. - 9. Running an instance of bitcoind - 1. To run it in regtest mode, run this command: `bitcoind -deprecatedrpc=generate -addresstype=legacy -regtest -printtoconsole -server -rpcuser=rsk -rpcpassword=rsk -rpcport=18332 -txindex -datadir=/Library/Bitcoin/data` - 2. You can also put this command into an `bitcoin-regtest.sh` file, make it executable with `sudo chmod +x bitcoin-regtest.sh` and run it like `./bitcoin-regtest.sh` - 3. To run it in regular mode, simply run the command: `bitcoind` - 10. Generate some blocks - 1. To generate, for example, 200 regtest bitcoin blocks, run: `./btc-regtest.sh generate 200` -3. Create a `powpeg-project` folder anywhere you like - 1. For example: `mkdir /Library/powpeg-project` -4. Setup the rskj project - 1. `cd` to the `powpeg-project` directory: `cd /Library/powpeg-project` - 2. Clone it from here: `https://github.com/rsksmart/rskj` - 1. `git clone https://github.com/rsksmart/rskj.git` - 2. `cd` to the cloned `rskj` directory: `cd rskj` - 3. Run the `configure.sh` - 1. You will probably have to make it executable first with: `sudo chmod +x configure.sh` - 2. And run it from a terminal like this: `./configure.sh` -5. Setup this project (powpeg-node: `https://github.com/rsksmart/powpeg-node`) - 1. `cd` to the `powpeg-project` directory: `cd /Library/powpeg-project` - 2. `git clone https://github.com/rsksmart/powpeg-node.git` - 3. `cd` to the cloned `powpeg-node` directory: `cd powpeg-node` - 4. Run the `configure.sh` file present in the root directory - 1. You will probably have to make it executable with: `sudo chmod +x configure.sh` - 2. And run it from a terminal like this: `./configure.sh` - 5. Make a copy of the `development-settings.gradle.sample` file and rename it to `DONT-COMMIT-settings.gradle` - 1. Remove the line `# Sample configuration to build rskj from the directory /home/user/another/dir/rskj` - 2. Remove the line `# Rename it to DONT-COMMIT-settings.gradle for use in your local environment` - 3. Replace the `'/home/user/another/dir/rskj/'` with the relative or absolute path where the `rskj` project is, for example: `/Library/powpeg-project/rskj` - 6. Create a `fed.conf` file and set it up - 1. Check the config file sample in `src/main/resources/config/fed-sample.conf`, copy it, rename it to `fed.conf` and update it as you need. - 7. Optionally create a `logback.xml` file for the logging - 1. Check the config file sample in `src/main/resources/config/logback-sample.xml`, copy it, rename it to `logback.xml` and update it as you need, adding or removing classes and their log level. - 8. Build the powpeg project - 1. Run: `./gradlew clean build` - 2. To build it without running the tests, run: `./gradlew clean build -x test` - 3. `cd` into `/Library/powpeg-project/powpeg-node/build/libs/` directory to see the version of the `federate-node-SNAPSHOT--all.jar` file, so you can run it in the following step. - 9. Run the project - 1. Resetting the rsk db (replace `` with the actual version of the `.jar`): `java -cp /Library/powpeg-project/powpeg-node/build/libs/federate-node-SNAPSHOT--all.jar -Drsk.conf.file=/Library/powpeg-project/powpeg-node/src/main/resources/config/fed-sample.conf -Dlogback.configurationFile=/Library/powpeg-project/powpeg-node/logback.xml co.rsk.federate.FederateRunner --regtest --reset` - 2. Without resetting the rsk db (replace `` with the actual version of the `.jar`): `java -cp /Library/powpeg-project/powpeg-node/build/libs/federate-node-SNAPSHOT--all.jar -Drsk.conf.file=/Library/powpeg-project/powpeg-node/src/main/resources/config/fed-sample.conf -Dlogback.configurationFile=/Library/powpeg-project/powpeg-node/logback.xml co.rsk.federate.FederateRunner --regtest` - ### Setup Details +If you need a quick and easy, fool-proof way to setup the powpeg-node, you can follow the steps in the `quick_setup_samples/quick_setup_for_macos_x64.md` file. + #### **Java JDK 1.8** Although optional we recommend to install jenv to manage different Java versions, to do that run: `brew install jenv` diff --git a/quick_setup_samples/quck_setup_for_macos_x64.md b/quick_setup_samples/quck_setup_for_macos_x64.md new file mode 100644 index 000000000..ba2606187 --- /dev/null +++ b/quick_setup_samples/quck_setup_for_macos_x64.md @@ -0,0 +1,68 @@ +# Quick Setup for macos x64 + +In case you would like to try a fool-proof setup for macos from scratch, you can try the following steps. +You can also skip some of the steps if it is not applicable, for example, you don't need to install Java 1.8 if you have it already installed. + +You can also try your own variations. But the example provided here makes it easy for anybody to setup a powpeg node from scratch in an easy way. + +## Steps + +1. Install Java OpenJDK 1.8 from the binaries (if it is not installed yet) + 1. You can download it from here: `https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u-2021-05-08-08-14/OpenJDK8U-jdk_x64_mac_hotspot_2021-05-08-08-14.tar.gz` + 1. `cd` to the directory where you want to download it. It could be like `cd /Library/Java/JavaVirtualMachines/` + 2. Download it like this: `sudo curl -o adoptopenjdk-8.tar.gz -L https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u-2021-05-08-08-14/OpenJDK8U-jdk_x64_mac_hotspot_2021-05-08-08-14.tar.gz` + 3. Unzip it like this: `sudo tar -zxvf adoptopenjdk-8.tar.gz` + 4. The unzipped directory could be named like this `jdk8u302-b01`. Run an `ls` command to see it. + 2. Add it to the `.bash_profile`. + 1. Open the `.bash_profile` file with `nano` like this `nano ~/.bash_profile` and add the following 2 `export` lines: + 2. `export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk8u302-b01/Contents/Home/bin` + 3. `export PATH="$JAVA_HOME/bin:$PATH"` + 4. Save it and run the command: `source ~/.bash_profile` and restart the terminal. After this, the `java -version` command should return info. +2. Install bitcoind + 1. `cd` to the directory where you want to download it. It could be `/Library/Bitcoin` (if it doesn't exit, you can create it running the command `sudo mkdir /Library/Bitcoin`) + 2. You can download version 0.18.1 (ideal for regtest) from here: `https://bitcoincore.org/bin/bitcoin-core-0.18.1/bitcoin-0.18.1-osx64.tar.gz` + 3. You can download version 24.0.1 `https://bitcoincore.org/bin/bitcoin-core-24.0.1/bitcoin-24.0.1-x86_64-apple-darwin.tar.gz` + 4. Download it like this: `sudo curl -o bitcoind18.tar.gz -L https://bitcoincore.org/bin/bitcoin-core-0.18.1/bitcoin-0.18.1-osx64.tar.gz` + 5. Unzip it like this: `sudo tar -zxvf bitcoind18.tar.gz` + 6. Run the `ls` command to see the actual name of the unzipped directory. It should be like `bitcoin-0.18.1` + 7. Add the path `export PATH="$PATH:/Library/Bitcoin/bitcoin-0.18.1/bin"` to the `/.zshrc` file + 1. Open the `.zshrc` file with nano like this: `nano ~/.zshrc` and add the following line in it and save it: `export PATH="$PATH:/Library/Bitcoin/bitcoin-0.18.1/bin"` + 8. Run `source ~/.zshrc` command, close and reopen the terminal. + 9. Running an instance of bitcoind + 1. To run it in regtest mode, run this command: `bitcoind -deprecatedrpc=generate -addresstype=legacy -regtest -printtoconsole -server -rpcuser=rsk -rpcpassword=rsk -rpcport=18332 -txindex -datadir=/Library/Bitcoin/data` + 2. You can also put this command into an `bitcoin-regtest.sh` file, make it executable with `sudo chmod +x bitcoin-regtest.sh` and run it like `./bitcoin-regtest.sh` + 3. To run it in regular mode, simply run the command: `bitcoind` + 10. Generate some blocks + 1. To generate, for example, 200 regtest bitcoin blocks, run: `./btc-regtest.sh generate 200` +3. Create a `powpeg-project` folder anywhere you like + 1. For example: `mkdir /Library/powpeg-project` +4. Setup the rskj project + 1. `cd` to the `powpeg-project` directory: `cd /Library/powpeg-project` + 2. Clone it from here: `https://github.com/rsksmart/rskj` + 1. `git clone https://github.com/rsksmart/rskj.git` + 2. `cd` to the cloned `rskj` directory: `cd rskj` + 3. Run the `configure.sh` + 1. You will probably have to make it executable first with: `sudo chmod +x configure.sh` + 2. And run it from a terminal like this: `./configure.sh` +5. Setup this project (powpeg-node: `https://github.com/rsksmart/powpeg-node`) + 1. `cd` to the `powpeg-project` directory: `cd /Library/powpeg-project` + 2. `git clone https://github.com/rsksmart/powpeg-node.git` + 3. `cd` to the cloned `powpeg-node` directory: `cd powpeg-node` + 4. Run the `configure.sh` file present in the root directory + 1. You will probably have to make it executable with: `sudo chmod +x configure.sh` + 2. And run it from a terminal like this: `./configure.sh` + 5. Make a copy of the `development-settings.gradle.sample` file and rename it to `DONT-COMMIT-settings.gradle` + 1. Remove the line `# Sample configuration to build rskj from the directory /home/user/another/dir/rskj` + 2. Remove the line `# Rename it to DONT-COMMIT-settings.gradle for use in your local environment` + 3. Replace the `'/home/user/another/dir/rskj/'` with the relative or absolute path where the `rskj` project is, for example: `/Library/powpeg-project/rskj` + 6. Create a `fed.conf` file and set it up + 1. Check the config file sample in `src/main/resources/config/fed-sample.conf`, copy it, rename it to `fed.conf` and update it as you need. + 7. Optionally create a `logback.xml` file for the logging + 1. Check the config file sample in `src/main/resources/config/logback-sample.xml`, copy it, rename it to `logback.xml` and update it as you need, adding or removing classes and their log level. + 8. Build the powpeg project + 1. Run: `./gradlew clean build` + 2. To build it without running the tests, run: `./gradlew clean build -x test` + 3. `cd` into `/Library/powpeg-project/powpeg-node/build/libs/` directory to see the version of the `federate-node-SNAPSHOT--all.jar` file, so you can run it in the following step. + 9. Run the project + 1. Resetting the rsk db (replace `` with the actual version of the `.jar`): `java -cp /Library/powpeg-project/powpeg-node/build/libs/federate-node-SNAPSHOT--all.jar -Drsk.conf.file=/Library/powpeg-project/powpeg-node/src/main/resources/config/fed-sample.conf -Dlogback.configurationFile=/Library/powpeg-project/powpeg-node/logback.xml co.rsk.federate.FederateRunner --regtest --reset` + 2. Without resetting the rsk db (replace `` with the actual version of the `.jar`): `java -cp /Library/powpeg-project/powpeg-node/build/libs/federate-node-SNAPSHOT--all.jar -Drsk.conf.file=/Library/powpeg-project/powpeg-node/src/main/resources/config/fed-sample.conf -Dlogback.configurationFile=/Library/powpeg-project/powpeg-node/logback.xml co.rsk.federate.FederateRunner --regtest` From c4d17d3cd9db786447679df7c6ffeb89db56d5ad Mon Sep 17 00:00:00 2001 From: Marcos Date: Mon, 29 Apr 2024 14:02:23 -0300 Subject: [PATCH 3/6] Move quick setup to docs folder --- .../quck_setup_for_macos_x64.md => docs/QuickSetupMacOsx64.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename quick_setup_samples/quck_setup_for_macos_x64.md => docs/QuickSetupMacOsx64.md (99%) diff --git a/quick_setup_samples/quck_setup_for_macos_x64.md b/docs/QuickSetupMacOsx64.md similarity index 99% rename from quick_setup_samples/quck_setup_for_macos_x64.md rename to docs/QuickSetupMacOsx64.md index ba2606187..f65a7949b 100644 --- a/quick_setup_samples/quck_setup_for_macos_x64.md +++ b/docs/QuickSetupMacOsx64.md @@ -1,4 +1,4 @@ -# Quick Setup for macos x64 +# Quick Setup for macOS x64 In case you would like to try a fool-proof setup for macos from scratch, you can try the following steps. You can also skip some of the steps if it is not applicable, for example, you don't need to install Java 1.8 if you have it already installed. From c3ea1b5b4cf0e733b7475e969dc72e9d26c65d3b Mon Sep 17 00:00:00 2001 From: Marcos Date: Mon, 29 Apr 2024 14:07:44 -0300 Subject: [PATCH 4/6] Link to the quick setup from the README --- README.md | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 5f40f8419..34c5ee670 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,27 @@ -# Welcome to RskJ Powpeg Node - - +# Welcome to RskJ PowPeg Node ## About -Powpeg node is a specialized rskj node which interacts with both Rootstock and Bitcoin. +PowPeg node is a specialized rskj node which interacts with both Rootstock and Bitcoin. This node is used by Rootstock PowPeg signatories to interact with the Bridge contract and to broadcast peg-out transactions to Bitcoin. - ## Software Requirements 1. Java JDK 1.8 2. Bitcoin Core daemon (bitcoind) 24.0.1 3. A Java compatible IDE. Recommended [IntelliJ IDEA](https://www.jetbrains.com/idea/download) as this guide covers the setup with it - **Not sure how to install any of these? See [software installation help](#software-installation-help)** - ## Software installation help + Disclaimer: this documentation will be specific for macOS operating system. -### Setup Details +### Quick setup for macOS x64 -If you need a quick and easy, fool-proof way to setup the powpeg-node, you can follow the steps in the `quick_setup_samples/quick_setup_for_macos_x64.md` file. +A quick and easy, fool-proof way to setup the powpeg-node using macOS x64 is available [here](docs/QuickSetupMacOsx64.md). -#### **Java JDK 1.8** +### **Java JDK 1.8** Although optional we recommend to install jenv to manage different Java versions, to do that run: `brew install jenv` @@ -53,7 +49,7 @@ Java HotSpot(TM) 64-Bit Server VM (build 25.351-b10, mixed mode) *If not, try closing the terminal and open a new one cause sometimes it stays cached.* -#### Bitcoind +### Bitcoind To install version `24.0.1` follow instructions listed [here](https://bitcoincore.org/en/releases/24.0.1/) @@ -63,10 +59,10 @@ It should output ```Bitcoin server starting``` Run `bitcoin-cli stop` afterwards. -#### Setting up the project +## Setting up the project Create a directory (for example, “powpeg-project”) to hold the rskj node, the powpeg node and further configurations. -##### Fetch the code +### Fetch the code Inside the `powpeg-project` directory clone the powpeg-node repository. @@ -78,7 +74,7 @@ git clone https://github.com/rsksmart/powpeg-node cd powpeg-node ``` -##### [Optional] Verify the code +### [Optional] Verify the code Before anything, you must ensure the security chain of the source code. For that, you must go through the following steps. For Linux based OS (Ubuntu for example) it’s recommended to install `gnupg-curl` to download the key through HTTPS. @@ -143,7 +139,7 @@ configure.sh: OK sha256sum: WARNING: 19 lines are improperly formatted ``` -##### Configure +### Configure Run configure script to configure secure environment. @@ -151,7 +147,7 @@ Run configure script to configure secure environment. ./configure.sh ``` -##### Required configurations +### Required configurations **1. Pegnatory private key** @@ -253,11 +249,11 @@ includeBuild('') { } ``` -##### [Optional] Import and configure the project +### [Optional] Import and configure the project To import the project to IntelliJ IDEA go to `File > New > Project from existing sources...` Select `powpeg-node/build.gradle` and import. -##### Build +### Build Then clean and build project using: @@ -265,7 +261,7 @@ Then clean and build project using: ./gradlew clean build ``` -##### Run bitcoind +### Run bitcoind Create a new directory called datadir inside powpeg-project. In the next step you need to replace `` with this directory absolute path. @@ -313,7 +309,7 @@ This should return an integer. - For more references, check **[https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line](https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line)** -##### Run PowPeg node! +### Run PowPeg node! You can run it either with the FedRunner configuration from IntelliJ or manually from the command line. From d30f5b41f4f10a0e567b4d98499c7644fc9da573 Mon Sep 17 00:00:00 2001 From: Marcos Date: Mon, 29 Apr 2024 14:20:00 -0300 Subject: [PATCH 5/6] Update quick guide instructions to install java --- docs/QuickSetupMacOsx64.md | 45 +++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/docs/QuickSetupMacOsx64.md b/docs/QuickSetupMacOsx64.md index f65a7949b..b7f09aa12 100644 --- a/docs/QuickSetupMacOsx64.md +++ b/docs/QuickSetupMacOsx64.md @@ -1,38 +1,33 @@ # Quick Setup for macOS x64 -In case you would like to try a fool-proof setup for macos from scratch, you can try the following steps. -You can also skip some of the steps if it is not applicable, for example, you don't need to install Java 1.8 if you have it already installed. - -You can also try your own variations. But the example provided here makes it easy for anybody to setup a powpeg node from scratch in an easy way. +The following steps provide a quick setup guide for macOS x64. Some of the steps may be skipped if it is not applicable. For example, no need to install Java 1.8 if already installed. ## Steps -1. Install Java OpenJDK 1.8 from the binaries (if it is not installed yet) - 1. You can download it from here: `https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u-2021-05-08-08-14/OpenJDK8U-jdk_x64_mac_hotspot_2021-05-08-08-14.tar.gz` - 1. `cd` to the directory where you want to download it. It could be like `cd /Library/Java/JavaVirtualMachines/` - 2. Download it like this: `sudo curl -o adoptopenjdk-8.tar.gz -L https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u-2021-05-08-08-14/OpenJDK8U-jdk_x64_mac_hotspot_2021-05-08-08-14.tar.gz` - 3. Unzip it like this: `sudo tar -zxvf adoptopenjdk-8.tar.gz` - 4. The unzipped directory could be named like this `jdk8u302-b01`. Run an `ls` command to see it. - 2. Add it to the `.bash_profile`. - 1. Open the `.bash_profile` file with `nano` like this `nano ~/.bash_profile` and add the following 2 `export` lines: - 2. `export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk8u302-b01/Contents/Home/bin` - 3. `export PATH="$JAVA_HOME/bin:$PATH"` - 4. Save it and run the command: `source ~/.bash_profile` and restart the terminal. After this, the `java -version` command should return info. +1. Install Java OpenJDK 1.8 from the binaries (if not installed yet) + 1. Download link: `https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u-2021-05-08-08-14/OpenJDK8U-jdk_x64_mac_hotspot_2021-05-08-08-14.tar.gz` + 1. `cd` into the directory to download it. Example: `cd /Library/Java/JavaVirtualMachines/` + 2. Download: `sudo curl -o adoptopenjdk-8.tar.gz -L https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u-2021-05-08-08-14/OpenJDK8U-jdk_x64_mac_hotspot_2021-05-08-08-14.tar.gz` + 3. Unzip: `sudo tar -zxvf adoptopenjdk-8.tar.gz` + 2. Add JAVA_HOME environment variable to bash + 1. Open `.bash_profile` file with some text editor. Example: `nano ~/.bash_profile` + 2. Add the following 2 `export` lines: + 1. `export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk8u302-b01/Contents/Home/bin` (replace the path with the actual path) + 2. `export PATH="$JAVA_HOME/bin:$PATH"` + 3. Restart the terminal. Run command `java -version` to validate the system detects the installed version of Java. 2. Install bitcoind - 1. `cd` to the directory where you want to download it. It could be `/Library/Bitcoin` (if it doesn't exit, you can create it running the command `sudo mkdir /Library/Bitcoin`) - 2. You can download version 0.18.1 (ideal for regtest) from here: `https://bitcoincore.org/bin/bitcoin-core-0.18.1/bitcoin-0.18.1-osx64.tar.gz` - 3. You can download version 24.0.1 `https://bitcoincore.org/bin/bitcoin-core-24.0.1/bitcoin-24.0.1-x86_64-apple-darwin.tar.gz` - 4. Download it like this: `sudo curl -o bitcoind18.tar.gz -L https://bitcoincore.org/bin/bitcoin-core-0.18.1/bitcoin-0.18.1-osx64.tar.gz` - 5. Unzip it like this: `sudo tar -zxvf bitcoind18.tar.gz` - 6. Run the `ls` command to see the actual name of the unzipped directory. It should be like `bitcoin-0.18.1` - 7. Add the path `export PATH="$PATH:/Library/Bitcoin/bitcoin-0.18.1/bin"` to the `/.zshrc` file + 1. `cd` into the directory to download it. Example: `cd /Library/Bitcoin/` + 2. Download version 24.0.1: `sudo curl -o bitcoind18.tar.gz -L https://bitcoincore.org/bin/bitcoin-core-0.18.1/bitcoin-0.18.1-osx64.tar.gz` + 3. Unzip: `sudo tar -zxvf bitcoind18.tar.gz` + 4. Run the `ls` command to see the actual name of the unzipped directory. It should be like `bitcoin-0.18.1` + 5. Add the path `export PATH="$PATH:/Library/Bitcoin/bitcoin-0.18.1/bin"` to the `/.zshrc` file 1. Open the `.zshrc` file with nano like this: `nano ~/.zshrc` and add the following line in it and save it: `export PATH="$PATH:/Library/Bitcoin/bitcoin-0.18.1/bin"` - 8. Run `source ~/.zshrc` command, close and reopen the terminal. - 9. Running an instance of bitcoind + 6. Run `source ~/.zshrc` command, close and reopen the terminal. + 7. Running an instance of bitcoind 1. To run it in regtest mode, run this command: `bitcoind -deprecatedrpc=generate -addresstype=legacy -regtest -printtoconsole -server -rpcuser=rsk -rpcpassword=rsk -rpcport=18332 -txindex -datadir=/Library/Bitcoin/data` 2. You can also put this command into an `bitcoin-regtest.sh` file, make it executable with `sudo chmod +x bitcoin-regtest.sh` and run it like `./bitcoin-regtest.sh` 3. To run it in regular mode, simply run the command: `bitcoind` - 10. Generate some blocks + 8. Generate some blocks 1. To generate, for example, 200 regtest bitcoin blocks, run: `./btc-regtest.sh generate 200` 3. Create a `powpeg-project` folder anywhere you like 1. For example: `mkdir /Library/powpeg-project` From 5684dc3283ab29b72571b2654177cc833e3988a7 Mon Sep 17 00:00:00 2001 From: Marcos Date: Mon, 29 Apr 2024 14:35:41 -0300 Subject: [PATCH 6/6] Update quick guide instructions to install bitcoind --- docs/QuickSetupMacOsx64.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/docs/QuickSetupMacOsx64.md b/docs/QuickSetupMacOsx64.md index b7f09aa12..66bfb41fa 100644 --- a/docs/QuickSetupMacOsx64.md +++ b/docs/QuickSetupMacOsx64.md @@ -19,16 +19,15 @@ The following steps provide a quick setup guide for macOS x64. Some of the steps 1. `cd` into the directory to download it. Example: `cd /Library/Bitcoin/` 2. Download version 24.0.1: `sudo curl -o bitcoind18.tar.gz -L https://bitcoincore.org/bin/bitcoin-core-0.18.1/bitcoin-0.18.1-osx64.tar.gz` 3. Unzip: `sudo tar -zxvf bitcoind18.tar.gz` - 4. Run the `ls` command to see the actual name of the unzipped directory. It should be like `bitcoin-0.18.1` - 5. Add the path `export PATH="$PATH:/Library/Bitcoin/bitcoin-0.18.1/bin"` to the `/.zshrc` file - 1. Open the `.zshrc` file with nano like this: `nano ~/.zshrc` and add the following line in it and save it: `export PATH="$PATH:/Library/Bitcoin/bitcoin-0.18.1/bin"` - 6. Run `source ~/.zshrc` command, close and reopen the terminal. - 7. Running an instance of bitcoind - 1. To run it in regtest mode, run this command: `bitcoind -deprecatedrpc=generate -addresstype=legacy -regtest -printtoconsole -server -rpcuser=rsk -rpcpassword=rsk -rpcport=18332 -txindex -datadir=/Library/Bitcoin/data` - 2. You can also put this command into an `bitcoin-regtest.sh` file, make it executable with `sudo chmod +x bitcoin-regtest.sh` and run it like `./bitcoin-regtest.sh` - 3. To run it in regular mode, simply run the command: `bitcoind` - 8. Generate some blocks - 1. To generate, for example, 200 regtest bitcoin blocks, run: `./btc-regtest.sh generate 200` + 4. Add bitcoind to bash PATH + 1. Open `.bash_profile` file with some text editor. Example: `nano ~/.bash_profile` + 2. Add the following line: `export PATH="$PATH:/Library/Bitcoin/bitcoin-0.18.1/bin"` (replace the path with the actual path) + 3. Restart the terminal + 5. Running an instance of bitcoind + 1. To run in regtest mode, run the following command: `bitcoind -deprecatedrpc=generate -addresstype=legacy -regtest -printtoconsole -server -rpcuser=rsk -rpcpassword=rsk -rpcport=18332 -txindex -datadir=/Library/Bitcoin/data` + 2. To simplify, the command can be included in a bash file `bitcoin-regtest.sh`. To make it executable run `sudo chmod +x bitcoin-regtest.sh` + 6. Generate some blocks + 1. To generate, for example, 200 regtest bitcoin blocks, run: `./btc-regtest.sh generate 200` // TODO: where did btc-regtest.sh file come from? 3. Create a `powpeg-project` folder anywhere you like 1. For example: `mkdir /Library/powpeg-project` 4. Setup the rskj project