package tezos-base

  1. Overview
  2. Docs
Tezos: meta-package and pervasive type definitions for Tezos

Install

Dune Dependency

Authors

Maintainers

Sources

tezos-17.3.tar.gz
sha256=7062cd57addd452852598a2214ade393130efa087b99068d53713bdf912b3680
sha512=08e4091144a03ce3c107fb91a66501bd8b65ca3278917c455a2eaac6df3e108ade63f6ab8340a4bb152d60f404326e464d0ec95d26cafe8e82f870465d24a5fc

doc/tezos-base.p2p-identity-file/Tezos_base_p2p_identity_file/Identity_file/index.html

Module Tezos_base_p2p_identity_file.Identity_fileSource

Sourcetype Tezos_base.TzPervasives.error +=
  1. | No_identity_file of string
Sourcetype Tezos_base.TzPervasives.error +=
  1. | Insufficient_proof_of_work of {
    1. expected : float;
    }
Sourcetype Tezos_base.TzPervasives.error +=
  1. | Existent_identity_file of string
Sourceval read : ?expected_pow:float -> string -> Tezos_base.TzPervasives.P2p_identity.t Tezos_base.TzPervasives.tzresult Lwt.t

read ?expected_pow filename reads an P2p_identity.t from disk at location filename. If expected_pow is set, the function also checks that the read identity has the expected PoW.

The function fails with:

  • No_identity_file if the given file is not found;
  • Identity_mismatch if the given identity is ill-formed (the id is not the hash of the public key);
  • Identity_keys_mismatch if the the public and secret keys do not match;
  • Insufficient_proof_of_work if the read identity doesn't have the expected PoW.
Sourceval write : check_data_dir: (data_dir:string -> unit Tezos_base.TzPervasives.tzresult Lwt.t) -> string -> Tezos_base.TzPervasives.P2p_identity.t -> unit Tezos_base.TzPervasives.tzresult Lwt.t

write ~check_data_dir filename identity writes identity into file filename. The function fails with Existent_identity_file if the file already exists.

See init for check_data_dir.

Sourceval generate : check_data_dir: (data_dir:string -> unit Tezos_base.TzPervasives.tzresult Lwt.t) -> string -> float -> Tezos_base.TzPervasives.P2p_identity.t Tezos_base.TzPervasives.tzresult Lwt.t

generate ~check_data_dir filename expected_pow generates a fresh identity with the given expected_pow and saves it into filename. The function fails with Existent_identity_file if filename already exists.

Sourceval init : check_data_dir: (data_dir:string -> unit Tezos_base.TzPervasives.tzresult Lwt.t) -> identity_file:string -> expected_pow:float -> Tezos_base.TzPervasives.P2p_identity.t Tezos_base.TzPervasives.tzresult Lwt.t

init ~check_data_dir ~identity_file ~expected_pow returns the P2p_identity.t read from identity_file, if any. Otherwise, it generates a fresh one with the given expected_pow, saves it into identity_file and returns it. In this latter case, the function check_data_dir can be used to enforce invariants on the "data dir" (the directory containing the identity file).

OCaml

Innovation. Community. Security.