Documentation
¶
Index ¶
- Constants
- func Mine(ctx context.Context, pb PendingBlock, miningDifficulty uint) (database.Block, error)
- type AddPeerResponse
- type AddTxRequest
- type AddTxResponse
- type AddWalletRequest
- type AddWalletResponse
- type BalancesResponse
- type CreateWalletRequest
- type CreateWalletResponse
- type ErrorResponse
- type Node
- func (n *Node) AddPeer(peer PeerNode)
- func (n *Node) AddPendingTX(tx database.SignedTx, fromPeer PeerNode) error
- func (n *Node) ChangeMiningDifficulty(newDifficulty uint)
- func (n *Node) IsKnownPeer(peer PeerNode) bool
- func (n *Node) KnownPeers() []PeerNode
- func (n *Node) LatestBlockHash() database.Hash
- func (n *Node) RemovePeer(peer PeerNode)
- func (n *Node) Run(ctx context.Context) error
- type NodeInfo
- type PeerNode
- type PendingBlock
- type StatusResponse
- type SyncResponse
Constants ¶
View Source
const ( DefaultIP = "127.0.0.1" BootstrapPort = 3000 BootstrapAccount = "0xe153037747eadbDAA34a3D8c07dBd1F86dc7a17C" )
View Source
const (
DefaultMiningDifficulty = 3
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AddPeerResponse ¶
type AddTxRequest ¶
type AddTxResponse ¶
type AddTxResponse struct {
Success bool `json:"success"`
}
type AddWalletRequest ¶
type AddWalletRequest struct {
Password string `json:"password"`
}
type AddWalletResponse ¶
type AddWalletResponse struct {
Account string `json:"account"`
}
type BalancesResponse ¶
type CreateWalletRequest ¶
type CreateWalletRequest struct {
Password string `json:"password"`
}
type CreateWalletResponse ¶
type CreateWalletResponse struct {
Address string `json:"address"`
}
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
func (*Node) AddPendingTX ¶
func (*Node) ChangeMiningDifficulty ¶
func (*Node) IsKnownPeer ¶
func (*Node) LatestBlockHash ¶
func (*Node) RemovePeer ¶
type PeerNode ¶
type PeerNode struct { IP string `json:"ip"` Port uint64 `json:"port"` IsBootstrap bool `json:"is_bootstrap"` Account common.Address `json:"account"` // contains filtered or unexported fields }
func NewPeerNode ¶
func (PeerNode) ApiProtocol ¶
func (PeerNode) TcpAddress ¶
type PendingBlock ¶
type PendingBlock struct { Parent database.Hash `json:"parent"` Number uint64 `json:"number"` Time uint64 `json:"time"` Miner common.Address `json:"miner"` TXs []database.SignedTx `json:"txs"` }
func NewPendingBlock ¶
type StatusResponse ¶
type SyncResponse ¶
Click to show internal directories.
Click to hide internal directories.