bios

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AN = eos.AN

AN is a shortcut to create an AccountName

View Source
var PN = eos.PN

PN is a shortcut to create a PermissionName

Functions

func AccountToNodeID

func AccountToNodeID(acct eos.AccountName) int64

func ChunkifyActions

func ChunkifyActions(actions []*eos.Action) (out [][]*eos.Action)

func Retry

func Retry(attempts int, sleep time.Duration, callback func() error) (err error)

func ScanLinesUntilBlank

func ScanLinesUntilBlank() (out string, err error)

func ScanSingleLine

func ScanSingleLine() (out string, err error)

Types

type ActionMap

type ActionMap map[string]*eos.Action

type BIOS

type BIOS struct {
	Log       *Logger
	CachePath string

	TargetNetAPI       *eos.API
	Snapshot           Snapshot
	BootSequenceFile   string
	BootSequence       *BootSeq
	WriteActions       bool
	HackVotingAccounts bool
	ReuseGenesis       bool

	Genesis *GenesisJSON

	EphemeralPrivateKey *ecc.PrivateKey
	EphemeralPublicKey  ecc.PublicKey
}

func NewBIOS

func NewBIOS(logger *Logger, cachePath string, targetAPI *eos.API) *BIOS

func (*BIOS) Boot

func (b *BIOS) Boot() error

func (*BIOS) DispatchBootNode

func (b *BIOS) DispatchBootNode(genesisJSON, publicKey, privateKey string) error

func (*BIOS) DownloadReferences

func (b *BIOS) DownloadReferences() error

func (*BIOS) DownloadURL

func (b *BIOS) DownloadURL(ref string, hash string) error

func (*BIOS) FileNameFromCache

func (b *BIOS) FileNameFromCache(ref string) string

func (*BIOS) GenerateEphemeralPrivKey

func (b *BIOS) GenerateEphemeralPrivKey() (*ecc.PrivateKey, error)

func (*BIOS) GenerateGenesisJSON

func (b *BIOS) GenerateGenesisJSON(pubKey string) string

func (*BIOS) GetContentsCacheRef

func (b *BIOS) GetContentsCacheRef(filename string) (string, error)

func (*BIOS) LoadGenesisFromFile

func (b *BIOS) LoadGenesisFromFile(pubkey string) (string, error)

func (*BIOS) ReadFromCache

func (b *BIOS) ReadFromCache(ref string) ([]byte, error)

func (*BIOS) ReaderFromCache

func (b *BIOS) ReaderFromCache(ref string) (io.ReadCloser, error)

func (*BIOS) RunChainValidation

func (b *BIOS) RunChainValidation() (bool, error)

type BootSeq

type BootSeq struct {
	Keys         map[string]string `json:"keys"`
	Contents     []*ContentRef     `json:"contents"`
	BootSequence []*OperationType  `json:"boot_sequence"`
}

func ReadBootSeq

func ReadBootSeq(filename string) (out *BootSeq, err error)

type ContentRef

type ContentRef struct {
	Name string `json:"name"`
	URL  string `json:"url"`
	Hash string `json:"hash"`
}

type GenesisJSON

type GenesisJSON struct {
	InitialTimestamp string `json:"initial_timestamp"`
	InitialKey       string `json:"initial_key"`
}

TODO: update with latest GenesisJSON with the basic parameters...

type Logger

type Logger struct {
	OutputFile   io.Writer
	OutputScreen io.Writer
	Debug        bool
}

func NewLogger

func NewLogger() *Logger

func (*Logger) Debugf

func (l *Logger) Debugf(format string, args ...interface{})

func (*Logger) Debugln

func (l *Logger) Debugln(args ...interface{})

func (*Logger) Printf

func (l *Logger) Printf(format string, args ...interface{})

func (*Logger) Println

func (l *Logger) Println(args ...interface{})

type OpCreateToken

type OpCreateToken struct {
	Account eos.AccountName `json:"account"`
	Amount  eos.Asset       `json:"amount"`
}

func (*OpCreateToken) Actions

func (op *OpCreateToken) Actions(b *BIOS) (out []*eos.Action, err error)

type OpCreateVoters

type OpCreateVoters struct {
	Creator eos.AccountName
	Pubkey  string
	Count   int
}

func (*OpCreateVoters) Actions

func (op *OpCreateVoters) Actions(b *BIOS) (out []*eos.Action, err error)

type OpInjectUnregdSnapshot

type OpInjectUnregdSnapshot struct {
	TestnetTruncateSnapshot int `json:"TESTNET_TRUNCATE_SNAPSHOT"`
}

func (*OpInjectUnregdSnapshot) Actions

func (op *OpInjectUnregdSnapshot) Actions(b *BIOS) (out []*eos.Action, err error)

type OpIssueToken

type OpIssueToken struct {
	Account eos.AccountName
	Amount  eos.Asset
	Memo    string
}

func (*OpIssueToken) Actions

func (op *OpIssueToken) Actions(b *BIOS) (out []*eos.Action, err error)

type OpNewAccount

type OpNewAccount struct {
	Creator    eos.AccountName
	NewAccount eos.AccountName `json:"new_account"`
	Pubkey     string
}

func (*OpNewAccount) Actions

func (op *OpNewAccount) Actions(b *BIOS) (out []*eos.Action, err error)

type OpResignAccounts

type OpResignAccounts struct {
	Accounts            []eos.AccountName
	TestnetKeepAccounts bool `json:"TESTNET_KEEP_ACCOUNTS"`
}

func (*OpResignAccounts) Actions

func (op *OpResignAccounts) Actions(b *BIOS) (out []*eos.Action, err error)

type OpSetCode

type OpSetCode struct {
	Account         eos.AccountName
	ContractNameRef string `json:"contract_name_ref"`
}

func (*OpSetCode) Actions

func (op *OpSetCode) Actions(b *BIOS) (out []*eos.Action, err error)

type OpSetPriv

type OpSetPriv struct {
	Account eos.AccountName
}

func (*OpSetPriv) Actions

func (op *OpSetPriv) Actions(b *BIOS) (out []*eos.Action, err error)

type OpSetProds

type OpSetProds struct {
	Prods []producerKeyString
}

func (*OpSetProds) Actions

func (op *OpSetProds) Actions(b *BIOS) (out []*eos.Action, err error)

type OpSetRAM

type OpSetRAM struct {
	MaxRAMSize uint64 `json:"max_ram_size"`
}

func (*OpSetRAM) Actions

func (op *OpSetRAM) Actions(b *BIOS) (out []*eos.Action, err error)

type OpSnapshotCreateAccounts

type OpSnapshotCreateAccounts struct {
	BuyRAMBytes             uint64 `json:"buy_ram_bytes"`
	TestnetTruncateSnapshot int    `json:"TESTNET_TRUNCATE_SNAPSHOT"`
}

func (*OpSnapshotCreateAccounts) Actions

func (op *OpSnapshotCreateAccounts) Actions(b *BIOS) (out []*eos.Action, err error)

type OpTransferToken

type OpTransferToken struct {
	From     eos.AccountName
	To       eos.AccountName
	Quantity eos.Asset
	Memo     string
}

func (*OpTransferToken) Actions

func (op *OpTransferToken) Actions(b *BIOS) (out []*eos.Action, err error)

type Operation

type Operation interface {
	Actions(b *BIOS) ([]*eos.Action, error)
}

type OperationType

type OperationType struct {
	Op    string
	Label string
	Data  Operation
}

func (*OperationType) UnmarshalJSON

func (o *OperationType) UnmarshalJSON(data []byte) error

type Snapshot

type Snapshot []SnapshotLine

func NewSnapshot

func NewSnapshot(content []byte) (out Snapshot, err error)

type SnapshotLine

type SnapshotLine struct {
	EthereumAddress string
	EOSPublicKey    ecc.PublicKey
	Balance         eos.Asset
	AccountName     string
}

type UnregdSnapshot

type UnregdSnapshot []UnregdSnapshotLine

func NewUnregdSnapshot

func NewUnregdSnapshot(content []byte) (out UnregdSnapshot, err error)

type UnregdSnapshotLine

type UnregdSnapshotLine struct {
	EthereumAddress string
	AccountName     string
	Balance         eos.Asset
}

type ValidationError

type ValidationError struct {
	Err               error
	BlockNumber       int
	Action            *eos.Action
	RawAction         []byte
	Index             int
	ActionHexData     string
	PackedTransaction *eos.PackedTransaction
}

func (ValidationError) Error

func (e ValidationError) Error() string

type ValidationErrors

type ValidationErrors struct {
	Errors []error
}

func (ValidationErrors) Error

func (v ValidationErrors) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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