p2p

package
v0.0.0-...-17204ef Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type P2PNode

type P2PNode struct {
	// contains filtered or unexported fields
}

P2PNode represents a P2P node in the Binomena network

func NewP2PNode

func NewP2PNode(blockchain *core.Blockchain, listenAddr string) (*P2PNode, error)

NewP2PNode creates a new P2P node

func (*P2PNode) AnnounceWallet

func (n *P2PNode) AnnounceWallet(address string) error

AnnounceWallet announces a wallet address to the network

func (*P2PNode) BroadcastBlock

func (n *P2PNode) BroadcastBlock(block core.Block) error

BroadcastBlock broadcasts a block to all known peers

func (*P2PNode) BroadcastTransaction

func (n *P2PNode) BroadcastTransaction(tx core.Transaction) error

BroadcastTransaction broadcasts a transaction to all known peers

func (*P2PNode) ConnectToPeer

func (n *P2PNode) ConnectToPeer(peerAddr string) error

ConnectToPeer connects to a peer using its multiaddress

func (*P2PNode) FindWalletPeer

func (n *P2PNode) FindWalletPeer(address string) (string, bool)

FindWalletPeer finds the peer ID for a wallet address

func (*P2PNode) GetAddress

func (n *P2PNode) GetAddress() string

GetAddress returns the node's address

func (*P2PNode) GetPeerCount

func (n *P2PNode) GetPeerCount() int

GetPeerCount returns the number of known peers

func (*P2PNode) GetPeers

func (n *P2PNode) GetPeers() []string

GetPeers returns a list of connected peers

func (*P2PNode) GetWalletCount

func (n *P2PNode) GetWalletCount() int

GetWalletCount returns the number of known wallets

func (*P2PNode) Stop

func (n *P2PNode) Stop() error

Stop stops the P2P node

Jump to

Keyboard shortcuts

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