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
1answer
9 views

How can the smart contract auto execute the function in the private chain?

I know currently, we can use the Ethereum Alarm Clock and Aion scheduling system to execute the function automatically, but according to what I know, it only can work in Main Net and Test Net(Rposten)....
0
votes
2answers
13 views

How to restrict ICO investors to redeem their ERC20 tokens while not restricting them to trade tokens among themselves?

We want to create an ICO where investors can purchase ERC20 tokens anytime but have to wait for atleast 3 months from the date of purchase in order to redeem/encash them on our platform. But we do ...
0
votes
1answer
20 views

Contract change registry

If i have a smart contract stored on block 10, when i change the status of this contract, the altered contract will be stored on the next block or the status of the contract will be stored in block 10 ...
1
vote
1answer
20 views

add fields to ERC721 tokens, still belongs to the standard?

if starting from the code of an erc721 token, I add fields beside the name, symbol and URI, is it still a token that respects the standard? Add in the contract, not in the JSON file. The most ...
0
votes
2answers
10 views

Problem making solidity contract compatible with version 0.5.0 or higher

pragma solidity >=0.5.0 <0.6.0; contract Courses { struct Instructor { string age; //add memory to struct varibles string fName; string lName; } ...
1
vote
1answer
20 views

is there a list type in solidity?

I know there are dynamically sized arrays, but I need a data structure that can remove elements from the middle cheaply. Using pop() with a dynamically sized array should require a shift of every ...
0
votes
1answer
22 views

CREATE / CREATE2 Verification

Where do I verify whether a contract has been created with CREATE or CREATE2, would I have to disassemble the contract and look for a CREATE2 opcode in the contract creation code?
1
vote
1answer
26 views

Enigma “secret contract” and concealing transactions history: How is it possible?

Enigma protocol is a second-layer, off-chain network that aims to solve privacy issues in blockchain. However In Enigma blog, there is an article (Link to Article), explaining the secret contract, ...
0
votes
1answer
22 views

map multikey how-to?

I'm trying to create a map whose key is composed of two bytes32 keys. I've tried with tuples-keys and struct-keys but both are rejected by the compiler. I'm also thinking about "hashing" both keys ...
0
votes
1answer
29 views

Sending private key to server side

I am trying to build new Dapp application for our startup by using web3j , I am facing an issue with signing the transaction from server side , because i need to know the private key for the client (...
0
votes
2answers
16 views

Std set in solidity?

Is there any way or library to have a set in solidity that can be iterated like C++'s std::set? library Set { // We define a new struct datatype that will be used to // hold its data in the ...
1
vote
1answer
16 views

reverse crowd sale possibility

Is it possible to do a reverse crowd sale? e.g. send tokens to a smart contract to get ether back. Or would this require to load the contract with WETH or something in advance?
5
votes
1answer
26 views

What is WETH and why can't we just use ETH?

can someone explain why we need WETH? what's the purpose of WETH, can't we just use plain ETH? it's not like it removes the tx fees or something. Hopefully someone can shed light on the concept.
1
vote
1answer
96 views

How to prevent selfdestruct from another contract

I have a contract A calling another contract B Contract A contract A { function sendValue(B _externalContract, uint _value) { _externalContract.acceptValue(_value); } } contract B { ...
1
vote
1answer
11 views

Return each struct value from a key inside a mapping, where the key is also a value from array inside another mapping

I have a project that I'm working on and I'm trying to figure out a way to do as the title says. I'm looking for the easiest and/or cheapest way(gas wise) and since I'm stuck I'm open to better ways ...
1
vote
1answer
18 views

Listen smart contract event

I use parity --light geth --syncmode "light" I would like to listen smart contract Event. Do I need to download all blockchain on local PC or light mode will be enough?
0
votes
0answers
10 views

Transfer from smart contract to CoinTiger non smart contract [on hold]

Yesterday I have transferred some ETH from Wirex who has smart contract address to CoinTiger exchange who doesn’t have a smart contract address. The transaction status is successful w/ 18% GAS ...
1
vote
2answers
26 views

Decentralized Exchange on Ethereum?

Is a decentralized exchange basically a smart contract that includes all the exchange functionality? Where is the engine?
1
vote
2answers
37 views

Decode transaction input INSIDE contract with solidity? [duplicate]

I would like to know if it is possible to read blockchain transactions from a smart contract. How web3 has the possibility to scroll, read and decrypt the input data of the transactions, does solidity ...
0
votes
1answer
18 views

Retrieving block hash of current block vs previous block

What is the formula for retrieving the blockhash of 1) previous block and of 2) current block?
0
votes
1answer
18 views

Find word in string solidity

How is it possible to look for if a certain word is part of a string in solidity? let's say someone upload a string to a smart contract, this string must contain the word "solidity" to be accepted by ...
0
votes
2answers
22 views

Solidity how to check if user is already used another contract?

I am trying to figure out how to set up a simple communication between contracts. For example, we have a contract Passport, in which the user writes his data. After that, through the Election ...
0
votes
1answer
24 views

In ICOs why initial supply/total supply tokens are transferred to owner address rather than storing it in the contract itself?

Here I have taken two of the top 20 ERC20 Token/ICO. 1.BNB(https://etherscan.io/address/0xB8c77482e45F1F44dE1745F52C74426C631bDD52#code) 2.BAT(https://etherscan.io/address/...
0
votes
1answer
14 views

Trigger manual DB UPSERTs through smart contract

Can I add a trigger to smart contract to insert/update data to my traditional DB. E.g. Let's say I have students private blockchain where each student has to update their info. Once they insert/update ...
1
vote
2answers
28 views

How to deal with smart contract Versioning

I just got hit by a problem regarding the changes in a smart contract in case of a business use case. Changing the smart contract in general means, " in business terms", loosing the data and starting ...
1
vote
1answer
19 views

overflow/underflow issues?

pragma solidity 0.5.1; contract basics{ using SafeMath for *; uint time; address payable sender; uint amount; event moneySent(address s,uint a); mapping(address=>person) ...
3
votes
1answer
49 views

function input conditional check

I have a function which is accepting a string argument as input parameter. This string is an IPFS hash and I would like to check that the input is actually just that and not a malicious link or the ...
0
votes
1answer
11 views

Memory error while compiling

Please have a look at the contract pragma solidity ^0.5.1; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function mul(uint256 a, ...
1
vote
1answer
17 views

Is it possible for a contract to auto-execute a function every hour? [duplicate]

I have a contract with a manual function that checks the balance of the contract and if it's zero it changes certain values in mapping. How to make this happen automatically every hour?
0
votes
1answer
20 views

how can a signature for a document on a blockchain be revoked?

I am trying to do document verification through blockchain. The way I'm trying to do this is by digitally signing a document, and storing its hash on the blockchain. Now I'm trying to create a feature ...
1
vote
3answers
42 views

Is the burnFrom function in erc20 token contract unsafe?

We have been issuing a token using a basic erc20 token contract from https://ethereum.org/token An exchange that we wanted to list our token, asked for a collateral as they see the burnFrom() function ...
1
vote
3answers
52 views

Do you need to use/learn Solidity to make smart contracts

I'm working on an API that sends multiple transactions out from one wallet. I realized I cannot do it without creating a smart contract the way Ethereum is structured which is actually quite a great ...
1
vote
2answers
45 views

Reset all values in a mapping

I am trying to figure out how to have the balance of all players reset to (amount) when a certain condition happens. This is the function that will update a specific player balance. How do I make it ...
1
vote
1answer
22 views

Prevent Replay protection in Preauthorized functions

I was looking for a way to send transaction on behalf of users in Dapp. Luckily, I came across the EIP 662. I am implementing something suggested here by emansipater As stated in EIP, the replay ...
0
votes
1answer
13 views

How to prove data you input is what an API call returned without using third-party service?

I know of Oraclize. As discussed in this answer How does Oraclize handle the TLSnotary secret? by Jeff Coleman there are disadvantages, and he suggests using TLSNotary oneself is safer than trusting ...
1
vote
1answer
73 views

Wrapping Cryptocurrencies for interoperability sake

How is it possible to standardize bitcoin and wrap it to the ERC20 format, creating smart contracts for Bitcoin. This should make it easier to write smart contracts that integrate bitcoin transfers ...
1
vote
1answer
17 views

Pros & cons of enterprise volatile/stable ERC20 usage and likelihood

What are the pros and cons for a business to accept a stable/volatile erc20 token as means of payment? and what is the likelihood of such? I assume a business would always prefer a stablecoin over a ...
1
vote
1answer
37 views

List of Stablecoins built on Ethereum

What are some stablecoin projects built on Ethereum and how do they distinct between each other?
0
votes
1answer
26 views

Difference between ERC20 and ERC223

i still don't get the idea behind the "if you send 100 ERC20 to a contract, they're stuck there and these 100 ERC20 are lost forever".. i really don't get.. like, a contract has an address and a ...
0
votes
1answer
9 views

Disguise the input from msg.sender of a function call

is it possible to disguise the input from msg.sender of a function call? e.g. If we assume I have a smart contract which includes a mapping of registered inmates, and a user-group called prison ...
1
vote
1answer
18 views

I am trying to build a land registry of land titles on the blockchain, [closed]

Good Day. I am trying to build a land registry of land titles on the blockchain, with the intention of being able to sell such title to someone else. Therefore, the title eventually has to be ...
3
votes
2answers
276 views

How to create a paid keyvalue store

I'd like to create a contract through which people can set publicly available key:value information in exchange for some Ether sent to me (the owner of the contract). This is to create a public ...
0
votes
1answer
17 views

How to push new struct to storage?

I get an error when trying to push the newRound struct to storage. How can it be fixed? Error: UnimplementedFeatureError: Copying of type struct Lottery.Ticket memory[] memory to storage not yet ...
1
vote
2answers
18 views

Verify transfered amount of two transactions from same ERC20 to same Contract

I making a contract to sell stuff in a decentralized way and want to use following method to transfer founds. function transferToken(address token, address from, uint256 amount) internal { IERC20 ...
0
votes
0answers
26 views

Smart contract migration through Proxy delegate pattern in solidity 0.5

I am trying to do smart contract migration in solidity 0.5 using the proxy delegate pattern. When I write the integration test in javascript how should i make a delegate call using the proxy contract ...
0
votes
1answer
32 views

Delay a transaction

Is it possible to delay a transaction in one contract? let's say Alice wants to send a product to Bob and Bob has to transfer, for example, 2 Ethers to Alice for buying that product. How can I do ...
1
vote
2answers
30 views

On-chain settlement based on off-chain activity

I'm build a DApp where the end-user should be able to attach a proof (could be information, data, attachment, whatever). Now, if the DApp accepts this proof as being legit off-chain, then I want the ...
1
vote
2answers
36 views

Best way to delete element of a dynamic array without knowing the index

I have this mapping mapping(bytes32 => address[]) public authorisation; This maps a hash with a list of authorised users. I have a function to add, and confirm - these work and its not an ...
1
vote
1answer
47 views

Ideal way to store hash on the ethereum blockchain

I would like to store a certificate on the blockchain. I only need to store its hash and if its been verified by both parties or not. Should I create a struct that is made up of bytes32 for the hash, ...
0
votes
1answer
28 views

Two smart contracts interacting, should they know each other?

This may sound like a very naïve question. It's the first time I'm making interact two smart contracts (in general, I'm not very proficient with blockchain development). I have these two smart ...