blockchain

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2017 License: AGPL-3.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockRequestByte   = byte(0x10)
	BlockResponseByte  = byte(0x11)
	StatusRequestByte  = byte(0x20)
	StatusResponseByte = byte(0x21)
	NewTransactionByte = byte(0x30)
)
View Source
const (
	// BlockchainChannel is a channel for blocks and status updates
	BlockchainChannel = byte(0x40)
)

Variables

View Source
var (
	AccountUTXOFmt = `` /* 195-byte string literal not displayed */

)
View Source
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

func TLSConfig(certFile, keyFile, rootCAs string) (*tls.Config, error)

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

type BlockRequestMessage struct {
	Height  uint64
	RawHash [32]byte
}

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 NewBlockchainReactor(chain *protocol.Chain, txPool *protocol.TxPool, accounts *account.Manager, assets *asset.Registry, sw *p2p.Switch, hsm *pseudohsm.HSM, pinStore *pin.Store) *BlockchainReactor

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 BuildRequest struct {
	Tx      *legacy.TxData           `json:"base_transaction"`
	Actions []map[string]interface{} `json:"actions"`
	TTL     json.Duration            `json:"ttl"`
}

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

type StatusResponseMessage struct {
	Height  uint64
	RawHash [32]byte
}

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 SubmitArg

type SubmitArg struct {
	Transactions []txbuilder.Template
	Wait         chainjson.Duration
	WaitUntil    string `json:"wait_until"` // values none, confirmed, processed. default: processed
}

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

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.
rpc
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.

Jump to

Keyboard shortcuts

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