Questions tagged [michelson]
The michelson tag has no usage guidance.
74
questions
0
votes
2answers
38 views
Michelson gas cost optimizations: any techniques, patterns and rules of thumb
Gas cost is an important topic in smart contract development. We want to maintain the costs as low as possible to allow for more operations in a block. There is a handy gas consumption reference, but ...
3
votes
1answer
36 views
Max stack depth of a Michelson program?
Is it possible to determine an upper bound for the (runtime) max stack depth that a given Michelson program will use?
I'm thinking here in terms of static analysis of the program. So, 'given a ...
1
vote
1answer
24 views
Design an oracle that provides random values to a contract
This answer mentions an improved way for an oracle to provide random numbers to a contract.
use commitments, i.e. the oracle would push a hash in the contract before the game, and send the random ...
1
vote
1answer
21 views
How are tickets passed to and read by contracts in the Edo protocol?
The Michelson documentation for the Edo protocol mentions four new operations for tickets and this blog post has an example of how tickets are used. I see that the contract in that example can take a ...
1
vote
1answer
19 views
How un/reliable is the timestamp provided by NOW in Michelson?
To which extend can bakers manipulate the timestamp Michelson uses for NOW?
I am not really sure how this value is provided to the smart contract and how reliable/unreliable it can be...
Is it safe to ...
2
votes
2answers
70 views
Passing parameters in truffle tests
I have this parameter for a function:
type modify_list is
| Add of list(address)
| Remove of list(address)
type modify_list_michelson is michelson_or_right_comb(modify_list)
When I try to supply ...
1
vote
1answer
20 views
What's the best way to convert from TMutez to TBytes?
Previously when I asked about converting types, I got this useful suggestion:
For mutez, you could start to convert to int (by dividing by 1 mutez) and then use the same techniques.
I'm wondering if ...
1
vote
2answers
62 views
How to Integrating SmartPy compiler within the browser?
I have been trying to integrate the SmartPy compiler toolchain within Cryptoverse wars Learning interface and have been going through this video (OCaml Under The Hood: SmartPy) and have encountered ...
0
votes
0answers
28 views
signing and broadcasting operations sdks and other methods?
I'm trying to broadcast an operation using the following method in pytezos as a backend for a dapp:
forge -> receive signature (from thanos) -> reconstruct operation group -> inject
this ...
1
vote
2answers
43 views
How can I write On Chain Contract Calls in Tezos Sandbox?
I am trying to write a test case in Tezos Sandbox that uses an On Chain Contract Call. To start with, I am trying to implement the example from SmartPy "On Chain Contract Calls - Collatz" ...
0
votes
1answer
27 views
How are pairs serialized in Tezos?
Running the PACK operation on a tuple (represented as a pair in Michelson, I get
$ ligo interpret -s pascaligo 'Bytes.pack((1, 2))'
0x05070700010002
The numbers 1 and 2 are serialized as 0001 and ...
0
votes
1answer
39 views
Handling floating point numbers in decentralized exchanges
I am writing a contract in Ligo that manages FA2 fungible tokens with an interface that lets users easily create new tokens. I am building a very simple exchange where the users can create orders to ...
1
vote
1answer
44 views
How to call PACK in JavaScript
In my smart contract in LIGO I serialize some data using Bytes.pack which calls the underlying PACK Michelson instruction. In my case, the function signature is (nat, address, nat) -> bytes. Does ...
1
vote
1answer
53 views
Batching Transactions FA2
On the Tzip for FA2, I read that
Every transfer operation MUST happen atomically and in order. If at least one
transfer in the batch cannot be completed, the whole transaction MUST fail, all
token ...
1
vote
1answer
26 views
Maximum value for Nat in michelson
Hello what is the maximum value for natrual number in michelson or what a bigmap can handle. I am trying to write a FA1.2 contract and is concerned if there will be a maximum amount an account can ...
2
votes
1answer
34 views
What are the changes in Michelson in Dalphanet?
Dalphanet introduces quite a few new primitives and types.
What are these primitives and types?
What are their typing rules?
1
vote
1answer
18 views
How does sp.record arrange data into pairs?
For example if I have the following code:
sp.record(one = one, two = two, three = three, four = four, five = five)
Would the format of the result be
pair(one pair(two pair(three pair(four five))))
or
...
3
votes
1answer
122 views
Gas costs types in Michelson
Gas cost is an important topic in tezos and I would like to understand better
the different types of it that occur in michelson
how they are calculated
Could someone offer me a pointer ?
2
votes
1answer
28 views
Overflow/ Underflow in Smart Contract
Is Tezos vulnerable to overflow/ underflow attacks on the smart contracts? If yes, how do you recommend to test whether a particular smart contract suffers from it.
1
vote
1answer
27 views
Michelson: Parameter vs Storage
I'm struggling to process what the difference between parameter and storage is in Michelson. From what I've been reading, it just looks like two different types of inputs to a contract. So how should ...
2
votes
1answer
22 views
Timestamps overflow/underflow errors
In the list of possible errors in RPC: http://tezos.gitlab.io/api/errors.html#michelson-parsing-macros, there are timestamp_add and timestamp_sub errors, that could happen in arithmetic instructions ...
3
votes
1answer
79 views
How do I call the FA2 balance_of endpoint through Truffle?
I have written a contract to implement FA2 and I have a Truffle/JavaScript setup to test this contract while running against a sandboxed node. I can test the transfer endpoint and the update_operators ...
2
votes
1answer
28 views
Call method taking unit type as parameter from JavaScript
I have a Truffle instance of the contract and I call the method like this
contract_instance.method();
This gives me this error message:
method Received 0 arguments while expecting on of the follow ...
2
votes
4answers
78 views
Is there a formula to build parameter messages to be passed to smart contract entrypoints?
When calling a smart contract entrypoint, it is required to pass the needed entrypoint parameters. This is done through a message that must be sent in JSON/Pairs format. My doubt is: Is there a ...
1
vote
1answer
19 views
Contract calling convention for sum type
burn function in KT_token contract can be called with arg format:
burn: (pair (or (unit %uSD) (unit %xTZ)) mutez)
so I tried,
./tezos-client transfer 0 from alice to KT_token --entrypoint burn --...
2
votes
1answer
48 views
Why does michelson have no heap?
I have read a recent article about juvix optimizations to adjust for michelson specifics
https://research.metastate.dev/juvix-compiling-juvix-to-michelson/
And saw that michelson has 2 features ...
2
votes
1answer
46 views
how to encode contract invoke parameter to json code? ConseilJS not support parameter of tyep List Signature
ConseilJS seems not support parameter type List Signature, see at https://github.com/Cryptonomic/ConseilJS/issues/261.
So I want to encode my parameter to JSON code that I can change parameterType ...
3
votes
2answers
216 views
What are the differences between key, key_hash, address, contract and signature in Michelson?
There is a related question, but the differences are still not clear. These five types are mentioned in the Michelson whitedoc with the following definitions:
address: An untyped address (implicit ...
1
vote
2answers
163 views
Pretty-printing Micheline JSON
How can I pretty-print a Michelson contract in JSON to concrete syntax?
2
votes
1answer
52 views
Ill formed storage type in origination
Attempted to originate a contract but getting a storage type error when trying to originate it
Error: proto.005-PsBabyM1.michelson_v1.ill_formed_type
Error: proto.005-PsBabyM1.michelson_v1....
1
vote
0answers
17 views
Breadth-first inter-transaction semantics
In the « inter-transaction semantics » section of the Michelson specification it appears that when a contract emits internal operations (which in turn can emit their own) the overall evaluation ...
3
votes
1answer
154 views
Michelson pairs not comparable
When I try to type the following Michelson script, I get a type error.
parameter unit;
storage (big_map (pair string address) (list timestamp));
code {CDR; NIL operation; PAIR};
Ill formed type.
At ...
3
votes
1answer
33 views
How to check in Michelson if a key_hash is delegatable
A Set_delegate operation will fail if the specified key_hash is not delegatable.
Is it possible in Michelson to verify if a kh : key_hash is not delegatable and thus if the operation emitted by ...
6
votes
1answer
112 views
Relative gas cost of map vs bigmap
Does there exist a realistic performance benchmark between map/bigmap?
I am looking for a tipping point where it would make more sense to use a big map for gas cost optimization
1
vote
1answer
64 views
How to interact with SmartPy BigMap in contract?
I would like to setup a smart contract that contains (as defined by smartpy) a BigMap storage.
I have the following code:
import smartpy as sp
class contract(sp.Contract):
def __init__(self):
...
2
votes
1answer
41 views
ConseilJS TezosContractIntrospector.generateEntryPointsFromAddress `Uncaught (in promise) TypeError: Cannot read property '0' of undefined`
Trying to retrieve contract entry points using the TezosContractIntrospector
The following code:
async function entry_points(){
const server={
url:'https://conseil-dev.cryptonomic-infra.tech:...
5
votes
4answers
205 views
Ethereum/Solidity dev here, looking to migrate some Solidity contracts onto Tezos. Was hoping to have some light shed on a few questions
Was hoping to have some light shed on a few questions.
Narrowing in on using Ligo, Archetype, or Liquidity.
Is Liquidity kind of a dead-end right now? I noticed it's not listed on developeres.tezos....
2
votes
3answers
61 views
Originate contract with init
I have a contract of type:
pair (pair (list nat) (pair mutez (map address (list nat))))
(pair address (pair address bool))
What is an example of a valid initial storage that can be passed to ...
2
votes
1answer
53 views
What is the behavior of SET_DELEGATE in particular cases
The Michelson Documentation does not say much about this function:
SET_DELEGATE: Forge a delegation.
:: option key_hash : 'S -> operation : 'S
This left me wondering about its behavior and if ...
2
votes
1answer
170 views
How to deploy a smart contract influenced by UI inputs using ConseilJS and SmartPy generated Michelson?
I wish to be able to create a smart contract taking input from a UI to supply parameters pubKey,prvKey,pubHash for the deployment and minAmount and maxTime to influence the Michelson.
I have the ...
2
votes
1answer
48 views
What is the execution sequence of this Michelson code snippet
I tried to get a better grip on michelson but found myself fail at a simple piece of michelson code.
Is anyone willing to help on the logic of below code? Thanks a lot!
parameter (pair nat nat);
...
1
vote
1answer
56 views
What is the size limit of a list in Michelson
Can lists be used to store large amounts of data like big maps ?
The doc (https://tezos.gitlab.io/whitedoc/michelson.html?highlight=michelson%20types#core-data-types-and-notations) doesn't talk about ...
1
vote
0answers
15 views
Split function contract template
Is there a code template for a simple contract which splits the incoming funds and sends them proportionally to a list of pre-registered addresses?
Example:
Contract has the following functions:
...
1
vote
2answers
45 views
How to use Emacs michelson-mode with Tezos sandboxed client?
The Emacs michelson-mode relies on being able to call Tezos client. How can you use the Tezos sandboxed client for it?
4
votes
0answers
57 views
Error too big to serialize within the provided gas bounds. Increasing the gas bounds does not help
I am developing a fairly large set of contracts that interact with each other. I wanted to reorganize and optimized the code and I've added lots of PUSH string "..."; FAILWITH to help me debug. I am ...
4
votes
1answer
57 views
Why cant i call the contract entry point with type parameter througth eztz.contract.send
im trying to call the entry point create_proposition ...
(pair :proposition %_Liq_entry_create_proposition
(key_hash %destination)
(mutez %amount))
using the function eztz.contract....
3
votes
1answer
43 views
Getting errors related to the smart contract after running eztz.contract.send()
im tryng to send a operation to a previously deployed contract and im geting these errors,
error: "Operation Failed"
ā
errors: (3) [ā¦]
āā
0: {ā¦}
āāā
contract: "...
3
votes
1answer
73 views
how can i send operation throught eztz to a contract specific entry point?
im tryng to send the operation to a deployed contract, this is my function ...
eztz.contract
.send(
"KT18qHvhEZUwiawA8QEURwuK8RGJj184725L",
keysext.pkh,
keysext.sk,
5,
"RIGHT LEFT UNIT",
"...
5
votes
1answer
88 views
Error while initializing storage in contract deployment
I am using folowing command:
./tezos-client originate contract TestContract for tz1address transferring 1 from tz1address running contes.fi --init 'pair (map "KT1address" 1) (map "KT1address" "2019-...
4
votes
0answers
62 views
How to implement a signature checker for the signature scheme BLS?
We are willing to implement a signature checker for the signature scheme BLS (or BLS12-381). To the best of our knowledge, it may not be too painful since the smart contract language already supports ...