16

Michelson (and higher level language like Liquidity on top of it) does not allow a smart contract to call another smart contract without commmitting its state/storage first. It makes reentrancy attacks less likely to happen, but not impossible.


11

There are several test frameworks coming for Tezos. Ours (Techelson) can be used both from Michelson and from Liquidity. It should be released soon. (I will update this answer when it is released)


10

No, a contract can only spend its own funds.


10

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 top of the stack, * pops two elements from the stack and pushes their product, and + pops two elements from the stack and pushes their sum. Your program starts ...


9

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 at execution. Yes, Michelson is a low-level language, you should aim at a higher-level language, like Liquidity (http://www.liquidity-lang.org/), that ...


9

'*' 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 elements of the stack with the result of the operation.


9

This is an obsolete example. Contract calls do not return values anymore (it should not be in the repo). Have a look here instead (contract calls create operations that are executed sequentially after the calling contract execution terminates, note that the operations must be returned in order at the end).


8

So this is a huge question and I think there are many people more qualified than me, but I'll offer some initial guidance. In Software Foundations, a book on Coq, they talk about an implied language called Imp. Imp has a syntax like: Z ::= X;; Y ::= 1;; WHILE ~(Z = 0) DO Y ::= Y * Z;; Z ::= Z - 1 END Which should be somewhat easily understood as ...


8

If what you mean is a non-predictable source of randomness, no, there is none. Any information that could be used for that could either be predictable by a user, or tempered by a malicious baker. You should probably use an external source of randomness, as the oracle presented in here. An improvement of that would be to use commitments, i.e. the oracle ...


8

You can use Loop.left (with and accumulator) but it is easier to use List.fold and tail recursive functions (those are encoded with loops). Here is a way to do it (you can call the entry point test with parameter [{name="A"; value=5}; {name="B"; value=10}; {name="C"; value=20}] and storage [{name="A"; value=15}; {name="B"; value=8}; {name="C"; value=15}; {...


8

Because values of type lambda can be kept in storage or passed as parameters (either as lambda or as bytes to be UNPACKed), it is possible to write contracts which can upgrade themselves... This won't always make sense, but might sometimes be useful. For example, one of the very early mainnet contracts appears to have a kind of upgrade mechanism: https://...


8

1. Maximum parameter size per transaction The maximum number of bytes per transaction for a single transaction is limited several constants, in particular an upper size of for operations max_operation_data_length and the hard gas limits for operations and blocks (a block contains a set of operations): "max_operation_data_length": 16384, "...


7

So apparently, this feature is no longer available in Liquidity, and the docs are incorrect in this case. You can read a reply from Liquidity Lead Dev here.


7

Martin Pospěch drafted an Tezos "ICO token" standard at https://gitlab.com/tips2/TIPs/blob/master/TIPS/tip-7.md Stephen Andrews is working on a tztoken at http://tztoken.teztech.io/ OcamlPro has a token contact (in Liquidity) in its examples available at http://www.liquidity-lang.org/edit/. You can also see code for that at https://github.com/OCamlPro/...


7

Disclaimer: This is just an example for educational purposes, don't use it in production. Here is a fairly primitive upgradable design for a Liquidity smart contract: Proxy Contract Holds the state / storage Points to a Logic Contract, and proxies its entry points Can be amended / upgraded, by its rightful owner. You can run into decentralization / ...


7

In the command line ./tezos-client get contract storage for KT1BRudFZEXLYANgmZTka1xCDN5nWTMWY7SZ You could also just call the RPC curl http://localhost:8732/chains/main/blocks/head/context/contracts/KT1BRudFZEXLYANgmZTka1xCDN5nWTMWY7SZ/storage


6

If we agree that the purpose of analyses is to both prove properties and help users of smart contracts to understand them, I would say: Values: studying what values each element of the storage can take in the future. Effects: studying what effects can occur in the future: typically what transfers can occur and on what conditions. Ownership: who can trigger ...


6

Am I understanding correctly, that I can store for example my rental contract as a Smart Contract and then it is made official with baking it with bakers? Like in all open blockchain systems, you can run a full node, which downloads all blockchain data. Once it has been synced, it can propagate new transactions and blocks to network, can validate new ...


6

Michelson doesn't support multiple entry points right now. Liquidity uses unions (or type variables) to make up for this. A union has a Left and Right side, but can also be nested. Let's analyse the parameter of the script provided: parameter (or :_entries (int %_Liq_entry_create) <-- Left Side (int %_Liq_entry_main)) <-- Right ...


6

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 compiler. What you see is what is executed on chain. In addition, it is purely functional and statically typed, attributes which generally help developers avoid ...


6

Contract origination incurs standard transaction fees (see here). One thing to note is that the storage cost is 0.001 tez per byte of data being stored on-chain (which includes the size of your contract and initial bytes for the state/storage data of the contract. Contract calls, which are just transactions to a smart contract, may incur storage costs IF ...


6

Ad 1. I am not sure whether it is what you look for, but look at: https://smartpy.io/demo/ SmartPy offers different tools: Analytics: elements of the UI in SmartPy.io to analyse smart contracts and their properties; SmartML: a virtual machine written in OCaml; Compiler: used to translate contracts from SmartML to Michelson; Python library: facilitates the ...


6

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 saves to be reused later). It is true that both the storage and the parameter can be seen as inputs because they are fed to the contract at the beginning of its ...


5

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> running <prg> where <prg> is a file containing your Michelson source.


5

If you use the next branch of Liquidity, you can use : liquidity CONTRACT.liq --call-arg main '{ name = "test"; sig = "abcd" }' to print the argument to be used by tezos-client (where main is the entry point you want) liquidity --re CONTRACT.liq to directly compile a file in ReasonML syntax (add the --re argument in the previous command also) (the double ...


5

How to check the proof Currently, the only way to check the proof is to install and run the Coq proof assistant on the manager.tz file. This is automated in the continuous integration script of the Mi-Cho-Coq project so you can see it here. In the future, we plan to use JsCoq to run Mi-Cho-Coq proofs from web browsers. What is proved The family of ...


5

Active accounts For the first question, it depends on what you mean with "active". This term has at least two meanings in the context of Tezos. First, an implicit account (i.e. a Tezos account that is not associated with a smart contract: a regular account that is used to store and transfer tez) is either present or not in the context. The context contains ...


5

As of Taquito release v6.1.0-beta.0 Taquito offers a new API for Maps which support pairs as keys in Maps and BigMaps. Here's a link to documentation & examples on Accessing Map values using Pairs


5

Operations of the following types can affect account balance: transaction revelation origination delegation endorsement seed_nonce_revelation double_endorsement_evidence double_baking_evidence activate_account However, there are three additional things which affect account balance as well: When you bake a block. When you miss seed_nonce_revelation. When ...


5

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 transaction. An entry point gets the current contract storage value and returns an updated storage value. If the operation fails for any reason, a new storage value is ...


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