miner

package
v0.0.0-...-5e63da4 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

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
	BLOCKHASH_SIZE        = 32    //Byte
	FEE_MINIMUM           = 1     //Coins
	BLOCK_SIZE            = 20000 //Byte
	DIFF_INTERVAL         = 15    //Blocks
	BLOCK_INTERVAL        = 15    //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
	NO_AGGREGATION_LENGTH = 3     //Number of blocks after the newest block which are not aggregated.
)

Variables

View Source
var (
	FileConnectionsLog *os.File
	FileConnections    *os.File
)
View Source
var StartTime = time.Now()

Functions

func AggregateFundsTransactions

func AggregateFundsTransactions(SortedAndSelectedFundsTx []*protocol.FundsTx, block *protocol.Block, selection int) error

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_KEY_LENGTH]byte)

func Init

func Init(validatorWallet, multisigWallet ed25519.PublicKey, rootWallet ed25519.PrivateKey, 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

func OrderedBy

func OrderedBy(less ...lessFunc) *multiSorter

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
	ConflictingBlockHashWithoutTx1 [32]byte
	ConflictingBlockHashWithoutTx2 [32]byte
}

Jump to

Keyboard shortcuts

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