blockchain

package
v0.0.0-...-868bdbc Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2020 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBlockchainDb

func GetBlockchainDb() db.DB

func LoadDB

func LoadDB()

LoadDB loads databases used by blockchain

Types

type Service

type Service struct{}

Service ...

func (*Service) AddBaseBlock

func (s *Service) AddBaseBlock(bb *protobuf.BaseBlock) error

AddBaseBlock adds base block to blockchain db

func (*Service) CreateOrLoadGenesisBlock

func (s *Service) CreateOrLoadGenesisBlock() (*protobuf.BaseBlock, error)

CreateOrLoadGenesisBlock ...

func (*Service) GetBlockByBlockHash

func (s *Service) GetBlockByBlockHash(db db.DB, key []byte) (*protobuf.BaseBlock, error)

GetBlockByBlockHash ...

func (*Service) GetBlockByHeight

func (s *Service) GetBlockByHeight(height int64) (*protobuf.BaseBlock, error)

GetBlockByHeight ...

func (*Service) GetLastBlock

func (s *Service) GetLastBlock() *protobuf.BaseBlock

GetLastBlock ...

func (*Service) GetTx

func (s *Service) GetTx(txID string) ([]byte, error)

GetTx searches a transaction against a tx id in blockchain TODO: This will be completed in another PR since account since account registeration needs to be completed and I would like to complete the implementation once the account registeration works.

func (*Service) LoadStateDBWithInitialAccounts

func (s *Service) LoadStateDBWithInitialAccounts() ([]byte, error)

LoadStateDBWithInitialAccounts loads state db with initial predefined accounts. Initially 50 accounts will be loaded to state db

type ServiceI

type ServiceI interface {
	GetBlockByHeight(height int64) (*protobuf.BaseBlock, error)
	CreateOrLoadGenesisBlock() (*protobuf.BaseBlock, error)
	GetBlockByBlockHash(db db.DB, key []byte) (*protobuf.BaseBlock, error)
	AddBaseBlock(bb *protobuf.BaseBlock) error
	GetLastBlock() *protobuf.BaseBlock
	GetTx(txID string) ([]byte, error)
}

ServiceI is blockchain service interface

type TxService

type TxService struct{}

TxService ...

func (*TxService) GetLockedTxsByBlockNumber

func (t *TxService) GetLockedTxsByBlockNumber(blockNumber int64) (*pluginproto.TxLockedResponse, error)

GetLockedTxsByBlockNumber returns a list of all locked txs in a block

func (*TxService) GetRedeemTxsByBlockNumber

func (t *TxService) GetRedeemTxsByBlockNumber(blockNumber int64) (*pluginproto.TxRedeemResponse, error)

GetRedeemTxsByBlockNumber returns a list of all locked txs in a block

func (*TxService) GetTx

GetTx ...

func (*TxService) GetTxs

func (t *TxService) GetTxs(address string) (*pluginproto.TxsResponse, error)

GetTxs : Get all the txs by account address

func (*TxService) GetTxsByAssetAndAddress

func (t *TxService) GetTxsByAssetAndAddress(assetName, address string) (*pluginproto.TxsResponse, error)

GetTxsByAssetAndAddress : Get all the txs by account address and asset name

func (*TxService) GetTxsByHeight

func (t *TxService) GetTxsByHeight(height int64) (*pluginproto.TxsResponse, error)

GetTxsByHeight returns a list of all txs in a given block by height

type TxServiceI

type TxServiceI interface {
	GetTx(id string) (*pluginproto.TxDetailResponse, error)
	GetTxs(address string) (*pluginproto.TxsResponse, error)
	GetTxsByAssetAndAddress(assetName, address string) (*pluginproto.TxsResponse, error)
	GetTxsByHeight(height int64) (*pluginproto.TxsResponse, error)
}

TxServiceI is transaction service interface over blockchain

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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