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
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

questions for finding and squashing bugs in smart contracts and decentralized development

1
vote
1answer
16 views

Returning Structs and Lists in Solidity

Is there a particular reason why Solidity prevents you from returning structs, lists and other data structures? I understand that it needs to be secure and allowing array/list access may mess with the ...
1
vote
1answer
24 views

Not able to send Ether to contract

I am trying to send Ethers to a contract deployed on Ganache but I am getting VM Exception while processing transaction: revert, the same logic is able to transfer Ethers to other account. Following ...
0
votes
2answers
27 views

Can code send ETH to user accounts?

I was watching a talk by Vitalik in DEVCON1 in which he says code can do three things one of them being code can send ETH to other contracts. But can it send ETH to users account as well? Attached is ...
0
votes
0answers
15 views

uint not getting added to contract uint array

I'm having trouble saving/reading back uint that I have written to a solidity contract. My factory can successfully create an Item contract and deploy it but when I try to retrieve the ids owned from ...
0
votes
0answers
8 views

How parameters encoded?

I have a function in smart contract: function ERC20Token(uint256 _initialAmount, string _tokenName, uint8 _decimalUnits) I am using web3j to encode the function with params (100, "KToken", 100) and ...
0
votes
0answers
38 views

web3 remix cannot deploy contract

I have a problem when deploying smart contracts on remix. When I click create, I can see that transactions are passing through, from the blockchain explorer. I clicked multiple times, and this is the ...
0
votes
0answers
10 views

@param _toAddresses quesion

Is there anyway to increase the * @param _toAddresses The addresses of the recipients (MAX 255) * @param _amounts The amounts of tokens to be transferred Instead of 255, can it be increased to ...
0
votes
2answers
33 views

Get array values in Truffle console

Is there a way to print the values of an array in my contract to a console (using truffle or geth for example)? Suppose this is my contract: contract MetaCoin { uint256[] public someNumbers; ...
0
votes
1answer
22 views

Contract structure for storing user application

I have a Nodejs application in which users fill up multiple forms and that data is saved to the centralized DB i.e MongoDB. Admin can review the user data and can push the user data to Blockchain to ...
0
votes
2answers
26 views

Token deployment for DAO

I have coded a token that has about 5000 addresses. With token balances in them Each of these addresses will release tokens at a controlled rate. I would like these tokens to represent shares and ...
0
votes
0answers
39 views

Listing all the smart contracts deployed on ethereum [duplicate]

I want to list all smart contracts deployed on a private Ethereum chain, using Nethereum, and also those which were deployed by a certain address. I have seen here and here but I cannot get anywhere ...
2
votes
0answers
20 views

remix: The method debug_traceTransaction does not exist/is not available

I have followed this answer. So, you just need to add the --rpcapi "eth,net,web3,debug" command line option. The way I run my geth: geth --datadir /home/user/POA/private --rpcaddr 127.0.0.1 --...
2
votes
0answers
26 views

Getting error message from require() using golang, and go-ethereum?

From everything I've been able to find, the only way you can get the error message from require() is by using remix which isn't practical for dealing with production issues. Therefore, I'm wondering ...
0
votes
0answers
27 views

My smart smart contract won't send to multiple addresses

I have experienced some difficulties in getting deployed multisend/airdrop smart contract to distribute tokens to multiple addresses by interacting with the main contract. Each time it failed. Kindly ...
1
vote
1answer
30 views

go-ethereum keccak256 multi value byte slice does not match solidity keccak256

I have a smart contract with the following function: function testHash( address _sender, uint8 _method, uint256 _number, uint256 _amount) public returns (bytes32) { ...
1
vote
2answers
32 views

Failing transaction [not out of gas] but error during execution

My 2 assumptions of the problem: out of gas some failed require statement when calling mint I don't see these 2 because I made sure to send more than enough gas and that msg.value > ...
0
votes
0answers
21 views

Debugging on ropsten

The ropsten chain is a pain to debug. The RPC won't work for the default MetaMask node. Is there any way to get debug traces on ropsten?
0
votes
1answer
70 views

Division/Percentages in Solidity (a workaround)

Division/percentages is a required part of many applications but is difficult to implement since fixed and ufixed are not supported yet in Solidity. I've come up with this workaround: pragma ...
0
votes
1answer
21 views

Unpredictable states error when refactoring smart contracts

Ethereum smart contract functions are limited to around 16 local variables. When they exceed that number, stack is too deep error is generated. The solution is to refactor the large functions into ...
0
votes
2answers
70 views

How does MetaMask's TRANSACTION DATA work? How to interact with smart contracts by only using MetaMask?

I have this source code pragma solidity ^0.4.21; // Relevant part of the CaptureTheEther contract. contract CaptureTheEther { mapping (address => bytes32) public nicknameOf; function ...
1
vote
2answers
62 views

Execution difference of method call in MainNet vs TestNet

I was looking at the new smart contracts submitted list on Etherscan to pass the afternoon, and I came across this one: https://etherscan.io/address/0x70bf9df6967dc96156e76cc43b928a7ef02e159a The ...
0
votes
0answers
28 views

Debug failing transaction on mainnet

We have a smart contract deployed on main net and some of the recent transactions have started failing. Any idea how we can start debugging the contract? Contract address: ...
0
votes
1answer
26 views

Get contract bytecode and creator from contract address on Geth console

I can get contract bytecode and it's creator via this URL. https://etherscan.io/address/CONTRACT_ADDRESS [example: https://etherscan.io/address/0x5a3e58c7cf09217d2a5385bf96c02673ed1187bb#code] I ...
3
votes
0answers
54 views

Why does this work with Solidity 0.4.21 but not 0.4.22?

I have this simple set of contracts. pragma solidity ^0.4.21; contract FirstContract { bool public isTrue = true; function sayHello() public pure returns(bool) { return true; } } ...
0
votes
0answers
29 views

How does adminClaimAirdropMultiple work?

It was written as function adminClaimAirdropMultiple(address[] _addresses, uint _amount) public onlyOwner { for (uint i = 0; i < _addresses.length; i++) doAirdrop(_addresses[i], ...
1
vote
1answer
38 views

Constructor Arguments ABI-encoded - verification not working!

I think I must be going blind or something because I can not find the Constructor Arguments for this smart contract 0x3a2F46b0B0c187B152Db0c658b27E693f0A273a1 I have tried a number of options but ...
1
vote
0answers
29 views

help with fixing reverting token contract [closed]

I have been trying to interact with a smart contract deployed on the ropsten test network but have a problem sending ethers in exchange for tokens ( Transaction reverted: Error in contract code). ...
1
vote
1answer
34 views

Run contracts and create traces with Node

I came across an article: https://wanderer.github.io/ethereum/nodejs/code/2014/08/12/running-contracts-with-vm/ At the bottom of the page is shown how to write a contract execution route. But ...
0
votes
1answer
32 views

Trouble with libraries (Remix)

Tried out libraries for the first time, had a really bad experience with them. I need some help in getting my contracts to work between libraries. Library 1: pragma solidity ^0.4.0; library ...
0
votes
1answer
56 views

Truffle web3.eth.sign produces wrong signature

Somehow truffle produces an invalid signature. To clarify this I imported the private key of the first Ganache account to metamask and compared the results. The following code used in a chrome ...
2
votes
1answer
20 views

Event not exactly working (Inexperienced OP)

pragma solidity ^0.4.0; contract CustodialContract{ address client; bool public _switch = false; event UpdateStatus(string _msg); event UserStatus(string _msg, address user, uint ...
0
votes
1answer
32 views

Is there a way of inspecting msg.value and msg.sender in remix IDE?

I'm playing with re-entrancy business: https://medium.com/@gus_tavo_guim/reentrancy-attack-on-smart-contracts-how-to-identify-the-exploitable-and-an-example-of-an-attack-4470a2d8dfe4 Just curious if ...
0
votes
1answer
38 views

Transactions confirmation

I am using geth --dev --ipcpath ~/.ethereum/geth.ipc --minerthreads=5 console to run privatenet. So i use Etherium wallet to interact with it. The problem is that i need to do some transfer ...
1
vote
2answers
29 views

How to use a date time from an API to prevent contract interactions if the date is a string?

I want an to use an oracle to prevent contract interaction after certain time cutoffs This is the APIs format: "event":"event2","timezone":"UTC+1","datetime":"2018-06-07 01:00:00" I think doing all ...
0
votes
1answer
97 views

Truffle Test - Solidity: How to access value of Promise object? [object Promise] [BigNumber]

a.getB.call().then(function (f) { console.log(f[1][0]) }); outputs: BigNumber { s: 1, e: 20, c: [ 5000000 ] } How can I access the value in c? How can I save object f to a javascript variable? ...
0
votes
2answers
30 views

Comparing values of fetched data with input data of different contracts

Given two contracts as follows, contract TestData calls contract Reg to fetch data that had already been stored in its map using get_attributes function. pragma solidity ^0.4.21; contract Reg { ...
0
votes
1answer
38 views

Smart Contract Fails When Not Owner

The contract I am working on is failing when trying to send a transaction with MetaMask from an address thats not the owner. I have tried multiple times and also added huge amounts of gas. Even with ...
0
votes
0answers
41 views

Why does remix not use contract source code for debugging?

Remix is the only symbolic debugger I know (debugging line by solidity line instead of by instructions). But sometimes like with this transaction, the matching source code isn’t used for debugging, ...
0
votes
2answers
52 views

What is the most efficient way to map two different key types to a struct?

In the code here, I have created a new Customer called "mcycleowner", and mapped it to an input _address. However, I also want to map it to the input _license so that customer info can be queried ...
0
votes
1answer
37 views

Getting Errors with Solidity Contract

We are modifying the code used in a blockchain class to develop our first Dapp. We have added more variables to the contract code, and when we run the test files, we get the following errors: "...
3
votes
0answers
36 views

How to configure parameter reexec of debug_traceTransaction?

I am trying to use debug_traceTransaction to scan the internal transactions of smart contracts, so I need set the value of reexec, what value should I use? It seems that reexec is the number of blocks ...
1
vote
2answers
78 views

Solidity - Smart Contract - Send eth from external account to smart contract

I read this example http://solidity.readthedocs.io/en/latest/solidity-by-example.html#simple-open-auction to learn how to let my smart contract recieve eth from external account. It seems that I need ...
1
vote
1answer
38 views

Detecting contact internal transactions

Say I have a list of addresses whose transactions I want to monitor. Detecting regular ethereum transactions is easy. Detecting internal contract transfers looks much more complex. If my research ...
0
votes
0answers
24 views

remix debugging step over not going line by line

I'm testing my code using remix IDE, and when I debug it by clicking Step over forward button it doesn't seem like it's really reading line by line. It seemed like it was reading line by line, but at ...
1
vote
2answers
42 views

What is from address and Topic address in Remix log

I am invoking the buyTicket function of contract from account "0x14723A09ACff6D2A60DcdF7aA4AFf308FDDC160C" in remix IDE with 20 ethers which is clear from log but confused what is "from" and "topic" ...
0
votes
0answers
18 views

Tranfer tokens out of a Smart contract

I have been traying for days to make this work but i cannot really find a solution to this. I tried several examples i found, included this: https://github.com/SmaCo/Tex/blob/...
0
votes
0answers
12 views

Are Event Logs mandatory and specified in ERC-20 or how to get transactions?

How do I get the transactions on ERC-20 contracts? What kind of information do I get and which is not included in event logs? Can I use same logic for reading logs of all erc-20 contracts or do I need ...
0
votes
0answers
92 views

Implementation of an Allowance Crowdsale. Token Interface / _prevalidatePurchase-/_delivertokens-function

I am new to solidity coding and after I created some basic contracts as well as a ERC20 token contract I wanted to create a crowdsale contract. Now I am stuck and I have a question regarding the ...
0
votes
0answers
19 views

contract function call fail in mainnet but, in testnet, contract function call success

First, I use remix-ide. I want to 'ETC contract function' call that send coins to multiple addresses. And, this code is below. I wanted to call 'send_to_N' function. And, I tested my ETC contract ...
1
vote
0answers
72 views

Mix of Crowdsale contracts does not work. Completely lost :-/ [closed]

I am following this community for quite a bit and found some very helpful answers in the past, so I hope you can help me to solve a problem with my crowdsale contract as well. At first I would like ...