mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-02-21 18:37:26 +08:00
25 lines
545 B
Go
25 lines
545 B
Go
package internal
|
|
|
|
import (
|
|
"github.com/libp2p/go-libp2p/core/crypto"
|
|
"github.com/libp2p/go-libp2p/core/peer"
|
|
"source.quilibrium.com/quilibrium/monorepo/node/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
|
|
}
|