Michael Zaikin
  • Member for 2 years, 11 months
  • Last seen more than a month ago
How to derive the tezos public key from the points on the curve (SECP256K1 or P-256)
Accepted answer
9 votes

Public keys in Tezos are stored in compressed form: <1 byte prefix>|X Prefix is b'\x02' if Y is even, b'\x03' otherwise, now you have a compressed key of 33 bytes long; Add tezos prefix b'\x03\...

View answer
How is the hash code of blocks generated?
7 votes

Take a byte representation of a particular block header: http://rpc.tzkt.io/mainnet/chains/main/blocks/head/header/raw. The format of the block header is described in the docs. Get a BLAKE2b (32bit) ...

View answer
How to generate a fake but valid protocol hash?
7 votes

Take blake2b hash of arbitrary data. Prepend \x02\xaa and base58 encode it with checksum. Example in Python: from pytezos.encoding import base58_encode from pytezos.crypto import blake2b_32 ...

View answer
How are the originated contract addreses (KT1) computed?
6 votes

In case someone needs precise calculations. Say, you have an operation group hash onvsLP3JFZia2mzZKWaFuFkWg2L5p3BDUhzh5Kr6CiDDN3rtQ1D and an origination index 0 which is increased for every ...

View answer
What are the differences between key, key_hash, address, contract and signature in Michelson?
Accepted answer
5 votes

key_hash is blake2b hash of a public key, in the base58 encoded form it can start only with tz, but address is more general, it can also hold KT accounts; There are no instructions for that, probably ...

View answer
Creating public key hash
5 votes

Try https://github.com/murbard/pytezos/blob/master/pytezos/crypto.py from pytezos.crypto import Key key = Key(key='mnemonic', passphrase='******', email='foo@bar.com') key.public_key_hash() >>&...

View answer
How are Tezos operations encoded?
Accepted answer
4 votes

The structure of an encoded operation group is the following: <branch : 32 bytes> <tag#0 : nat> | <content#0> ... <tag#n : nat> | <content#n> <signature (optional) : ...

View answer
Get unencrypted secret key from the encrpyted one in a programmatic way
Accepted answer
3 votes

If using pytezos that would be: >>> from pytezos import Key ... Key.from_encoded_key('edskReYTc3xorfemyNAcrYb6Sz8Wgj6e1PfevpZ6uysf4KXWBNxXcoLA4KBtZp7hmUCy6V3bhtWZRMSuya5DgXA1TU2JXYeDmG')....

View answer
pytezos deploy kt
3 votes

The problem is with the storage annotation (%storedValue), if you remove it, everything works. In the storage section, field annotations (starting with %) are allowed in components of pair types, ...

View answer
Need help understanding smart contract method call of tzBTC
Accepted answer
2 votes

The concept of entrypoints is very lightweight in Michelson, and under the hood it's still a value of a single type that is actually passed to the script. Hence the various ways to do the same thing, ...

View answer
How to access Big Map value for a specific key
Accepted answer
2 votes

Quick way (using Pytezos library): >>> from pytezos.michelson.pack import get_key_hash >>> get_key_hash({"string": "KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn"}, {"...

View answer
How to transfer Tez using pytezos?
2 votes

Like that: from pytezos import pytezos from decimal import Decimal pytezos.using(key='edsk...', shell='babylonnet') \ .transaction(destination='tz1...', amount=Decimal('123.456')) \ ....

View answer
Unable to get consistent tz2 (secp256pk1) signature
2 votes

Not a direct answer, but workaround python-ecdsa lib generates non-deterministic signatures by default (see more at https://www.rfc-editor.org/rfc/rfc6979#section-3.2). Each time you run your code you ...

View answer
How do I base58 encode the chain ID using Python?
2 votes

First of all, many thanks! You've helped me with solving the block signature mystery :) You can use pytezos.encoding package: from pytezos.encoding import base58_encode def get_chain_id(self): ...

View answer
Pretty-printing Micheline JSON
Accepted answer
1 votes

With PyTezos it would be (don't mind the naming, it is wrong, will be fixed at some point): >>> from pytezos.michelson.converter import micheline_to_michelson >>> print(...

View answer
Tezos CLI keypair to software wallet
0 votes

It's not possible to derive the mnemonic from a private key. Just create a new wallet using Galleon/Temple/Kukai/Atomex/other and transfer your funds using tezos-client.

View answer