From 97c29699ff0480c8e1c68631e2750c2d3b9899ab Mon Sep 17 00:00:00 2001 From: eshon <1017762+eshon@users.noreply.github.com> Date: Fri, 11 Oct 2019 17:36:58 +0200 Subject: [PATCH] adding make a deal instructions and some additional copy --- README.md | 161 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 107 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index d47385a73..9cf8658d8 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,21 @@ # project lotus - 莲 -Lotus is an experimental implementation of the Filecoin Distributed Storage -Network. For more details, check out the -[spec](https://github.com/filecoin-project/specs). +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). ## Development -All work is tracked via issues. An attempt at keeping an up-to-date view on -remaining work is in the [lotus testnet github project -board](https://github.com/filecoin-project/lotus/projects/1). +All work is tracked via issues. An attempt at keeping an up-to-date view on remaining work is in the [lotus testnet github project board](https://github.com/filecoin-project/lotus/projects/1). ## Building *Dependencies:* -- go1.12 or higher -- gcc (v7.4.0 or higher) + +- go (1.12 or higher) +- gcc (7.4.0 or higher) - git - bzr (some go dependency needs this) -- b2sum +- b2sum (In Linux in coreutils) - jq - pkg-config @@ -31,14 +28,19 @@ $ make ### Node setup -(If you have run lotus before and want to remove all previous data: `rm -rf ~/.lotusstorage`) +If you have run lotus before and want to remove all previous data: `rm -rf ~/.lotus ~/.lotusstorage` + +[You can copy `lotus` and `lotus-storage-miner` to your `$GOPATH/bin` or `$PATH/bin`, or reference all lotus commands below from your local build directory with `./lotus`] + +The following sections describe how to use the lotus CLI. Alternately you can running nodes and miners using the [Pond GUI](#pond). + +### Start Daemon -Start full node daemon ```sh $ lotus daemon ``` -Check that you are connected to the network +In another window check that you are connected to the network: ```sh $ lotus net peers | wc -l 2 # number of peers @@ -48,7 +50,11 @@ $ lotus net peers | wc -l You can see current chain height with ```sh -lotus chain getblock $(lotus chain head) | jq .Height +$ lotus sync status +``` +or use +```sh +$ lotus chain getblock $(lotus chain head) | jq .Height ``` ### Basics @@ -60,7 +66,7 @@ t3... ``` Grab some funds from faucet - go to http://147.75.80.29:777/, paste the address -you just created, and press Send +you just created, and press Send. See wallet balance: ```sh @@ -68,7 +74,7 @@ $ lotus wallet balance [optional address (t3...)] ``` (NOTE: If you see an error like `actor not found` after executing this command, it means that either there are no transactions to this address on chain - using -faucet should 'fix' this, or your node isn't fully synced) +faucet should 'fix' this, or your node isn't fully synced). ### Mining @@ -93,18 +99,75 @@ Start mining: $ lotus-storage-miner run ``` +In the Miner's startup log will be the miner address used for deals: e.g. `Registering miner 't0111' with full node.` + Seal random data to start producing PoSts: + ```sh $ lotus-storage-miner store-garbage ``` -### Making deals +### Stage Data + +Import some data: + +```sh +# Create a simple file +$ echo "Hi my name is $USER" > hello.txt + +# Import the file into lotus & get a Data CID +$ lotus client import ./hello.txt + + +# List imported files by CID, name, size, status +$ lotus client local +``` + +(CID is short for Content Identifier, a self describing content address used throughout the IPFS ecosystem. It is a cryptographic hash that uniquely maps to the data and verifies it has not changed.) + +### Make a deal + +(It is possible for a Client to make a deal with a Miner on the same lotus Node.) + +```sh +# List asks proposed by a miner +$ lotus client query-ask + +# Propose a deal with a miner +$ 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. + +### Search & Retrieval + +If you've stored data with a miner in the network, you can search for it by CID: + +```sh +# Search for data by CID +$ lotus client find +LOCAL +RETRIEVAL @-- +``` + +To 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.) + -TODO: see `$ lotus client` commands ### Pond UI +----- + +Alternative to using the CLI commands above you can also 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: + ``` $ make pond ``` @@ -115,77 +178,67 @@ $ ./pond run Listening on http://127.0.0.1:2222 ``` -Now go to http://127.0.0.1:2222, basic usage should be rather intuitive +Now go to http://127.0.0.1:2222. -Note: don't leave unattended for long periods of time (10h+), the web-ui tends to -eventually consume all the available RAM +**Things to try:** + +- Use `Spawn Node` to start 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. + +> Note: 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 +* Turn it off and on - Start at the top * `rm -rf ~/.lotus ~/.lotusstorage/` -* "Turn it on" - Start at the top -* If that didn't help, open a new issue +* Verify you have the correct versions of dependencies +* If that didn't help, open a new issue, ask in the [Community Forum]([https://discuss.filecoin.io](https://discuss.filecoin.io/)) or reach out to us via [Community chat](https://github.com/filecoin-project/community#chat). + + ## Architecture -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 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. +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 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. ## Notable Modules -### Api -The systems api is defined in here. The rpc maps directly to the api defined -here using the jsonrpc package in `lib/jsonrpc`. +### 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`. Initial API documentation in [docs/API.md](docs/API.md). ### 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. +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). +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. +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 implented in the same process (very likely to -be extracted as its own separate process in the near future). +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. +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. +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. -To try it out, run `make pond`, then run `./pond run`. +To try it out, run `make pond`, then run `./pond run`. Once it is running, visit localhost:2222 in your browser. ## 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. +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. For more details, see [this document](./docs/tracing.md).