Reference implementation of the Filecoin protocol, written in Go
Go to file
2019-10-04 22:10:22 +02:00
.circleci fix tests 2019-09-23 15:19:05 +02:00
api fix websocket closing 2019-10-04 10:06:05 -06:00
bin pull ipget from dists and use it 2019-09-13 15:29:38 -07:00
build Depoly testnet v3 2019-10-04 22:05:29 +02:00
chain the doneset is for dropping sectors 2019-10-04 12:30:30 -06:00
cli fix websocket closing 2019-10-04 10:06:05 -06:00
cmd pass those tests 2019-10-04 10:06:05 -06:00
docs Add tracing doc 2019-07-26 11:08:48 +02:00
extern update go-sectorbuilder 2019-09-23 12:08:57 +02:00
gen Merge pull request #216 from filecoin-project/feat/consensus-slashing 2019-09-20 16:58:03 +02:00
lib pass those tests 2019-10-04 10:06:05 -06:00
lotuspond pond: Show basic node info in node index 2019-10-01 17:58:08 +02:00
miner fix nonce checking and also check cumulative balance 2019-09-26 13:47:34 -07:00
node pass those tests 2019-10-04 10:06:05 -06:00
paych paych: strict nonce check when expecteing nonzero delta 2019-09-25 15:25:54 +02:00
retrieval Incremental deal payments 2019-09-24 23:13:47 +02:00
scripts Fix build 2019-07-08 13:00:52 +02:00
storage the doneset is for dropping sectors 2019-10-04 12:30:30 -06:00
tracing Fix jaeger spam 2019-10-03 20:01:23 +02:00
.codecov.yml Disable codecov comments 2019-07-02 11:55:12 +02:00
.gitignore all-in-one paramfetch 2019-09-26 12:13:43 -07:00
.gitmodules Simpler paramfetch 2019-09-04 12:10:07 +02:00
.golangci.yml Remove doc lint 2019-07-11 10:00:24 +02:00
go.mod Built in paramfetch 2019-10-02 19:20:30 +02:00
go.sum Fix jaeger spam 2019-10-03 20:01:23 +02:00
LICENSE-APACHE Add basic readme and licenses 2019-08-01 21:26:11 -07:00
LICENSE-MIT Add basic readme and licenses 2019-08-01 21:26:11 -07:00
Makefile Clean built binaries 2019-10-03 20:07:49 +02:00
README.md Depoly testnet v3 2019-10-04 22:05:29 +02:00

project lotus - 莲

Lotus is an experimental implementation of the Filecoin Distributed Storage Network. For more details, check out the 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.

Building

Dependencies:

  • go1.12 or higher
  • gcc
  • git
  • bzr (some go dependency needs this)
  • b2sum
  • jq
  • pkg-config

Building:

$ make

Devnet

Node setup

Start full node daemon

$ lotus daemon

Connect to the network:

$ lotus net connect /ip4/147.75.80.29/tcp/1347/p2p/12D3KooWGThG7Ct5aX4tTRkgvjr3pT2JyCyyvK77GhXVQ9Cfjzj2
$ lotus net connect /ip4/147.75.80.17/tcp/1347/p2p/12D3KooWRNm4a6ESBr9bbTpSC2CfLfoWKRpABJi7FR3GhHw7usKW

[wait for the chain to finish syncing]

You can see current chain height with

lotus chain getblock $(lotus chain head) | jq .Height

Basics

Create new address

$ 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:

$ 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:

$ 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:

$ lotus-storage-miner init --owner=t3...  

This command should return successfully after miner is setup on-chain (30-60s)

Start mining:

$ lotus-storage-miner run

Seal random data to start producing PoSts:

$ 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

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.

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.

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.

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 (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.

License

MIT + Apache