Questions tagged [contract-debugging]

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

108 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
1answer
174 views

Can't debug transactions that fail during the Web3.js estimateGas() call? No Tx Hash

NOTE: I am doing my work with the Ganache v1.2.2 GUI client on a Linux Ubuntu 18.04 station. There are many revert errors that happen during the estimateGas() call that precedes the actual Web3.js ...
4
votes
0answers
157 views

Is it possible to trace a function call hitting revert?

It is possible to trace a transaction with debug_traceTransaction. But it needs the transaction hash, requiring it to be a transaction in first place. I'm debugging a function call that generates a ...
4
votes
0answers
420 views

Event and/or watch does not work

I have a contract for a simple bidding scenario as below: pragma solidity ^0.4.9; /* Contract accepting biddings during 30 minutes */ contract SimpleBidding { address contractOwnersAccount; ...
3
votes
0answers
75 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 ...
3
votes
0answers
90 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; } } ...
3
votes
0answers
108 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 ...
3
votes
0answers
373 views

How to use logx in Solidity?

Aim: To log data from a smart contract. Following function is written in accordance with low level interface to Logs in ethereum. However, due to lack of documentation, and being new in Solidity, I ...
3
votes
0answers
178 views

Debugging smart contract with source trace

I am currently able to debug a tx with source trace in remix if I use my local geth node as rpc provider. The problem is that keeping a local node in sync is time and resource consuming. I am ...
3
votes
1answer
76 views

Non-specific error from truffle debugger

I am testing a contract which is using ecrecover function of solidity. While its testing when i go with a failed test case while debugging, it doesn't go step by step and at the end return the same ...
3
votes
0answers
125 views

Using Mix IDE on a private testnet?

Is it possible to run/debug contracts in mix-ide on a private test net?
3
votes
0answers
828 views

Tutorial on Ethereum wallet, create your token: strange behaviour

I've followed the tutorial here using ethereum-wallet (mist) 0.5.0. I'm running geth on a custom network launched as: geth --datadir ~/ethprivatechain/testing/01/ --networkid 42371325 --nodiscover --...
2
votes
0answers
20 views

Address to create a contract

This query is for informational purposes, with something that has had me in doubt all night. I am trying to send a self-signed transaction for the creation of a contract My Tx transaction to send is ...
2
votes
1answer
52 views

How to trace the line where a tx failed in truffle tests?

I know about 0x's sol-compiler and sol-trace. I used them before and they do exactly what I'm looking for, but these modules bring significant overhead when used with truffle. Check out this file to ...
2
votes
1answer
390 views

How to debug transaction from truffle test on development network

I am trying to debug a failing solidity function, which I am calling from the JS test files with truffle. When I run my test, I am successfully able to get a transaction id. However, my solidity ...
2
votes
1answer
281 views

Remix: Gas required exceeds allowance or always failing transaction

I have a contract which has transferFrom function mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; mapping (address => bool) public ...
2
votes
0answers
442 views

Contract too large

I am sure this has already been answered but I could not find a clear answer. I get the following error: Contract creation initialization returns data with length of more than 24576 bytes. The ...
2
votes
1answer
227 views

call other contract's external function , the error: The contract code couldn't be stored, please check your gas amount

when I deploy a contract, the truffle frame told me this error :“The contract code couldn't be stored, please check your gas amount”。 the solidity code is: 1) Base.sol pragma solidity ^0.4.22; ...
2
votes
1answer
176 views

Contract working on Javascript VM and not Web3 Provider, why?

Here is the code: Calling contract: pragma solidity ^0.4.24; contract Caller { address public called_address; constructor() public payable { } function set_address(address _addy)...
2
votes
1answer
111 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
48 views

Why would a contract throw after it has executed the last line of code?

I'm debugging a contract function with Truffle. It always throws the following error: Error: VM Exception while processing transaction: revert However, I'm certain that the function has reached the ...
2
votes
0answers
243 views

Usage regarding for loop in solidity contract

I am trying to integrate for loop in my smartcontract for adding details to a struct. I have implemented for loop using frontend by calling the function in smartcontract one by one. struct details {...
2
votes
1answer
227 views

Creating contract issue. Contract keeps loading

I'm testing the process of creating an Ethereum contract using the Mist Rinkeby test Network. I used the code from an online tutorial, everything went fine, except at the creation of the contract. ...
2
votes
0answers
303 views

debug.traceTransaction(<transactionID>) returns a empty structLogs: []. What might be the reason?

On the comments here: https://ethereum.stackexchange.com/a/6011/4575 For a transaction to a contract, the contract vm instructions will execute and the steps are shown in the status.structLogs, ...
2
votes
0answers
849 views

TypeError: Cannot access member 'code' of undefined

I am new to geth command line for testnet in Windows. I got an error when trying to deploy this contract example ---------------------------------------------- source = "contract test { function ...
2
votes
0answers
96 views

VM jump when accessing statically set variables

Hey it seems I get a jump error when I try to access any variable not set through a parameter in the constructor. amountRaised is throwing a jump error below as I try to statically set the value. ...
2
votes
0answers
109 views

Minimal contract testing setup using truffle

This question is a follow up onto this one. I have tried following the suggestion in the answer of adding a done() method that fires when an error occurs (an exception is raised) but it doesn't when I ...
2
votes
0answers
416 views

Contract storage not being updated after sendTransaction

First of all, sorry about the code written in Portuguese. I have the following contract: contract GerenciadorBoletos { struct Boleto { uint codigoBarra; uint ...
1
vote
0answers
50 views

Cannot execute contract in non-intaractive scripts

I want to deploy and to execute ERC-20 contract on geth with non-interactive scripts. But, it seems that non-interactive scripts and console shows different results. Enviroment ubuntu 18.04(docker ...
1
vote
1answer
54 views

Token migration and IDEX smart contract problem

During a recent token migration from token A to token B, a large number of token A were held by a number of people in an IDEX address (where it was ready to trade). The IDEX address is part of a smart ...
1
vote
1answer
28 views

Using contract to create Child contracts (web3j Java wrapper)

I have a simple Parent contract that creates child contracts and stores their address. contract Parent { address[] public registry; function createChild () public { address newChild =...
1
vote
0answers
133 views

why .call() in Truffle did not return results as expected?

I'm deploying a contract to my private chain and try to call the contract's function. After I got in the geth console and finished deploy contract, I called the function but it doesn't work ...
1
vote
1answer
94 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) ...
1
vote
0answers
15 views

Understanding a simple online contract which seems not functional

I am writing to understand the functionality of this contract (https://etherscan.io/address/0x1f14b77e9f4844889fa63bc1e5180c8b90ec18db), this does not look even "functional" to me. Here is the ...
1
vote
2answers
34 views

Why is solidity throwing “Note: The constructor should be payable if you send value. ”, when clearly the issue is elsewhere?

I'm writing a contract on Remix that is able to deploy and track child contracts. Here are the 2 contracts: pragma solidity ^0.5.0; Contract Factory contract ContractFactory{ ChildContract[] ...
1
vote
0answers
53 views

state channel between smart contracts

In my scenario, there are data sellers and data buyers which might be persons or organizations. I would like to create a smart contract for data seller and another smart contract for data buyer where ...
1
vote
2answers
871 views

Returning Struct Array in solidity

contract TripHistory { struct Trip { string lat; string lon; } mapping(string => Trip[]) trips; function getTrip(string _trip_id) public view ...
1
vote
1answer
34 views

Ethereum Node I want to export transactions from a token

I have an Ethereum node running and I am wanting to export transaction history for a specific ERC20 token to a local database every 10 minutes. Does anyone have any suggestions on how they would do ...
1
vote
0answers
43 views

exception calling another contract method

I have tried this several ways. In the simpliest form, I put both contracts in the same file, and Im still getting an issue when I try and run this in the browser compiler remix. Also, I am using ...
1
vote
1answer
124 views

How to understand output of debug.trace

I have created a Private Ethereum network and I have deployed a contract in it.. Now I am trying to post a transaction in that contract but I m getting error that transaction has been reverted by EVM ...
1
vote
0answers
93 views

Gas requirement of function client.<function_name>() high: infinite

I've tried fix that problem. but still i don't know what was wrong If someone can fix this problem, please save me. I'm still trying this. below sample code contract HelloWorld { uint private ...
1
vote
1answer
73 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 ...
1
vote
2answers
177 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 > ...
1
vote
0answers
84 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: ...
1
vote
1answer
69 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
2answers
133 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 ...
1
vote
2answers
189 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" ...
1
vote
1answer
73 views

Given a failed contract transaction how can I determine on which line of contact source code execution was fail?

I have failed token transfer and I want to know why it was failed by reading contract source code. Is there any steps I can make to know on which line of the source contract code the execution was ...
1
vote
0answers
281 views

Debug with geth

I'm trying to debug a failed ether transaction and to understand what went wrong. The transaction is this one: https://etherscan.io/tx/...
1
vote
0answers
27 views

How to replicate the state of a deployed contract in development environment

I'm trying to debug a contract that has been deployed, and I'd like to have a debug version that has a contract state as close as possible to the version in production (variable values). The first ...
1
vote
2answers
231 views

Issue with autonomous contract calling erc20 token's transferFrom for approved amount

Trying to transfer fund using ERC20 token handle and calling 'transferFrom'. Assume that the specific amount is preapproved by owner account for 'MyContract' contract address. contract StandardToken {...