14 votes
Accepted

What is the BigMap container and why does it matter?

The BigMap container is a special map (dictionary) whose storage is only read or written per key on demand. The motivation to have such a container is the following. Suppose that you have a contract ...
FFF's user avatar
  • 3,250
11 votes
Accepted

Ethereum/Solidity dev here, looking to migrate some Solidity contracts onto Tezos. Was hoping to have some light shed on a few questions

In response to question 4: Reuse and modularity We discuss reuse and modularity, of which inheritance is one of many mechanisms: Michelson has no mechanism for code reuse, except for calling existing ...
arvidj's user avatar
  • 2,378
10 votes
Accepted

Michelson Logic understanding problem

We can simulate the program in the following way. We write the stack between [...] and then the operations. We use three different operations push <int>, * and +. push puts an integer at the ...
FFF's user avatar
  • 3,250
9 votes

Benefits of Michelson

The main benefits of Michelson are the guarrantees that it gives on the execution of a smart contract : static typing catches many errors, and the semantics is clearly defined, so you have no surprise ...
lefessan's user avatar
  • 3,308
9 votes

Michelson Logic understanding problem

'*' and '+', in this context, are not the infix operators you are used to. Imagine reading left to right and stacking up the numbers as you go. When you encounter + or * you replace the top two ...
Arthur B's user avatar
  • 4,599
7 votes

Ethereum/Solidity dev here, looking to migrate some Solidity contracts onto Tezos. Was hoping to have some light shed on a few questions

Here is a complement to Arvid's answer regarding Archetype: Reuse and modularity Indeed Archetype's extensions are reusable codes to add features to a contract. For example, using the 'transferable' ...
Benoit Rognier's user avatar
7 votes
Accepted

Relative gas cost of map vs bigmap

Let's find out. We start by running a sandbox node. We'll originate two contracts, one for maps, the other for bigmap. parameter (pair address nat); storage (big_map address nat); code { UNPAIR; ...
Arthur B's user avatar
  • 4,599
7 votes
Accepted

Michelson: Parameter vs Storage

The difference is very simple :) The parameter is made of data that are sent to the contract with a transaction while the storage holds the state of the contract (i.e all the data that the contract ...
Claude Barde's user avatar
7 votes

Gas costs types in Michelson

There are eight types of costs: 1 Reading cost 2 Deserialization cost 3 Parsing cost 4 Type comparison cost 5 Interpreter cost 6 Unparsing cost 7 Serialization cost 8 Writng ...
Ezy's user avatar
  • 6,054
6 votes

What does the DIP opcode in Michelson do?

DIP lets you operate on the stack one level below the top element. You can think of DIP as taking the top element, putting it on an auxiliary stack, performing some operations on the remaining stack, ...
Arthur B's user avatar
  • 4,599
6 votes
Accepted

Differences between Micheline and Michelson

Micheline is the concrete syntax of Michelson. https://tezos.gitlab.io/whitedoc/michelson.html The concrete syntax means that it is the part of language in which Michelson is actually written and ...
FFF's user avatar
  • 3,250
6 votes
Accepted

Benefits of Michelson

Michelson lets you write concise contracts using high level primitives (like maps, sets) without departing from Tezos' native VM. That means you don't have to trust your contract to the output of a ...
Arthur B's user avatar
  • 4,599
6 votes
Accepted

Michelson pairs not comparable

This feature is not totally implemented in Babylon (http://tezos.gitlab.io/protocols/006_carthage.html#comparable-pairs-in-sets-and-maps), but it will arrive with Cartage in a few days if the vote is ...
charles Dehlinger's user avatar
6 votes
Accepted

Batching Transactions FA2

Other transactions will fail automatically and the contract will revert to the previous storage state automatically. By design, any invocation of the Tezos smart contract works as an atomic ...
Eugene Mishura's user avatar
5 votes
Accepted

How can I deploy a Michelson smart contract?

Read the documentation of: tezos-client -A mainnet-node.tzscan.io originate contract It says: tezos-client originate contract <new> for <mgr> transferring <qty> from <src> ...
lefessan's user avatar
  • 3,308
5 votes
Accepted

How does NOW work?

There is an assumption that all Tezos nodes are synchronized, otherwise the consensus with 1-minute slots would not work. Of course, some delay is ok, but more than a few seconds might prevent a baker ...
lefessan's user avatar
  • 3,308
5 votes
Accepted

Implementation details for PACK and UNPACK

I have implemented the PACK and UNPACK in tezbridge-crypto project. You can checkout the source code here: codec.js#L426 Here are some test cases: index.js#L35 In short words, there are several ...
catsigma's user avatar
5 votes

Ethereum/Solidity dev here, looking to migrate some Solidity contracts onto Tezos. Was hoping to have some light shed on a few questions

Do Archetype/Ligo provide everything that Michelson can currently do, or are there limitations with either? I think if something is possible in Michelson and not in Ligo, it is probably a bug worth ...
Raphaël Cauderlier's user avatar
5 votes
Accepted

What are the differences between key, key_hash, address, contract and signature in Michelson?

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 ...
Michael Zaikin's user avatar
5 votes

What are the differences between key, key_hash, address, contract and signature in Michelson?

Why can I convert between address and contract. But not between address and key_hash? There is the (IMPLICIT_ACCOUNT) instruction to go from key_hash to address. For the other direction, there was (a ...
Raphaël Cauderlier's user avatar
5 votes
Accepted

Call method taking unit type as parameter from JavaScript

You express the Unit in JavaScript by calling the method like this contract_instance.method([["unit"]]);
Thorkil Værge's user avatar
4 votes

How can I deploy a Michelson smart contract?

ConseilJS beta 0.2.7 has experimental functionality that allows that sort of GUI deployment. Docs here, code here.
Crypto Mike's user avatar
4 votes
Accepted

Is there a way to call a function inside a contract from a function in another contract?

Contracts don't currently return any data. You should use callbacks for on-chain data transmission, or use an off-chain oracle. On chain, you use the TRANSFER_TOKENS; instruction to send from ...
Stephen Andrews's user avatar
4 votes
Accepted

Get a returned value when calling a Michelson contract

No. The only way to do that is for the contract you call to explicitely send you a callback, continuation passing style.
Arthur B's user avatar
  • 4,599
4 votes
Accepted

Regarding annotations in michelson

Annotations are never necessary, they only add new type constraints. Their purpose is twofold: documenting what corresponds to what in a Michelson smart contract (and I personally feel that this is ...
FFF's user avatar
  • 3,250
4 votes

Parameter passed when calling CONTRACT in michelson

It does need to be exactly an int. Something close to what you describe is probably how multiple entry points for contracts would be supported, though there would be an additional tag to indicate the ...
Arthur B's user avatar
  • 4,599
4 votes

Error while initializing storage in contract deployment cmd using tezos-client command line interface option

Turns out this supposed to be passed like this: '(Pair "tz1PKKC9NTsxxfwYpg1bVAY5k5AKuPYe9gpg" "KT1GE2AZhazRxGsAjRVkQccHcB2pvANXQWd7")'
user_184's user avatar
  • 347
4 votes
Accepted

What is the size limit of a list in Michelson

The practical limit to the size of a list in Michelson is the amount of gas it will cost to call the contract. Every time a contract is called it is parsed, which means the contract code and entire ...
cousinit's user avatar
  • 1,999
4 votes

Ethereum/Solidity dev here, looking to migrate some Solidity contracts onto Tezos. Was hoping to have some light shed on a few questions

With respect to question 3, following @ezy remark, SmartPy has some inlining capabilities including with new opcodes as shown in the Inline Michelson template (of the new version, currently https://...
FFF's user avatar
  • 3,250
4 votes

How un/reliable is the timestamp provided by NOW in Michelson?

NOW is the earliest date at which the current block can be baked, it is computed as the timestamp of the previous block + the minimal time that can separate 2 blocks (60 seconds on mainnet). As a ...
Raphaël Cauderlier's user avatar

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