Documentation
¶
Index ¶
- Constants
- func GetAddressKey(address string) string
- func GetExplorerPort(nodePort string) string
- type AddrBalance
- type Address
- type Data
- type HTTPError
- type Service
- func (s *Service) APIs() []rpc.API
- func (s *Service) GetAddresses(w http.ResponseWriter, r *http.Request)
- func (s *Service) GetTopAddresses(w http.ResponseWriter, r *http.Request)
- func (s *Service) Init(remove bool)
- func (s *Service) NotifyService(params map[string]interface{})
- func (s *Service) Run() *http.Server
- func (s *Service) SetMessageChan(messageChan chan *msg_pb.Message)
- func (s *Service) StartService()
- func (s *Service) StopService()
- func (s *Service) UpdateTopAddresses()
- type Storage
- func (storage *Storage) Dump(block *types.Block, height uint64)
- func (storage *Storage) GetAddresses(size int, prefix string) ([]string, error)
- func (storage *Storage) GetDB() *leveldb.DB
- func (storage *Storage) Init(ip, port string, remove bool)
- func (storage *Storage) UpdateAddress(batch *leveldb.Batch, explorerTransaction *Transaction, tx *types.Transaction)
- func (storage *Storage) UpdateAddressStorage(batch *leveldb.Batch, addr string, explorerTransaction *Transaction, ...)
- type Transaction
Constants ¶
const ( TopAddrLen = 20 TopPrefix = "top" )
Constants for explorer service.
const ( AddressPrefix = "ad" PrefixLen = 3 )
Constants for storage.
const ( Received = "RECEIVED" Sent = "SENT" Cross = "CROSS" )
Tx types ...
Variables ¶
This section is empty.
Functions ¶
func GetExplorerPort ¶
GetExplorerPort returns the port serving explorer dashboard. This port is explorerPortDifference less than the node port.
Types ¶
type AddrBalance ¶ added in v1.2.5
AddrBalance ...
type Address ¶
type Address struct {
ID string `json:"id"`
Balance *big.Int `json:"balance"`
TXs []*Transaction `json:"txs"`
}
Address ...
type Service ¶
type Service struct {
IP string
Port string
Storage *Storage
State func() (*state.DB, error)
// contains filtered or unexported fields
}
Service is the struct for explorer service.
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) GetTopAddresses ¶ added in v1.2.5
func (s *Service) GetTopAddresses(w http.ResponseWriter, r *http.Request)
GetTopAddresses serves end-point /top, returns top <= 20 addresses by balance with respective balance.
func (*Service) NotifyService ¶
NotifyService notify service.
func (*Service) SetMessageChan ¶
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.
func (*Service) UpdateTopAddresses ¶ added in v1.2.5
func (s *Service) UpdateTopAddresses()
UpdateTopAddresses updates 20 top addresses by balance from storage each 10 minutes.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage dump the block info into leveldb.
func GetStorageInstance ¶
GetStorageInstance returns attack model by using singleton pattern.
func (*Storage) GetAddresses ¶ added in v1.2.5
GetAddresses returns size of addresses from address with prefix.
func (*Storage) UpdateAddress ¶
func (storage *Storage) UpdateAddress(batch *leveldb.Batch, explorerTransaction *Transaction, tx *types.Transaction)
UpdateAddress ...
func (*Storage) UpdateAddressStorage ¶
func (storage *Storage) UpdateAddressStorage(batch *leveldb.Batch, addr string, explorerTransaction *Transaction, tx *types.Transaction)
UpdateAddressStorage updates specific addr 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
GetTransaction ...