ceremonyclient/node/p2p/internal/beacon.go
Cassandra Heart dbd95bd9e9
v2.1.0 (#439)
* v2.1.0 [omit consensus and adjacent] - this commit will be amended with the full release after the file copy is complete

* 2.1.0 main node rollup
2025-09-30 02:48:15 -05:00

25 lines
540 B
Go

package internal
import (
"github.com/libp2p/go-libp2p/core/crypto"
"github.com/libp2p/go-libp2p/core/peer"
"source.quilibrium.com/quilibrium/monorepo/config"
)
// BeaconPeerID returns the peer ID of the beacon node.
func BeaconPeerID(network uint) peer.ID {
genesis, err := config.DownloadAndVerifyGenesis(network)
if err != nil {
panic(err)
}
pub, err := crypto.UnmarshalEd448PublicKey(genesis.Beacon)
if err != nil {
panic(err)
}
peerID, err := peer.IDFromPublicKey(pub)
if err != nil {
panic(err)
}
return peerID
}