* Add links to the existing guides on Run Codex page * Add Codex/Geth bootstrap nodes and endpoints to the Testnet page * Initial version of the Quick start page * Fix bad links on Quick start page * Install dependencies in Quick start guide * minor language upgrades * Copies over disclaimer from testnet-starter repo * octet-stream type for upload * Add Disclaimer Codex page to the sidebar * Adjust Quick start guide to auto-detect platform and architecture --------- Co-authored-by: Ben <thatbenbierens@gmail.com>
4.5 KiB
Quick start
To start using Codex we would need to perform the following steps:
Get Codex binary
For quick start we will use precompiled binaries from GitHub release page. If you prefer to compile from the sources, please check Build Codex.
-
Download binary and checksum for your platform/architecture
Linux/macOS
version=v0.1.3 platform=$(echo `uname -s` | awk '{print tolower($0)}') architecture=$([[ `uname -m` == 'x86_64' ]] && echo amd64 || echo arm64) # Binary curl -LO https://github.com/codex-storage/nim-codex/releases/download/${version}/codex-${version}-${platform}-${architecture}.tar.gz # Checksum curl -LO https://github.com/codex-storage/nim-codex/releases/download/${version}/codex-${version}-${platform}-${architecture}.tar.gz.sha256 -
Verify checksum
# Linux sha256sum -c codex-${version}-${platform}-${architecture}.tar.gz.sha256 # macOS shasum -a 256 -c codex-${version}-${platform}-${architecture}.tar.gz.sha256Make sure you get
OKin the resultcodex-v0.1.3-linux-amd64.tar.gz: OK -
Extract binary
tar -zxvf codex-${version}-${platform}-${architecture}.tar.gz -
Copy binary to the appropriate folder
sudo install codex-${version}-${platform}-${architecture} /usr/local/bin/codex -
Install dependencies
# Debian-based Linux sudo apt update && sudo apt install libgomp1 -
Check the result
codex --versionCodex version: v0.1.3 Codex revision: 89917d4 Nim Compiler Version 1.6.14 [Linux: amd64] -
Cleanup
rm -f \ codex-${version}-${platform}-${architecture} \ codex-${version}-${platform}-${architecture}.tar.gz \ codex-${version}-${platform}-${architecture}.tar.gz.sha256
Run Codex
Currently, we can run Codex in two modes:
- Client node - you can upload/download files and purchase storage
- Storage node - you can sell your local storage
For quick start we will run a Codex client node as an easy way to get started. If you would like to run a storage node please follow Run Codex and Codex Testnet guides.
-
Run Codex client node
codex \ --data-dir=./data \ --api-cors-origin="*" \ --nat=`curl -s https://ip.codex.storage` \ --disc-port=8090 \ --listen-addrs=/ip4/0.0.0.0/tcp/8070 \ --bootstrap-node=spr:CiUIAhIhAiJvIcA_ZwPZ9ugVKDbmqwhJZaig5zKyLiuaicRcCGqLEgIDARo8CicAJQgCEiECIm8hwD9nA9n26BUoNuarCEllqKDnMrIuK5qJxFwIaosQ3d6esAYaCwoJBJ_f8zKRAnU6KkYwRAIgM0MvWNJL296kJ9gWvfatfmVvT-A7O2s8Mxp8l9c8EW0CIC-h-H-jBVSgFjg3Eny2u33qF7BDnWFzo7fGfZ7_qc9P::: tip In the example above we use Codex Testnet bootstrap nodes and thus we join Testnet. If you would like to join a different network, please use appropriate value. :::
-
Configure port-forwarding for the TCP/UDP ports on your Internet router
Protocol Service Port UDP Discovery 8090TCP Transport 8070
Interact with Codex
After we performed the steps above, we have a Codex client node up and running and can interact with it using Codex API.
We can perform basic tasks:
Check node information
curl http://localhost:8080/api/codex/v1/debug/info \
--write-out '\n'
Upload file ::: warning Once you upload a file to Codex, other nodes in the network can download it. :::
curl --request POST \
http://localhost:8080/api/codex/v1/data \
--header 'Content-Type: application/octet-stream' \
--write-out '\n' \
-T <FILE>
You will get CID when upload will be finished.
Download file
CID="..." # paste your CID from the previous step here between the quotes.
curl http://localhost:8080/api/codex/v1/data/${CID}/network -o ${CID}
Next steps
Now we have a Codex node up and running and know how to interact with it.
For more advanced use cases, please check the following guides: