miner

package
v0.0.0-...-f23cd05 Latest Latest
Warning

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

Go to latest
Published: May 2, 2019 License: Apache-2.0 Imports: 21 Imported by: 2

Documentation

Index

Constants

View Source
const (
	//How many blocks can we verify dynamically (e.g. proper time check) until we are too far behind
	//that this dynamic check is not possible anymore?!
	DELAYED_BLOCKS = 10

	TXFETCH_TIMEOUT    = 5  //Sec
	BLOCKFETCH_TIMEOUT = 40 //Sec

	//Some prominent programming languages (e.g., Java) have not unsigned integer types
	//Neglecting MSB simplifies compatibility
	MAX_MONEY = 9223372036854775807 //(2^63)-1

	//Default Block params
	//TODO @simibac How can I assure that only every min. a block will be mined?
	BLOCKHASH_SIZE       = 32      //Byte
	FEE_MINIMUM          = 1       //Coins
	BLOCK_SIZE           = 5000000 //Byte
	DIFF_INTERVAL        = 50      //Blocks
	BLOCK_INTERVAL       = 60      //Sec
	BLOCK_REWARD         = 0       //Coins
	STAKING_MINIMUM      = 1000    //Coins
	WAITING_MINIMUM      = 0       //Blocks
	ACCEPTED_TIME_DIFF   = 60      //Sec
	SLASHING_WINDOW_SIZE = 100     //Blocks
	SLASH_REWARD         = 2       //Coins
	NUM_INCL_PREV_PROOFS = 5       //Number of previous proofs included in the PoS condition
)

Variables

This section is empty.

Functions

func CalculateBlockchainSize

func CalculateBlockchainSize(currentBlockSize uint64)

func CheckAndChangeParameters

func CheckAndChangeParameters(parameters *Parameters, configTxSlice *[]*protocol.ConfigTx) (change bool)

Separate function to reuse mechanism in client implementation

func GetLatestProofs

func GetLatestProofs(n int, block *protocol.Block) (prevProofs [][crypto.COMM_PROOF_LENGTH]byte)

func Init

func Init(validatorWallet, multisigWallet, rootWallet *ecdsa.PublicKey, validatorCommitment, rootCommitment *rsa.PrivateKey)

Miner entry point

func InvertBlockArray

func InvertBlockArray(array []*protocol.Block) []*protocol.Block

func IsInSameChain

func IsInSameChain(b1, b2 *protocol.Block) bool

Check if two blocks are part of the same chain or if they appear in two competing chains

Types

type Parameters

type Parameters struct {
	BlockHash            [BLOCKHASH_SIZE]byte
	Fee_minimum          uint64 //Paid minimum fee for sending a tx.
	Block_size           uint64 //Block size in bytes.
	Diff_interval        uint64
	Block_interval       uint64
	Block_reward         uint64 //Reward for delivering the correct PoS.
	Staking_minimum      uint64 //Minimum amount a validator must own for staking.
	Waiting_minimum      uint64 //Number of blocks that must a new validator must wait before it can start validating.
	Accepted_time_diff   uint64 //Number of seconds that a block can be received in the future.
	Slashing_window_size uint64 //Number of blocks that a validator cannot vote on two competing chains.
	Slash_reward         uint64 //Reward for providing the correct slashing proof.
	// contains filtered or unexported fields
}

An instance of this datastructure is created whenever system parameters change. The blockhash is additionally recorded to know which blocks the parameter change belongs to. This is necessary, because the system records ALL config txs (even those who have no corresponding code to execute [e.g., when they're running an older version of the code]).

func NewDefaultParameters

func NewDefaultParameters() Parameters

func (Parameters) String

func (param Parameters) String() string

type SlashingProof

type SlashingProof struct {
	ConflictingBlockHash1 [32]byte
	ConflictingBlockHash2 [32]byte
}

Jump to

Keyboard shortcuts

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