Documentation
¶
Index ¶
- Constants
- Variables
- func HomeDirFromEnvironment() string
- func TLSConfig(certFile, keyFile, rootCAs string) (*tls.Config, error)
- type BlockRequestMessage
- type BlockResponseMessage
- type BlockchainMessage
- type BlockchainReactor
- func (bcR *BlockchainReactor) AddPeer(peer *p2p.Peer)
- func (bcR *BlockchainReactor) BroadcastStatusResponse()
- func (bcR *BlockchainReactor) BroadcastTransaction(tx *legacy.Tx) error
- func (bcr *BlockchainReactor) BuildHander()
- func (bcr *BlockchainReactor) GetAccountUTXOs() []account.AccountUTXOs
- func (bcR *BlockchainReactor) GetChannels() []*p2p.ChannelDescriptor
- func (bcR *BlockchainReactor) OnStart() error
- func (bcR *BlockchainReactor) OnStop()
- func (bcR *BlockchainReactor) Receive(chID byte, src *p2p.Peer, msgBytes []byte)
- func (bcR *BlockchainReactor) RemovePeer(peer *p2p.Peer, reason interface{})
- func (bcr *BlockchainReactor) ServeHTTP(rw http.ResponseWriter, req *http.Request)
- type BuildRequest
- type StatusRequestMessage
- type StatusResponseMessage
- type SubmitArg
- type TransactionNotifyMessage
Constants ¶
const ( BlockRequestByte = byte(0x10) BlockResponseByte = byte(0x11) StatusRequestByte = byte(0x20) StatusResponseByte = byte(0x21) NewTransactionByte = byte(0x30) )
const ( // BlockchainChannel is a channel for blocks and status updates BlockchainChannel = byte(0x40) )
Variables ¶
var (
AccountUTXOFmt = `` /* 195-byte string literal not displayed */
)
var ErrNoTLS = errors.New("no TLS configuration available")
Functions ¶
func HomeDirFromEnvironment ¶
func HomeDirFromEnvironment() string
HomeDirFromEnvironment returns the directory to use for reading config and storing variable data. It returns $BYTOM_HOME, or, if that is empty, $HOME/.chaincore.
func TLSConfig ¶
TLSConfig returns a TLS config suitable for use as a bytom client and server. It reads a PEM-encoded X.509 certificate and private key from certFile and keyFile. If rootCAs is given, it should name a file containing a list of trusted root CA certs, otherwise the returned config uses the system cert pool.
For compatibility, it attempts to read the cert and key from the environment if certFile and keyFile both do not exist in the filesystem.
TLSCRT=[PEM-encoded X.509 certificate] TLSKEY=[PEM-encoded X.509 private key]
If certFile and keyFile do not exist or are empty and the environment vars are both unset, TLSConfig returns ErrNoTLS.
Types ¶
type BlockRequestMessage ¶ added in v0.1.4
func (*BlockRequestMessage) GetHash ¶ added in v0.1.4
func (m *BlockRequestMessage) GetHash() *bc.Hash
func (*BlockRequestMessage) String ¶ added in v0.1.4
func (m *BlockRequestMessage) String() string
type BlockResponseMessage ¶ added in v0.1.4
type BlockResponseMessage struct {
RawBlock []byte
}
func NewBlockResponseMessage ¶ added in v0.1.4
func NewBlockResponseMessage(block *legacy.Block) (*BlockResponseMessage, error)
func (*BlockResponseMessage) GetBlock ¶ added in v0.1.4
func (m *BlockResponseMessage) GetBlock() *legacy.Block
func (*BlockResponseMessage) String ¶ added in v0.1.4
func (m *BlockResponseMessage) String() string
type BlockchainMessage ¶
type BlockchainMessage interface{}
BlockchainMessage is a generic message for this reactor.
func DecodeMessage ¶
func DecodeMessage(bz []byte) (msgType byte, msg BlockchainMessage, err error)
type BlockchainReactor ¶
type BlockchainReactor struct { p2p.BaseReactor // contains filtered or unexported fields }
BlockchainReactor handles long-term catchup syncing.
func NewBlockchainReactor ¶
func (*BlockchainReactor) AddPeer ¶
func (bcR *BlockchainReactor) AddPeer(peer *p2p.Peer)
AddPeer implements Reactor by sending our state to peer.
func (*BlockchainReactor) BroadcastStatusResponse ¶ added in v0.1.4
func (bcR *BlockchainReactor) BroadcastStatusResponse()
BroadcastStatusRequest broadcasts `BlockStore` height.
func (*BlockchainReactor) BroadcastTransaction ¶
func (bcR *BlockchainReactor) BroadcastTransaction(tx *legacy.Tx) error
func (*BlockchainReactor) BuildHander ¶
func (bcr *BlockchainReactor) BuildHander()
func (*BlockchainReactor) GetAccountUTXOs ¶ added in v0.1.3
func (bcr *BlockchainReactor) GetAccountUTXOs() []account.AccountUTXOs
func (*BlockchainReactor) GetChannels ¶
func (bcR *BlockchainReactor) GetChannels() []*p2p.ChannelDescriptor
GetChannels implements Reactor
func (*BlockchainReactor) OnStart ¶
func (bcR *BlockchainReactor) OnStart() error
OnStart implements BaseService
func (*BlockchainReactor) OnStop ¶
func (bcR *BlockchainReactor) OnStop()
OnStop implements BaseService
func (*BlockchainReactor) Receive ¶
func (bcR *BlockchainReactor) Receive(chID byte, src *p2p.Peer, msgBytes []byte)
Receive implements Reactor by handling 4 types of messages (look below).
func (*BlockchainReactor) RemovePeer ¶
func (bcR *BlockchainReactor) RemovePeer(peer *p2p.Peer, reason interface{})
RemovePeer implements Reactor by removing peer from the pool.
func (*BlockchainReactor) ServeHTTP ¶
func (bcr *BlockchainReactor) ServeHTTP(rw http.ResponseWriter, req *http.Request)
type BuildRequest ¶
type StatusRequestMessage ¶ added in v0.1.4
type StatusRequestMessage struct{}
func (*StatusRequestMessage) String ¶ added in v0.1.4
func (m *StatusRequestMessage) String() string
type StatusResponseMessage ¶ added in v0.1.4
func NewStatusResponseMessage ¶ added in v0.1.4
func NewStatusResponseMessage(block *legacy.Block) *StatusResponseMessage
func (*StatusResponseMessage) GetHash ¶ added in v0.1.4
func (m *StatusResponseMessage) GetHash() *bc.Hash
func (*StatusResponseMessage) String ¶ added in v0.1.4
func (m *StatusResponseMessage) String() string
type TransactionNotifyMessage ¶ added in v0.1.4
type TransactionNotifyMessage struct {
RawTx []byte
}
func NewTransactionNotifyMessage ¶ added in v0.1.4
func NewTransactionNotifyMessage(tx *legacy.Tx) (*TransactionNotifyMessage, error)
func (*TransactionNotifyMessage) GetTransaction ¶ added in v0.1.4
func (m *TransactionNotifyMessage) GetTransaction() *legacy.Tx
func (*TransactionNotifyMessage) String ¶ added in v0.1.4
func (m *TransactionNotifyMessage) String() string
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package accesstoken provides storage and validation of Chain Core credentials.
|
Package accesstoken provides storage and validation of Chain Core credentials. |
Package account stores and tracks accounts within a Chain Core.
|
Package account stores and tracks accounts within a Chain Core. |
Package pseudohsm provides a pseudo HSM for development environments.
|
Package pseudohsm provides a pseudo HSM for development environments. |
Package query implements indexing and querying of annotated blockchain data.
|
Package query implements indexing and querying of annotated blockchain data. |
filter
Package filter parses and evaluates Chain filter expressions.
|
Package filter parses and evaluates Chain filter expressions. |
Package signers associates signers and their corresponding keys.
|
Package signers associates signers and their corresponding keys. |
Package txbuilder builds a Chain Protocol transaction from a list of actions.
|
Package txbuilder builds a Chain Protocol transaction from a list of actions. |
internal/storage
Package storage is a generated protocol buffer package.
|
Package storage is a generated protocol buffer package. |