Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [contract-design]

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

-1
votes
0answers
21 views

Contract Creator has been HACKED, How to recover my token [on hold]

I made a token with solidity as below: pragma solidity ^0.4.22; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a * b; assert(a == 0 || ...
1
vote
0answers
12 views

Smart contract design for gas refund

I'm designing a proxy smartcontract that will be filled by users so that anyone has an incentive to can perform a transaction useful to the user. I won't go into the detail of "usefulness" here. My ...
-2
votes
1answer
16 views

What other function calls can freeze a smart contract like the pause() function?

I'm learning to audit Ethereum smart contract code for clues if a smart contract can be frozen or not. Many smart contract creators claim their contracts are "unstoppable", but I'd like to know if ...
0
votes
1answer
18 views

Insurance platform's and Ethereum smart contracts

I am trying to create a proof of concept for an insurance platform, a one that deals with risk and selling promises of coverage. A similar idea will be the car insurance platform's where you pay each ...
0
votes
1answer
31 views

Time Lock and vesting smart contract

I would like to create a smart contract that will take care of locking and/or vesting funds to several beneficiaries (inputted by the owner of the smart contract). The funds that it will vest and lock ...
0
votes
1answer
15 views

Why is it that my first original contract containing the setters and gettters are not showing up when I hit deploy?

pragma solidity ^0.4.24; contract Bank{ uint private value; constructor(uint amount) public{ value = amount; } function deposit(uint amount) public{ value += amount; ...
0
votes
0answers
8 views

Is contract suitable for running remote command on specific button press?

I am trying to put up a new use case where a user having a mobile app to open car door remotely. Is blockchain suitable in such case? Is contract suitable in this case?
2
votes
1answer
26 views

Handling the String msg returned from revert() in solidity

This is my sample contract.. pragma solidity ^ 0.4.15; contract Sample{ struct Info { address pubKey; //key bytes32 Id; } mapping(address => Info) public userMap; // ...
2
votes
1answer
21 views

Is there any point in adding msg.sender to an event?

I am asked to provide the value of msg.sender as part of an event emitted in a function. It is something like: contract MyContract { event MyEvent(address indexed sender, uint256 input, uint256 ...
1
vote
1answer
42 views

Force two users to send the same amount of ether when starting a game

In my smart contract, I want the two participants to send the same amount of ether so they can start a game of rock, paper, scissors. How can I modify the sendEnoughCash() function do that? This is ...
0
votes
2answers
30 views

avoid replay attacks on signing on smart contracts

the scenario: a user has a privatekey and wants to sign something to send to the contract ex: the user send his (message,signature,publickey) to the contract and the contract can verify it with the ...
1
vote
0answers
21 views

What is a suitable pattern for building a web/mobile app that leverages ether? [closed]

Noob to ether dev. Looking to understand how to build an app that leverages Ethereum - what suitable patterns are out there (ideally to go via some tutorials). A few apps examples (from easy to ...
0
votes
1answer
23 views

Transfer() will transfer the ether in the form of wei or ether by default?

pragma solidity ^0.4.17; // I want to write a code for loyalty points when user pays contract GiveRefreceId { mapping(address => uint256) ...
0
votes
2answers
16 views

Are there a standard for generating a unique thing to send to the smart contract?

Are there anything that is unique maybe combine with time, user address or something else, and send it to the smart contract, and the contract can know that it is indeed the unique thing that user ...
0
votes
1answer
20 views

Avoiding for loop and making function call only once by any user

pragma solidity ^0.4.17; // I want to write a code for loyalty points when user pays contract GiveRefreceId { struct referenceids { uint256 rid ; address addressrid; } ...
0
votes
1answer
13 views

how to fix a fact that the recipient received the file so that the recipient could not dispute it?

how to fix a fact that the recipient received the file so that the recipient could not dispute it? How to do this by a smart contract? thanks in advance.
0
votes
2answers
28 views

Can I make recursive calls using Ethereum Alarm Clock Scheduler?

Answer given here does not provide full solution. Can some one please suggest me if it is practically feasible to execute a method in my smart contract every 24 hours using Ethereum Alarm Clock? You ...
1
vote
1answer
21 views

Designing a smart contract to do trustless transactions of eth/tokens between users (buyer/seller)

I'm looking for any help og pointers, as to the possibility of creating a contract that would act as a "middleman" in a token/eth transaction between 2 users. Considering a website, were users can ...
1
vote
1answer
33 views

Why is delete on arrays implemented in an energy and gas wasting way?

If I delete the whole array (static/dynamic), then all elements of an array are set to default value. So, it means that if an array has a million elements, then I have to pay gas for setting up of ...
1
vote
1answer
28 views

OMG Tokens locked in smart contract - onlyPayloadSize

My OMG Tokens are locked into a smart contract due to modifier - onlyPayloadSize Line #93 - https://etherscan.io/address/0xd26114cd6EE289AccF82350c8d8487fedB8A0C07#code I had stored dozens of ERC20 ...
-1
votes
1answer
21 views

Understand inter-operation between typical DApp and its underlying smart contracts

I am a newbie to Ethereum and start to study some typical implementations of commonly-used DApp. So basically for the popular dapp on this list (https://www.stateofthedapps.com/rankings/platform/...
0
votes
0answers
10 views

Why does ENS's public resolver have a setPubkey function?

The contract at 0x1da022710df5002339274aadee8d58218e9d6ab5 has a setPubkey function, which I assume takes the x and y-coordinates of an ellptic curve (secp256k1 public key). Most guides tell the user ...
1
vote
1answer
9 views

How to build a contact that allow rating?

If I have a contract that has a list of sellers, how would I code a simple contract that if some condition applies, the contract in an automatic way will increase the reputation/rating of the sender ??...
0
votes
1answer
19 views

Implementing function to transact with other ERC-20 tokens in smart contract?

A while back I saw an example contract which allowed users to send any ERC-20 tokens through one of its functions, but I can't seem to find anything about this anywhere anymore. So, what is the ...
0
votes
1answer
36 views

How can I make a database and smart contract interact?

I started to code a smart contract which was supposed to store some datas from corporations. These datas (mostly names and dates) were organized like that : ├── Client1(Contract) │ ├── Year2018 (...
0
votes
1answer
23 views

Storing and Updating an array in a smart contract (for creating permissioned networks and updating members)

Can I define a smart contract including a dynamic array that I can update its content later? precisely,I have some IoT(Internet of things) nodes sharing the received data from sensors with each ...
0
votes
2answers
28 views

Any coding games made for learning how to build out ethereum smart contracts?

I recently saw this for learning how to code smart contracts on EOS: https://battles.eos.io but was wondering is there something similar in Ethereum where one can play a game to learn smart contract ...
0
votes
1answer
13 views

Is it available to have an application that is managed by single Entity?

If For example Entity A wants to build a smart contract that manage a group of devices. But since each device uses pseudonym and he may change it later, is there any way to build the contract such ...
0
votes
1answer
26 views

Reading of state variables vs the memory varables . and memory vs storage keywords

contract Shopping { struct Article { uint id; address seller; address buyer; string name; string description; uint256 price; } // state ...
0
votes
1answer
24 views

Why my tokens aren't visible to the address sent in etherscan?

I've flattened the code and fixed the warning. But the problem with the contract is that the tokens are not visible in the addresses when searched with etherscan but when I try to add through Metamask,...
1
vote
2answers
30 views

Check given adders transaction history? [closed]

I've created a voting game on eth blockchain. I would like to make a function, that only address with previous transaction history(not a fresh address) can call. So doesn't allow people to create a ...
4
votes
2answers
37 views

Why doesn't ETH allow a contract to read another contract / account's state?

Been thinking about this for a while, and came on this question: Can a contract access another contract's storage?. What is the design rationale behind NOT allowing these types of reads? It ...
1
vote
1answer
55 views

smart contract and private blockchain

I have some IoT(Internet of things) nodes sharing the received data from sensors with each others. I partitioned them to 2 private(permissioned) networks: Network 1 includes: X,Y,Z nodes trusting ...
0
votes
1answer
20 views

cypto-signing in a smart contract -> verify the identity of a smart contract

my Question in short is: -> is it possible to digitally sign some data by a smart contract (e.g. with a secret key of the contract) and thus confirm that it was exactly this smart contract, who ...
1
vote
1answer
35 views

Passing data between two Ethereum networks

I have some IoT(Internet of things) nodes sharing the received data from sensors with each others. I partitioned them to 2 permissioned networks: Network 1 includes: X,Y,Z nodes trusting each other,...
1
vote
1answer
10 views

How to i display information from a smart contract on my wordpress website [closed]

I want to display specific information from a smart contract on the main ether network on a wordpress website i can't seem to be able to do that, all tutorials only show test networks. the smart ...
0
votes
0answers
41 views

Only owner can do the transfer of ERC20 token

Is it possible that only a single address (the owner's address, who published the Smart Contract) that can perform the transfer of ERC20 token from one address to another? So this company (owner) ...
1
vote
2answers
56 views

Can a Contract ABI change?

I am developing an app that is using the etherscan-api package. I use it to get the contract ABI. The problem is that I retrieve it via the API every time the function is called. My question is: ...
0
votes
0answers
33 views

Export / Import data in a contract

I have a project which will have a lot of datas in different nested structs. I want to know what is the best practice to import datas in my contract. Is it possible to parse a Json file and fill my ...
0
votes
2answers
46 views

What is wrong with this code, deployed but showing error while sending ether?

I have tried to compile this code for crowdsale and also have deployed the contract on Rinkeby Network. But each time I send a transaction, it says Warning! Error Encounter during Contract Execution [...
1
vote
1answer
39 views

How can this work?

Please see this txid : https://etherscan.io/tx/0x475743c4b17542b52c91d642a130af89f4ec7ca41eb43fc00fa788465a2b6c13 How can this work. I see this only does one transaction, but why can the address ...
0
votes
1answer
31 views

Sorting elements from mapping according to certain value?

I have created a function that receive some values from users an store them in a mapping. How to arrange the stored values in mapping according to a certain value ( Priority as in the shown example ...
1
vote
0answers
12 views

How to build an incentivization model for a behavioural change using smart contracts? [closed]

I have been researching various incentivization models and reading whitepapers regarding crypto-economics(e.g: steemit whitepaper) for a while but is it necessary to have a private blockchain for that ...
0
votes
2answers
76 views

How to do division and multiplication using solidity?

I am building a program on solidity that receives 3 values(bonus, value1, value2) through function, Then, another value called priority is calculated as follows: Priority= (0.5*Value1 + 0.5*value2) / ...
0
votes
1answer
28 views

Smart Contract that can transfer ETH to other ETH Wallet (Owner of the Smart Contract)

I actually my partner created a Smart Contract which is able to create a new smart contract and send the proceeds. I'm quite new to Solidity unable to figure out a way to modify the smart contract to ...
0
votes
1answer
18 views

Should I route forwarding contracts through a second forwarding contract?

This is more of a question of filter events, I guess. If I have 500k deposit addresses and they are all forwarding to one account and emitting event logs with address(this) and msg.value, would it be ...
0
votes
1answer
50 views

Track my contract as its owner

I wonder if there is a way to keep track of my smart contract as an owner of it. Like get a full dynamic report regarding each and every action happened on it since it has been created ?
0
votes
2answers
47 views

Array of addresses

I have an array of addresses and a function which returns how many times an address is in the array. For example, if the array has ['0x00', '0x01', '0x00'] the function will return 2 for 0x00 and 1 ...
0
votes
0answers
22 views

How to store & retrieve data in blockchain(Solidity) using merkle tree approach for tracking?

I'm working on asset tracking sample application. currently i'm tracking asset transfer information using events. I would like to store asset transfer information in blockchain using merkle tree ...
0
votes
0answers
48 views

how to create efficient & scalable smart contract function?

I want to pass a dynamic array value from the backend to solidity function like as mentioned in the below code. pragma solidity ^0.4.19; contract EventFArr { event TestEvent(uint256[] eventDArray,...