16
votes
Accepted
Reentrancy attack vector on tezos smart contracts?
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 ...
14
votes
Storage and parameter size limitations of smart contract?
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
...
11
votes
Accepted
How can I write tests for my smart contracts?
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)
11
votes
Is there a way to generate a pseudo-random number inside a contract in liquidity?
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 ...
10
votes
Accepted
Spending XTZ held in an implicit account from a smart contract
No, a contract can only spend its own funds.
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 ...
10
votes
How to upgrade a smart contract?
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 ...
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 ...
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 ...
9
votes
Accepted
In the broker2.liq example, how is storage being returned by the call function?
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 ...
9
votes
Accepted
How to upgrade a smart contract?
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 ...
9
votes
How are the originated contract addreses (KT1) computed?
In case someone needs precise calculations.
Say, you have an operation group hash onvsLP3JFZia2mzZKWaFuFkWg2L5p3BDUhzh5Kr6CiDDN3rtQ1D and an origination index 0 which is increased for every ...
8
votes
Accepted
How can a string be coerced into tez using Liquidity?
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.
8
votes
Formal verification of Tezos smart contracts
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 ...
8
votes
Accepted
Basic Syntax for iterating through List Element and processing each of them
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 ...
7
votes
Accepted
How are Smart Contracts saved for checking in future?
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 ...
7
votes
Is there a Tezos equivalent of ERC?
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 ...
7
votes
Accepted
How to extract the storage of a smart contract?
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/...
7
votes
How are the originated contract addreses (KT1) computed?
KT1 addresses are computed from origination nonce. The origination nonce is made of operation hash (the operation that creates the origination) and its index (the index starts from 0 and it gets ...
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 ...
6
votes
Accepted
How to specify the smart contract entry point in eztz call?
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 ...
6
votes
Accepted
Formal verification of Tezos smart contracts
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 ...
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 ...
6
votes
Accepted
What does it cost to make a contract through Tezos?
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 ...
6
votes
Accepted
How to retrieve data from smart-contract using javascript?
As of the current Babylon protocol and the upcoming Carthage, the RPC only provides you the ability to retrieve the value for a known key that you provide to the RPC. But even in this scenario you ...
6
votes
Testing frameworks for tezos smart-contracts
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 ...
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 ...
6
votes
Accepted
Can a smart contract know its own address?
Yes, Michelson provides the following instruction SELF_ADDRESS
In SmartPy you can use sp.self_address
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> ...
5
votes
How can I call a contract with a type parameter?
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
smart-contracts × 399smartpy × 128
michelson × 48
ligo × 34
tezos-client × 32
liquidity × 29
taquito × 24
contract × 22
nft × 20
storage × 19
error × 12
fa2 × 12
archetype × 12
deploy × 11
node × 9
baking × 9
blockchain × 9
testing × 9
bigmap × 9
fa1.2 × 9
dapps × 9
rpc × 8
transactions × 7
javascript × 7
gas × 7