explorer

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: May 21, 2019 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assignment added in v0.1.2

type Assignment struct {
	gorm.Model

	Shard           uint64
	CommitteeHashes []byte
	Slot            uint64
}

Assignment is the assignment of a committee to shards.

type Attestation added in v0.1.2

type Attestation struct {
	gorm.Model

	ParticipantHashes   []byte
	Signature           []byte `gorm:"size:48"`
	Slot                uint64
	Shard               uint64
	BeaconBlockHash     []byte `gorm:"size:32"`
	EpochBoundaryHash   []byte `gorm:"size:32"`
	ShardBlockHash      []byte `gorm:"size:32"`
	LatestCrosslinkHash []byte `gorm:"size:32"`
	JustifiedSlot       uint64
	JustifiedBlockHash  []byte `gorm:"size:32"`
	BlockID             uint
}

Attestation is a single attestation.

type AttestationData added in v0.1.2

type AttestationData struct {
	ParticipantHashes   []string
	Signature           string
	Slot                uint64
	Shard               uint64
	BeaconBlockHash     string
	EpochBoundaryHash   string
	ShardBlockHash      string
	LatestCrosslinkHash string
	JustifiedSlot       uint64
	JustifiedBlockHash  string
}

AttestationData is the data of an attestation that gets passed to templates.

type Block added in v0.1.2

type Block struct {
	gorm.Model

	Proposer        []byte `gorm:"size:32"`
	ParentBlockHash []byte `gorm:"size:32"`
	StateRoot       []byte `gorm:"size:32"`
	RandaoReveal    []byte `gorm:"size:48"`
	Signature       []byte `gorm:"size:48"`
	Hash            []byte `gorm:"size:32"`
	Height          uint64
	Slot            uint64
}

Block is a single block in the chain.

type BlockData added in v0.1.2

type BlockData struct {
	Slot         uint64
	BlockHash    string
	ProposerHash string
	ParentBlock  string
	StateRoot    string
	RandaoReveal string
	Signature    string
	Attestations []AttestationData
}

BlockData is the data of a block that gets passed to templates.

type Config added in v0.1.2

type Config struct {
	GenesisTime          uint64
	DataDirectory        string
	InitialValidatorList []beacon.InitialValidatorEntry
	NetworkConfig        *config.Config
	Resync               bool
	ListeningAddress     string
	DiscoveryOptions     p2p.DiscoveryOptions
}

Config is the explorer app config.

type Database added in v0.1.2

type Database struct {
	// contains filtered or unexported fields
}

Database is the database used to store information about the blockchain.

func NewDatabase added in v0.1.2

func NewDatabase(db *gorm.DB) *Database

NewDatabase creates a new database given a gorm DB.

func (*Database) GetLatestBlocks added in v0.1.2

func (db *Database) GetLatestBlocks(n int) []Block

GetLatestBlocks gets the latest blocks in the chain.

type Epoch added in v0.1.2

type Epoch struct {
	gorm.Model

	StartSlot  uint64
	Committees []Assignment
}

Epoch is a single epoch in the blockchain.

type Explorer

type Explorer struct {
	// contains filtered or unexported fields
}

Explorer is a blockchain explorer. The explorer streams blocks from the beacon chain as they are received and then keeps track of its own blockchain so that it can access more info like forking.

func NewExplorer

func NewExplorer(c Config, gormDB *gorm.DB) (*Explorer, error)

NewExplorer creates a new block explorer

func (*Explorer) StartExplorer

func (ex *Explorer) StartExplorer() error

StartExplorer starts the block explorer

func (*Explorer) WaitForConnections added in v0.1.2

func (ex *Explorer) WaitForConnections(numConnections int)

WaitForConnections waits until beacon app is connected

type IndexData

type IndexData struct {
	Blocks       []BlockData
	Transactions []TransactionData
}

IndexData is the data that gets sent to the index page.

type ProposerData added in v0.1.2

type ProposerData struct {
	Slot      uint64
	Validator string
}

ProposerData is the data of a proposer that gets passed to templates.

type Template

type Template struct {
	// contains filtered or unexported fields
}

Template is the template engine used by the explorer.

func (*Template) Render

func (t *Template) Render(w io.Writer, name string, data interface{}, c echo.Context) error

Render renders the template.

type Transaction added in v0.1.2

type Transaction struct {
	gorm.Model

	Amount        int64
	RecipientHash []byte `gorm:"size:32"`
	Type          uint8
	Slot          uint64
}

Transaction is a slashing or reward on the beacon chain.

type TransactionData added in v0.1.2

type TransactionData struct {
	Recipient string
	Amount    int64
	Slot      uint64
}

TransactionData is the data of a transaction that gets passed to templates.

type Validator added in v0.1.2

type Validator struct {
	gorm.Model

	Pubkey                 []byte `gorm:"size:96"`
	WithdrawalCredentials  []byte `gorm:"size:32"`
	Status                 uint64
	LatestStatusChangeSlot uint64
	ExitCount              uint64
	ValidatorID            uint64
	ValidatorHash          []byte `gorm:"size:32"` // Hash(pubkey || validatorID)
}

Validator is a single validator

type ValidatorData added in v0.1.2

type ValidatorData struct {
	Pubkey                 string
	WithdrawalCredentials  string
	Status                 uint64
	LatestStatusChangeSlot uint64
	ExitCount              uint64
	ValidatorID            uint64
	ValidatorHash          string
	Attestations           []AttestationData
}

ValidatorData is the data of a validator passed to explorer templates.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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