Hot answers tagged

8

Heres how to do it in python, where the variable pubkey is the bytes array of the public key P2HASH_MAGIC = bytes.fromhex('06a1a4') blake2bhash = blake2b(pubkey, digest_size=20).digest() shabytes = sha256(sha256(P2HASH_MAGIC + blake2bhash).digest()).digest()[:4] pkhash = b58encode(P2HASH_MAGIC + blake2bhash + shabytes).decode()


5

Do you have the tezos repo built? If yes, you can run the ocaml CLI with tezos-crypto: $ dune utop src/lib_crypto and then: ocaml# open Tezos_crypto;; ocaml# Ed25519.Public_key.of_b58check_exn "edpkuoK2J2UVbDcSTdJgP85JmDN3gxBCswcgApbtY5d7zHVunwCKNR" |> Ed25519.Public_key.hash |> Ed25519.Public_key_hash.to_b58check;; ...


4

In python, using the git version of pytezos: from pytezos.crypto import Key public_key = 'edpkuoK2J2UVbDcSTdJgP85JmDN3gxBCswcgApbtY5d7zHVunwCKNR' hash = Key(public_key).public_key_hash() print(hash)


3

You can use the hash of the last known block head as branch. But it need to be injected within 64 blocks. This is to protect the operation from being executed on an alternative head (fork).


1

In NodeJS it is also possible to do it using sotez: import {Key} from 'sotez'; const sotezKey = new Key({ key: 'edpktx799pgw7M4z8551URER52VcENNCSZwE9f9cst4v6h5vCrQmJE' }); await sotezKey.ready; console.log(sotezKey.publicKeyHash()); prints: tz1Xv78KMT7cHyVDLi9RmQP1KuWULHDafZdK


1

TLDR: the first operation you injected in your node is valid but will be never be injected by other nodes/bakers because it has too low fees. It is then stuck in the mempool and make the the next operations you're trying to forge invalid because the next valid counter you want to use is already being taken by the too low fee operation. You can restart your ...


Only top voted, non community-wiki answers of a minimum length are eligible