Questions tagged [contract-design]

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

341 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
1answer
53 views

Contract owned by a wallet

Can a wallet address own a contract? There's a difference between the two. Would it be perfectly fine to transfer ownership of a contract to a wallet?
0
votes
1answer
213 views

Smart Contract Design: 2-step Escrow Architecture

How can I architecture following in the most optimal way; I'm trying to have a flow between contract A, B, and C. Contract C should be sending ERC20 to contract B. Contract A should be sending Ether ...
0
votes
0answers
44 views

Push Transfer of minted tokens

How can I create a single function which on its own, will reward an address with minted tokens if a certain time condition is met? Every time I try, I can only get it to work if I create two functions ...
0
votes
0answers
355 views

Can't change a structs member value in a mapping?

I'm having an issue where when I try to change a struct objects value that is stored in my mapping, it doesn't permanently / globally change it, it only appears to change it locally. In my example ...
0
votes
2answers
62 views

Is this contract correct?

Hi i write simple contract to test. Does he have any known mistakes or bugs? What would you change in it for the better? Thanks for answer. pragma solidity ^0.4.21; contract Lock { uint256 ...
0
votes
2answers
459 views

Create Tokens Pegged to Ether

I would like to create tokens where its price is pegged to the price of Ethereum (i.e. Ether price goes up, my token price goes up). Regardless of number tokens been sold or changed hands.Is it ...
0
votes
1answer
30 views

Minitng tokens automatically over a regular periods of time

Is there maybe a way to program a contract to mint a certain amount of tokens over regular periods of time automatically? Say, I would like a contract to create 1 000 new tokens once a year on Dec., ...
0
votes
2answers
417 views

Is there a way to dynamically create a contract that points to a previous contract?

I would like to implement a tracking system .. where i track events between two parties who deliver an item between them .. then the receiver would deliver it to another person and so on... I would ...
0
votes
0answers
105 views

Best practices for handling payment in smart contracts

I am developing a Dapp in which users can buy and sell stamps. I have two different smart contract with the following struct each (plus setter/getter functions): //Stamp.sol struct Stamp { ...
0
votes
0answers
113 views

Using Oraclize for ICO smart contract

What is the advantages of using Oraclize for the development of an ICO Smart contract? doesn't it just add unnecessary complexity?
0
votes
0answers
28 views

Return a value while hiding output from logs

I would like to return a value to one ethereum address without the other parties of the contract seeing the returned value. The returned values always show up in the logs as decoded output. How do I ...
0
votes
2answers
54 views

How can you tell if a mined transaction made permanent changes?

I have set up a private ethereum blockchain and I have defined a new coin. When I send coins from one account to another through the smart contract the transaction is always mined even when the coins ...
0
votes
0answers
47 views

What inputs to smart contracts can be maliciously modified by miners, beyond timestamps? Why isn't this caught by mining verification?

Are there other trusted inputs which miners could maliciously modify which still get accepted by blockchain verification? I realize the timestamp can be modified in a small way to potentially modify ...
0
votes
0answers
289 views

Calling function of one contract in another using truffle

I have one contract and in it's constructor I have initialized properties of balances contract TestChainCoin is RefundableCrowdsale { function TestChainCoin() RefundableCrowdsale() { ...
0
votes
1answer
137 views

how to transfer token with timestamp to restrict token transfer

I am working on basic ERC20 token smart contract and i would like to add some conditions in token transfer Suppose, I transfer 100 tokens to receiver on 2018-03-01 then receiver can't sent that 100 ...
0
votes
1answer
291 views

Accesing state variables in an other contract

I as trying to add methods in a contract, but it got so big that i couldn't deploy it with truffle. Now i need to create an otehr contract that will be called instead of the original contract to ...
0
votes
1answer
869 views

How can i create an array that contains multiple tuples in solidity?

I am trying to create a smart contract that will store an array containing GPS coordinates such as: X=[(31.332,54.213),(32.013,54.312), (33.124,56.2134),(34.123, 57.789), (34.789,59.654),(31.332,54....
0
votes
1answer
1k views

Loading smart contract x with tokens; sending eth to smart contract x; receiving tokens for that eth

Hello dear Eth community, I am a complete noob, please go easy on me ;) I am an IT teacher and I want to create a reward system for my class for a game that we play weekly. The game is not ...
0
votes
2answers
60 views

Can a smart contract function prompt different entities for some input

Let's say that in my system I have different nodes. In regular intervals some of these nodes can be chosen as "gold nodes" which means for example that they need to do some computations. Is it ...
0
votes
0answers
250 views

Can you use a smart contract to generate a symmetric key?

Let's say that I want to generate a key such that a user can use it and at the same time save the hashed key on the blockchain. My idea was to use a smart contract that could implement the Diffie-...
0
votes
0answers
724 views

How to structure a solidity project

Very new to Solidity. Found a intellij plugin in repository, now wondering what is the best way to structure the project? For example npm js projects usually have have src folder and node_modules then ...
0
votes
1answer
248 views

C++ (or generally OOP) inheritance in Solidity

In Solidity, when one does inheritance, the two contracts share state. Some pseudocode, contract A { uint myVar = 1 setVar() {myVar = 3} } contract B is A { myVar = 2 } If I deploy A, A.myVar = 1. ...
0
votes
0answers
56 views

The fee to interact with my contract is extremely high

I have an smart contract, the clasic crowdfunding contract where you send ether and receive tokens. I want to send 0.1 from my wallet to make a test, but once I write the contract address, the ...
0
votes
0answers
205 views

Bad Instruction

When I call multisend on the following contract I keep getting "Bad Instruction" error. What is wrong with the code? pragma solidity ^0.4.11; /** * @title Ownable * @dev The Ownable contract has ...
0
votes
0answers
60 views

Investor and share Smart Contract

I'm trying to write a contract that : Show current value investor can buy share before sale start (contract is sealed when it starts), and each investor get his own equity As the profit grows during ...
0
votes
0answers
70 views

Struggling with Interactions and Effects when coding

I don't think there is a better place to ask than here. I enjoy coding but I feel like I'm having an uphill battle when I'm getting to the interaction and effect part of various functions, what sort ...
0
votes
1answer
184 views

adding the contract value but still not changed

I am using web3 1.0 and testrpc, The following is my contract. pragma solidity ^0.4.18; contract LocalEthereum { event Created(bytes32 _tradeHash); uint32 value = 0; function addValue() ...
0
votes
1answer
63 views

How to vaildate the structure of a smart contract?

I want to automatically verify the structure of a published smart contract. A smart contract should be valid if the smart contract matches a template. Only the storage can diverge between the template ...
0
votes
4answers
77 views

Restricting payment from one account only

I am a beginner in ethereum DApp development and I am testing my Contracts in Remix IDE. My question is that can I restrict only one account to pay for all the transactions happening on my application ...
0
votes
1answer
204 views

Return subset of variable-length array

How does one return the first x elements of an array of addresses? I'm pretty sure this can be done in assembly but could not find the reference.
0
votes
1answer
537 views

Setting variable using constructor or methods

Would it be optimal to set variables within a smart contract using the constructor or using different set methods? Where would you use each case? I'm assuming setting them in the constructor would ...
0
votes
1answer
310 views

Getting ABI interface using solc offline

Suppose I have an inheritance contract (xyz.sol) with three contracts A, B and C such that C is B, I am trying to compile using solc offline in node console. Upon compiling, I have three separate ...
0
votes
3answers
420 views

how does digital signature functionality in blockchain fulfil the requirement of user identification?

As we are aware that blockchain is a decentralized application and it is tough to implement user identity mechansim in decentralized application so we use digital signature to verify the identity of a ...
0
votes
1answer
381 views

“Error: VM Exception while executing eth_call: invalid opcode” when accessing array

I'm trying to incorporate storage in a smart contract where participants of the contract will have their address stored in a address[] look up table participationAddressLUT. The contract initializes ...
0
votes
3answers
211 views

New temporary struct causing state variables to be overwritten

I'm running an experiment where I'm trying to create the following behavior: Service owner deploys Experiment1 to the blockchain and is recorded as the owner. Owner then adds a user address, a user-...
0
votes
1answer
53 views

Initiate a transaction from within a constant function

Good day, I know that using a constant function means that no change will be done on the blockchain, but I'd like to have a smart contract that verifies the user input WITHOUT exposing what the input ...
0
votes
1answer
131 views

Browsing a mapping variable

This is my contract where I am building a list of members who will use a addVote function. The allMembersVoted function always seems to return false even though the Remix debugger shows that, the ...
0
votes
1answer
146 views

Callback error when contract is mined successfully

I am getting an error today, when tried to mine a contract to ethereum testnet. Even after the transaction is mined successfully (I can check that in the Testnet), the call back is executing the code ...
0
votes
0answers
122 views

call wont work in order to update another contract's storage

Storage(variable n) of E won't get updated when I use call from contract D. addressOfE = "0x13fac93069c10e977204b9b64502439740cbe46a"; //Contract E's address that exist on my private chain. call ...
0
votes
1answer
80 views

ICO requires 20 ETH. I only have 5 ETH, can I set up a group buy with three others using a smart contract?

I want to be involved in an ICO but it requires 20 ETH. Is there a way I can utilize an smart contract, where 5 ETH is sent to a group buy ETH address. Upon 20 ETH being sent to the ICO eth address, ...
0
votes
1answer
90 views

Parent-Child Contract Synergy Broken

When I call a function from a child contract which has been generated through a parent contract, then the mapping within the parent contract which consist of information related to the child contract (...

1
3 4 5 6
7