explorer

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddressPrefix    = "ad"
	CheckpointPrefix = "dc"
	PrefixLen        = 3
)

Constants for storage.

View Source
const (
	Received = "RECEIVED"
	Sent     = "SENT"
)

Tx types ...

Variables

This section is empty.

Functions

func GetAddressKey

func GetAddressKey(address string) string

GetAddressKey ...

func GetCheckpointKey added in v1.3.8

func GetCheckpointKey(blockNum *big.Int) string

GetCheckpointKey ...

func GetExplorerPort

func GetExplorerPort(nodePort string) string

GetExplorerPort returns the port serving explorer dashboard. This port is explorerPortDifference less than the node port.

Types

type Address

type Address struct {
	ID         string    `json:"id"`
	Balance    *big.Int  `json:"balance"`
	TXs        TxRecords `json:"txs"`
	StakingTXs TxRecords `json:"staking_txs"`
}

Address ...

type Data

type Data struct {
	Addresses []string `json:"Addresses"`
}

Data ...

type HTTPError

type HTTPError struct {
	Code int
	Msg  string
}

HTTPError is an HTTP error.

type Service

type Service struct {
	IP      string
	Port    string
	Storage *Storage
	// contains filtered or unexported fields
}

Service is the struct for explorer service.

func New

func New(selfPeer *p2p.Peer, ss *syncing.StateSync, bc *core.BlockChain) *Service

New returns explorer service.

func (*Service) APIs

func (s *Service) APIs() []rpc.API

APIs for the services.

func (*Service) GetAddresses added in v1.2.5

func (s *Service) GetAddresses(w http.ResponseWriter, r *http.Request)

GetAddresses serves end-point /addresses, returns size of addresses from address with prefix.

func (*Service) GetCirculatingSupply added in v1.3.2

func (s *Service) GetCirculatingSupply(w http.ResponseWriter, r *http.Request)

GetCirculatingSupply serves /circulating-supply end-point.

func (*Service) GetNodeSync added in v1.10.0

func (s *Service) GetNodeSync(w http.ResponseWriter, r *http.Request)

GetNodeSync returns status code 500 if node is not in sync

func (*Service) GetTotalSupply added in v1.3.2

func (s *Service) GetTotalSupply(w http.ResponseWriter, r *http.Request)

GetTotalSupply serves /total-supply end-point.

func (*Service) Init

func (s *Service) Init()

Init is to initialize for ExplorerService.

func (*Service) NotifyService

func (s *Service) NotifyService(params map[string]interface{})

NotifyService notify service.

func (*Service) Run

func (s *Service) Run() *http.Server

Run is to run serving explorer.

func (*Service) SetMessageChan

func (s *Service) SetMessageChan(messageChan chan *msg_pb.Message)

SetMessageChan sets up message channel to service.

func (*Service) StartService

func (s *Service) StartService()

StartService starts explorer service.

func (*Service) StopService

func (s *Service) StopService()

StopService shutdowns explorer service.

type StakingTransaction added in v1.3.7

type StakingTransaction struct {
	Transaction
}

StakingTransaction ...

func GetStakingTransaction added in v1.3.7

func GetStakingTransaction(tx *staking.StakingTransaction, addressBlock *types.Block) (*StakingTransaction, error)

GetStakingTransaction ...

type Storage

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

Storage dump the block info into leveldb.

func GetStorageInstance

func GetStorageInstance(ip, port string) *Storage

GetStorageInstance returns attack model by using singleton pattern.

func (*Storage) Dump

func (storage *Storage) Dump(block *types.Block, height uint64)

Dump extracts information from block and index them into lvdb for explorer.

func (*Storage) GetAddresses added in v1.2.5

func (storage *Storage) GetAddresses(size int, prefix string) ([]string, error)

GetAddresses returns size of addresses from address with prefix.

func (*Storage) GetDB

func (storage *Storage) GetDB() *leveldb.DB

GetDB returns the LDBDatabase of the storage.

func (*Storage) Init

func (storage *Storage) Init(ip, port string)

Init initializes the block update.

func (*Storage) UpdateTxAddressStorage added in v1.3.7

func (storage *Storage) UpdateTxAddressStorage(addr string, txRecords TxRecords, isStaking bool)

UpdateTxAddressStorage updates specific addr tx Address.

type Transaction

type Transaction struct {
	ID        string   `json:"id"`
	Timestamp string   `json:"timestamp"`
	From      string   `json:"from"`
	To        string   `json:"to"`
	Value     *big.Int `json:"value"`
	Bytes     string   `json:"bytes"`
	Data      string   `json:"data"`
	GasFee    *big.Int `json:"gasFee"`
	FromShard uint32   `json:"fromShard"`
	ToShard   uint32   `json:"toShard"`
	Type      string   `json:"type"`
}

Transaction ...

func GetTransaction

func GetTransaction(tx *types.Transaction, addressBlock *types.Block) (*Transaction, error)

GetTransaction ...

type TxRecord added in v1.3.8

type TxRecord struct {
	Hash      string
	Type      string
	Timestamp string
}

TxRecord ...

type TxRecords added in v1.3.11

type TxRecords []*TxRecord

TxRecords ...

Jump to

Keyboard shortcuts

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