UNPKG

@lodestar/beacon-node

Version:

A Typescript implementation of the beacon chain

17 lines (12 loc) 438 B
import {PeerId} from "@libp2p/interface"; import {peerIdFromString} from "@libp2p/peer-id"; import {base58btc} from "multiformats/bases/base58"; // Ensure consistent serialization of PeerId to string /** * PeerId serialized with `peerId.toString` */ export type PeerIdStr = string; export {peerIdFromString}; export function peerIdToString(peerId: PeerId): string { return base58btc.encode(peerId.toMultihash().bytes).slice(1); }