---
# System prepended metadata

title: Prysm migration from libp2p to it's own p2p implmentation

---

# Prysm migration from libp2p to it's own p2p implmentation

## libp2p abstractions and specs for scratch impl:
1. use [discv5](https://github.com/ethereum/devp2p/blob/master/discv5/discv5.md) peers discovery(no change in this)
2. implement [noise protcol framework](https://noiseprotocol.org/noise.html) instead of using [noise-libp2p](https://github.com/libp2p/specs/tree/master/noise), considered specs:
   *    static authentication
   *    handshake payload distribution
   *    handshake pattern
   *    add support for 25519 DH functions, ChaChaPoly cipher functions, and SHA256 hash function 

3. ensure proper encodingtyping, serialisation, desirialisation and merkelisation of payload data before distribution, refer [SSZ consensus specs](https://github.com/ethereum/consensus-specs/blob/dev/ssz/simple-serialize.md) specs included:
   * serialisation
   * deserialisation
   * typing
   * merkelisation

4. gossiping of messages between peers, implement [gossipsub framework](https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.0.md) considered specs:
   * define [pubsub](https://github.com/libp2p/specs/blob/master/pubsub/README.md) interface
   * local state discovery
   * notify using [graft control message](https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.0.md#graft)
   * implement IHAVE and IWANT correctly
   * implement subsidiary of [hearbeat procedure](https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.0.md#heartbeat) to perform regular maintainance

5. implement [multistream select](https://github.com/multiformats/multistream-select/) and multiplexing framework: [mplex](https://github.com/libp2p/specs/tree/master/mplex), [yamux](https://github.com/libp2p/specs/blob/master/yamux/README.md)

6. modify current libp2p implementation in prysm for upcoming [pectra specs](https://github.com/ethereum/consensus-specs/blob/dev/specs/electra/p2p-interface.md) mostly customiize changes for gossip domain, `beacon_block` `beacon_aggregate_and_proof` `beacon_attestation_{subnet_id}`
 
## Lighthouse custom implmentations references:
lighthouse has abstracted major part of libp2p for it's personal use already in the following crates:
1. req/resp custom implementation: [https://github.com/sigp/lighthouse/tree/stable/beacon_node/lighthouse_network/src/rpc](https://github.com/sigp/lighthouse/tree/stable/beacon_node/lighthouse_network/src/rpc) 
2. lighthouse's gossipsub implementation:
[https://github.com/sigp/lighthouse/tree/stable/beacon_node/lighthouse_network/src/rpc](https://github.com/sigp/lighthouse/tree/stable/beacon_node/lighthouse_network/gossipsub)
3. custom discv5 developed by lighhouse:
[https://github.com/sigp/discv5](https://github.com/sigp/discv5)

## prysm p2p implementation parts:
*  [beacon-chain/p2p](https://github.com/prysmaticlabs/prysm/tree/develop/beacon-chain/p2p) consensus diffenreces for p2p framework