Stack Exchange Network

Stack Exchange network consists of 175 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

0
votes
0answers
2 views

Is it okay to define the following smart contract that a accepts funds from two parties?

I want to deploy a smart contract that receive funds from two parties. The contract is initialized with some ethers from person (call it revealer), and another Recipient (name it fineRecipient) who ...
0
votes
1answer
11 views

Can use smart contract as payment gateway

Most suggest that cannot use ERC20 token as payment gateway integration .Why?
2
votes
2answers
14 views

How to speed up data loading from the blockchain to the frontend?

I have a function that, according to the Unique ID of the car, gives me all its characteristics: function getCarArray(uint _carId) public view returns (uint[12] memory) ...
1
vote
1answer
6 views

What is the Withdrawal Pattern?

I am reading this article : https://medium.com/@jgm.orinoco/why-use-the-withdrawal-pattern-d5255921ca2a It seems interesting. Could anyone explain the idea of the Withdrawal pattern in a simple way ?
1
vote
1answer
15 views

Can abstract contracts in solidity have state variables?

I want to have one deployed contract with my data structure and all data and another separate contract with functions that calls the deployed contract. If i've understood things correctly, one should ...
0
votes
1answer
17 views

How to run a contract in specific time? [duplicate]

I am developing a simple application that should work only in a specific time, lets say between 0800 hrs and 1600 hours. How can I do it. That means. The contract should start by itself at 0800 and ...
0
votes
1answer
15 views

Can be fix our token price to a stock?

For example can we create a pepsi token which is fix to pepsi stocks? Do you think that is useful?
1
vote
0answers
9 views

How the following scenario be achieved using smart contracts?

Assuming we have two parties (A & B). How the following scenario be achieved using smart contracts? User A will deposit some funds (x coins). user A can receive penalty funds from user B, So user ...
0
votes
1answer
16 views

Pushing constructor result to contract member array

I'm trying to do the following operation in Solidity: BetCampaign memory newCampaign = BetCampaign(id, new Bet[](0), betEndTime, false); betCampaigns.push(newCampaign); With the following member ...
0
votes
1answer
12 views

How you can have real-time database modifications if transactions require acceptance by all others

I'm trying to understand the current implementation of smart contracts and transactions and am wondering about real-time behavior. I read that it can take up to 10 minutes for a transaction to become ...
1
vote
1answer
76 views

Why transactions/contracts aren't priced/tracked based on computer running time

Amazon AWS and Google Cloud all base their pricing off of, among a few other things, the amount of compute and storage used. For compute, it's based on time, how much time the computer runs. This is ...
0
votes
1answer
11 views

Condition for changing a smart contract

I'm developing an application using smart contracts. I wonder if it is possible to establish different states for a contract, for example: User 1 determines a condition X, but also determines that ...
0
votes
1answer
17 views

Pass structures between contracts with Solidity 0.5

I'm trying to pass an instance of the Storage structure from StorageController.sol to Publisher.sol. No matter what I do, I get VM Exception while processing transaction: revert in my Truffle test. ...
1
vote
2answers
37 views

“Self-destruct” use cases?

According to solidity.readthedocs.io (Link) here is the definition of Self-destruct: "Definition: The only way to remove code from the blockchain is when a contract at that address performs the ...
0
votes
1answer
24 views

Transaction pending

If I call this function the transaction get pending and never finish. Any idea? pragma solidity ^0.4.24; contract test { uint[] values = [1,2,3,4,5,6]; function removeValueFromArray(uint _num) ...
0
votes
2answers
26 views

What are differences between bitcoin and etherum trancactions?

I have read about how transactions work and how they can be redeemed in bitcoin. In a very abstract way, the sender defines the output script that should redeem the transaction. But I am new to ...
1
vote
2answers
18 views

What is the difference?

I noticed some smart contracts have the wallet address of the creator in the smart contract to send the tokens to the wallet like example #1: Example #1: constructor() public { symbol = "...
-1
votes
1answer
28 views

Identity Verification [closed]

I am trying to build a certificate DAPP, where the universities will upload certificates/degrees of students to the blockchain. But How can I verify that the university is genuine and its the ...
1
vote
1answer
19 views

Is there any way that smart contract can access xacml policies?

I am trying to implement role based access control model using blockchain. How do i store these policies? Later my smartcontract should be able to allow or deny the rquest of user based on policie. ...
0
votes
1answer
24 views

Is the following scenario doable by a smart contract?

I have 2 persons ( say A or B). They want to have the following agreement. Person ‘A’ specify a deposit (x coins ) for user ‘B’ under a certain condition with a future time lock ‘t’. If user ‘B’ ...
1
vote
1answer
25 views

Is there any simple explanation to multisig wallets?

I read on ConsenSys and Ethereum MultiSigWallet. I got that "The purpose of multisig wallets is to increase security by requiring multiple parties to agree on transactions before execution. ...
0
votes
1answer
35 views

How to start auditing smart contract?

I want to become a smart contract auditor. I will report all the vulnerabilities which I have explored while auditing smart contracts. Is there any platform available to learn how to audit smart ...
0
votes
1answer
18 views

Constantinople gas change, reentrancy possibilities

With the new reduced fee for using SSTORE for 'dirty' storage slots, is it possible to re-enter a function from a send() or transfer() and have the contract call send() or transfer() again? Or is it ...
1
vote
1answer
9 views

Smart Contract Tokens and exchanges?

Is there any special code you need so your token can be traded on exchanges example Binance? Right now its a pretty basic contact like Fixed Supply token. Or is it as long as the exchange(...
1
vote
0answers
15 views

Secuirty Token Escrow setllement

Is Esrcow could be applied in ST 20 tokens ? If yes, please guide for the same.
0
votes
1answer
29 views

Multi-signature Ecrow time based?

I have a user A and a user B. They do not trust each other. So, they run the following smart contract: User A specify a time locked deposit of x coins to user B under a predefined condition( For ...
0
votes
2answers
16 views

Keep private data in contract and manage access

Is it possible to keep data in a contract, in a similar way that we can create wallet contract? Wondering if it would be possible to keep that and then manage the access to this 'hidden' data ...
0
votes
1answer
23 views

Calling another contracts function -minimum info required

I understand how to call another contracts function. My question is, if I want to use an interface like in this question over call(): Call function on another contract contract Name { mapping(...
0
votes
1answer
21 views

Can I just change just 1 bit of data in a smart contract?

Can I just change 1 bit of data in a smart contract? More specifically would this allow me to make a smart contract where it is really cheap just to flip specific bits. This would be like setting ...
0
votes
0answers
19 views

Approve/TransferFrom Methods

During an Audit I got a warning for this code lines: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md // recommends that there are no checks for the approval double-...
1
vote
0answers
26 views

Hardcoded Address

I did an audit on a smart contract and it says it has a hardcoded address. constructor() public { symbol = "0PUCKS"; name = "0 Pucks Token"; decimals = 18; ...
0
votes
1answer
17 views

Is it possible to have a contract run whenever a wallet address receives a transaction?

I'd like to build some code that monitors a wallet address, and performs an action whenever that wallet receives a transaction. I could do this with say javascript or whatever, but that doesn't offer ...
0
votes
1answer
23 views

Can we pass some verification values from web to solidity contract?

Is there a way we can pass some value checks from web to solidity contract Just for example if we want to make sure, the person who is calling contract function is present on our website and not suing ...
0
votes
1answer
16 views

Allow all ERC20?

So far a user can allow a smart contract or any address on Ethereum blockchain to spend their coins by calling the 'approve' function. If I want to allow address X to spend 250 of my FabulousCoins I ...
0
votes
1answer
18 views

Design pattern Checks-Effects-Interactions Pattern

I was workig on design pattern Checks-Effects-Interactions Pattern and found the below link which has a similar question but in the direction which I am looking at .. Checks-Effects-Interactions ...
0
votes
1answer
24 views

How to map one to many

I am working on rent agreement and I have a situation here One landlord can have multiple properties every property have different details (property details, values) now I want to link property ...
0
votes
1answer
21 views

Time-locked deposit protocol?

I am designing a protocol where a user A sends a time-locked deposit to user that if the user B within time t provide a proof that he exists in a location x (this may be obtained by third party like ...
0
votes
2answers
28 views

Including an owner address based automated routine execution in a React ethereum dapp?

As I understand, all the front-end components for a react based ethereum dapp are rendered from the point of view of the user's metamask default account. All the calls to constant functions in ...
0
votes
1answer
29 views

Storing User data on blockchain

I am currently using the structure and mapping to store the user data in the blockchain. In the mapping I am using user's address (msg.sender) for mapping it with structure so every user can only ...
0
votes
0answers
31 views

Underflow attack, is it possible here?

Assume that you send X ERC20 SomeCoins and in exchange, you receive X/2 MyCoins. Both ERC20 have 4 decimals. My question is, if the user sends the minimum value or, a value that can't be divided by 2,...
0
votes
1answer
33 views

Getting TypeError: Operator == not compatible with types int_const 1000000000000000000 and address payable

I am trying to use external modifier however I getting error as below code. { require(block.timestamp < start + buyPeriod); require(1 ether == msg.sender);<--- error got here ...
1
vote
1answer
27 views

Using smart contracts for delivering encrypted data [closed]

How can I utilise (perhaps automate) a smart contract to deliver some encrypted data from A to B, based on the pre-requisite that A fulfills B's requirements. Would I need an oracle for this type of ...
0
votes
1answer
21 views

Index 0 in empty address array reverts

I have a struct that has an array of addresses. When the address array is empty and I try to get index 0 I would expect it to return address(0), but instead it reverts. Any way around this? struct ...
2
votes
3answers
89 views

What other constants depend on the current call like msg.sender?

I recently noticed that msg.sender isn't always the original caller's address (see here). It's the address of the current call. So if foo() calls bar(), then msg.sender in bar() will be the address of ...
0
votes
1answer
28 views

timed commitment using ethereum blockchain

I read this paper: https://eprint.iacr.org/2013/784.pdf that introduces the idea of Bitcoin-based time commitment scheme. In which if the commiter does not open his commitment before a specific time ...
1
vote
1answer
19 views

How to burn non burnable ERC20?

Suppose you received 250 HELLOCoins and you want to burn them. Unfortunately, HELLOCoins uses OpenZeppelin ERC20 which implements the following function: function _transfer(address from, address to,...
0
votes
2answers
30 views

Which ERC standard is suitable for an ICO token to have types?

There will be ICO with multiple cycles... Here, investors can purchase tokens and after a fixed window of 270 days, they can redeem it back. But within this window period, they can transfer tokens to ...
1
vote
1answer
28 views

Zero knowledge contingent payment on etherum?

I know that bitcoin supports Zero knowledge contingent payment (ZKCP) , can etherum support such ZKCP Payment ?
1
vote
1answer
34 views

How to search through blockchain?

I m doing project for document verification using blockchain in which we don't have to carry documents everywhere, hash key of block will fetch data of doc from blockchain.I m not getting how to ...
0
votes
3answers
49 views

Use function return variable of smart contract in web3.py

since im new to solidity programming i have some problem with executing my Contract. My Contract looks like this: # Solidity source code contract_source_code = ''' pragma solidity ^0.4.1; contract ...