generation

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2019 License: MIT Imports: 26 Imported by: 0

README

Block Generator

Block Generator is the first of the two full-node types eligible to participate in the consensus (the other being the Provisioner). To become a Block Generator, a full-node has to submit a Bid Transaction. The Block Generator is eligible to participate in one phase - the block generation where the Block Generators participates in a non-interactive lottery to be able to forge a candidate block.

Blind Bid Algorithm

The block generation makes use of bulletproof-based zero-knowledge cryptography in order to prove the correct computation of a score associated with a block candidate which gets validated and selected by Provisioners during the score selection phase carried out by the selection package.

Procedure

The Blind Bid algorithm is outlined in the following steps

  1. A universal counter N is maintained for all bidding transactions in the lifetime.
  2. Seed S is computed and broadcasted.
  3. Bidder selects secret K.
  4. Bidder sends a bidding transaction with data M = H(K).
  5. For every bidding transaction with d coins and data M an entry X = H(d,M,N) is added to T. Then N is increased.
  6. Potential bidder computes Y =H(S,X), score Q=F(d,Y), and identifier Z =H(S,M).
  7. Bidder selects a bid root RT and broadcasts proof π = Π(Z, RT, Q, S; K, d, N).

Architecture

The zk-proof generation is delegated to a dedicated process written in rustlang which communicates with the main golang process through named pipes (also known as FIFO). Named pipes have been chosen over other IPC methodologies due to the excellent performance they offer. According to our benchmarks, named pipes is two times more performant than CGO (which allows golang to perform calls to C libraries) and comparable to calling the rust process directly.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateGenesisBlock

func GenerateGenesisBlock(generatorPubKey *key.PublicKey) (string, error)

GenerateGenesisBlock is a developer utility for regenerating the genesis block as they would be different per network type. Once a genesis block is approved, its hex blob should be copied into config.TestNetGenesisBlob

func Launch

func Launch(eventBus wire.EventBroker, rpcBus *wire.RPCBus, d, k ristretto.Scalar, gen Generator, blockGen BlockGenerator, keys user.Keys, publicKey *key.PublicKey)

Launch will start the processes for score/block generation.

Types

type BlockGenerator

type BlockGenerator interface {
	GenerateBlock(round uint64, seed, proof, score, prevBlockHash []byte) (*block.Block, error)
}

BlockGenerator defines a method which will create and return a new block, given a height and seed.

type Generator

type Generator interface {
	GenerateProof([]byte) zkproof.ZkProof
	UpdateBidList(user.Bid)
	RemoveExpiredBids(uint64)
}

Generator defines the capability of generating proofs of blind bid, needed to propose blocks in the consensus.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL