Questions tagged [contract-debugging]

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

Filter by
Sorted by
Tagged with
14
votes
1answer
5k views

What Ethereum blockchain explorers exist?

What blockchain explorers exist and What special features do they have? Are they open-source? How reliable are they (approximate uptime in %)? Is there a testnet version?
0
votes
2answers
68 views

ParserError: Expected pragma, import directive or contract /interface/library definition

In an attempt to compile my ABI and verify my contract, I am getting the following warning: "ParserError: Expected pragma, import directive or contract /interface/library definition" on the first line ...
0
votes
2answers
17 views

How to diagnose a “Error: Transaction has been reverted by the EVM”?

This the error intercepted from my javascript, using web3.js Error: Transaction has been reverted by the EVM: { "blockHash": "...
0
votes
1answer
190 views

COB token transfer failed with error: “Bad Instruction”; will I get my tokens back?

I transferred 10 COB tokens from my one address 0x782e265f911167e4FDbfbFb63a32cC27341724E7 on my Metamask wallet to another Metamask wallet address 0x0a42AD94FC81db989575365Be28DCd64417Ce564 but the ...
0
votes
1answer
247 views

Truffle “Replacing” durring migration

what does "Replacing" mean in migration? a simple test contract C.sol: pragma solidity ^0.4.17; contract C{ uint public ConstructorUint; function C(uint SetConstructorUint)public{ ...
0
votes
1answer
34 views

Remix IDE: How to debug a contract having a function with a argument & for Loop

I am trying to debug a contract on Remix IDE: pragma solidity ^0.5.1; contract DebuggerSampleContract{ int counter = 10; function LoopCounter(int _input) public view returns (int) { int ...
1
vote
1answer
21 views

Getting an 'invalid opcode' calling a solidty function from test file

im in the process of learning about ethereum and Solidity, and im having a problem calling a payable function from a test file. This is my contract pragma solidity >=0.4.22 <0.6.0; //pragma ...
0
votes
4answers
72 views

Owner is returned as 0x00

I am a japanese student. I am studying ethereum. pragma solidity ^ 0.4.18; contract Owned { address public owner; // contract owner // / modifier for access check modifier onlyOwner () {...
1
vote
1answer
606 views

Invalid number of arguments error for getter function with no passed arguments

I am receiving this error when trying to call the getUsers getter function from the contract below: Invalid number of arguments to Solidity function. Running on Truffle in develop mode. mapping (...
0
votes
2answers
55 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
vote
1answer
95 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
3answers
35 views

Revising Smart Contracts [closed]

If I create a Smart Contract that pays users for sharing their data, how can I ever update this smart contract in the case it has an error, or perhaps I wish to change the amount paid for data sharing?...
1
vote
1answer
29 views

Cannot transfer ownership of ERC20 contract

My contract source code likes below: contract StandardToken { uint256 totalSupply; ... } contract Ownable { address public owner; function Ownable() public { owner = msg.sender; } ...
0
votes
2answers
31 views

Stuck in Contract or something similar

Hey guys i almost sent ethereum to a scam address luckily it got rejected cause i didnt use enough gas. this is the ethersacan transaction https://etherscan.io/tx/...
0
votes
1answer
45 views

truffle won't run tests while initializing a global contract instance

I am testing my smart contract in truffle. I need to declare some global variables hence I did so outside 'it'. I also tried declaring a global contract instance that I can use in all test cases. ...
0
votes
1answer
17 views

Why does declaring returns type bytes memory give a compiler error?

If we have the following code: pragma solidity >= 0.5; contract stringsContract { function takesTwo(string memory str, uint idx) public pure returns (bytes memory) { bytes memory ...
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
1answer
55 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 ...
0
votes
1answer
100 views

Sending value to a solidity contract method from web3 results in `Invalid Tuple Value` error

I'm sending values to a solidity 0.5.1 method using web3 and keep getting an invalid Tuple value error. Here's the relevant contract code: struct mystruct { bytes32 id; string str; } ...
0
votes
0answers
17 views

Sample Contracts for Testing Static Analysis Tools

I have to analyse some static Analysis tools against well documented vulnerabilities. My questions are ; Can we use the provided sample contracts (in above link) directly or not ? If not, then where ...
0
votes
1answer
40 views

VM error: revert.The called function should be payable if you send value and the value you send should be less than your current balance

There is already a similar question, but it doesn't help me. So I ask this question again and expect something useful information. Two contracts named AccessControl.sol and Judge.sol. I've removed ...
1
vote
2answers
73 views

Install Old Solc Compiler Versions

I would like to compile older versions of solc contract source code using a solc compiler on my local machine. Is there a website from which to download old solc compilers? Google revealed a GitHub ...
0
votes
1answer
291 views

I need help; the Solidity Code yields a warning you will see below

pragma solidity ^0.4.4; contract token { function mintToken(address receiver, uint amount){if (msg.value < amount) throw; if (msg.value > amount) throw; } } ...
0
votes
1answer
495 views

Solidity - Ballot Example

I have this following Ballot contract: pragma solidity ^0.4.11; /// @title Voting with delegation. contract Ballot { // This declares a new complex type which will // be used for variables later. // ...
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 =...
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 ...
0
votes
1answer
53 views

i want to get data from the transaction hash i tried many codes at last i am getting boxes in the output

1) First, I got the input console.log(web3.eth.getTransaction('0x725fc75264726f409793164e336e7d5ed35df8d2be469a0cc1a3a8cc4756b9b9').then((i) => console.log(i) )); 2) I manually pasted the input ...
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
2answers
538 views

Calling a function from a contract passed in as an argument

Im Trying to create a DAPP with two contracts generating assets. One is acting as the "factory" for the other contracts. From the latter I try to call a function in the factory without knowing its ...
2
votes
1answer
400 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 ...
12
votes
5answers
5k views

Sorting an Array of integer with Ethereum

I'm trying to have a simple array of integer sorted in Solidity but i couldn't find any real ressources so instead i'm trying to do it "the hard way" but so far with very little success. Is anyone ...
0
votes
1answer
29 views

Compile source code error expected pragma

I am getting an error when coding a token with the Ethereum wallet. Namely, Expected pragma, import directive or contract/interface/library definition. function burn (uint256 _value)public returns(...
0
votes
1answer
236 views

Browser integration testing with web3.js for dApps

What are the practices to test web3.js codebase in a wwv browser using testrpc chain? Basically emulating Metamask and having Selenium automation to sign the transactions.
4
votes
1answer
177 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 ...
2
votes
1answer
27 views

Solidity. Find whether a key exists in a mapping. Then get its value

I have a simple mapping: mapping(address => string) professorsExam; How can I check if msg.sender is a key in this mapping, and if it is, get its value? If it isn't I should return something. ...
0
votes
3answers
136 views

New temporary struct causing state variables to be overwritten

I'm running an experiment where I'm trying to create the following behavior: Service owner deploys Experiment1 to the blockchain and is recorded as the owner. Owner then adds a user address, a user-...
0
votes
1answer
53 views

minimumBet Appears to be Returning Incorrect Amount

I'm following this tutorial, which seems like a great intro to solidity contracts, but I've got an issue where I don't see the same results as on the post. When calling minimumBet from remix.solidity,...
0
votes
1answer
18 views

What are the ways to call a smart contract function during development?

What are the ways to call a smart contract function during development using Truffle simulated VM with a GUI interface (like Remix or EtherScan offer)? I know I could use CLI options like Truffle ...
0
votes
0answers
15 views

Backward program analysis (like symbolic backward execution) tools for smart contracts

I know there are some backward program analysis tools for traditional softwares, but i wonder if there are already backward symbolic execution tools for smart contracts, or any tool that I can refer ...
0
votes
2answers
244 views

ERC-20 token address on Rinkeby for testing

I am looking for addresses of ERC-20 tokens on Rinkeby in order to test my smart contract. I know that I can find a lot of them at https://rinkeby.etherscan.io/. However, it would be nicer if there ...
0
votes
1answer
71 views

retrieving tokens from contract

I am using the MyAdvancedToken code from: https://www.ethereum.org/token I transferred tokens from owner account into the contract, to fund any buy(). Now, I want those tokens back. Is there any ...
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 ...
0
votes
2answers
607 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
68 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: "...
1
vote
1answer
74 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
1answer
150 views

dApp index.html fails to load for dAppUniversity election application

Hit a brick wall with this. git clone https://github.com/dappuniversity/election The following is the Shell output I get when I npm run dev. I’m using the cloned project from GitHub but I’ve ...
1
vote
1answer
125 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 ...
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)...
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 {...
0
votes
1answer
62 views

Contract can't be mined in ropsten network

I have a node running from geth --testnet --rpc --rpcapi "eth,web3,personal" --rpcport=8545 --rpccorsdomain "*" . The contract is pragma solidity ^0.4.15; contract SimpleMultiSig { uint public ...