From 24414051a15f12afa7ad2fee28ecbf0457bf2dea Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 18 Jun 2024 13:44:02 +0200 Subject: [PATCH 01/12] Sets up windows scripts for bootstrap node and storage node --- scripts/windows/download.bat | 5 +++++ scripts/windows/eth.key | 1 + scripts/windows/run_bootstrap.bat | 14 ++++++++++++++ scripts/windows/run_storage.bat | 30 ++++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+) create mode 100644 scripts/windows/download.bat create mode 100644 scripts/windows/eth.key create mode 100644 scripts/windows/run_bootstrap.bat create mode 100644 scripts/windows/run_storage.bat diff --git a/scripts/windows/download.bat b/scripts/windows/download.bat new file mode 100644 index 0000000..24d348a --- /dev/null +++ b/scripts/windows/download.bat @@ -0,0 +1,5 @@ +curl -O -L https://github.com/codex-storage/nim-codex/releases/download/v0.1.0/codex-v0.1.0-windows-amd64.zip +unzip codex-v0.1.0-windows-amd64.zip + +curl -O -L https://github.com/codex-storage/nim-codex/releases/download/v0.1.0/codex-prover-v0.1.0-windows-amd64.exe.zip +unzip codex-prover-v0.1.0-windows-amd64.exe.zip diff --git a/scripts/windows/eth.key b/scripts/windows/eth.key new file mode 100644 index 0000000..c082f66 --- /dev/null +++ b/scripts/windows/eth.key @@ -0,0 +1 @@ +0x292db809944ca4f5ca818066c85c30c9eaee3c6871ba49259f6d4bc9ba1786a6 diff --git a/scripts/windows/run_bootstrap.bat b/scripts/windows/run_bootstrap.bat new file mode 100644 index 0000000..50c675f --- /dev/null +++ b/scripts/windows/run_bootstrap.bat @@ -0,0 +1,14 @@ +set LOCALIP="192.168.178.138" + +start /b codex-v0.1.0-windows-amd64.exe ^ + --data-dir=data_bootstrap ^ + --nat=%LOCALIP% ^ + --api-port=8080 ^ + --disc-port=8090 ^ + --listen-addrs=/ip4/0.0.0.0/tcp/8070 + +timeout 5 + +cls + +curl http://localhost:8080/api/codex/v1/debug/info diff --git a/scripts/windows/run_storage.bat b/scripts/windows/run_storage.bat new file mode 100644 index 0000000..b27463e --- /dev/null +++ b/scripts/windows/run_storage.bat @@ -0,0 +1,30 @@ +set LOCALIP="192.168.178.138" +set BOOTSPR="spr:CiUIAhIhA7hDRTkU9Pb_Wt4qdoN_IsRGuDL6bucyvMqbE3F7UmFREgIDARo8CicAJQgCEiEDuENFORT09v9a3ip2g38ixEa4Mvpu5zK8ypsTcXtSYVEQ1uHFswYaCwoJBMCosoqRAh-aKkcwRQIhAKdz-V1ne8GB-QlUmXnA4_EO1WIisy6PPBJDzRRLn02UAiB4QmAVgBgJ94OxnrTo7c_zgsjDJXL_E0_KlBb2KaFzPw" + +@REM Quota = 11 GB +@REM Availability = 10 GB + +start /b codex-v0.1.0-prover-windows-amd64.exe ^ + --data-dir=data_storage ^ + --circuit-dir=circuit ^ + --storage-quota=11811160064 ^ + --nat=%LOCALIP% ^ + --api-port=8180 ^ + --disc-port=8190 ^ + --listen-addrs=/ip4/0.0.0.0/tcp/8170 ^ + --bootstrap-node=%BOOTSPR% ^ + persistence ^ + --eth-private-key=eth.key ^ + --eth-provider=https://rpc.testnet.codex.storage ^ + --marketplace-address=0x4cBDfab37baB0AA3AC69A7b12C4396907dfF5227 ^ + prover + +timeout 30 + +cls + +curl http://localhost:8180/api/codex/v1/debug/info + +timeout 5 + +curl --request POST --url http://localhost:8180/api/codex/v1/sales/availability --header "Content-Type: application/json" --data "{\"totalSize\": \"10737418240\", \"duration\": \"86400\", \"minPrice\": \"1\", \"maxCollateral\": \"9999999999\"}" From 358d282f6007d9962ed0c57744846aba33643ddd Mon Sep 17 00:00:00 2001 From: ThatBen Date: Tue, 18 Jun 2024 14:05:29 +0200 Subject: [PATCH 02/12] sets up download script for linux --- scripts/linux/download.sh | 9 +++++++++ scripts/linux/eth.key | 1 + scripts/linux/run_bootstrap.bat | 14 ++++++++++++++ scripts/linux/run_storage.bat | 30 ++++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+) create mode 100755 scripts/linux/download.sh create mode 100644 scripts/linux/eth.key create mode 100644 scripts/linux/run_bootstrap.bat create mode 100644 scripts/linux/run_storage.bat diff --git a/scripts/linux/download.sh b/scripts/linux/download.sh new file mode 100755 index 0000000..d238b49 --- /dev/null +++ b/scripts/linux/download.sh @@ -0,0 +1,9 @@ +curl -o codex-v0.1.0-linux-amd64.tar.gz -L https://github.com/codex-storage/nim-codex/releases/download/v0.1.0/codex-v0.1.0-linux-amd64.tar.gz +tar -xvzf codex-v0.1.0-linux-amd64.tar.gz + +curl -o codex-prover-v0.1.0-linux-amd64.zip -L https://github.com/codex-storage/nim-codex/releases/download/v0.1.0/codex-prover-v0.1.0-linux-amd64.zip +unzip codex-prover-v0.1.0-linux-amd64.zip + +chmod +x codex-v0.1.0-linux-amd64 +chmod +x codex-v0.1.0-prover-linux-amd64 + diff --git a/scripts/linux/eth.key b/scripts/linux/eth.key new file mode 100644 index 0000000..c082f66 --- /dev/null +++ b/scripts/linux/eth.key @@ -0,0 +1 @@ +0x292db809944ca4f5ca818066c85c30c9eaee3c6871ba49259f6d4bc9ba1786a6 diff --git a/scripts/linux/run_bootstrap.bat b/scripts/linux/run_bootstrap.bat new file mode 100644 index 0000000..50c675f --- /dev/null +++ b/scripts/linux/run_bootstrap.bat @@ -0,0 +1,14 @@ +set LOCALIP="192.168.178.138" + +start /b codex-v0.1.0-windows-amd64.exe ^ + --data-dir=data_bootstrap ^ + --nat=%LOCALIP% ^ + --api-port=8080 ^ + --disc-port=8090 ^ + --listen-addrs=/ip4/0.0.0.0/tcp/8070 + +timeout 5 + +cls + +curl http://localhost:8080/api/codex/v1/debug/info diff --git a/scripts/linux/run_storage.bat b/scripts/linux/run_storage.bat new file mode 100644 index 0000000..b27463e --- /dev/null +++ b/scripts/linux/run_storage.bat @@ -0,0 +1,30 @@ +set LOCALIP="192.168.178.138" +set BOOTSPR="spr:CiUIAhIhA7hDRTkU9Pb_Wt4qdoN_IsRGuDL6bucyvMqbE3F7UmFREgIDARo8CicAJQgCEiEDuENFORT09v9a3ip2g38ixEa4Mvpu5zK8ypsTcXtSYVEQ1uHFswYaCwoJBMCosoqRAh-aKkcwRQIhAKdz-V1ne8GB-QlUmXnA4_EO1WIisy6PPBJDzRRLn02UAiB4QmAVgBgJ94OxnrTo7c_zgsjDJXL_E0_KlBb2KaFzPw" + +@REM Quota = 11 GB +@REM Availability = 10 GB + +start /b codex-v0.1.0-prover-windows-amd64.exe ^ + --data-dir=data_storage ^ + --circuit-dir=circuit ^ + --storage-quota=11811160064 ^ + --nat=%LOCALIP% ^ + --api-port=8180 ^ + --disc-port=8190 ^ + --listen-addrs=/ip4/0.0.0.0/tcp/8170 ^ + --bootstrap-node=%BOOTSPR% ^ + persistence ^ + --eth-private-key=eth.key ^ + --eth-provider=https://rpc.testnet.codex.storage ^ + --marketplace-address=0x4cBDfab37baB0AA3AC69A7b12C4396907dfF5227 ^ + prover + +timeout 30 + +cls + +curl http://localhost:8180/api/codex/v1/debug/info + +timeout 5 + +curl --request POST --url http://localhost:8180/api/codex/v1/sales/availability --header "Content-Type: application/json" --data "{\"totalSize\": \"10737418240\", \"duration\": \"86400\", \"minPrice\": \"1\", \"maxCollateral\": \"9999999999\"}" From 6448618ca71bb3bedf8cf84fac20759fb877e326 Mon Sep 17 00:00:00 2001 From: ThatBen Date: Tue, 18 Jun 2024 14:57:25 +0200 Subject: [PATCH 03/12] Fixes run scripts for linux --- scripts/linux/run_bootstrap.bat | 14 -------------- scripts/linux/run_bootstrap.sh | 13 +++++++++++++ scripts/linux/run_storage.bat | 30 ------------------------------ scripts/linux/run_storage.sh | 31 +++++++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 44 deletions(-) delete mode 100644 scripts/linux/run_bootstrap.bat create mode 100755 scripts/linux/run_bootstrap.sh delete mode 100644 scripts/linux/run_storage.bat create mode 100755 scripts/linux/run_storage.sh diff --git a/scripts/linux/run_bootstrap.bat b/scripts/linux/run_bootstrap.bat deleted file mode 100644 index 50c675f..0000000 --- a/scripts/linux/run_bootstrap.bat +++ /dev/null @@ -1,14 +0,0 @@ -set LOCALIP="192.168.178.138" - -start /b codex-v0.1.0-windows-amd64.exe ^ - --data-dir=data_bootstrap ^ - --nat=%LOCALIP% ^ - --api-port=8080 ^ - --disc-port=8090 ^ - --listen-addrs=/ip4/0.0.0.0/tcp/8070 - -timeout 5 - -cls - -curl http://localhost:8080/api/codex/v1/debug/info diff --git a/scripts/linux/run_bootstrap.sh b/scripts/linux/run_bootstrap.sh new file mode 100755 index 0000000..492c1bc --- /dev/null +++ b/scripts/linux/run_bootstrap.sh @@ -0,0 +1,13 @@ +LOCALIP="192.168.178.138" + +./codex-v0.1.0-linux-amd64 \ + --data-dir=data_bootstrap \ + --nat=${LOCALIP} \ + --api-port=8080 \ + --disc-port=8090 \ + --listen-addrs=/ip4/0.0.0.0/tcp/8070 \ + & + +sleep 5 + +curl http://localhost:8080/api/codex/v1/debug/info diff --git a/scripts/linux/run_storage.bat b/scripts/linux/run_storage.bat deleted file mode 100644 index b27463e..0000000 --- a/scripts/linux/run_storage.bat +++ /dev/null @@ -1,30 +0,0 @@ -set LOCALIP="192.168.178.138" -set BOOTSPR="spr:CiUIAhIhA7hDRTkU9Pb_Wt4qdoN_IsRGuDL6bucyvMqbE3F7UmFREgIDARo8CicAJQgCEiEDuENFORT09v9a3ip2g38ixEa4Mvpu5zK8ypsTcXtSYVEQ1uHFswYaCwoJBMCosoqRAh-aKkcwRQIhAKdz-V1ne8GB-QlUmXnA4_EO1WIisy6PPBJDzRRLn02UAiB4QmAVgBgJ94OxnrTo7c_zgsjDJXL_E0_KlBb2KaFzPw" - -@REM Quota = 11 GB -@REM Availability = 10 GB - -start /b codex-v0.1.0-prover-windows-amd64.exe ^ - --data-dir=data_storage ^ - --circuit-dir=circuit ^ - --storage-quota=11811160064 ^ - --nat=%LOCALIP% ^ - --api-port=8180 ^ - --disc-port=8190 ^ - --listen-addrs=/ip4/0.0.0.0/tcp/8170 ^ - --bootstrap-node=%BOOTSPR% ^ - persistence ^ - --eth-private-key=eth.key ^ - --eth-provider=https://rpc.testnet.codex.storage ^ - --marketplace-address=0x4cBDfab37baB0AA3AC69A7b12C4396907dfF5227 ^ - prover - -timeout 30 - -cls - -curl http://localhost:8180/api/codex/v1/debug/info - -timeout 5 - -curl --request POST --url http://localhost:8180/api/codex/v1/sales/availability --header "Content-Type: application/json" --data "{\"totalSize\": \"10737418240\", \"duration\": \"86400\", \"minPrice\": \"1\", \"maxCollateral\": \"9999999999\"}" diff --git a/scripts/linux/run_storage.sh b/scripts/linux/run_storage.sh new file mode 100755 index 0000000..1926773 --- /dev/null +++ b/scripts/linux/run_storage.sh @@ -0,0 +1,31 @@ +LOCALIP=192.168.178.138 +BOOTSPR="spr:CiUIAhIhA7hDRTkU9Pb_Wt4qdoN_IsRGuDL6bucyvMqbE3F7UmFREgIDARo8CicAJQgCEiEDuENFORT09v9a3ip2g38ixEa4Mvpu5zK8ypsTcXtSYVEQ1uHFswYaCwoJBMCosoqRAh-aKkcwRQIhAKdz-V1ne8GB-QlUmXnA4_EO1WIisy6PPBJDzRRLn02UAiB4QmAVgBgJ94OxnrTo7c_zgsjDJXL_E0_KlBb2KaFzPw" + +# Quota = 11 GB +# Availability = 10 GB + +./codex-v0.1.0-prover-linux-amd64 \ + --data-dir=data_storage \ + --circuit-dir=circuit \ + --storage-quota=11811160064 \ + --nat=${LOCALIP} \ + --api-port=8180 \ + --disc-port=8190 \ + --listen-addrs=/ip4/0.0.0.0/tcp/8170 \ + --bootstrap-node=${BOOTSPR} \ + persistence \ + --eth-private-key=eth.key \ + --eth-provider=https://rpc.testnet.codex.storage \ + --marketplace-address=0x4cBDfab37baB0AA3AC69A7b12C4396907dfF5227 \ + prover \ + & + +sleep 30 + +curl http://localhost:8180/api/codex/v1/debug/info + +sleep 5 + +curl --request POST --url http://localhost:8180/api/codex/v1/sales/availability --header "Content-Type: application/json" --data "{\"totalSize\": \"10737418240\", \"duration\": \"86400\", \"minPrice\": \"1\", \"maxCollateral\": \"9999999999\"}" + + From 5d15514afc0b82fa19c2f15a1b7051558b1e07e3 Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 18 Jun 2024 15:03:08 +0200 Subject: [PATCH 04/12] Some time-saving notes --- scripts/linux/README.md | 3 +++ scripts/windows/README.md | 11 +++++++++++ scripts/windows/run_storage.bat | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 scripts/linux/README.md create mode 100644 scripts/windows/README.md diff --git a/scripts/linux/README.md b/scripts/linux/README.md new file mode 100644 index 0000000..642676a --- /dev/null +++ b/scripts/linux/README.md @@ -0,0 +1,3 @@ +# May need +`sudo apt-get install libzip-dev unzip` +`chmod 600 eth.key` diff --git a/scripts/windows/README.md b/scripts/windows/README.md new file mode 100644 index 0000000..3e81739 --- /dev/null +++ b/scripts/windows/README.md @@ -0,0 +1,11 @@ +# May need +Right-click 'eth.key' file -> Properties +-> Security -> Advanced +Add -> Select a principal -> Advanced -> Find now +Select you user from the list +OK -> OK +Check Full control, Modify, Read&exe, Read, Write, Special +OK +Disable inheritance -> Confirm warning +Apply and close +Apply and close diff --git a/scripts/windows/run_storage.bat b/scripts/windows/run_storage.bat index b27463e..67906ba 100644 --- a/scripts/windows/run_storage.bat +++ b/scripts/windows/run_storage.bat @@ -1,5 +1,5 @@ set LOCALIP="192.168.178.138" -set BOOTSPR="spr:CiUIAhIhA7hDRTkU9Pb_Wt4qdoN_IsRGuDL6bucyvMqbE3F7UmFREgIDARo8CicAJQgCEiEDuENFORT09v9a3ip2g38ixEa4Mvpu5zK8ypsTcXtSYVEQ1uHFswYaCwoJBMCosoqRAh-aKkcwRQIhAKdz-V1ne8GB-QlUmXnA4_EO1WIisy6PPBJDzRRLn02UAiB4QmAVgBgJ94OxnrTo7c_zgsjDJXL_E0_KlBb2KaFzPw" +set BOOTSPR="UPDATE ME FROM BOOTSTRAP NODE" @REM Quota = 11 GB @REM Availability = 10 GB From f2c83e2a608f6a6e902bffe6c2202b3f99252ebb Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 19 Jun 2024 13:36:53 +0200 Subject: [PATCH 05/12] update --- scripts/linux/download.sh | 4 ---- scripts/linux/download_prover.sh | 5 +++++ scripts/linux/run_bootstrap.sh | 3 ++- scripts/linux/run_client.sh | 20 ++++++++++++++++++ scripts/linux/{run_storage.sh => run_host.sh} | 2 +- scripts/windows/download.bat | 3 --- scripts/windows/download_prover.bat | 2 ++ scripts/windows/run_client.bat | 21 +++++++++++++++++++ .../windows/{run_storage.bat => run_host.bat} | 0 9 files changed, 51 insertions(+), 9 deletions(-) create mode 100644 scripts/linux/download_prover.sh create mode 100644 scripts/linux/run_client.sh rename scripts/linux/{run_storage.sh => run_host.sh} (76%) mode change 100755 => 100644 create mode 100644 scripts/windows/download_prover.bat create mode 100644 scripts/windows/run_client.bat rename scripts/windows/{run_storage.bat => run_host.bat} (100%) diff --git a/scripts/linux/download.sh b/scripts/linux/download.sh index d238b49..c2ba249 100755 --- a/scripts/linux/download.sh +++ b/scripts/linux/download.sh @@ -1,9 +1,5 @@ curl -o codex-v0.1.0-linux-amd64.tar.gz -L https://github.com/codex-storage/nim-codex/releases/download/v0.1.0/codex-v0.1.0-linux-amd64.tar.gz tar -xvzf codex-v0.1.0-linux-amd64.tar.gz -curl -o codex-prover-v0.1.0-linux-amd64.zip -L https://github.com/codex-storage/nim-codex/releases/download/v0.1.0/codex-prover-v0.1.0-linux-amd64.zip -unzip codex-prover-v0.1.0-linux-amd64.zip - chmod +x codex-v0.1.0-linux-amd64 -chmod +x codex-v0.1.0-prover-linux-amd64 diff --git a/scripts/linux/download_prover.sh b/scripts/linux/download_prover.sh new file mode 100644 index 0000000..f8657cc --- /dev/null +++ b/scripts/linux/download_prover.sh @@ -0,0 +1,5 @@ +curl -o codex-prover-v0.1.0-linux-amd64.zip -L https://github.com/codex-storage/nim-codex/releases/download/v0.1.0/codex-prover-v0.1.0-linux-amd64.zip +unzip codex-prover-v0.1.0-linux-amd64.zip + +chmod +x codex-v0.1.0-prover-linux-amd64 + diff --git a/scripts/linux/run_bootstrap.sh b/scripts/linux/run_bootstrap.sh index 492c1bc..c023226 100755 --- a/scripts/linux/run_bootstrap.sh +++ b/scripts/linux/run_bootstrap.sh @@ -10,4 +10,5 @@ LOCALIP="192.168.178.138" sleep 5 -curl http://localhost:8080/api/codex/v1/debug/info +curl http://localhost:8080/api/codex/v1/debug/info > bootstrap.info + diff --git a/scripts/linux/run_client.sh b/scripts/linux/run_client.sh new file mode 100644 index 0000000..064fd99 --- /dev/null +++ b/scripts/linux/run_client.sh @@ -0,0 +1,20 @@ +LOCALIP=192.168.178.138 +BOOTSPR=spr:CiUIAhIhAteA6IVIcN3egB_1rPz3HpFKVVO4emfRRcRzvyf0ES11EgIDARo8CicAJQgCEiEC14DohUhw3d6AH_Ws_PcekUpVU7h6Z9FFxHO_J_QRLXUQlcfKswYaCwoJBMCosquRAh-aKkcwRQIhAPzHOsoFmh96SeuFPzErNeck9C-vOkWp74HpddLmM4zLAiBwvbCZDaeMRkmVRVxh24J8OEGGuHFUTWPHAL8T7e8GyQ + +./codex-v0.1.0-prover-linux-amd64 \ + --data-dir=data_bootstrap \ + --storage-quota=11811160064 \ + --nat=${LOCALIP} \ + --api-port=8080 \ + --disc-port=8090 \ + --listen-addrs=/ip4/0.0.0.0/tcp/8070 \ + --bootstrap-node=${BOOTSPR} \ + persistence \ + --eth-private-key=eth.key \ + --eth-provider=https://rpc.testnet.codex.storage \ + --marketplace-address=0x4cBDfab37baB0AA3AC69A7b12C4396907dfF5227 \ + & + +sleep 5 + +curl http://localhost:8180/api/codex/v1/debug/info diff --git a/scripts/linux/run_storage.sh b/scripts/linux/run_host.sh old mode 100755 new mode 100644 similarity index 76% rename from scripts/linux/run_storage.sh rename to scripts/linux/run_host.sh index 1926773..55cb1b8 --- a/scripts/linux/run_storage.sh +++ b/scripts/linux/run_host.sh @@ -1,5 +1,5 @@ LOCALIP=192.168.178.138 -BOOTSPR="spr:CiUIAhIhA7hDRTkU9Pb_Wt4qdoN_IsRGuDL6bucyvMqbE3F7UmFREgIDARo8CicAJQgCEiEDuENFORT09v9a3ip2g38ixEa4Mvpu5zK8ypsTcXtSYVEQ1uHFswYaCwoJBMCosoqRAh-aKkcwRQIhAKdz-V1ne8GB-QlUmXnA4_EO1WIisy6PPBJDzRRLn02UAiB4QmAVgBgJ94OxnrTo7c_zgsjDJXL_E0_KlBb2KaFzPw" +BOOTSPR=$(curl http://localhost:8080/api/codex/v1/spr | cut -d '"' -f4) # Quota = 11 GB # Availability = 10 GB diff --git a/scripts/windows/download.bat b/scripts/windows/download.bat index 24d348a..1475912 100644 --- a/scripts/windows/download.bat +++ b/scripts/windows/download.bat @@ -1,5 +1,2 @@ curl -O -L https://github.com/codex-storage/nim-codex/releases/download/v0.1.0/codex-v0.1.0-windows-amd64.zip unzip codex-v0.1.0-windows-amd64.zip - -curl -O -L https://github.com/codex-storage/nim-codex/releases/download/v0.1.0/codex-prover-v0.1.0-windows-amd64.exe.zip -unzip codex-prover-v0.1.0-windows-amd64.exe.zip diff --git a/scripts/windows/download_prover.bat b/scripts/windows/download_prover.bat new file mode 100644 index 0000000..7304d9c --- /dev/null +++ b/scripts/windows/download_prover.bat @@ -0,0 +1,2 @@ +curl -O -L https://github.com/codex-storage/nim-codex/releases/download/v0.1.0/codex-prover-v0.1.0-windows-amd64.exe.zip +unzip codex-prover-v0.1.0-windows-amd64.exe.zip diff --git a/scripts/windows/run_client.bat b/scripts/windows/run_client.bat new file mode 100644 index 0000000..61b0f23 --- /dev/null +++ b/scripts/windows/run_client.bat @@ -0,0 +1,21 @@ +set LOCALIP="192.168.178.138" +set BOOTSPR="spr:CiUIAhIhAteA6IVIcN3egB_1rPz3HpFKVVO4emfRRcRzvyf0ES11EgIDARo8CicAJQgCEiEC14DohUhw3d6AH_Ws_PcekUpVU7h6Z9FFxHO_J_QRLXUQlcfKswYaCwoJBMCosquRAh-aKkcwRQIhAPzHOsoFmh96SeuFPzErNeck9C-vOkWp74HpddLmM4zLAiBwvbCZDaeMRkmVRVxh24J8OEGGuHFUTWPHAL8T7e8GyQ" + +start /b codex-v0.1.0-windows-amd64.exe ^ + --data-dir=data_bootstrap ^ + --storage-quota=11811160064 ^ + --nat=%LOCALIP% ^ + --api-port=8080 ^ + --disc-port=8090 ^ + --listen-addrs=/ip4/0.0.0.0/tcp/8070 ^ + --bootstrap-node=%BOOTSPR% ^ + persistence ^ + --eth-private-key=eth.key ^ + --eth-provider=https://rpc.testnet.codex.storage ^ + --marketplace-address=0x4cBDfab37baB0AA3AC69A7b12C4396907dfF5227 + +timeout 5 + +cls + +curl http://localhost:8080/api/codex/v1/debug/info diff --git a/scripts/windows/run_storage.bat b/scripts/windows/run_host.bat similarity index 100% rename from scripts/windows/run_storage.bat rename to scripts/windows/run_host.bat From efd0f6fd2785d0198f9f2bf846bb94f2fc78202b Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 19 Jun 2024 14:14:11 +0200 Subject: [PATCH 06/12] generate scripts - to be updated with our own url --- scripts/linux/generate.sh | 1 + scripts/windows/generate.bat | 1 + 2 files changed, 2 insertions(+) create mode 100644 scripts/linux/generate.sh create mode 100644 scripts/windows/generate.bat diff --git a/scripts/linux/generate.sh b/scripts/linux/generate.sh new file mode 100644 index 0000000..091d004 --- /dev/null +++ b/scripts/linux/generate.sh @@ -0,0 +1 @@ +curl -sX POST https://api.blockcypher.com/v1/eth/main/addrs diff --git a/scripts/windows/generate.bat b/scripts/windows/generate.bat new file mode 100644 index 0000000..091d004 --- /dev/null +++ b/scripts/windows/generate.bat @@ -0,0 +1 @@ +curl -sX POST https://api.blockcypher.com/v1/eth/main/addrs From 75fce80a252964d3a4c9c71ab4924b358426f243 Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 19 Jun 2024 14:52:47 +0200 Subject: [PATCH 07/12] do not use prover binary for client node --- scripts/linux/run_client.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/linux/run_client.sh b/scripts/linux/run_client.sh index 064fd99..65ede8f 100644 --- a/scripts/linux/run_client.sh +++ b/scripts/linux/run_client.sh @@ -1,7 +1,7 @@ LOCALIP=192.168.178.138 BOOTSPR=spr:CiUIAhIhAteA6IVIcN3egB_1rPz3HpFKVVO4emfRRcRzvyf0ES11EgIDARo8CicAJQgCEiEC14DohUhw3d6AH_Ws_PcekUpVU7h6Z9FFxHO_J_QRLXUQlcfKswYaCwoJBMCosquRAh-aKkcwRQIhAPzHOsoFmh96SeuFPzErNeck9C-vOkWp74HpddLmM4zLAiBwvbCZDaeMRkmVRVxh24J8OEGGuHFUTWPHAL8T7e8GyQ -./codex-v0.1.0-prover-linux-amd64 \ +./codex-v0.1.0-linux-amd64 \ --data-dir=data_bootstrap \ --storage-quota=11811160064 \ --nat=${LOCALIP} \ From 4057ac06520adff1b5c162f63f782f6ff0169945 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 20 Jun 2024 09:05:51 +0200 Subject: [PATCH 08/12] updates marketplace address --- scripts/linux/run_client.sh | 2 +- scripts/linux/run_host.sh | 2 +- scripts/windows/run_client.bat | 2 +- scripts/windows/run_host.bat | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/linux/run_client.sh b/scripts/linux/run_client.sh index 65ede8f..717f454 100644 --- a/scripts/linux/run_client.sh +++ b/scripts/linux/run_client.sh @@ -12,7 +12,7 @@ BOOTSPR=spr:CiUIAhIhAteA6IVIcN3egB_1rPz3HpFKVVO4emfRRcRzvyf0ES11EgIDARo8CicAJQgC persistence \ --eth-private-key=eth.key \ --eth-provider=https://rpc.testnet.codex.storage \ - --marketplace-address=0x4cBDfab37baB0AA3AC69A7b12C4396907dfF5227 \ + --marketplace-address=0x9C88D67c7C745D2F0A4E411c18A6a22c15b37EaA \ & sleep 5 diff --git a/scripts/linux/run_host.sh b/scripts/linux/run_host.sh index 55cb1b8..e41ae1e 100644 --- a/scripts/linux/run_host.sh +++ b/scripts/linux/run_host.sh @@ -16,7 +16,7 @@ BOOTSPR=$(curl http://localhost:8080/api/codex/v1/spr | cut -d '"' -f4) persistence \ --eth-private-key=eth.key \ --eth-provider=https://rpc.testnet.codex.storage \ - --marketplace-address=0x4cBDfab37baB0AA3AC69A7b12C4396907dfF5227 \ + --marketplace-address=0x9C88D67c7C745D2F0A4E411c18A6a22c15b37EaA \ prover \ & diff --git a/scripts/windows/run_client.bat b/scripts/windows/run_client.bat index 61b0f23..a392724 100644 --- a/scripts/windows/run_client.bat +++ b/scripts/windows/run_client.bat @@ -12,7 +12,7 @@ start /b codex-v0.1.0-windows-amd64.exe ^ persistence ^ --eth-private-key=eth.key ^ --eth-provider=https://rpc.testnet.codex.storage ^ - --marketplace-address=0x4cBDfab37baB0AA3AC69A7b12C4396907dfF5227 + --marketplace-address=0x9C88D67c7C745D2F0A4E411c18A6a22c15b37EaA timeout 5 diff --git a/scripts/windows/run_host.bat b/scripts/windows/run_host.bat index 67906ba..5a6a652 100644 --- a/scripts/windows/run_host.bat +++ b/scripts/windows/run_host.bat @@ -16,7 +16,7 @@ start /b codex-v0.1.0-prover-windows-amd64.exe ^ persistence ^ --eth-private-key=eth.key ^ --eth-provider=https://rpc.testnet.codex.storage ^ - --marketplace-address=0x4cBDfab37baB0AA3AC69A7b12C4396907dfF5227 ^ + --marketplace-address=0x9C88D67c7C745D2F0A4E411c18A6a22c15b37EaA ^ prover timeout 30 From 550e12d8415d7b2ec69fde9bbcb5f32bcca46f70 Mon Sep 17 00:00:00 2001 From: ThatBen Date: Thu, 20 Jun 2024 09:45:58 +0200 Subject: [PATCH 09/12] chmod --- scripts/linux/download_prover.sh | 0 scripts/linux/run_client.sh | 0 scripts/linux/run_host.sh | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/linux/download_prover.sh mode change 100644 => 100755 scripts/linux/run_client.sh mode change 100644 => 100755 scripts/linux/run_host.sh diff --git a/scripts/linux/download_prover.sh b/scripts/linux/download_prover.sh old mode 100644 new mode 100755 diff --git a/scripts/linux/run_client.sh b/scripts/linux/run_client.sh old mode 100644 new mode 100755 diff --git a/scripts/linux/run_host.sh b/scripts/linux/run_host.sh old mode 100644 new mode 100755 From eb5693e00961662110dee7294d751f19fdc8c9f1 Mon Sep 17 00:00:00 2001 From: ThatBen Date: Thu, 20 Jun 2024 09:46:18 +0200 Subject: [PATCH 10/12] one more --- scripts/linux/generate.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/linux/generate.sh diff --git a/scripts/linux/generate.sh b/scripts/linux/generate.sh old mode 100644 new mode 100755 From 2aca2bc2daab47b9d1d7e4fad7bd1e4f462d254f Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 24 Jun 2024 14:53:38 +0200 Subject: [PATCH 11/12] datadir names --- scripts/linux/run_client.sh | 2 +- scripts/linux/run_host.sh | 2 +- scripts/windows/run_client.bat | 2 +- scripts/windows/run_host.bat | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/linux/run_client.sh b/scripts/linux/run_client.sh index 717f454..62fc7c6 100755 --- a/scripts/linux/run_client.sh +++ b/scripts/linux/run_client.sh @@ -2,7 +2,7 @@ LOCALIP=192.168.178.138 BOOTSPR=spr:CiUIAhIhAteA6IVIcN3egB_1rPz3HpFKVVO4emfRRcRzvyf0ES11EgIDARo8CicAJQgCEiEC14DohUhw3d6AH_Ws_PcekUpVU7h6Z9FFxHO_J_QRLXUQlcfKswYaCwoJBMCosquRAh-aKkcwRQIhAPzHOsoFmh96SeuFPzErNeck9C-vOkWp74HpddLmM4zLAiBwvbCZDaeMRkmVRVxh24J8OEGGuHFUTWPHAL8T7e8GyQ ./codex-v0.1.0-linux-amd64 \ - --data-dir=data_bootstrap \ + --data-dir=data_client \ --storage-quota=11811160064 \ --nat=${LOCALIP} \ --api-port=8080 \ diff --git a/scripts/linux/run_host.sh b/scripts/linux/run_host.sh index e41ae1e..3eca484 100755 --- a/scripts/linux/run_host.sh +++ b/scripts/linux/run_host.sh @@ -5,7 +5,7 @@ BOOTSPR=$(curl http://localhost:8080/api/codex/v1/spr | cut -d '"' -f4) # Availability = 10 GB ./codex-v0.1.0-prover-linux-amd64 \ - --data-dir=data_storage \ + --data-dir=data_host \ --circuit-dir=circuit \ --storage-quota=11811160064 \ --nat=${LOCALIP} \ diff --git a/scripts/windows/run_client.bat b/scripts/windows/run_client.bat index a392724..d3c8b9e 100644 --- a/scripts/windows/run_client.bat +++ b/scripts/windows/run_client.bat @@ -2,7 +2,7 @@ set LOCALIP="192.168.178.138" set BOOTSPR="spr:CiUIAhIhAteA6IVIcN3egB_1rPz3HpFKVVO4emfRRcRzvyf0ES11EgIDARo8CicAJQgCEiEC14DohUhw3d6AH_Ws_PcekUpVU7h6Z9FFxHO_J_QRLXUQlcfKswYaCwoJBMCosquRAh-aKkcwRQIhAPzHOsoFmh96SeuFPzErNeck9C-vOkWp74HpddLmM4zLAiBwvbCZDaeMRkmVRVxh24J8OEGGuHFUTWPHAL8T7e8GyQ" start /b codex-v0.1.0-windows-amd64.exe ^ - --data-dir=data_bootstrap ^ + --data-dir=data_client ^ --storage-quota=11811160064 ^ --nat=%LOCALIP% ^ --api-port=8080 ^ diff --git a/scripts/windows/run_host.bat b/scripts/windows/run_host.bat index 5a6a652..a445bec 100644 --- a/scripts/windows/run_host.bat +++ b/scripts/windows/run_host.bat @@ -5,7 +5,7 @@ set BOOTSPR="UPDATE ME FROM BOOTSTRAP NODE" @REM Availability = 10 GB start /b codex-v0.1.0-prover-windows-amd64.exe ^ - --data-dir=data_storage ^ + --data-dir=data_host ^ --circuit-dir=circuit ^ --storage-quota=11811160064 ^ --nat=%LOCALIP% ^ From a77539399b21dfab5e5b0ecdfd78de8e613409a6 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 24 Jun 2024 15:18:58 +0200 Subject: [PATCH 12/12] Moving setup instructions to MD --- README.md | 193 -------------------------------------- WORKSHOPSETUP.mb | 51 ++++++++++ scripts/linux/README.md | 7 +- scripts/windows/README.md | 25 ++--- 4 files changed, 70 insertions(+), 206 deletions(-) create mode 100644 WORKSHOPSETUP.mb diff --git a/README.md b/README.md index 4003658..9725f01 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,6 @@ # Codex Testnet Starter Hit the ground running with Codex. -1. [Overview](#overview) -2. [How to start](#how-to-start) -3. [How to get ready](#how-to-get-ready) -4. [How to use](#how-to-use) -5. [How to stop](#how-to-stop) -6. [How to stop and delete everything](#how-to-stop-and-delete-everything) -7. [Troubleshooting](#troubleshooting) - - -## [Overview](#codex-testnet-starter) -![Overview](/docs/overview.png) -Using the Testnet Starter, you can run a (mostly preconfigured) Codex node on your machine. You always have the option to build and run Codex from sources [Here](https://github.com/codex-storage/nim-codex/). - ### Links - Codex Website - [codex.storage](https://codex.storage) - Codex Whitepaper - [codex.storage](https://codex.storage) @@ -22,183 +9,3 @@ Using the Testnet Starter, you can run a (mostly preconfigured) Codex node on yo - Block explorer - [explorer.testnet.codex.storage](https://explorer.testnet.codex.storage) - Web wallet - [wallet.testnet.codex.storage](https://wallet.testnet.codex.storage) - -## [How to start](#codex-testnet-starter) - 1. [Have Docker with compose installed](https://docs.docker.com/engine/install/) - - 2. Clone this repo - ```shell - git clone https://github.com/codex-storage/codex-testnet-starter && cd codex-testnet-starter - ``` - - 3. Create an Ethereum public/private key pair using [web wallet](https://wallet.testnet.codex.storage) or consider other local methods -
- Use Docker - - ```shell - # Generate keypair - docker run --rm gochain/web3 account create - ``` -
- -
- Use MetaMask - - 1. [Accounts and Addresses](https://support.metamask.io/hc/en-us/sections/4471975962907-Accounts-and-Addresses) - 2. [How to export an account's private key](https://support.metamask.io/hc/en-us/articles/360015289632-How-to-export-an-account-s-private-key) -
- -
- Use Python code - - 1. Create a venv - ```shell - pip3 install virtualenv - - venv=codex-eth-key - mkdir $venv && cd $venv - - python3 -m venv env - source env/bin/activate - ``` - - 2. Install required packages - ```shell - pip3 install web3 - ``` - - 3. Create a script - ```shell - vi eth-keys.py - ``` - ```python - from eth_account import Account - - def generate_ethereum_keypair(): - # Generate a new Ethereum account - account = Account.create() - - # Get the private key - private_key = account._private_key.hex() - - # Get the public key (Ethereum address) - public_key = account.address - - return private_key, public_key - - # Generate the Ethereum key pair - private_key, public_key = generate_ethereum_keypair() - - # Print the keys - print("Private Key:", private_key) - print("Public Key (Ethereum Address):", public_key) - ``` - - 4. Generate the keys - ```shell - python3 eth-keys.py - ``` - 5. Cleanup - ```shell - deactivate - cd .. && rm -rf $venv - ``` -
- - ``` - # Example - Private key: 0xacec4df7549199708a9f66b151aea7bf41b4d30bd325b96b26f017246226e1a3 - Public address: 0x1C408C8572ce7d5E79a3a6D353e5FC2E8E2c49ce - ``` - - 4. Define variables - ```shell - export PRIV_KEY=0xacec4df7549199708a9f66b151aea7bf41b4d30bd325b96b26f017246226e1a3 - export CODEX_LISTEN_ADDRS=/ip4/0.0.0.0/tcp/8070 - export CODEX_DISC_PORT=8090 - - # export CODEX_ETH_PROVIDER=https://rpc.testnet.codex.storage - # export CODEX_LOG_LEVEL=TRACE - # - # export GETH_DISCOVERY_PORT=8547 - # export GETH_PORT=8548 - # export GETH_NAT=extip:1.1.1.1 - # export GETH_VERBOSITY=3 - ``` - - 5. Run local nodes - ```shell - docker-compose up -d - ``` - - 6. Setup port forwarding on your router for Codex, based on defined values - ``` - TCP - CODEX_LISTEN_ADDRS=/ip4/0.0.0.0/tcp/8070 - UDP - CODEX_DISC_PORT=8090 - ``` - - -## [How to get ready](#codex-testnet-starter) -When starting the Testnet Starter for the first time, (or restarting after a long pause) please keep in mind: -- Your local Geth node will need time to sync. -- Geth checker will wait until Geth is in sync and only then Codex will start. - -Before you can use the marketplace functionality of Codex, you will need to obtain some tokens in the Testnet. -1. Use web faucets - - ETH - [faucet-eth.testnet.codex.storage](https://faucet-eth.testnet.codex.storage) - - TST - [faucet-tst.testnet.codex.storage](https://faucet-tst.testnet.codex.storage/) - -2. Or join the [Codex Discord server](https://discord.gg/codex-storage) -
- Get tokens on Discord server faucet - - 1. Find the `#bot` channel. - 2. Give your public key to the bot using `set` command. -
- example - - ![Bot-Set](/docs/bot-set.png) -
- 3. Ask it politely to mint some tokens for you using `mint` command. -
- example - - ![Bot-Mint](/docs/bot-mint.png) -
- (It may or may not happen in the future that testnet participation will be rewarded automatically with Discord server roles.) -
- - -## [How to use](#codex-testnet-starter) -Once running, Codex exposes a web-api at the API port. (default: 8080) -To read more about how to use the API, go [Here](/USINGCODEX.md) - - -## [How to stop](#codex-testnet-starter) -- `docker-compose down` - - -## [How to stop and delete everything](#codex-testnet-starter) -- `docker-compose down --rmi all -v` - - -## [Troubleshooting](#codex-testnet-starter) - - -### Geth -```shell -# List peers -docker exec -it geth geth attach --exec net.peerCount /data/geth.ipc - -# Connected peers -docker exec -it geth geth attach --exec admin.peers /data/geth.ipc - -# Add a peer -docker exec -it geth geth attach --exec 'admin.addPeer("enode://cff0c44c62ecd6e00d72131f336bb4e4968f2c1c1abeca7d4be2d35f818608b6d8688b6b65a18f1d57796eaca32fd9d08f15908a88afe18c1748997235ea6fe7@159.223.243.50:40010")' /data/geth.ipc - -# Sync status -docker exec -it geth geth attach --exec eth.syncing /data/geth.ipc - -# Geth own enode -docker exec -it geth geth attach --exec admin.nodeInfo.enode /data/geth.ipc -``` diff --git a/WORKSHOPSETUP.mb b/WORKSHOPSETUP.mb new file mode 100644 index 0000000..23cd52c --- /dev/null +++ b/WORKSHOPSETUP.mb @@ -0,0 +1,51 @@ +# Workshop Setup +With these instructions you can set up a Codex node on your machine, to use during the Brussels 2024 workshop. If you run into trouble and need help, ask a nearby Codexer! + +## Local network +Switch to the workshop wifi: +- SSID: `codex` +- Password: `ethcc2024` + +## Clone this repository +``` +git clone https://github.com/codex-storage/codex-testnet-starter.git +``` + +Open a terminal in the scripts folder for your platform: +- `scripts/linux` +- `scripts/mac` +- `scripts/windows` + +## Download Codex +Run `download` script. + +## Generate an Eth key-pair +Run `generate` script. + +Keep your public key at hand. Update the file named `eth.key` with your private key. You may need to change the permissions for this file. See the README.md in your platform specific folder. + +## Start Codex node +Determine your local IP address. Use `ifconfig` or `ipconfig`, depending on your platform. + +Set local IP environment variable + - Bash: `export LOCALIP="192.168.179.999"` + - Batch: `set LOCALIP="192.168.179.999"` + +Run `run_client` script. + +## Acquire tokens +You can acquire tokens in one of two ways: Discord bot or faucet. + +### 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 public key. + - Use `/mint` command to receive some tokens. + +### Faucet + - Follow instructions on https://faucet-eth.testnet.codex.storage to get some Eth. + - Follow instructions on https://faucet-tst.testnet.codex.storage to get some test tokens. +You will need both Eth and test tokens to use Codex. + +## Use Codex +You can now proceed to use your Codex node. Follow the instructions [here](./USINGCODEX.md) diff --git a/scripts/linux/README.md b/scripts/linux/README.md index 642676a..9a2dd75 100644 --- a/scripts/linux/README.md +++ b/scripts/linux/README.md @@ -1,3 +1,6 @@ -# May need -`sudo apt-get install libzip-dev unzip` +# Permissions +To fix the permissions of your eth.key file: `chmod 600 eth.key` + +# Additional requirements for prover +`sudo apt-get install libzip-dev unzip` diff --git a/scripts/windows/README.md b/scripts/windows/README.md index 3e81739..2a208c9 100644 --- a/scripts/windows/README.md +++ b/scripts/windows/README.md @@ -1,11 +1,14 @@ -# May need -Right-click 'eth.key' file -> Properties --> Security -> Advanced -Add -> Select a principal -> Advanced -> Find now -Select you user from the list -OK -> OK -Check Full control, Modify, Read&exe, Read, Write, Special -OK -Disable inheritance -> Confirm warning -Apply and close -Apply and close +# Permissions +To fix the permissions of your eth.key file in Windows: + - Right-click 'eth.key' file + - Properties + - Security + - Advanced + - Add -> Select a principal -> Advanced -> Find now + - Select you user from the list + - OK -> OK + - Check: "Full control", "Modify", "Read&exe", "Read", "Write" + - OK + - Disable inheritance -> Confirm warning + - Apply and close + - Apply and close