5
votes
Accepted
Why does smartpy use sp.for/sp.while instead of the default loops provided by python?
Your understanding is quite correct.
SmartPy is a Python library, not a Python-inspired language so we use Python everywhere and overload Python's constructions.
This approach is called meta-...
5
votes
Creating public key hash
Try https://github.com/murbard/pytezos/blob/master/pytezos/crypto.py
from pytezos.crypto import Key
key = Key(key='mnemonic', passphrase='******', email='[email protected]')
key.public_key_hash()
>>&...
5
votes
Accepted
How do I base58 encode the chain ID using Python?
Your magicbyte seems to be wrong. If you take the decimal byte values from the original, convert them to hex, then pad it with a leading zero, you get
>>> struct.unpack('>L', b'\x00\x57\...
4
votes
Accepted
Pytezos: structuring call for FA2
As @Groxan pointed out, update_operators entrypoint expects a list:
add_op = token.update_operators([{
"add_operator": {
"owner": 'tz1...',
"operator":...
4
votes
How do I base58 encode the chain ID using Python?
It looks like you are only actually grabbing 2 bytes of data (4 hex chars). I verified this by decoding the result you got, and it only returning two bytes of data for the given magic byte.
Try ...
3
votes
Accepted
Unable to get consistent tz2 (secp256pk1) signature
The immediate problem seems to be that you are not getting signatures in "lower S" form. This seems better:
sk.sign_digest(digest, sigencode=ecdsa.util.sigencode_string_canonize)
I cannot vouch for ...
2
votes
Accepted
How to total smartpy.TMutez type stored as values in smartpy.bigmap?
There is no way of iterating over all values in a big_map in the language to which SmartPy compiles (Michelson). So it doesn't surprise me that this doesn't work in SmartPy either. Indeed, according ...
2
votes
Accepted
How to connect to sandboxed server with pytezos?
Accounts are pre-created in Sandboxed mode, this shows how to find the secret keys:
$ grep SECRET src/bin_client/tezos-init-sandboxed-client.sh
export BOOTSTRAP1_SECRET="unencrypted:...
2
votes
How to connect to sandboxed server with pytezos?
Accounts are pre-created in Sandboxed mode, this shows how to find the secret keys:
$ grep SECRET src/bin_client/tezos-init-sandboxed-client.sh
export BOOTSTRAP1_SECRET="unencrypted:...
2
votes
Unable to get consistent tz2 (secp256pk1) signature
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 ...
2
votes
Can inject operation but can't preapply operation, returns 400
The preapply/operations endpoint requires an array of operations to be submitted.
Just wrap your call around square brackets and it should work. This is how it's done in eztz.
2
votes
How do I base58 encode the chain ID using Python?
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):
...
2
votes
Accepted
How to compare a mutez value with int in smartpy
It seems like SmartPy type inference doesn't auto-cast 0 to mutez. We need to do the following:
sp.amount > sp.mutez(0)
2
votes
Pytezos for originating contracts
You can get the contract script and use it for the origination:
kolibri_oven = pytezos.using('mainnet').contract('KT1KH3wH4sneEevPVW7AACiVKMjhTvmXLSK6')
initial_storage = {}
pytezos.origination(script ...
2
votes
Accepted
Gas Exhausted error
I think this is an estimation bug on pytezos side, which only seems to happen for transactions without parameters.
Try the following:
<...>.transaction(
destination=targetAddr,
amount=...
2
votes
Accepted
How can I connect to the kathmandunet in pytezos?
Have a look at the example bellow:
from pytezos import pytezos
pytezos_client = pytezos.using(shell='https://rpc.kathmandunet.teztnets.xyz')
1
vote
1
vote
Using Pytezos to Properly call a smart contract with correct parameters ( to purchase token from objkt )
Your destination contract doesn't seem to have a fulfill_ask entrypoint.
https://tzkt.io/KT1KXXZ758wtyf2NBjWKPeXugDh5Mm7kyckw/entrypoints
And according to betterCallDev, there is no deployed Tezos ...
1
vote
Accepted
How to validate a tezos address either it's valid or invalid?
Please use the pyTezos documentation search feature
1
vote
Accepted
how to find the balance in pytezos
You can query the node to know if an implicit account tz{1,2,3}* is revealed or not.
Examples
Revealed Account: https://mainnet.api.tez.ie/chains/main/blocks/head/context/contracts/...
1
vote
How to create an address of tezos by using pytezos?
pytezos.using expects a private key as key parameter. In the example above you are providing the public key hash, which is incorrect.
:param key:
base58 encoded key, path to the faucet file, faucet ...
1
vote
Accepted
How to use the pytezos.crypto.encoding.base58_encode function?
Try the following:
from pytezos.crypto.key import Key
pk = Key.from_encoded_key('edpkvFujbm3Xiamfxceg4GbsUBHzvqLZQmZvddg7xcFFvFQBEjeHTp')
1
vote
Getting error in cryptobot smart contract. [What fix is required ?? ]
I hope you found an answer before the one I'm giving you.
I fixed 3 things:
# Line 41:
data_type = sp.TRecord(powerup = sp.TString, cryptobot_contract = sp.TContract(sp.TRecord(power = sp.TString, ...
1
vote
Buying NFT's on objkt.com using Pytezos
The contract you're originating is the tezzard's FA2 contract.
This contract is where NFT's data is stored, and where ownership of the NFTs is recorded (the ledger).
This contract does not handle the ...
1
vote
Accepted
my tezos oracles docker image (tqtezos/oracle-stock-ticker) is unable to find activation code via faucet file
The secret field was changed to activation_code when the faucets moved from https://faucet.tezos.com to https://teztnets.xyz.
Try to open a ticket in their repository: https://github.com/tqtezos/...
1
vote
Tezos for Python
PyTezos and SmartPy allow you to write smart contracts in Python, which is then transpiled into Michelson (the native language of Tezos). You then need to use the tezos-client to deploy this Michelson ...
1
vote
How to total smartpy.TMutez type stored as values in smartpy.bigmap?
@arvidj is right of course and you cannot iterate on a bigmap. You need to keep your sum in the storage.
You also have another error: if it was a map, you would still need to use a local variable to ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
python × 27smart-contracts × 7
smartpy × 5
rpc × 3
account × 3
address × 2
sandbox × 2
cryptography × 2
encoding × 2
pytezos × 2
node × 1
tezos-client × 1
transactions × 1
michelson × 1
protocol × 1
ledger × 1
operation × 1
taquito × 1
docker × 1
gas × 1
bigmap × 1
key × 1
hash × 1
fa2 × 1
faucet × 1