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

1
vote
2answers
84 views

Estimate Gas Price (not Gas) using Web3

Using Web3, we are able to estimate the amount of gas needed for a transaction let estimatedGas = web3.eth.estimateGas({ to: "0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe", data: "...
0
votes
1answer
127 views

Using ERC20 token contract with my own token code

I am using the ERC20 token contract from OpenZeppelin and want to add my own code with the total supply, decimals, token name, token symbol and owner of total balance. I have tried adding my code ...
0
votes
1answer
51 views

Some basic problem about Smart Contract

I just started learning how to write smart contracts. I have some questions about crowdfunding.I follow the instructions of my textbook. My operating system is Windows 10. It compiles OK, but when I ...
0
votes
1answer
32 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
32 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 ...
1
vote
1answer
40 views

How do you implement a “Micropayment Channel” in a Dapp?

I've come acrossed an article, Signing and Verifying Messages in Ethereum, where it says that you can pay for other user's gas transactions but so far I haven't seen any implementation or tutorial on ...
2
votes
0answers
35 views

A token transfer enable/disable function works fine in 0.10.0 but not working in Mist 0.11.1

So i have this contract where i have a function to enable/disable transfer of the contract's token. it works fine in Mist 0.10.0 but when i try to call the disable/enable function, it gives me the ...
1
vote
1answer
33 views

I want to remove the timed aspect of this crowdsale contract and make it finalizable manually [closed]

Which lines do I remove and what do I replace them with to change this from a timed crowdsale contract into one I can end manually? pragma solidity ^0.4.18; interface token { function transfer(...
1
vote
0answers
33 views

Not able to Get the response from the function call from Node Js Service Using Web3@1.0.0-beta.36

I am deploying two contracts A and B using Web3(1.0) and solc. My Solidity file looks something like this: pragma solidity ^0.4.21; contract A { uint public value; constructor(uint newValue) ...
0
votes
1answer
41 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
0answers
34 views

Gnosis/MultiSig - how to fix “you just received 0.000 ETH”?

I deployed Gnosis/MultiSigWallet contract, and after confirming I receive Parity-UI system notification "You just received 0.000 ETH", but I sent more than 0 in confirmed transaction. Execution order:...
0
votes
1answer
22 views

Web3js 1.0 events: closing the contract.events “socket”

My code is the following: contract.events.Deposit({}, function (err, event) { if (err) { console.error; } else { console.log(event.blockNumber); } }) .on('data', ...
0
votes
1answer
25 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,...
0
votes
2answers
40 views

Why it's showing errors in this contract?

Actually, I wrote the code in multiple files, but since I need to Verify and Publish the code so, I tried to flatten the code. But now it is showing way too many errors. I put the code below with ...
0
votes
1answer
22 views

Problem transferring ether to contract (Error: transact to EtherInteractionTest.deposit errored: VM error: revert)

I'm trying to test a simple contract to deposit and withdraw ether in remix. Code: pragma solidity ^0.4.17; contract EtherInteractionTest { function withdraw() public { msg.sender....
2
votes
2answers
116 views

Is it possible to use a modifier from a different contract?

Is there a way to use modifiers from a different contract? My attempt did not work. contract con1{ modifier supermod(uint _value){ require(_value == 1); _; } } contract con2{...
1
vote
1answer
85 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 ...
1
vote
0answers
49 views

smart contract and permissioned blockchain

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. ...
0
votes
1answer
22 views

Geth Contract Deployment Error : Contract transaction couldn't be found after 50 blocks

I have created a private blockchain and tried to deploy a simple contract on blockchain. But the deployment throws the following error - Error sending/minig the transaction: { "message": "...
0
votes
1answer
18 views

what does the second address refer to in this link

What does the second address refer to in this link? https://api.etherscan.io/api?module=account&action=tokentx&contractaddress=0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2&address=...
1
vote
3answers
55 views

How to store 32 input parameters in a single solidity function with data types being string and bytes32?

When I try to exceute a solidity smart conract function to store 32 input parameters, I am getting a stack too deep error. To resolve that, at the middleware we have consolidated and created an array ...
0
votes
1answer
15 views

Service that can accept an Ethereum private key and then forward funds in the future?

Is there a smart contract or service that lets me input my Ethereum private key or any crypto private key for that matter and have the smart contract sweep or forward a portion of funds to another ...
0
votes
1answer
40 views

Is there any tool for Ethereum which can convert smart contract into REST API similar to hyperledger fabric?

In Hyperledger Fabric, REST API can be created for chain code/smart contract using composer-rest-server. Is there any tool which can do the same for Ethereum Smart Contract? So that any front ...
-1
votes
0answers
72 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) ...
0
votes
1answer
116 views

Truffle Develop Could not find suitable configuration file

Basically, after I installed the truffle the command: nom truffle -g . Then I went to set up the metamask on the google chrome. Once the metamask is set up then I try the command: truffle develop and ...
0
votes
2answers
84 views

How would you render this structure of data?

I have coded a smart contract which allows one to store a certain type of structure of datas which can be described as something like that : ├── Client1(Contract) │ ├── Year2018 (Struct containing ...
1
vote
1answer
95 views

Buy token function does not work in crowd-sale smart contract

I am new to ethereum block-chain. I created a crowd-sale and ERC20 smart contract and deployed on rinkeby test network. The ERC20 token transfer function working fine. But when I check functionality ...
1
vote
1answer
29 views

How do I resolve “gas required exceeds allowance or always failing transaction” when trying to send ether?

This is the sample smart contract I am trying to run. All methods work, except, "payVendor" - it fails with gas required exceeds allowance or always failing transaction . I have tried increasing the ...
0
votes
1answer
92 views

Freezing ERC20 token for certain amount of time?

Is there any functionality like randomly specifying freezing portion and freezing period .For example, we must transfer 100,000 ERC20 tokens to a users. We transfer 10,000 tokens with no restriction, ...
0
votes
1answer
58 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 [...
0
votes
3answers
54 views

How to create a smart contract that has token and transfers tokens to whoever sends ether?

I want to create a smart contract which is able to create tokens, priced at some amount of ether, example uint price = 1 ether;. Now after someone sends any amount of ether, the same amount of tokens ...
1
vote
1answer
41 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 ...
4
votes
1answer
67 views

How to map from two keys to one value?

I'd like to store a unique mapping from NFT's to some state data in my contract. NFT's are globally unique based on: the NFT contract address, and the uint ID within the NFT contract. I would ...
1
vote
0answers
13 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
1answer
40 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 ...
1
vote
2answers
172 views

solidity ecrecovery and ethereumjs ecsign return different address

I have a code as follow using web3 0.2 and ethereumjs-util to interact with smart contract. What exactly am i doing it wrong? is it incompatible between ecsign of ehtereumjs with smart contract ...
1
vote
1answer
25 views

What is the best way to imbricate structs of data?

I'm creating a DAPP and i'm currently drafting the structure of my code. I'm not really experienced with Solidity so i'm trying to have a clear representation of my code before starting to code it. I ...
0
votes
1answer
44 views

ContractInstance.method is undefined

When I use contractInstance.getDrawStats or any other method it returns error method is not a function because of contractInstance doesn't contain any contract methods. However, they are definitely in ...
0
votes
1answer
28 views

First time writing a smart contract , please help me check are there any vulnerability in my code

This is the first time I write a smart contract and I'm going to use it for real application , so I hope there isn't any vulnerability or exploit since smart contract is immutable This contract able ...
2
votes
1answer
190 views

Is ERC 865 safe to use?

Would like to implement ERC 865 (pay transfer fees with token instead of eth) or similar functionality in my smart contract. Is ERC 865 safe and audited currently? If not, is there any implementation ...
0
votes
1answer
27 views

All functions not implemented error

I have a complex structure of various contracts using various interfaces in solidity. When I want to deploy the contract that runs all the others; I have the following error appearing in remix IDE: ...
0
votes
1answer
33 views

Difference between the way methods are called in smart contract

What is the difference between instance.totalSupply() vs instance.methods.totalSupply().call() To my knowledge one is for truffle and the other is for web3. But truffle also uses web3 then why can ...
0
votes
1answer
65 views

Get allowance list after approve function in erc 20

A ➜ approve(spender, amount) B ➜ transferFrom(sender, buyer, amount) allowance(address tokenOwner, address spender) I am seeing that this function can be call only if the person know the address of ...
0
votes
2answers
102 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 ...
1
vote
1answer
21 views

How to decoding transaction value from an input string? (a specific case)

I tried to decode an input string of an ethereum transaction, based on ERC20 ABI. ...
0
votes
1answer
23 views

acess variable from token contract to ico contract , both placed in diffrent files

//token.sol pragma solidity ^0.4.24; /*import "./Ownable.sol"; */ contract ERC20Interface { function totalSupply() public constant returns (uint); function balanceOf(address tokenOwner) ...
0
votes
2answers
94 views

Why use arrays and not mappings? [duplicate]

So I was implementing a trading contract and need to keep a list of products on sale. I was using arrays but later switched to mappings. So arrays implementation: uint[] public productsOnSale; uint ...
2
votes
2answers
60 views

How to maintain history of changes in mapping?

I have a mapping variable in my solidity code which maps address to name. I want to maintain the history/log of every change that happens in this mapping. What is the best possible solution to it?
1
vote
1answer
89 views

Transfer X% of Eth. sent to smart contract, to contract owner on buy function call

I use this "buy" function in a smart contract, to receive Eth. for a token. I would like to extend the function, so if the Eth amount in a transaction is higher than X Eth. then send Y% to smart ...
0
votes
1answer
25 views

How to calculate gas for calling a function without deploying to mainnet?

What is the best way to check the cost (gas) price for any given function call in a smart contract, before deployment to mainnet? Thanks