-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
79f7e84
commit 137adeb
Showing
224 changed files
with
12,264 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
title: Systems | ||
entries: | ||
- filecoin_nodes | ||
- filecoin_files | ||
- filecoin_vm | ||
- filecoin_blockchain | ||
- filecoin_token | ||
- filecoin_mining | ||
- filecoin_markets | ||
--- | ||
|
||
# Systems | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
menuIcon: 📦 | ||
title: "**Blockchain**" | ||
entries: | ||
- struct | ||
- message_pool | ||
- genesis | ||
- chainsync | ||
- storage_power_consensus | ||
--- | ||
|
||
# Blockchain | ||
--- | ||
|
||
{{< hint danger >}} | ||
incTocMap issue | ||
{{< /hint >}} | ||
|
||
{{/* < incTocMap "/docs/systems/filecoin_blockchain" 3 > */}} | ||
|
||
|
||
The Filecoin Blockchain is a distributed virtual machine that achieves consensus, processes messages, accounts for storage, and maintains security in the Filecoin Protocol. It is the main interface linking various actors in the Filecoin system. | ||
|
||
It includes: | ||
|
||
- A [Message Pool](\missing-link) subsystem that nodes use to track and propagate messages related to the storage market throughout a gossip network. | ||
- A [Virtual Machine](\missing-link) subsystem used to interpret and execute messages in order to update system state. | ||
- A [State Tree](\missing-link) subsystem which manages the creation and maintenance of state trees (the system state) deterministically generated by the vm from a given subchain. | ||
- A [Chain Synchronisation (ChainSync)](\missing-link) susbystem that tracks and propagates validated message blocks, maintaining sets of candidate chains on which the miner may mine and running syntactic validation on incoming blocks. | ||
- A [Storage Power Consensus](\missing-link) subsystem which tracks storage state (i.e., [Storage Subystem](\missing-link)) for a given chain and helps the blockchain system choose subchains to extend and blocks to include in them. | ||
|
||
And also: | ||
|
||
- A [Chain Manager](\missing-link) -- which maintains a given chain's state, providing facilities to other blockchain subsystems which will query state about the latest chain in order to run, and ensuring incoming blocks are semantically validated before inclusion into the chain. | ||
- A [Block Producer](\missing-link) -- which is called in the event of a successful leader election in order to produce a new block that will extend the current heaviest chain before forwarding it to the syncer for propagation. | ||
|
||
At a high-level, the Filecoin blockchain grows through successive rounds of leader election in which a number of miners are elected to generate a block, whose inclusion in the chain will earn them block rewards. | ||
Filecoin's blockchain runs on storage power. That is, its consensus algorithm by which miners agree on which subchain to mine is predicated on the amount of storage backing that subchain. At a high-level, the [Storage Power Consensus](\missing-link) subsystem maintains a _Power Table_ that tracks the amount of storage that [storage miner actors](\missing-link) have contributed to the network through _Sector commitments_ and _Proofs of Spacetime_. | ||
|
||
Most of the functions of the Filecoin blockchain system are detailed in the code below. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import abi "github.com/filecoin-project/specs-actors/actors/abi" | ||
import clock "github.com/filecoin-project/specs/systems/filecoin_nodes/clock" | ||
import st "github.com/filecoin-project/specs/systems/filecoin_vm/state_tree" | ||
import block "github.com/filecoin-project/specs/systems/filecoin_blockchain/struct/block" | ||
import chain "github.com/filecoin-project/specs/systems/filecoin_blockchain/struct/chain" | ||
|
||
type SectorID struct {} | ||
|
||
type Booting struct {} | ||
type CatchingUp struct {} | ||
type Synchronized struct {} | ||
type SyncState union { | ||
Booting | ||
CatchingUp | ||
Synchronized | ||
} | ||
|
||
type BlockchainSubsystem struct @(mutable) { | ||
Clock &clock.UTCClock | ||
|
||
LatestEpoch() abi.ChainEpoch | ||
BestChain() chain.Chain | ||
CandidateChains() [chain.Chain] | ||
|
||
// // Receiving blocks and tipset | ||
// should be channels or notifications | ||
NewTipsets() | ||
NewBestTipset() | ||
|
||
// validateBlockSemantics(Block) | ||
SyncState() SyncState | ||
|
||
// call by StorageClient in StorageDealMake | ||
VerifySectorExists(sectorId SectorID) bool | ||
|
||
// call by BlockSyncer in BlockReception | ||
HandleBlock(block block.Block) bool | ||
|
||
// call by BlockchainSubsystem itself in BlockProduction | ||
ValidateBlock(block block.Block) bool | ||
|
||
// call by BlockchainSubsystem itself in BlockProduction | ||
// apply messages in the parent tipset to the StateTree | ||
// and verify state root | ||
TryGenerateStateTree(block block.Block) st.StateTree | ||
|
||
// call by clock in BlockReception upon new epoch | ||
AssembleTipsets() [chain.Tipset] | ||
|
||
// call by BlockchainSubsystem itself in BlockReception upon new epoch | ||
ChooseTipset(tipsets [chain.Tipset]) chain.Tipset | ||
} |
16 changes: 16 additions & 0 deletions
16
next/content/systems/filecoin_blockchain/bootstrap/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
menuTitle: Genesis | ||
statusIcon: 🔁 | ||
title: Genesis - starting the Blockchain | ||
--- | ||
|
||
# Genesis | ||
--- | ||
|
||
**WARNING:** This section is not yet complete. | ||
|
||
Network Bootstrapping starts with production of the genesis block. | ||
|
||
The genesis block will contain: | ||
- An initial participant set, including committed storage from these miners (pre-sealed using special-cased randomness) | ||
- An initial randomness ticket |
Oops, something went wrong.