Libp2p.PeerId (libp2p_elixir v0.9.0)

PeerId derivation and formatting.

PeerId bytes are a multihash of the libp2p-crypto protobuf-encoded public key.

Per peer-ids/peer-ids.md:

  • If the protobuf-encoded public key is <= 42 bytes, use the identity multihash.
  • Otherwise, use sha2-256 multihash.

Summary

Types

t()

@type t() :: binary()

Functions

from_base58(str)

@spec from_base58(binary()) :: t()

from_public_key_protobuf(pk_pb)

@spec from_public_key_protobuf(binary()) :: t()

from_secp256k1_pubkey_compressed(pubkey33)

@spec from_secp256k1_pubkey_compressed(binary()) :: t()

to_base58(peer_id_bytes)

@spec to_base58(t()) :: binary()