Questions tagged [smart-contracts]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
13
votes
2answers
123 views

How can I write tests for my smart contracts?

I like doing TDD and would like to build up a test suite around my contract code. I have been looking at both ReasonML and Liquidity but neither seems to have a great testing story yet. Does it make ...
13
votes
2answers
292 views

Formal verification of Tezos smart contracts

What are the analyses of Tezos smart contracts that could benefit dapps writers the most? Just to be clear, by “analysis” here I mean “static program analysis”. See for instance here. Basically the ...
12
votes
3answers
190 views

How to upgrade a smart contract?

I'm building a smart contract that is sort of an index of signed documents (pointing to ipfs for the actual docs). What if I want to add some functionality to my app down the road and need to upgrade ...
11
votes
2answers
134 views

Reentrancy attack vector on tezos smart contracts?

I heard that Michelson helps with avoiding re-entrancy bug. Why is that? Is there some feature in the language that prevent it?
9
votes
1answer
78 views

Is there a way to generate a pseudo-random number inside a contract in liquidity?

If I require a pseudo-random number (PRN) in the internal working of a function in liquidity, is there a way to do it? Is there one in Michelson? I already know about the way to send a PRN through RPC ...
9
votes
1answer
132 views

How can a string be coerced into tez using Liquidity?

Documentation states the following: tez : an unbounded positive float of Tezzies, written either with a tz suffix (1.00tz, etc.) or as a string with type coercion ("1.00" : tez). Yet the following ...
8
votes
3answers
267 views

How can I deploy a Michelson smart contract?

I'm wondering how to deploy a Michelson smart contract on Tezos. Maybe I'm just bad at googling, but all the examples I can find are using liquidity-cli. I'm not using liquidity for this contract, ...
8
votes
1answer
44 views

Spending XTZ held in an implicit account from a smart contract

Is it possible for code in a KT1 smart contract to spend from a tz1 adress ?
8
votes
1answer
165 views

Is there a Tezos equivalent of ERC?

I’d like to read / contribute to existing contract standarts on Tezos, is there an opensource movement like ERC?
8
votes
1answer
153 views

How to specify the smart contract entry point in eztz call?

I want to call a smart contract with eztz: eztz.contract.send(contract,from, keys, amoun, params, gasLimit,storageLimit) How to specify the entry point, my smart contract has multiple entry points : ...
8
votes
1answer
109 views

What exactly are smart contracts?

I'm new to Tezos, and in fact to Bitcoin in general. I have been reading up on it a good bit, though, and I ran across an article on cryptobriefing which states that Tezos, like Ethereum, uses smart ...
8
votes
1answer
93 views

Why does a transaction contain a storage dump?

I have looked at a few transactions with some smart contracts and I have found that they store a dump of contract's storage. For instance: https://mainnet.tezrpc.me/chains/main/blocks/246869/...
7
votes
1answer
62 views

Basic Syntax for iterating through List Element and processing each of them

I am creating two lists in liquidity and trying to process on them as follow: type two_element = { name: string; value : nat; } type list1 = two_element list; type list2 = two_element list; ...
6
votes
2answers
97 views

Michelson Logic understanding problem

If i got it right, Michelson is a stack based language. I've read the following example about stack based languages: 3 4 5 * + = 23 how does Michelson know, that it has to mutiplicate 4 * 5 ...
6
votes
1answer
141 views

What does it cost to make a contract through Tezos?

I have seen clear structure and numbers on how baking, delegating and double endorsing etc. affect to the users amount of Tezos, but is there any cost on making a contract (in other words creating ...
6
votes
1answer
103 views

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

I want to have two different contracts that have functions that should interact with each other. Is there a way to pass/return values through function call between contracts?
6
votes
2answers
52 views

How to remain auditable while using a database or index for a smart contract application?

As I am setting out to build my first proper smart contract backed application, I need to set up a database & index for the website for fast query times etc. How can I set this up in a way so that ...
6
votes
1answer
45 views

Regarding annotations in michelson

Michelson has different type of annotations. I am curious about what is the main purpose of annotations and where should one use annotations vs where on shouldn't? Is there a michelson pattern where ...
5
votes
3answers
745 views

Testing frameworks for tezos smart-contracts

I did few smart contracts with Ligo, but now looking for more productionize setup. Is there a test framework one can use for Tezos? I'm looking for something like waffle + mocha in Ethereum, or ...
5
votes
2answers
215 views

How to call a smart contract method with params with eztz?

Does Eztz have some method for calling smart contract methods with parameters? For example if my contract has a method let%entry createFile ((fileHash : string),(manager:key_hash)) storage How can ...
5
votes
2answers
76 views

How do I get a list of a Tezos smart contract KT1 address entrypoints and its parameters?

I wish to retrieve info from a KT1 address so I know which entrypoints are available for consuming and which are their parameters and types. How can I achieve this? Thanks in advance.
5
votes
1answer
61 views

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? If I got the first part right, the contract ...
5
votes
1answer
72 views

Can I withdraw funds from an empty smart contract?

I've stuffed up bad and managed to send some Tez to an empty KT1 smart contract. Is there any way of getting it back? The contract is: parameter string; storage string; code { CAR ; NIL operation ;...
5
votes
1answer
72 views

method for calling to entry point of contract instance (?) created by contract.create

Contract A is not able to find the address of the contract created by contract.create. Tried adding the signature of B as well as it's complete definition in contract A but still, it doesn't solve the ...
5
votes
1answer
181 views

Gas consumption in a chain of internal transfers

I am trying to perform a chain of contract calls with internal transfers. I think my current contracts are very simple, but I run out of gas after only 4 internal transfers: A script or one of its ...
5
votes
1answer
77 views

Contract.create bytes array return value

I'm using liquidity lang, and define a storage: type storage = { usersDocuments : (address,address set) big_map; documents: string set; } and I add in to usersDocuments https://pastebin.com/...
5
votes
1answer
76 views

Operations created by a smart contract call chain go in the same block?

Imagine there is a smart contract which calls other smart contracts using TRANSFER_TOKENS and in the end lots of operations are created. Are these operations baked in a block atomically? I mean, is ...
5
votes
1answer
39 views

bigmap.get(key, “”) with default param in case of no entry for key in the map with Taquito

Can we do something similar to myMap.get(key, defaultValue = None) of smartPy with Taquito? An instruction like: const myContract = await Tezos.contract.at(contractAddress); const contractStorage = ...
5
votes
1answer
41 views

Are there any wallets that can call contracts?

I'm building a dapp on Tezos and would like users to call some of the related contracts directly from the webapp. E.g. I present a QR code with a prefilled contract call. Are there any wallets that ...
5
votes
1answer
28 views

Tuples index access via contract's input params

I'm trying to get tuple value by index using contract's input param. Getting weird assertion error. let%entry main = (idx: int, storage) => { let tmp = ("test - 1","test - 2", 3) failwith(tmp[...
5
votes
2answers
107 views

Smart contract for bakers

Is it possible to write a Smart contract that would define the relationships between baker and delegator, and if so how would it be done? It should include the following: - delegation duration - ...
5
votes
0answers
66 views

“Unhandled error: Failure backtracked” while trying to creating a contract

I'm trying to work with the example code from the liquidity documentation for Contract.create(). The code compiles and tests on the online-editor properly. It also deploys using the editor. But when I ...
4
votes
2answers
112 views

Benefits of Michelson

I'm trying to understand the design decisions behind Michelson and I'm in the process of evaluating if I should be writing my dapp in the Tezos blockchain. What type of benefits does Michelson have ...
4
votes
1answer
39 views

In the broker2.liq example, how is storage being returned by the call function?

The code here returns value from Contract.call() as: let _result, storage = Contract.call storage.x transfer storage () in What are the values stored in _result and storage? Note: I couldn't ...
4
votes
1answer
186 views

Storage and parameter size limitations of smart contract?

Got a few questions regarding storage limitations of smart contract. What is the maximum number of bytes of data that I can send for a single transaction? Is there a size limit to the storage of a ...
4
votes
1answer
85 views

How do I get the storage value of a bigmap using pair datatype as key with taquito library?

I am using the taquito library to interact with a smart contract that I have uploaded to carthagenet. However, I am facing an issue in retrieving the value of a bigmap property in my smart contract ...
4
votes
1answer
59 views

Can someone provide a link to a tutorial on how to do a basic smart contract on the Tezos protocol?

I'm looking for a video tutorial on how to become a programmer/how to become more knowledgeable regarding smart contracts and such. Is there a good you-tuber who blogs about Tezos programming?
4
votes
2answers
108 views

Operation cost for invoking smart contract

I would like to find out if the smart contract's code size/storage or an operation's parameters helps to derive to the cost. Is there a formula to calculate the cost of the operation to be invoking a ...
4
votes
3answers
186 views

How to get smart-contract storage data?

I try to get smart-contract storage data: eztz.node.setProvider('https://alphanet-node.tzscan.io') eztz.contract.watch(addr, 2, function(s){ console.log("New storage", s); }); But got an ...
4
votes
1answer
42 views

When contract simulation may fail to predict the contract's behavior?

When we try to run a smart contract using tezos-client, it estimates the gas cost and predicts the final output of the contract. It simulates the contract execution under the current block-chain, ...
4
votes
1answer
46 views

Time based Delegations possible?

Would it be possible, to make a "time-based-delegation"? I.E.; I want to delegate for 5 Cycles to Bakery A and after that for 10 Cycles to Bakery B and so on. Could something like this be realized ...
4
votes
1answer
74 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
3answers
270 views

How to watch transaction status with eztz after eztz.contract.send

I am developing an app and I use JavaScript. I need to watch transaction from user browser. I use eztz method eztz.contract.send for create transaction. I receive back the transaction hash, but not ...
4
votes
0answers
23 views

Checking contract against contract type in Liquidity

With the example below, is it possible to get liquidity to check that the type of the contract C matches C_intf? contract type C_intf = sig type storage val%entry check_balance : nat -> _ end ...
4
votes
0answers
24 views

How to split a string in Liquidity?

I'm attempting to split apart a string by "." so that "my.name" returns {"my", "name"}. However, I can't seem to find an in-built method of performing this operation in Liquidity. Lately, I've tried ...
4
votes
0answers
50 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 ...
4
votes
0answers
25 views

Michelson_v1_printer.unparse error with originate contract

I am trying to use tezos client to deploy contract on alphanet but I get error Michelson_v1_printer.unparse Command: tezos-client -l -A $TEZOS_NODE originate contract controller_v6 for $MANAGER ...
3
votes
2answers
153 views

How can I call a contract with a type parameter?

I have the following contract: parameter (pair :doc (string %name) (string %sig)); storage (list (pair :doc (string %name) (string %sig))); code { DUP ; DIP { CDR @storage_slash_1 } ; ...
3
votes
4answers
77 views

Is it possible to use natural logarithmic in your smartpy code?

If not,is there any alternative way to implement a natural log component into your smart contract code?
3
votes
2answers
270 views

How to extract the storage of a smart contract?

How do I extract the storage data of a deployed smart contract? I am trying to read the storage data from the "free Ledger Nano S" contract KT1BRudFZEXLYANgmZTka1xCDN5nWTMWY7SZ from the Tezos ...