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-development]

Questions regarding the development of smart contracts

0
votes
1answer
12 views

Interacting with Already deployed Ethereum Contract and recording response

I understand this topic has been discussed before, but my question is specific to web3.py. How can I interact with function of already deployed ethereum contracts on Ropsten TestNet. my code runs with ...
0
votes
1answer
21 views

ERC721 Default Implementation

I’m working on a card game. Right now it is really simple. There are orcs and cards. Both should be implemented as ERC 721. What would be the most natural way to make the orc an ERC-721 token? ...
1
vote
1answer
17 views

looking for ethereum account easy management process

Suppose I want users to answer surveys and that each response are hashed and sent to ethereum. My issue is the user experience of creating an account and login without metamask which is not user ...
0
votes
1answer
5 views

POA chain: intrinsic gas too low, contract deployment

I'm trying to deploy my smart contract to a private proof of authority chain with geth, but i always get the following error message intrinsic gas too low This is the JSON RPC request i'm sending. ...
1
vote
1answer
11 views

How to improve web3 when importing and stop doing the same task over and over again?

When using web3js, you will automatically have to make file to create an instance of that contract which you will use in your main project to interact with. For example, smartContract.js import ...
1
vote
1answer
19 views

Processing gas cost on a sidechain

I am developing a sidechain that will store data and I want to evaluate the processing of this data in the ethereum network to get the cost in gas. I'm going to develop a smart contract that will ...
1
vote
1answer
159 views

Unable to replicate short-address attack

I was reading about the short address attack and decided to replicate and test the possible solutions. What I know about short address attack is if you skip n characters of your address, you end up ...
1
vote
1answer
144 views

creating multi signature address in solidity

How can I create an array of multi-signature address (2-of-2 P2SH multisig, keeping one account on all the multi-signature account constant) in web3js or solidity so that my custom token can be ...
0
votes
2answers
26 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 ...
0
votes
0answers
26 views

Transferring ether balance from contract balance to winner,not working

here is my Solidity snippet: function deliverPrizes(address payable winner) public onlyOwner{ winner.transfer(address(this).balance); } This is what I wrote on truffle console: dCoders....
0
votes
0answers
12 views

Transfering funds from a contract address to a list of winners [on hold]

I'm building a competition dapp where user has to pay to the contract to participate and I want to send the collected funds to 3 winners. How can I do so in a smart contract.Help
0
votes
1answer
13 views

TypeError: Return argument type bytes32 is not implicitly convertible to expected type (type of first return variable)

I have one issue while deploying the below contract.could anyone help me to find the issue as unable to find issue. pragma solidity >=0.4.22 <0.6.0; contract Lottery { address payable[] ...
2
votes
1answer
214 views

ERC-20 contract from another contract

I am trying to create contract which can access functions of any ERC-20 standard token contract. At first, I'd like to get balance of given address. I run private testnet using geth, I have deployed ...
0
votes
1answer
21 views

How to configure APIs to run with Ropsten addresses

I have my contracts deployed on Ropsten network. I deployed those contracts from my local machine using Truffle migrate. Then I set up an AWS EC2 Ubuntu server to host my RESTful APIs. I installed ...
8
votes
3answers
3k views

How can I accept Bitcoin payment in a smart contract? What would be the code for that?

I will create my personal token and I would like to be able to sell it for ETH and BTC. I know how to add the sell function for ETH, but how can I sell the tokens for BTC? The ETH sell function I ...
1
vote
1answer
152 views

How to read “allevents” using Python web3 (there's capability in web3.js)?

Is there a mechanism to create a listener for all events being emitted from a smart contract for the python web3 library. There is a way to do it in web3.js: myContract.events.allEvents([options][, ...
0
votes
2answers
154 views

How to call a function and to read return values from an external deployed contract address?

I am trying to call a function from deployed contract address using the below format DeployedContractAddress.call(bytes4(keccak256("get(address)")),0xfffff); But when trying to call the get(_address)...
4
votes
1answer
159 views

Contract storage not changing on calling function

contract SimpleStorage { mapping(bytes32 => string) storedData; function set(bytes32 key, string value) { storedData[key] = value; } function get(bytes32 key) constant ...
1
vote
1answer
807 views

Truffle: Why is my “onlyOwner” modifier not running in truffle?

I'm using a simplified version of a contract provided by Solidity website. My contract is as follows: pragma solidity ^0.4.4; import "./ConvertLib.sol"; contract MetaCoin { address owner; uint ...
0
votes
1answer
717 views

Member “mul” not found or not visible after argument

I'm a beginner trying to write a Token contract, and I have encountered an error using Solidity 0.4.19. Here is the piece of code with the problem: function createTokens () payable { require(...
0
votes
1answer
122 views

getting error TypeError: Member “transfer” not found or not visible after argument-dependent lookup in address

Hi I need one help as I am unable to run below logic in solidity as some change in solidity. function transfer_balance(address recipient_address, uint amount) public returns(bool) { if(msg....
0
votes
1answer
254 views

Member “validPurchase” not found or not visible after argument-dependent lookup in contract super

pragma solidity ^0.4.18; contract MinInvest { function validPurchase() internal returns (bool) { bool moreThanMinimalInvestment = msg.value >= 0.1 ether; // change the value to whatever ...
0
votes
1answer
176 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. ...
1
vote
1answer
150 views

What is the point of having stateRoot rather executing every transaction?

EVM is a deterministic meaning that if any two(or more) nodes receive identical transactions in the same order(which is what blockchain is for), they will arrive at the same state independently. And ...
0
votes
2answers
14 views

Optimization Exception Remix Editor

I am trying to compile my solidity code in remix editor. I keep getting this error "Optimization exception during compilation". I was using solidity version 0.5.2 till day before yesterday. Now, It is ...
-1
votes
2answers
12 views

Expected import directive or contract definition… going crazy. same code different result [on hold]

i am learning from a video course but the teacher doesnt have got the error i got. so we have the same code but different result (error on mine and all ok on his) here my code. pragma solidity ^0....
0
votes
2answers
159 views

Too much gas consumption

I'm programming my first Eth Contract, I'm facing a problem, the gas consumption ( estimated ) of the buy method is going really to high ( Quickly > N million gas before getting the "Maximum gas ...
7
votes
2answers
3k views

How to give struct members default values

I am working on some complex Relational databases like structure in solidity and need to have some values initialized to a custom value not the usual 0. I want to do something like this : (Status is ...
1
vote
3answers
200 views

Repetitive validation through Modifier or function

What is the benefits from writing repetitive validation as functions instead of modifiers? The documentation clearly recommendations to use modifiers yet 'best practice' open source parties such as ...
1
vote
1answer
201 views

java.lang.RuntimeException: Error processing transaction request: Intrinsic gas too low

While deploying smart contract the error formed. java.lang.RuntimeException: Error processing transaction request: Intrinsic gas too low
0
votes
2answers
27 views

Can smart contract send tokens/eth if it doesn't have a send function?

Let's assume you just created 1,000 tokens at address 0x012345. You, the owner of 0x012345 sent by mistake all tokens and 1ETH to a smart contract with address 0x987654. This smart contract doesn't ...
0
votes
0answers
39 views

How to use mapping with array, struct to store seller's and buyer's data in array? [closed]

contract Seller { address payable owner; address [] sellerArray; struct Sellers { address sellerAddress; uint parcelId; uint parcelPrice; } contract Buyer is ...
0
votes
1answer
172 views

Send multiple transactions

This is contract I plan to implement multi send, so I can send multiple transactions to people. Here is my code pragma solidity ^0.4.11; /** * @title Ownable * @dev The Ownable contract has an ...
0
votes
1answer
198 views

using block.blockhash instead of block.timestamp for 30 minutes

I would like to check if the time has passed 30 minutes before executing a function in my contract. I know how it is done using block.timstamp .. But I want to use block.clockhash as it is more secure....
1
vote
0answers
28 views

blockhash refactoring, if hashes are relative to latest block, are all stored in contract?

The blockhash refactoring EIP included in Constantinople expands the range of blocks that can be accessed with blockhash(). Besides the last 256 blocks, 256 multiples of 256^1, and 256 multiples of ...
0
votes
1answer
178 views

How a smart contract works and when is activated?

I am trying to understand how a smart contracts works and what are the steps from requesting to receiving some amount of coin (let's say ethereum). I have some questions.. When a smart contract is ...
0
votes
1answer
591 views

“UPDATED : ” “VM Exception while processing transaction: revert”

I tested signature verification of the code presented HERE as follows: running testRPC : root@ubuntu:/home/s# testrpc EthereumJS TestRPC v6.0.3 (ganache-core: 2.0.2) Available Accounts =============...
0
votes
1answer
177 views

Contract not using Upgraded Proxy Contracts

There's 2 contracts A and B, A imports B, where B is a library that can be upgraded. To achieve this, I tried replacing B with a proxy contract and a delegate contract. We now have contracts Foo, ...
0
votes
1answer
16 views

contract reference another contract, what ABI information needed?

To reference another contract, the ABI is easily included like this. What information needs to be there? The function name, I guess, what about accessability such as public/private/internal/external/...
1
vote
2answers
206 views

Interacting with erc-20 contracts on testnet

I'd like to try some ERC-20 token transactions on testnet (preferably ropsten). Is it common that token issuers deploy their contracts on testnet? Are there any faucets? How does one proceed if want ...
0
votes
1answer
195 views

Stuck at emitting an event in Solidity

I am stuck at Step-6 of Bitdegree's Solidity tutorial. Question is to Emit an event ScoreChanged with two arguments: int amount (equal to the value that was sent) and bool direction (true for up ...
0
votes
0answers
19 views

My smart contract doesn't accept ERC20

NOTICE: The below implementation works. It assumes that the calling addresse has approved both the spender and the contract to carry the transaction. Because they were not approved it was not working. ...
0
votes
2answers
186 views

Guidance on creating new token with value tied to fiat currency & fixed increases in price (newbie)

I would like to create a new token, but I'm a complete newbie when it comes to Ethereum and cryptocurrencies/blockchain in general. I'm also not a programmer. My goal is to create a fixed number of ...
1
vote
1answer
176 views

OUt of gas duringcreation of contract

I tried to create a smart contract (Token ERC20) with this web IDE : https://remix.ethereum.org Everything was good. I taked te same contract and i tried to deploy it with node application by using ...
25
votes
3answers
10k views

How to write an optimized (gas-cost) smart contract?

As we all know, there are many factors that determine a good smart contract, such as: Security: it has minimal/zero vulnerability so they cannot be exploited by an adversary. Immune to Attacks. Cost:...
2
votes
2answers
191 views

Warnings for ERC223 token

There is another related question already posted, but it doesnt have the source code so I dont think it will ever get answered. My code is this: pragma solidity ^0.4.18; contract SafeMath { ...
1
vote
2answers
25 views

OpenZeppelin Starting Balance

I believe that the openzeppelin project have updated their StandardToken smart contract which is now called ERC20.sol. One issue that I have is that the new smart contract has some missing ...
0
votes
1answer
12 views

How do I get product/parcelID from particular Assigned address using struct and mapping?

struct Sellers{ address sellerAddress; uint parcelId; uint parcelPrice; } In this struct I've entered multiple parcel Ids to sellerAddress and I've retreived them using _sellerAddress. ...
0
votes
1answer
181 views

How could I debug EVM storage/memory layout while developing contract?

I'm looking for a tool which could provide me the following features: Feature to check how value/reference types fit into storage/memory slots. The doc says "declaring your storage variables in the ...
0
votes
1answer
21 views

find the bytecode of a contract during compilation

Is there a solution to recover the complete bytecode (init + runtime) of a contract imported in solidity. For example "bytes code = getBytecode (Escrow.sol)" and this would be replaced by bytecode ...