diff --git a/README.md b/README.md index 0e034e5ce8..656a36e7de 100644 --- a/README.md +++ b/README.md @@ -58,41 +58,47 @@ build gossamer command: make gossamer ``` -### Run Default Node +### Run Development Node + +To initialise a development node: -initialise default node: ``` -./bin/gossamer --chain gssmr init +./bin/gossamer --chain dev init ``` -start default node: +To start the development node: ``` -./bin/gossamer --chain gssmr --key alice +./bin/gossamer --chain dev ``` -The built-in keys available for the node are `alice`, `bob`, `charlie`, `dave`, `eve`, `ferdie`, `george`, and `ian`. +The development node is configured to produce a block every slot and to finalise a block every round (as there is only one authority, `alice`.) -The node will not build blocks every slot by default; it will appear that the node is doing nothing, but it is actually waiting for a slot to build a block. If you wish to force it to build blocks every slot, you update the `[core]` section of `chain/gssmr/config.toml` to the following: +### Run Gossamer Node +The gossamer node runs by default as an authority with 9 authorites set at genesis. The built-in keys, corresponding to the authorities, that are available for the node are `alice`, `bob`, `charlie`, `dave`, `eve`, `ferdie`, `george`, and `ian`. + +To initialise a gossamer node: ``` -[core] -roles = 4 -babe-authority = true -grandpa-authority = true -babe-threshold-numerator = 1 -babe-threshold-denominator = 1 +./bin/gossamer --chain gssmr init ``` -Then, re-run the above steps. NOTE: this feature is for testing only; if you wish to change the BABE block production parameters, you need to create a modified runtime. +To start the gossamer node: +``` +./bin/gossamer --chain gssmr --key alice +``` + +Note: If you only run one gossamer node, the node will not build blocks every slot or finalize blocks; it will appear that the node is doing nothing, but it is actually waiting for a slot to build a block. This is because there are 9 authorities set, so at least 6 of the authorities should be run for a functional network. If you wish to reduce the number of authorities, you can modify the genesis file in `chain/gssmr/genesis-spec.json`. ### Run Kusama Node -initialise kusama node: +Kusama is currently supported as a **full node**, ie. it can sync the chain but not act as an authority. + +To initialise a kusama node: ``` ./bin/gossamer --chain kusama init ``` -start kusama node: +To start the kusama node: ``` ./bin/gossamer --chain kusama ``` @@ -108,12 +114,14 @@ After it's finished bootstrapping, the node should begin to sync. ### Run Polkadot Node -initialise polkadot node: +Polkadot is currently supported as a **full node**, ie. it can sync the chain but not act as an authority. + +To initialise a polkadot node: ``` ./bin/gossamer --chain polkadot init ``` -start polkadot node: +To start the polkadot node: ``` ./bin/gossamer --chain polkadot ``` diff --git a/docs/docs/getting-started/installation.md b/docs/docs/getting-started/installation.md index 358775e051..a97eb7dfa5 100644 --- a/docs/docs/getting-started/installation.md +++ b/docs/docs/getting-started/installation.md @@ -23,31 +23,36 @@ Run the following command to build the Gossamer binary: make gossamer ``` -## Run a Gossamer Node +### Run Development Node + +To initialise a development node: -To run default Gossamer node, first initialise the node. This writes the genesis state to the database. ``` -./bin/gossamer --chain gssmr init +./bin/gossamer --chain dev init ``` -The gossamer node runs as an authority by default. The built-in authorities are `alice`, `bob`, `charlie`, `dave`, `eve`, `ferdie`, `george`, and `ian`. To start the node as an authority, provide it with a built-in key: +To start the development node: ``` -./bin/gossamer --chain gssmr --key alice +./bin/gossamer --chain dev ``` +The development node is configured to produce a block every slot and to finalise a block every round (as there is only one authority, `alice`.) -The node will not build blocks every slot by default; it will appear that the node is doing nothing, but it is actually waiting for a slot to build a block. If you wish to force it to build blocks every slot, you update the `[core]` section of `chain/gssmr/config.toml` to the following: +### Run Gossamer Node +The gossamer node runs by default as an authority with 9 authorites set at genesis. The built-in keys, corresponding to the authorities, that are available for the node are `alice`, `bob`, `charlie`, `dave`, `eve`, `ferdie`, `george`, and `ian`. + +To initialise a gossamer node: ``` -[core] -roles = 4 -babe-authority = true -grandpa-authority = true -babe-threshold-numerator = 1 -babe-threshold-denominator = 1 +./bin/gossamer --chain gssmr init +``` + +To start the gossamer node: +``` +./bin/gossamer --chain gssmr --key alice ``` -Then, re-run the above steps. NOTE: this feature is for testing only; if you wish to change the BABE block production parameters, you need to create a modified runtime. +Note: If you only run one gossamer node, the node will not build blocks every slot or finalize blocks; it will appear that the node is doing nothing, but it is actually waiting for a slot to build a block. This is because there are 9 authorities set, so at least 6 of the authorities should be run for a functional network. If you wish to reduce the number of authorities, you can modify the genesis file in `chain/gssmr/genesis-spec.json`. If you wish to run the default node as a non-authority, you can specify `roles=1`: ``` diff --git a/dot/core/service.go b/dot/core/service.go index cf72bdfe65..c7bce45155 100644 --- a/dot/core/service.go +++ b/dot/core/service.go @@ -284,12 +284,7 @@ func (s *Service) handleReceivedBlock(block *types.Block) (err error) { return ErrNilBlockState } - err = s.blockState.AddBlock(block) - if err != nil { - return err - } - - logger.Debug("added block from BABE", "header", block.Header, "body", block.Body) + logger.Debug("got block from BABE", "header", block.Header, "body", block.Body) msg := &network.BlockAnnounceMessage{ ParentHash: block.Header.ParentHash, diff --git a/lib/babe/babe.go b/lib/babe/babe.go index 8d640be386..072d22ada0 100644 --- a/lib/babe/babe.go +++ b/lib/babe/babe.go @@ -505,6 +505,11 @@ func (b *Service) handleSlot(slotNum uint64) error { logger.Info("built block", "hash", hash.String(), "number", block.Header.Number, "slot", slotNum) logger.Debug("built block", "header", block.Header, "body", block.Body, "parent", parent.Hash()) + err = b.blockState.AddBlock(block) + if err != nil { + return err + } + err = b.safeSend(*block) if err != nil { logger.Error("failed to send block to core", "error", err)