Localhost net interface:
External net interface:
TCP Socket
^
Multistream: /noise
^
Noise (Negotiator then Cipher)
^ (secured connection)
Multistream: /mplex/6.7.0 or /yamux (not supported yet)
^
Mplex stream multiplexer
^ ^ ^ ^ ^ (Streams)
Multistream: /ipfs/id/1.0.0,
/ipfs/ping/1.0.0,
/meshsub/1.1.0, (Gossip 1.1)
/eth2/beacon_chain/req/<method>/<ver> (Eth2 RPC)
^ ^ ^ ^ ^
Negotiated Protocol Handler
https://github.com/libp2p/jvm-libp2p
Channel
, ChannelPipeline
, ChannelHandler
, ByteBuf
Connection
, Stream
are essntially Netty Channel
sChannelHandler
sMinimal Libp2p spec subset required for implementing Eth2 node
TCP
WebSocket
(disabled in Teku now)Plain
(for tesing only)Secio
(disabled in Teku now)Noise-XX-25519-ChaChaPoly-SHA256
(Spec)mplex
(Spec)Gossip 1.1
: Generic pubsub
spec, Gossip
(v1.0 + v1.1) specPing
Identity
MDns
which is kind of standalone service now)The JVM library can still be assumed as beta-version:
networking:p2p module: Eth2 agnostic Libp2p binding. Contains generic classes for RPC, subscriptions
networking:eth module: Extends p2p classes for Eth2 specific functions
Configuration of Libp2p host: LibP2PNetwork.java
Stream
s/eth2/beacon_chain/req/status
/eth2/beacon_chain/req/ping
/eth2/beacon_chain/req/metadata
/eth2/beacon_chain/req/beacon_blocks_by_root
/eth2/beacon_chain/req/beacon_blocks_by_range
tech.pegasys.teku.networking.eth2.gossip
package): Gossip 1.1 topics:beacon_block
: new blocks broadcasting (BlockTopicHandler.java)beacon_attestation_{subnet_id}
: unaggregated attestations broadcasting to the subnet subnet_idbeacon_aggregate_and_proof
aggregated attestations broadcasting to be included in future blocksvoluntary_exit
, proposer_slashing
, attester_slashing
/eth2/beacon_chain/req/*
protocol IDStream
per each request/response (RpcHandler.java)[snappy[ssz[request|response]]]
(Snappy framing variant)chunk
s. Each chunk
may be fragmented to several snappy frames
. (IMO good place for hacking)respCode len1 [chunk-1-1] len2 [chunk-2-1][chunk-2-2]
beacon_attestation_{subnet_id}
topics subscriptions are volatile. A validator node needs to change subnet subscriptions on per epoch basis.[snappy[ssz[message]]]
(Snappy block variant)Spec: https://github.com/ethereum/devp2p/blob/master/discv5/discv5.md
JVM Implementation: https://github.com/PegaSysEng/discovery
beacon_attestation_{subnet_id}
Gossip subscriptionsMaturity may also be considered as Beta