bzzeth

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Spec = &protocols.Spec{
	Name:       "bzzeth",
	Version:    1,
	MaxMsgSize: 10 * 1024 * 1024,
	Messages: []interface{}{
		Handshake{},
		NewBlockHeaders{},
		GetBlockHeaders{},
		BlockHeaders{},
	},
	DisableContext: true,
}

Spec is the protocol spec for bzzeth

Functions

This section is empty.

Types

type BlockHeaders

type BlockHeaders struct {
	Rid     uint32         // request id
	Headers []rlp.RawValue // list of rlp encoded block headers
}

BlockHeaders encapsulates actual header blobs sent as a response to GetBlockHeaders multiple responses to the same request, whatever the node has it sends right away

type BzzEth

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

BzzEth is a global module handling ethereum state on swarm

func New

func New(netStore *storage.NetStore, kad *network.Kademlia) *BzzEth

New constructs the BzzEth node service

func (*BzzEth) APIs

func (b *BzzEth) APIs() []rpc.API

APIs return APIs defined on the node service

func (*BzzEth) Protocols

func (b *BzzEth) Protocols() []p2p.Protocol

Protocols returns the p2p protocol

func (*BzzEth) Run

func (b *BzzEth) Run(p *p2p.Peer, rw p2p.MsgReadWriter) error

Run is the bzzeth protocol run function. - creates a peer - checks if it is a swarm node, put the protocol in idle mode - performs handshake - adds peer to the peerpool - starts incoming message handler loop

func (*BzzEth) Start

func (b *BzzEth) Start(server *p2p.Server) error

Start starts the BzzEth node service

func (*BzzEth) Stop

func (b *BzzEth) Stop() error

Stop stops the BzzEth node service

type GetBlockHeaders

type GetBlockHeaders struct {
	Rid    uint64          // request id
	Hashes []chunk.Address // slice of hashes
}

GetBlockHeaders is used between a Swarm node and the Ethereum node in two cases: 1. When an Ethereum node asks the header corresponding to the hashes in the message (eth -> bzz) 2. When a Swarm node cannot find a particular header in the network, it asks the ethereum node for the header in order to push it to the network (bzz -> eth)

type Handshake

type Handshake struct {
	ServeHeaders bool // indicates if this node is expected to serve requests for headers
}

Handshake is used in between the ethereum node and the Swarm node

type NewBlockHeaders

type NewBlockHeaders []struct {
	Hash        common.Hash // block hash
	BlockHeight uint64      // block height
}

NewBlockHeaders is sent from the Ethereum client to the Swarm node

type Peer

type Peer struct {
	*protocols.Peer // embeds protocols.Peer
	// contains filtered or unexported fields
}

Peer extends p2p/protocols Peer and represents a conrete protocol connection

func NewPeer

func NewPeer(peer *protocols.Peer) *Peer

NewPeer is the constructor for Peer

Jump to

Keyboard shortcuts

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