diff --git a/docs/API.md b/docs/API.md deleted file mode 100644 index eada8460a..000000000 --- a/docs/API.md +++ /dev/null @@ -1,32 +0,0 @@ -TODO: make this into a nicer doc - -### Endpoints - -By default `127.0.0.1:1234` - daemon stores the api endpoint multiaddr in `~/.lotus/api` - -* `http://[api:port]/rpc/v0` - JsonRPC http endpoint -* `ws://[api:port]/rpc/v0` - JsonRPC websocket endpoint -* `PUT http://[api:port]/rest/v0/import` - import file to the node repo - * Requires write permission - -For JsonRPC interface definition see `api/api.go`. Required permissions are -defined in `api/struct.go` - -### Auth: - -JWT in the `Authorization: Bearer ` http header - -Permissions: -* `read` - Read node state, no private data -* `write` - Write to local store / chain, read private data -* `sign` - Use private keys stored in wallet for signing -* `admin` - Manage permissions - -Payload: -```json -{ - "Allow": ["read", "write", ...] -} -``` - -Admin token is stored in `~/.lotus/token` diff --git a/docs/images/lotus_logo_h.png b/docs/images/lotus_logo_h.png deleted file mode 100644 index 701191aae..000000000 Binary files a/docs/images/lotus_logo_h.png and /dev/null differ diff --git a/docs/images/lotus_logo_h.svg b/docs/images/lotus_logo_h.svg deleted file mode 100644 index cf9f17449..000000000 --- a/docs/images/lotus_logo_h.svg +++ /dev/null @@ -1 +0,0 @@ -lotus_logo_h \ No newline at end of file diff --git a/documentation/api.md b/documentation/api.md new file mode 100644 index 000000000..144a2a1aa --- /dev/null +++ b/documentation/api.md @@ -0,0 +1,35 @@ +# API + +The systems API is defined in here. The RPC maps directly to the API defined here using the JSON RPC package in `lib/jsonrpc`. + +## Overview + +By default `127.0.0.1:1234` - daemon stores the api endpoint multiaddr in `~/.lotus/api` + +- `http://[api:port]/rpc/v0` - JsonRPC http endpoint +- `ws://[api:port]/rpc/v0` - JsonRPC websocket endpoint +- `PUT http://[api:port]/rest/v0/import` - import file to the node repo, it requires write permission. + +For JsonRPC interface definition see `api/api.go`. Required permissions are +defined in `api/struct.go` + +## Auth + +JWT in the `Authorization: Bearer ` http header + +Permissions + +- `read` - Read node state, no private data +- `write` - Write to local store / chain, read private data +- `sign` - Use private keys stored in wallet for signing +- `admin` - Manage permissions + +Payload + +```json +{ + "Allow": ["read", "write", ...] +} +``` + +Admin token is stored in `~/.lotus/token` diff --git a/documentation/getting-started.md b/documentation/getting-started.md new file mode 100644 index 000000000..d851c8490 --- /dev/null +++ b/documentation/getting-started.md @@ -0,0 +1,9 @@ +# Project Lotus - 莲 + +Lotus is an experimental implementation of the **Filecoin Distributed Storage Network**. For more details about Filecoin, check out the [Filecoin Spec](https://github.com/filecoin-project/specs). + +## Background + +Lotus is architected modularly, and aims to keep clean API boundaries between everything, even if they are in the same process. Notably, the 'lotus full node' software, and the 'lotus storage miner' software are two separate programs. + +The **Lotus Storage Miner** is intended to be run on the machine that manages a single storage miner instance, and is meant to communicate with the full node via the websockets JSON RPC API for all of its chain interaction needs. This way, a mining operation may easily run one or many storage miners, connected to one or many full node instances. diff --git a/documentation/glossary.md b/documentation/glossary.md new file mode 100644 index 000000000..33300b8fb --- /dev/null +++ b/documentation/glossary.md @@ -0,0 +1,33 @@ +# Glossary + +## Chain/Types + +Implementation of data structures used by Filecoin and their serializations. + +## Chain/Store + +The chainstore manages all local chain state, including block headers, messages, and state. + +## Chain/State + +A package for dealing with the Filecoin state tree. Wraps the [HAMT](https://github.com/ipfs/go-hamt-ipld). + +## Chain/Actors + +Implementations of the builtin Filecoin network actors. + +## Chain/Vm + +The Filecoin state machine 'vm'. Implemented here are utilities to invoke Filecoin actor methods. + +## Miner + +The block producer logic. This package interfaces with the full node through the API, despite currently being implemented in the same process (very likely to be extracted as its own separate process in the near future). + +## Storage + +The storage miner logic. This package also interfaces with the full node through a subset of the api. This code is used to implement the `lotus-storage-miner` process. + +## Pond + +Pond is a graphical testbed for lotus. It can be used to spin up nodes, connect them in a given topology, start them mining, and observe how they function over time. diff --git a/documentation/hardware.md b/documentation/hardware.md new file mode 100644 index 000000000..98523207f --- /dev/null +++ b/documentation/hardware.md @@ -0,0 +1,3 @@ +# Picking Hardware + +Coming soon diff --git a/documentation/install-lotus-arch.md b/documentation/install-lotus-arch.md new file mode 100644 index 000000000..e1ca8d4e0 --- /dev/null +++ b/documentation/install-lotus-arch.md @@ -0,0 +1,44 @@ +# Installing Lotus on Arch Linux + +Install these dependencies: + +- go (1.13 or higher) +- gcc (7.4.0 or higher) +- git (version 2 or higher) +- bzr (some go dependency needs this) +- jq +- pkg-config +- opencl-icd-loader +- opencl driver (like nvidia-opencl on arch) (for GPU acceleration) +- opencl-headers (build) +- rustup (proofs build) +- llvm (proofs build) +- clang (proofs build) + +Arch (run): + +```sh +sudo pacman -Syu opencl-icd-loader +``` + +Arch (build): + +```sh +sudo pacman -Syu go gcc git bzr jq pkg-config opencl-icd-loader opencl-headers +``` + +## Clone + +```sh +$ git clone https://github.com/filecoin-project/lotus.git +$ cd lotus/ +``` + +## Install + +```sh +$ make clean all +$ sudo make install +``` + +Now you can use the command `lotus` in the command line. diff --git a/documentation/install-lotus-macos.md b/documentation/install-lotus-macos.md new file mode 100644 index 000000000..8c0bc3dec --- /dev/null +++ b/documentation/install-lotus-macos.md @@ -0,0 +1,32 @@ +# Installing Lotus on MacOS + +Install these dependencies: + +- go (1.13 or higher) +- gcc (7.4.0 or higher) +- git (version 2 or higher) +- bzr (some go dependency needs this) +- jq +- pkg-config +- opencl-icd-loader +- opencl driver (like nvidia-opencl on arch) (for GPU acceleration) +- opencl-headers (build) +- rustup (proofs build) +- llvm (proofs build) +- clang (proofs build) + +## Clone + +```sh +$ git clone https://github.com/filecoin-project/lotus.git +$ cd lotus/ +``` + +## Make & Install + +```sh +$ make clean all +$ sudo make install +``` + +Now you can use the command `lotus` in the command line. diff --git a/documentation/install-lotus-ubuntu.md b/documentation/install-lotus-ubuntu.md new file mode 100644 index 000000000..332a232e5 --- /dev/null +++ b/documentation/install-lotus-ubuntu.md @@ -0,0 +1,47 @@ +# Installing Lotus on Ubuntu + +Install these dependencies: + +- go (1.13 or higher) +- gcc (7.4.0 or higher) +- git (version 2 or higher) +- bzr (some go dependency needs this) +- jq +- pkg-config +- opencl-icd-loader +- opencl driver (like nvidia-opencl on arch) (for GPU acceleration) +- opencl-headers (build) +- rustup (proofs build) +- llvm (proofs build) +- clang (proofs build) + +Ubuntu / Debian (run): + +```sh +sudo apt update +sudo apt install mesa-opencl-icd ocl-icd-opencl-dev +``` + +Ubuntu (build): + +```sh +sudo add-apt-repository ppa:longsleep/golang-backports +sudo apt update +sudo apt install golang-go gcc git bzr jq pkg-config mesa-opencl-icd ocl-icd-opencl-dev +``` + +## Clone + +```sh +$ git clone https://github.com/filecoin-project/lotus.git +$ cd lotus/ +``` + +## Install + +```sh +$ make clean all +$ sudo make install +``` + +Now you can use the command `lotus` in the command line. diff --git a/documentation/mining.md b/documentation/mining.md new file mode 100644 index 000000000..1046eb8cf --- /dev/null +++ b/documentation/mining.md @@ -0,0 +1,53 @@ +# Mining + +Ensure that at least one BLS address (`t3..`) in your wallet exists + +```sh +$ lotus wallet list +t3... +``` + +With this address, go to https://lotus-faucet.kittyhawk.wtf/miner.html, and +click `Create Miner` + +Wait for a page telling you the address of the newly created storage miner to +appear - It should be saying: `New storage miners address is: t0..` + +Initialize storage miner: + +```sh +$ lotus-storage-miner init --actor=t01.. --owner=t3.... +``` + +This command should return successfully after miner is setup on-chain (30-60s) + +Start mining: + +```sh +$ lotus-storage-miner run +``` + +To view the miner id used for deals: + +```sh +$ lotus-storage-miner info +``` + +e.g. miner id `t0111` + +Seal random data to start producing PoSts: + +```sh +$ lotus-storage-miner store-garbage +``` + +You can check miner power and sector usage with the miner id: + +```sh +# Total power of the network +$ lotus-storage-miner state power + +$ lotus-storage-miner state power + +$ lotus-storage-miner state sectors +``` diff --git a/documentation/retrieving-data.md b/documentation/retrieving-data.md new file mode 100644 index 000000000..dd350764e --- /dev/null +++ b/documentation/retrieving-data.md @@ -0,0 +1,17 @@ +# Retrieving Data + +If you have stored data with a miner in the network, you can search for it by CID + +```sh +$ lotus client find +LOCAL +RETRIEVAL @-- +``` + +Retrieve data from a miner + +```sh +\$ lotus client retrieve +``` + +This will initiate a retrieval deal and write the data to the outfile. This process may take some time. diff --git a/documentation/setup-devnet-cli.md b/documentation/setup-devnet-cli.md new file mode 100644 index 000000000..090a3904c --- /dev/null +++ b/documentation/setup-devnet-cli.md @@ -0,0 +1,75 @@ +# Setup Lotus Devnet using the CLI + +## Node setup + +If you have run lotus before and want to remove all previous data: `rm -rf ~/.lotus ~/.lotusstorage` + +## Genesis & Bootstrap + +The current lotus build will automatically join the lotus Devnet using the genesis and bootstrap files in the `build/` directory. No configuration is needed. + +## Start Daemon + +```sh +$ lotus daemon +``` + +In another window check that you are connected to the network: + +```sh +$ lotus net peers | wc -l +2 # number of peers +``` + +Wait for the chain to finish syncing: + +```sh +$ lotus sync wait +``` + +You can view latest block height along with other network metrics at the https://lotus-metrics.kittyhawk.wtf/chain. + +## Basics + +Create a new address: + +```sh +$ lotus wallet new bls +t3... +``` + +Grab some funds from faucet - go to https://lotus-faucet.kittyhawk.wtf/, paste the address +you just created, and press Send. + +Check the wallet balance (balance is listed in attoFIL, where 1 attoFIL = 10^-18 FIL): + +```sh +$ lotus wallet balance [optional address (t3...)] +``` + +If you see an error like `actor not found` after executing this command, it means that either your node isn't fully synced or there are no transactions to this address yet on chain. If the latter, using the faucet should 'fix' this. + +## Make a deal + +It is possible for a Client to make a deal with a Miner on the same lotus Node. + +```sh + +# List all miners in the system. Choose one to make a deal with. + +$ lotus state list-miners + +# List asks proposed by a miner + +$ lotus client query-ask + +# Propose a deal with a miner. Price is in attoFIL/byte/block. Duration is # of blocks. + +$ lotus client deal +``` + +For example `\$ lotus client deal bafkre...qvtjsi t0111 36000 12` proposes a deal to store CID `bafkre...qvtjsi` with miner `t0111` at price `36000` for a duration of `12` blocks. If successful, the `client deal` command will return a deal CID. + +## Monitoring Dashboard + +To see the latest network activity, including chain block height, blocktime, total network power, largest miners, and more, check out the monitoring dashboard at https://lotus-metrics.kittyhawk.wtf. diff --git a/documentation/setup-devnet-gui.md b/documentation/setup-devnet-gui.md new file mode 100644 index 000000000..a5ff9c95f --- /dev/null +++ b/documentation/setup-devnet-gui.md @@ -0,0 +1,34 @@ +# Setup Lotus Devnet using a GUI + +As an alternative to the CLI you can use Pond, a graphical testbed for lotus. It can be used to spin up nodes, connect them in a given topology, start them mining, and observe how they function over time. + +Build: + +```sh +$ make pond +``` + +Run: + +```sh +$ ./pond run +Listening on http://127.0.0.1:2222 +``` + +Now go to http://127.0.0.1:2222. + +## Thing to try + +- The `Spawn Node` button starts a new lotus Node in a new draggable window. +- Click `[Spawn Storage Miner]` to start mining (make sure the Node's wallet has funds). +- Click on `[Client]` to open the Node's client interface and propose a deal with an existing Miner. If successful you'll see a payment channel open up with that Miner. + +Don't leave Pond unattended for long periods of time (10h+), the web-ui tends to eventually consume all the available RAM. + +## Troubleshooting + +- Turn it off and on - Start at the top +- `rm -rf ~/.lotus ~/.lotusstorage/` +- Verify you have the correct versions of dependencies +- If stuck on a bad fork, try `lotus chain sethead --genesis` +- If that didn't help, open a new issue, ask in the [Community forum](https://discuss.filecoin.io) or reach out via [Community chat](https://github.com/filecoin-project/community#chat). diff --git a/documentation/storing-data.md b/documentation/storing-data.md new file mode 100644 index 000000000..7f67bbb9d --- /dev/null +++ b/documentation/storing-data.md @@ -0,0 +1,20 @@ +# Storing Data + +Start by creating a file, in this example we will use the command line to create `hello.txt`. + +```sh +$ echo "Hi my name is $USER" > hello.txt +``` + +Afterwards you can import the file into lotus & get a **Data CID** as output. + +```sh +$ lotus client import ./hello.txt + +``` + +To see a list of files by `CID`, `name`, `size`, `status`. + +```sh +$ lotus client local +``` diff --git a/docs/tracing.md b/documentation/tracing.md similarity index 78% rename from docs/tracing.md rename to documentation/tracing.md index 35f6ffb0f..3807ca69b 100644 --- a/docs/tracing.md +++ b/documentation/tracing.md @@ -1,4 +1,8 @@ -## Tracing +# Tracing + +Lotus has tracing built into many of its internals. To view the traces, first download [jaeger](https://www.jaegertracing.io/download/) (Choose the 'all-in-one' binary). Then run it somewhere, start up the lotus daemon, and open up localhost:16686 in your browser. + +## Open Census Lotus uses [OpenCensus](https://opencensus.io/) for tracing application flow. This generates spans @@ -22,6 +26,7 @@ Now, to view any generated traces, open up `http://localhost:16686/` in your browser. ## Adding Spans + To annotate a new codepath with spans, add the following lines to the top of the function you wish to trace: ```go