Questions tagged [contract-design]

for high-level questions about the choices made during contract construction

Filter by
Sorted by
Tagged with
0
votes
1answer
19 views

What is the cost of inter-contract calls?

I have a contract with methods to create items and add them to categories. I want to create a wrapper contract that would combine several calls into one: create an item and add it to several ...
0
votes
1answer
8 views

When a contract calls other contracts, is it an atomic operation?

If a contract calls several external methods of other contract(s), is it as a whole one atomic transaction (reverted as a whole if an exception happens)?
1
vote
1answer
110 views

Is Solidity being replaced as the de facto standard for smart contract development?

Is Solidity being replaced by languages such as Rust or other programming languages for smart contract development?
3
votes
1answer
18 views

How is Chainlink decentralized? [closed]

I believe one of the main criticisms of chainlink is that it is not decentralized enough, adding more nodes would be a big step in a positive direction. When I pull data through a node, that node ...
0
votes
1answer
18 views

When would one want to use a linked library?

My understanding is that if a smart contract consumes a library that only has internal functions, then the compiler will embed the library into the contract bytecode. At the lowest level, there is no ...
-2
votes
0answers
49 views

how i specify sender address in ethereum [closed]

In our project we have a group of users in Ethereum who can write on the blockchain network In other words, we have a group of users who have addresses in Ethereum who want to keep their data in the ...
0
votes
1answer
42 views

how create address for each ethereum user [duplicate]

I have a group of Ethereum users how do I create an address for each user to send their data on the network?? I want a way to create addresses for each user??
0
votes
1answer
33 views

Deleting an array in storage (>= 0.6.0)

I need to add elements to a resizable myArray and then delete the myArray. I don't know what the length of myArray will be before the loop, and it's not possible to resize a memory array; that leaves ...
0
votes
1answer
18 views

When using mapping, why use an address over bytes32?

From an end user standpoint, they will never want to use the address for searching for mapped data when they could just submit a username for function parameters, so is there any specific reason why ...
0
votes
1answer
45 views

how different users write their data in ethereum network?

How a number of blockchain users save their data in the blockchain network using ethereum. Meaning more than one user sends his data using Python to save it in blockchain networl ?? How do I ...
0
votes
0answers
18 views

Compile error. Fallback function error

I use pragma 0.6.2. I am trying copile in truffle code which contain this lines: fallback() external payable{} I an getting error: The payable fallback function is defined here. fallback() external ...
0
votes
0answers
55 views

How do i withdraw Eth from a contract i created

New to blockchain.. havent a clue.. I managed to create a new contract with Eth. I moved money from MyEtherum Wallet to Metamask and into a contract, somehow? I have no coding experience but need ...
2
votes
1answer
32 views

Is the May 2017 contract creation attack still possible?

In May 2017, an "attacker" created a contract that attempts to create many other contracts(using many JUMPDEST operations in the creation bytecode) until it runs out of gas. I see the gas ...
0
votes
2answers
63 views

How do I give every user Ethereum an address and does it affect security

I have a project with Ethereum Blockchain the users send the data to the server and the server writes the data in the blockchain network My question is how do I represent the server in the smart ...
0
votes
1answer
51 views

Transfer money between contracts

I'm quite new at smart contracts/Solidity, which I'm learning for a postgraduate course. In one of the assignments, we have to implement a little competitive game (something like the game of Seven ...
0
votes
0answers
26 views

ERC-20 token with identitfication

I would like to create a generic ERC-20 token with identification. The token would only be transferred to previously identified addresses. The way identification is implemented should be as decoupled ...
0
votes
1answer
23 views

Should Try-Catch error handling be avoided for security? [closed]

What implications can it have to the security of a function if the content of it is wrapped into try-catch statements?
4
votes
2answers
77 views

Graph traversals on Ethereum, at scale

I read the Efficient Solidity storage pattern for a directional weighted graph thread, but that deals with storing graphs. I'm interested in techniques for how to traverse graphs in Solidity, at scale....
2
votes
0answers
39 views

SPDX license when importing other people's contracts

Since Solidity 0.6.8, the compiler started throwing warnings if a contract isn't annotated with a SPDX license identifier: // SPDX-License-Identifier: MIT contract MyContract { ... } Now, there'...
0
votes
0answers
10 views

Implementation Question for Licence Token

I am currently working on the idea of using token as licences for digital products. I am offering different documents and books in pdf format and want people to be able to buy them with ETH o.ä.. I ...
0
votes
1answer
40 views

Abstract contracts cannot be initialised, can they?

As of v0.6, solidity introduced abstract contracts. Do they behave just like in all other languages - that is, they can't be initialised, can they?
1
vote
0answers
18 views

How does zocrates process zk-SNARK step by step?

I'm trying to understand my zokrates code and how it processes zk-SNARK step by step in accordance to this article. The article breaks down the zk-SNARK into three steps. A key generator, G, takes ...
0
votes
1answer
52 views

What are the flaws of this example contract?

I am currently writing a paper/article on tokenization, in the beginning of which I introduce smart contracts. To this end, I present the following contract as an example: pragma solidity ^0.6.0; ...
0
votes
1answer
32 views

Multiple transfers, one smart contract

I have the following function in my contract: function AcceptOffer() public payable { if ( msg.sender != InstanceOwner ) { revert("You are not the owner of this ...
2
votes
1answer
40 views

Destroy smart contract and collect its funds

I'm quite new at smart contracts/Solidity, which I'm learning for a postgraduate course. In one of the assignments, we have to implement a short example of dutch auction (wiki link). Now my question ...
2
votes
0answers
25 views

Are there well-solved patterns and practices for handling errors in Solidity?

In the spirit of Are there well-solved and simple storage patterns for Solidity?... Are there known, battle-tested practices for how to deal with errors in large Solidity codebases? It's common in ...
0
votes
1answer
25 views

Nested Structs with Mappings Inside

I have the following code: // SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.7.0; pragma experimental ABIEncoderV2; contract VenueRegistry{ struct Queue{ uint head; ...
2
votes
1answer
24 views

Why can I call contract methods containing a selfdestruct multiple times?

The following code is part of a Smart Contract I'm working with: [...] function noComplain() allowed(receiver, stage.keyRevealed) public { selfdestruct(sender); } // function ...
0
votes
2answers
59 views

How can I get the revert reason of a call in Solidity so that I can use it in the same on-chain transaction?

I want to get the revert reason of a failed call and then use that revert reason in the same on-chain transaction. Is this possible?
0
votes
1answer
16 views

1-To-M struct relationship advice *DApp Development

Let's assume that I'm building a property investment DApp. I have two entities involved in the DApp. Those two entities are 1) providers and 2) investors. Right now, a provider is able to offer 1 ...
0
votes
0answers
21 views

TransferFrom - User Experience Examples

Can someone provide some DApp examples where the transferFrom pattern has been implemented and does an at least 'decent' job of providing a good user experience. If not, what is then a convenient way ...
1
vote
1answer
30 views

Accessing contract functions from web3 and javascript

I have deployed a contract in a private blockchain using remix and ganache. Now I want to interact with it trough web3 and the console from my browser, but I'm not managing to interact with the ...
0
votes
1answer
34 views

Receive ERC20 token as value in function of smart contract

I want to receive an erc20 token as value for a function. Basically, the function caller defines an amount which will then be transferred from their balance to the smart contract. Which transfer ...
1
vote
1answer
35 views

Can't people be tricked into calling approve on an ERC token contract, and having their tokens stolen?

Most users of Ethereum and ERC tokens probably aren't aware of the existence of the approve and transferFrom functions. Couldn't users unknowingly call approve on an ERC token contract, and ...
0
votes
1answer
40 views

Security flaws in a simple smart contract

I developed a simple smart contract to store two privacy preferences for a user. I am testing and evaluating this contract on a private blockchain via Ganache. I am currently validating the security ...
1
vote
1answer
25 views

Can you activate Contract Functions just by receiving Ether alone?

Noob Question here. I have a Dapp that has no actual need of a web interface. What is the best way to activate functions if someone did something as simple as send Ether to an address it controls from ...
0
votes
1answer
33 views

Card Game - Smart Contract (Public Cards)

We want to implement a card game with EVM and Smart Contracts. After defining all-important game information we asked ourselves how we can include the cards in the Smart Contract but don't make it ...
1
vote
1answer
40 views

Precompiled contracts

So I heard that the precompiled contracts perform functions that are difficult to do using EVM opcodes. Does that mean the precompiled contracts are not written in EVM opcodes. Which language are ...
0
votes
0answers
19 views

Which are the best and most secure multisend contract? [duplicate]

I am making a system where I need to withdraw funds from 1 wallet to 2 or more wallets at the same time. I have been looking for the solution to this problem, it seems like Multisend is the way to do ...
2
votes
2answers
38 views

A Captcha for Solidity Contracts

What is a good way to put the equivalent of a captcha in a Solidity contract? The objective is to put in a filter to make it difficult for bots to monopolize the contract, allowing regular humans to ...
1
vote
1answer
25 views

Explicitly conversion of addres and payable

i can't understand this Explicit conversions to and from address are permitted for integers, integer literals, contact types and bytes20. However, Solidity prevents the conversions of address payable(...
1
vote
1answer
24 views

How to get active users of Dapp [closed]

Is it possible to have unique constraint on parameters of an event? I will have a number of users using my Dapp, and I have provided functionality to delete the users. So while reading from the ...
0
votes
1answer
32 views

How do exchanges work internally?

Because EVM cannot watch events, we cannot send a token to an exchange and immediately get back some other token (EVM just does not "know" when it was send a token). As far as I understand, this is ...
0
votes
1answer
19 views

Can you force your smart contract to only process transactions in separate blocks

I am working on a smart contract and trying to come up with ways through which I can make sure that each transaction sent to my Ethereum smart contract is only processed as part of separate block, ...
0
votes
1answer
46 views

smart contract for fair exchange [closed]

Question: Is it possible to create a smart contract for fair exchange and investment: user1 sends ether to a smart contract which will multiply the amount by 2 and send it to user2. When user2 ...
0
votes
0answers
14 views

How do you know the number of smart contracts to be designed?

I am designing smart contracts for a supply chain project and I have noticed that everything can be fitted into the same smart contract, then why do people use a number of smart contracts for their ...
0
votes
1answer
25 views

how to disable a contract by changing some internal state which causes all functions to revert?

In official documentation of Solidity about Self-destruct instruction is written: If you want to deactivate your contracts, you should instead disable them by changing some internal state which ...
0
votes
0answers
14 views

function overloads when the function is payable

I'm calling a function from another contract using an interface. The called function is payable and also overloaded. Example: contract OverloadedContract { function foo(uint x) external payable ...
0
votes
1answer
19 views

Mapping multiple structs to a struct and call them

I have a question about how I should design my contract to achieve the following: I want to create products identifiers (can be struct or string) something like: "product#123abc". Then I want to map a ...
0
votes
0answers
23 views

Permissioned/Public architecture

I am quite a fresher with blockchain. I am trying to set up a system that requires a smart contract to allow some participants to send transactions. Each participant will have its wallet address from ...

1
2 3 4 5
33