Setup instructions for home setup

This commit is contained in:
Ben 2024-07-22 14:36:59 +02:00
parent ca2f79d7ca
commit 96a08e00b0
No known key found for this signature in database
GPG Key ID: 0F16E812E736C24B
4 changed files with 120 additions and 10 deletions

101
SETUP_HOME.md Normal file
View File

@ -0,0 +1,101 @@
# Home Setup
With these instructions you can set up a Codex node on your machine at home. If you run into trouble, reach out via our Discord server: https://discord.gg/codex-storage
## Prerequisites for Home Setup
In order for Codex to work from your home machine, please make sure you know your public IP address and are able to forward ports on your router or modem. If you're planning to participate as a storage node, please keep in mind that storage nodes are expected to maintain uptime as soon as they are engaged in one or more storage contracts. Taking your storage node offline while it's hosting storage contracts may result in loss of tokens.
## Port Forwarding
Codex requires you to forward two ports: One for data exchange, and one for discovery. These ports can be configured with the CLI parameters `--listen-addrs` and `--disc-port`. We proceed with 8070 for the listen port, and 8090 for the discovery port.
**Follow the instructions of your modem or router to configure the following port-forwards:**
- LAN port: 8070 - Public port: 8070 - Protocol: TCP
- LAN port: 8090 - Public port: 8090 - Protocol: UDP
## Public IP Address
It is important that your Codex node can be reached by others in the network. For this reason, Codex will announce your public IP address to the network. If the announced address is incorrect, other nodes will not be able to establish connections with yours. Here is a list of common issues and possible solutions.
- 1. ISP Sub-NAT<br>
Many ISPs (especially mobile carriers) are using a sub-NAT. In this setup, the IP address your modem receives as public address is not actually exposed to the internet. Rather it is another sub-net that is connected to the internet through another NAT. You can detect this issue by accessing your modem's admin interface and finding the reported public IP address. If it does not match with the IP address provided by services like whatsmyip.org, then you might be behind a sub-NAT. A possible solution: Contact your ISP and ask them to provide you a dynamic internet IP address. Many ISPs can switch you over with the push of a button.
- 2. VPNs<br>
We're all fans of privacy here, but if your uplink is routed through a VPN service, it is unlikely that you're able to get the forwarding working correctly. Some VPNs may try to block traffic that looks peer-to-peer. A solution is to not run a VPN on, or exampt from your VPN network the local device on which you're planning to run Codex.
- 3. Good old firewalls<br>
It still happens that your system's default security settings prevent Codex from accepting connections coming from outside the local address space. Please make sure it's configured properly.
**Discover your public IP address and keep it handy** (https://www.whatsmyip.org)
## Codex Setup
### 1. Clone this repository
```
git clone https://github.com/codex-storage/codex-testnet-starter.git
cd codex-testnet-starter/scripts
```
> #### 📢 **Windows users**<br>
>If you are using a native Windows environment, and not a *nix-like environment
>(eg CYGWIN/MINGW/MSYS/MINGW), use the `scripts/windows` directory.
### 2. Build or Download Codex
> 📢 If you're planning to run a storage node, additional steps are required.
To build Codex from sources, follow the instructions [here](https://github.com/codex-storage/nim-codex/blob/master/BUILDING.md)
> For storage nodes, be sure to build Codex from the branch `feature/ceremony-files`
To download Codex binaries, run `download_online` script.
> For storage nodes, modify the download script first by enabling it to download the 'prover' version of the binary. Look for the variable `BINARY_NAMES`.
```shell
./download_online.sh
```
### 3. Generate an ETH key-pair
Run `generate` script:
```shell
./generate.sh
```
* Your private key will be saved to scripts/eth.key.
* Your ethereum address will be saved to scripts/eth.address.
> #### 📢 **Don't lose your keys**<br>
>If you lose your key and address, you can generate new ones. But the faucet and/or discord bot may refuse to give you new tokens for quite a while!
### 4. Start Codex node
Set your public IP and run the `run_client` script.
```shell
LOCALIP=<PUBLIC-IP-HERE> ./run_client.sh
```
> 📢 For storage nodes, modify the run script first by adding the `prover` argument:
```bash
...
--bootstrap-node=${BOOTSPR} \
persistence \
--eth-private-key=eth.key \
--eth-provider=https://rpc.testnet.codex.storage \
--marketplace-address=0x9C88D67c7C745D2F0A4E411c18A6a22c15b37EaA \
prover
```
Unix users may be required to install libgomp:
```shell
sudo apt-get install libgomp1
```
### 6. Acquire tokens
You can acquire tokens in one of two ways: the testnet faucets or the Discord bot.
#### Faucets
You will need both ETH and TST to use Codex:
1. Get some testnet ETH using https://faucet-eth.testnet.codex.storage.
2. Get some testnet TST using https://faucet-tst.testnet.codex.storage.
#### Discord bot
- Join the Codex discord server: https://discord.gg/codex-storage.
- Go to the "bot" channel, in the category "codex-bot".
- Use `/set` command to enter your generated address.
- Use `/mint` command to receive some tokens.
### 7. Use Codex
Congrats, you're now a node operator! 🥳 You can now proceed to use your Codex node. Follow the
[instructions](./USINGCODEX.md) 🐇
If you're on Windows, we have prepare the same instructions for CMD [here](./USINGCODEX_WIN.md)

View File

@ -38,6 +38,8 @@ curl --request POST \
On successful upload, you'll receive a CID. This can be used to download the file from any node in the network.
> #### 📢 **Hint**
> Are you on the Codex Discord server? Post your CID in the test-net channel, see if others are able to download it. Codex does not provide file metadata, so if you want others to be able to open your file, tell them which extension to give it.
## Download a file
When you have a CID of data you want to download, you can use the following commands:
@ -50,11 +52,10 @@ CID="..." # paste your CID from the previous step here between the quotes
curl -o "${CID}.png" "http://localhost:8080/api/codex/v1/data/${CID}/network"
```
> #### 📢 **Note**
>NOTE: Use the file type of the image uploaded in the previous step
> NOTE: Use the correct extension for the downloaded file.
Note that Codex does not store content-type or extension information. If you get an error, run `echo ${CID}` to verify your CID is set properly.
## Local data
You can view which datasets are currently being stored by your node.
@ -64,9 +65,12 @@ curl http://localhost:8080/api/codex/v1/data \
```
## Create storage availability
> #### 📢 **Warning**
>Are you currently in a Codex workshop?! Yes: Please skip this step.
>Proceed with 'Purchase storage'.
> #### 📢 **Warning 1**
> Are you currently in a Codex workshop?! Yes: Please skip this step.
> Proceed with 'Purchase storage'.
> #### 📢 **Warning 2**
> This step required the prover-version of the Codex binary, or when built from sources, that the `feature/ceremony-files` branch was used for building. Also the 'prover' argument must have been provided at start.
In order to start selling storage space to the network, you must configure your node with the following command. Once configured, the node will monitor on-chain requests-for-storage and will automatically enter into contracts that meet these specifications.
@ -85,7 +89,6 @@ curl --request POST \
For descriptions of each parameter, please view the [Spec](https://github.com/codex-storage/nim-codex/blob/master/openapi.yaml).
## Purchase storage
To purchase storage space from the network, first you must upload your data. Once you have the CID, use the following to create a request-for-storage.

View File

@ -40,6 +40,9 @@ curl --request POST ^
On successful upload, you'll receive a CID. This can be used to download the file from any node in the network.
> #### 📢 **Hint**
> Are you on the Codex Discord server? Post your CID in the test-net channel, see if others are able to download it. Codex does not provide file metadata, so if you want others to be able to open your file, tell them which extension to give it.
## Download a file
When you have a CID of data you want to download, you can use the following commands:
@ -52,7 +55,7 @@ SET CID="..."
curl -o "%CID%.png" "http://localhost:8080/api/codex/v1/data/%CID%/network"
```
> #### 📢 **Note**
>NOTE: Use the file type of the image uploaded in the previous step
> NOTE: Use the correct extension for the downloaded file.
Note that Codex does not store content-type or extension information. If you get an error, run `echo ${CID}` to verify your CID is set properly.
@ -65,9 +68,12 @@ curl http://localhost:8080/api/codex/v1/data
```
## Create storage availability
> #### 📢 **Warning**
>Are you currently in a Codex workshop?! Yes: Please skip this step.
>Proceed with 'Purchase storage'.
> #### 📢 **Warning 1**
> Are you currently in a Codex workshop?! Yes: Please skip this step.
> Proceed with 'Purchase storage'.
> #### 📢 **Warning 2**
> This step required the prover-version of the Codex binary, or when built from sources, that the `feature/ceremony-files` branch was used for building. Also the 'prover' argument must have been provided at start.
In order to start selling storage space to the network, you must configure your node with the following command. Once configured, the node will monitor on-chain requests-for-storage and will automatically enter into contracts that meet these specifications.