sharechain

package
v0.0.0-...-e607a19 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2016 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//ShareChainLength is the number of shares the chain can hold, given an average share every 10 seconds, it holds 4 days worth of shares
	ShareChainLength = 8640 * 4
	//ShareTime is the target time between two shares (like block time in a normal blockchain)
	ShareTime = 30
	//ShareDifficulty is the required difficiculty for a share to be accepted, it is currently fixed for a 1Gh/s miner to find 2 shares per day
	ShareDifficulty = 1 * 1000 * 1000 * 1000 * 3600 * 12
)
View Source
const (
	// DatabaseFilename contains the filename of the database that will be used
	DatabaseFilename = "sharechain.db"
)

Variables

View Source
var (

	// ShareChainPool is a database bucket storing the current value of the
	// ShareChain pool.
	ShareChainPool = []byte("ShareChainPool")
)

Functions

This section is empty.

Types

type Share

type Share struct {
	BlockID   types.BlockID
	ParentID  types.BlockID
	Timestamp types.Timestamp
	Miner     string
}

Share is a block with a lower difficulty target

type ShareChain

type ShareChain struct {

	//Siad is the handler towards the sia daemon
	Siad *siad.Siad
	// contains filtered or unexported fields
}

ShareChain holds the previous shares of the pool

func New

func New(siadaemon *siad.Siad, persistDir string) (sc *ShareChain, err error)

New returns a new ShareChain. If there is an existing sharechain database present in the persist directory, it is loaded.

func (*ShareChain) GenerateMinerPayouts

func (sc *ShareChain) GenerateMinerPayouts(minerAddress types.UnlockHash, subsidy types.Currency) (payouts []types.SiacoinOutput, err error)

GenerateMinerPayouts creates a list of pplns payouts An extra payment of 0 to a random address is added to have a unique merkleroot for every generated set of payouts

func (*ShareChain) GetPPLNSSummary

func (sc *ShareChain) GetPPLNSSummary() (sharesummary map[string]int, err error)

GetPPLNSSummary returns a mapping between miner addresses and the number of shares they found (within the ShareChainLength last number of shares)

func (*ShareChain) HeaderForWork

func (sc *ShareChain) HeaderForWork(payoutaddress string) (blockheader types.BlockHeader, target types.Target, err error)

HeaderForWork returns a header that is ready for nonce grinding.

Jump to

Keyboard shortcuts

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