package tezos-base
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=7062cd57addd452852598a2214ade393130efa087b99068d53713bdf912b3680
sha512=08e4091144a03ce3c107fb91a66501bd8b65ca3278917c455a2eaac6df3e108ade63f6ab8340a4bb152d60f404326e464d0ec95d26cafe8e82f870465d24a5fc
doc/tezos-base/Tezos_base/P2p_identity/index.html
Module Tezos_base.P2p_identity
Source
type t = {
peer_id : Tezos_base.P2p_peer.Id.t;
public_key : Tezos_crypto.Crypto_box.public_key;
secret_key : Tezos_crypto.Crypto_box.secret_key;
proof_of_work_stamp : Tezos_crypto.Crypto_box.nonce;
}
Type of an identity, comprising a peer_id
, a cryptographic key pair, and a proof of work stamp with enough difficulty so that the network accept this identity as genuine.
generate pow_target
is a freshly minted identity whose proof of work stamp difficulty is at least equal to pow_target
.
The argument yield_every
(defaults to 500
) introduces a call to Lwt.pause
every that many operations.
val generate_with_bound :
?yield_every:int ->
?max:int ->
Tezos_crypto.Crypto_box.pow_target ->
t Lwt.t
generate_with_bound pow_target
is a freshly minted identity whose proof of work stamp difficulty is at least equal to pow_target
.
The optional argument max
sets a maximum number of attempts. If that many attempts are made without finding a successful pow, the function fails with Not_found
.
generate_with_pow_target_0 pk
generates a proof of work for the public key pk
following a (hard-coded) 0 proof-of-work target.
NOTICE: This function is meant for generating dummy identities. It is useful for tests and other such controlled environment but it is not suitable for generating identities for an open network.