2019-08-02 04:26:11 +00:00
|
|
|
# project lotus - 莲
|
|
|
|
|
2019-08-02 05:30:05 +00:00
|
|
|
Lotus is an experimental implementation of the Filecoin Distributed Storage
|
|
|
|
Network. For more details, check out the
|
|
|
|
[spec](https://github.com/filecoin-project/spec).
|
|
|
|
|
|
|
|
## Development
|
|
|
|
|
|
|
|
All work is tracked via issues, and an attempt to keep an up to date view on
|
|
|
|
this exists in the [lotus testnet github project
|
|
|
|
board](https://github.com/filecoin-project/go-lotus/projects/1).
|
|
|
|
|
2019-08-02 04:26:11 +00:00
|
|
|
|
|
|
|
## Building
|
|
|
|
|
|
|
|
*Dependencies:*
|
|
|
|
- go1.12 or higher
|
|
|
|
- rust (version?)
|
|
|
|
- git
|
|
|
|
- bzr (some go dependency needs this)
|
2019-09-13 22:29:38 +00:00
|
|
|
- b2sum
|
2019-09-19 18:31:54 +00:00
|
|
|
- jq
|
2019-08-02 04:26:11 +00:00
|
|
|
|
|
|
|
*Building:*
|
|
|
|
```
|
|
|
|
$ make
|
|
|
|
```
|
|
|
|
|
2019-09-27 14:53:34 +00:00
|
|
|
## Devnet
|
|
|
|
|
|
|
|
### Node setup
|
|
|
|
|
|
|
|
Download genesis, and parameters
|
|
|
|
```sh
|
|
|
|
$ wget https://ipfs.io/ipfs/QmQdj5bTUSaegqxahn5uhXY1Eb11fi3S9mZWmhFs6iTh3T/lotus.car
|
|
|
|
$ wget https://ipfs.io/ipfs/QmQdj5bTUSaegqxahn5uhXY1Eb11fi3S9mZWmhFs6iTh3T/paramfetch.sh
|
|
|
|
$ chmod +x paramfetch.sh
|
|
|
|
$ ./paramfetch.sh
|
|
|
|
```
|
|
|
|
|
|
|
|
Start full node daemon
|
|
|
|
```sh
|
|
|
|
$ lotus daemon --genesis=lotus.car
|
|
|
|
```
|
|
|
|
|
|
|
|
Connect to the network:
|
|
|
|
```sh
|
|
|
|
$ lotus net connect /ip4/147.75.80.29/tcp/41537/p2p/12D3KooWRXFamRyM924hPfEpogHLpGYx6Hdd6pHukL26iLiWRZBM
|
|
|
|
```
|
|
|
|
|
|
|
|
[wait for the chain to finish syncing]
|
|
|
|
|
|
|
|
### Basics
|
|
|
|
|
|
|
|
Create new address
|
|
|
|
```sh
|
|
|
|
$ lotus wallet new bls
|
|
|
|
t3...
|
|
|
|
```
|
|
|
|
|
|
|
|
Grab some funds from faucet - go to http://147.75.80.29:777/, paste the address
|
|
|
|
you just created, and press Send
|
|
|
|
|
|
|
|
See wallet balance:
|
|
|
|
```sh
|
|
|
|
$ 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)
|
|
|
|
|
|
|
|
### Mining
|
|
|
|
|
|
|
|
Ensure that at least one BLS address (`t3..`) in your wallet has enough funds to
|
|
|
|
cover pledge collateral:
|
|
|
|
```sh
|
|
|
|
$ lotus state pledge-collateral
|
|
|
|
1234
|
|
|
|
$ lotus wallet balance t3...
|
|
|
|
8999
|
|
|
|
```
|
|
|
|
(Balance must be higher than the returned pledge collateral for the next step to work)
|
|
|
|
|
|
|
|
Initialize storage miner:
|
|
|
|
```sh
|
|
|
|
$ lotus-storage-miner init --owner=t3...
|
|
|
|
```
|
|
|
|
This command should return successfully after miner is setup on-chain (30-60s)
|
|
|
|
|
|
|
|
Start mining:
|
|
|
|
```sh
|
|
|
|
$ lotus-storage-miner run
|
|
|
|
```
|
|
|
|
|
|
|
|
Seal random data to start producing PoSts:
|
|
|
|
```sh
|
|
|
|
$ lotus-storage-miner store-garbage
|
|
|
|
```
|
|
|
|
|
|
|
|
### Making deals
|
|
|
|
|
|
|
|
TODO: see `$ lotus client` commands
|
|
|
|
|
|
|
|
### Pond UI
|
|
|
|
|
|
|
|
Build:
|
|
|
|
```
|
|
|
|
$ make pond
|
|
|
|
```
|
|
|
|
|
|
|
|
Run:
|
|
|
|
```
|
|
|
|
$ ./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
|
|
|
|
|
|
|
|
Note: don't leave unattended for long periods of time (10h+), the web-ui tends to
|
|
|
|
eventually consume all the available RAM
|
|
|
|
|
|
|
|
### Troubleshooting
|
|
|
|
|
|
|
|
* Turn it off
|
|
|
|
* `rm -rf ~/.lotus ~/.lotusstorage/`
|
|
|
|
* "Turn it on" - Start at the top
|
|
|
|
* If that didn't help, open a new issue
|
|
|
|
|
2019-08-02 05:30:05 +00:00
|
|
|
## 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.
|
|
|
|
|
|
|
|
## 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`.
|
|
|
|
|
|
|
|
### 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 implented 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.
|
|
|
|
|
2019-08-02 05:35:37 +00:00
|
|
|
## 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.
|
|
|
|
|
2019-08-12 23:09:08 +00:00
|
|
|
To try it out, run `make pond`, then run `./pond run`.
|
2019-08-02 05:35:37 +00:00
|
|
|
Once it is running, visit localhost:2222 in your browser.
|
|
|
|
|
2019-08-02 06:26:24 +00:00
|
|
|
## 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.
|
|
|
|
|
|
|
|
For more details, see [this document](./docs/tracing.md).
|
|
|
|
|
2019-08-02 04:26:11 +00:00
|
|
|
## License
|
|
|
|
MIT + Apache
|