Documentation ¶
Index ¶
- Constants
- func CreateValidationBlock(timestamp uint64, channel, alias string, head []byte, block *bcgo.Block, ...) *bcgo.Block
- func CreateValidationEntries(timestamp uint64, node bcgo.Node, channels map[string]bool) ([]*bcgo.BlockEntry, error)
- func CreateValidationEntry(timestamp uint64, node bcgo.Node, channel string, updated uint64, head []byte) (*bcgo.BlockEntry, error)
- type Live
- type Periodic
- func NewCentennially(node bcgo.Node, channel bcgo.Channel, listener bcgo.MiningListener) Periodic
- func NewDaily(node bcgo.Node, channel bcgo.Channel, listener bcgo.MiningListener) Periodic
- func NewDecennially(node bcgo.Node, channel bcgo.Channel, listener bcgo.MiningListener) Periodic
- func NewHourly(node bcgo.Node, channel bcgo.Channel, listener bcgo.MiningListener) Periodic
- func NewPeriodic(node bcgo.Node, channel bcgo.Channel, threshold uint64, ...) Periodic
- func NewWeekly(node bcgo.Node, channel bcgo.Channel, listener bcgo.MiningListener) Periodic
- func NewYearly(node bcgo.Node, channel bcgo.Channel, listener bcgo.MiningListener) Periodic
- type PoW
- type Unique
Examples ¶
Constants ¶
View Source
const ( ERROR_MISSING_VALIDATED_BLOCK = "%s Missing Validated Block %s %s" PERIOD_HOURLY = time.Hour PERIOD_DAILY = PERIOD_HOURLY * 24 PERIOD_WEEKLY = PERIOD_HOURLY * 168 // (24 * 7) PERIOD_YEARLY = PERIOD_HOURLY * 8766 // (24 * 365.25) PERIOD_DECENNIALLY = PERIOD_HOURLY * 87660 // (24 * 365.25 * 10) PERIOD_CENTENNIALLY = PERIOD_HOURLY * 876600 // (24 * 365.25 * 100) THRESHOLD_PERIOD_HOUR = bcgo.THRESHOLD_F THRESHOLD_PERIOD_DAY = bcgo.THRESHOLD_E THRESHOLD_PERIOD_WEEK = bcgo.THRESHOLD_D THRESHOLD_PERIOD_YEAR = bcgo.THRESHOLD_C THRESHOLD_PERIOD_DECADE = bcgo.THRESHOLD_B THRESHOLD_PERIOD_CENTURY = bcgo.THRESHOLD_A )
View Source
const ( ERROR_DUPLICATE_BLOCK = "Duplicate Block: %s" ERROR_DUPLICATE_ENTRY = "Duplicate Entry: %s" )
View Source
const (
ERROR_DIFFERENT_LIVE_FLAG = "Different Live Flag; Expected '%s', got '%s'"
)
View Source
const (
ERROR_HASH_TOO_WEAK = "Hash doesn't meet Proof-of-Work threshold: %d vs %d"
)
Variables ¶
This section is empty.
Functions ¶
func CreateValidationBlock ¶
func CreateValidationEntries ¶
Types ¶
type Live ¶
type Live struct { }
Live is a validator which ensures the Live flag in each Records' Metadata matches the Live environment variable.
type Periodic ¶
type Periodic interface { bcgo.Validator AddChannel(string) FillChannelSet(map[string]bool, bcgo.Cache, bcgo.Network) error Update(bcgo.Cache, bcgo.Network, uint64) error Start() Stop() }
func NewCentennially ¶
func NewDecennially ¶
func NewPeriodic ¶
type PoW ¶
Example ¶
package main import ( "aletheiaware.com/bcgo" "aletheiaware.com/bcgo/cache" "aletheiaware.com/bcgo/channel" "aletheiaware.com/bcgo/validation" "aletheiaware.com/cryptogo" "fmt" "log" ) func main() { validator := validation.NewPoW(bcgo.THRESHOLD_G) channel := channel.New("FooBar") channel.AddValidator(validator) cache := cache.NewMemory(10) block := &bcgo.Block{ ChannelName: "TEST", Length: 1, } hash, err := cryptogo.HashProtobuf(block) if err != nil { log.Fatal("Could not hash block:", err) } fmt.Println(validator.Validate(channel, cache, nil, hash, block)) }
Output: Hash doesn't meet Proof-of-Work threshold: 262 vs 288
Click to show internal directories.
Click to hide internal directories.