Questions tagged [truffle]

Questions regarding the implementation and use of the Truffle development and testing environment.

Filter by
Sorted by
Tagged with
2
votes
2answers
41 views

Drizzle and Contract Instances

I am currently developing a dApp with Drizzle on top of ReactJS. My project consists of, basically, 8 .sol files. 4 of them are just abstract contracts that include the functions, structs etc. for ...
0
votes
2answers
47 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 ...
2
votes
1answer
215 views

Geth Sync Problems | Rinkeby, Ropsten | Deploy contracts

Get Geth to sync --> Rinkeby test network. For the love of god I just want to deploy a contract. I have deployed it to Ganache-cli, GUI, remixIDE, deployed with truffle/Infuria.io...I keep failing to ...
1
vote
1answer
252 views

Error: StartCoinCrowdsale contract constructor expected 5 arguments, received 6

This is my contract code. contract StartCoinCrowdsale is TimedCrowdsale, MintedCrowdsale, CappedCrowdsale, FinalizableCrowdsale { //100000000000 uint256 public constant TOTAL_SHARE = 100; ...
6
votes
3answers
6k views

Invalid JSON RPC response error for sendTransaction on Infura + Ropsten node + Truffle console

Calls work but transactions throw the error - Error: Invalid JSON RPC response: "" I am using web3 v0.19.0 & Truffle v3.4.9. Deploying contract using truffle, truffle migrate --network ...
0
votes
0answers
11 views

Developing a dapp using Truffle. Metamask will sometime throw this error when interacting with a simple contract

Trying to setup my development environment to start a personal dapp project. I am starting off the project with the React truffle box. 1) I start by running truffle develop which launches a local ...
7
votes
5answers
768 views

Prevent 'truffle test' from invoking 'truffle deploy (migrate)'

It seems that truffle test automatically invokes truffle deploy (aka truffle migrate). As far as I'm concerned, these two functionalities are completely unrelated. So I cannot quite figure out why ...
0
votes
1answer
199 views

How can I use truffle to deploy my contract to a local testnet (not testrpc)?

I followed the steps in the following link to create a local Ethereum testnet, but now I want to deploy a contract to "MyTestNetNode": https://medium.com/@WWWillems/how-to-set-up-a-private-ethereum-...
0
votes
1answer
32 views

truffle migrate --network kovan >> ProviderError: VM Exception while processing transaction: revert

I am a beginner. I can deploy to a private network but I can not deploy to a public network. I need a Deploy to the kovan test network. please help me. >truffle init >npm install truffle-...
0
votes
1answer
24 views

Web3 - how to add WEI and ETH values correctly

I'm working on an auction feature in my DApp and having problems correctly adding together two WEI values. The contract stores two important values: 1. A minBidIncrement variable - which I've set to ...
1
vote
1answer
850 views

Can't connect to local rinkeby node from web3.js

I'm developing a Dapp using truffle and I need to connect to a contract that I uploaded on rinkeby using truffle migrate --network rinkeby. Problem is that I'm unable to connect to the rinkeby network ...
6
votes
1answer
578 views

How to sequence steps in a truffle test?

I'm trying to test contract which rely on a particular state of other deployed contract. For example let say i have a contract wanting to test the "transfer" function of an ERC20 contract. I should ...
1
vote
0answers
28 views

Help hacking this contract

This is a very simple contract that I can't hack and I'm stuck, I need some help to get the concepts right. pragma solidity ^0.4.10; contract SimpleToken { mapping(address => uint) public ...
1
vote
2answers
36 views

What are contract Variables and how are they different from normal varables declaration

pragma solidity ^0.4.2; import DappToken; contract DappTokenSale { address admin; DappToken public tokenContract; function DappTokeSale(DappToken _tokenContract) public { ...
0
votes
0answers
4 views

sender account not recognized error when using “WrestlingInstance.registerAsAnOpponent({from: account1}) ”

I'm following the ethereum walkthrough at: https://hackernoon.com/ethereum-development-walkthrough-part-2-truffle-ganache-geth-and-mist-8d6320e12269 I got stuck at account0 = web3.eth.accounts[0]. ...
0
votes
1answer
238 views

Error: The contract code couldn't be stored, please check your gas amount during deploy

I know this issue was discussed before several times, but I cant get the solution to my problem. I'm trying to deploy a contract with Truffle on Ganache. During the deployment in 2_deploy_contracts....
0
votes
0answers
22 views

send().catch() doesn't give me the error message anymore

I'm using Truffle/Drizzle/MetaMask and calling methods with send() and using .then() and .catch() and I rely on getting the error message send to .catch() e.g. contract.methods['hello'](arg).send({ ...
0
votes
2answers
573 views

Deploying on Rinkeby with Truffle using infura

If I want to use HDWalletProvider to deploy my contract on a specific address, what should I do? rinkeby: { provider: () => { return new HDWalletProvider("Mnemnoic", "https://ropsten.infura....
2
votes
1answer
160 views

call graphs for solidity smart contracts

Do we have some open source tools where we can get call graphs for solidity smart contracts execution ? For ex: Suppose Function A in contract C calls some other function B so the graph should contain ...
0
votes
1answer
241 views

How to deploy smart contract to main ethereum network

I am tring to deploy our ERC20 token in main net it gives an error Error: exceeds block gas limit. First I download or sync whole blockchain using geth command ( geth --syncmode "fast" --rpc --rpcapi ...
1
vote
2answers
673 views

Truffle migrate no error but does not create build directory

I'm trying to develop a simple dapp using ReactJS.I used Charterhouse/truffle-create-react-app box suggested by truffle website. The problem is truffle compile and truffle migrate do not seem to work. ...
1
vote
1answer
138 views

Link library inside contract creation

I have a contract like this pragma solidity ^0.4.24; import './MyLibrary.sol'; contract A { // Do Stuff } And I have a factory contract instanciating A contracts pragma solidity ^0.4.24; ...
3
votes
2answers
859 views

Truffle does nothing and shows no output when running tests

I am switching machines and ran into a weird issue with truffle. Truffle is set up properly on my old machine. I can compile and run tests without any issues. To my knowledge, I set up everything ...
1
vote
4answers
50 views

Issue deploying this contract

This is a contract im trying to deploy and i think its an abstract contract as most of the functions dont seem to be implemented... anyway the issue im facing is that truffle is telling me i cant ...
0
votes
0answers
21 views

contract not deployed [on hold]

I am getting this error in the browser console and dont what to do please help... ERROR Error: Uncaught (in promise): Error: Contract has not been deployed to detected network (network/artifact ...
0
votes
1answer
46 views

MetaMask - RPC Error: Internal JSON-RPC error

I am getting this error when i trying to use metamask on my local for a simple transaction from one account(say A) to another (say B). code: -32603 data: {originalError: {…}} message: "Internal ...
1
vote
2answers
914 views

unable to uninstall truffle

I am unable to uninstall truffle using this command npm uninstall -g truffle Current ver is 4.1.5 , I want to uninstall and reinstall v4.1.4 as code seems to be breaking while compiling and v4.1.4 ...
2
votes
1answer
960 views

token transfer fails in crowdsale contract

I have a token contract and a crowdsale contract. When I try to send ether to the crowdsale contract from accounts[3] (or any other really), I get an opcode error: Error: VM Exception while ...
0
votes
1answer
411 views

Accessing Web3 in trufflebox's react-auth-box

Hi I am using trufflebox boilerplate react-auth-box. Created a new component called Foo where I am trying to access the web3 object that has been mapped from Store to this.props. However the console....
11
votes
3answers
2k views

How to set the timeout for truffle test's before block?

I'm running my tests on a private chain and some of them times out: 1) "before all" hook: Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning ...
0
votes
2answers
397 views

How to detect what instruction caused “truffle test” to result in “invalid opcode” error?

I wrote a test for my contract and it returns invalid opcode as a result. Full output: 1) Contract: FPCoin1 One can purchase tokens for ether: Error: VM Exception while processing transaction: ...
4
votes
1answer
319 views

Truffle test fails to call the base function, wants the override

I have an extended ERC20 contract with ERC827 functions, which are overrides of ERC20 with an extra callback parameter. I have these two pairs of base/override functions: Base: function ...
0
votes
0answers
18 views

Contract deployed successfully on localhost and mainnet, but gives error on rinkeby and ropsten

I tried to deploy a contract to rinkeby then on ropsten, but getting an error: Network ropsten-fork Minting initial supply of 5000000000 ... Error: Error: Error: invalid address (arg="_to", coderType=...
1
vote
2answers
244 views

Transaction exited with an error (status 0) after consuming all gas

I developed some smart contracts to be deployed to a private PoA (Proof of Authority) blockchain. I spun up a private blockchain via truffle develop and got the following receipt: Compiling your ...
2
votes
2answers
871 views

Truffle cannot find Ethereum client when running tests

By default this is the content of the file truffle.js: module.exports = { // See <http://truffleframework.com/docs/advanced/configuration> // to customize your Truffle configuration! }; ...
0
votes
1answer
32 views

Truffle Exec Return Events

I have set up a JavaScript file that takes in my contract and executes the various functions and then returns the correct events. The file runs through 'truffle exec'. I am using the following line ...
1
vote
1answer
582 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 (...
1
vote
1answer
22 views

Could not find __Truffle__NotFound.sol from any sources

This is the file I'm trying to compile. I've been using truffle for a few years and I remember that we used to be able to compile files with different names than the contracts inside. I'm using ...
4
votes
1answer
268 views

Truffle hangs forever with parity with PoA

I'm trying to create a private chain using parity (PoA) and truffle but when I do truffle migrate it hangs forever with the following output: > [ > { > "jsonrpc": "2.0", &...
0
votes
1answer
299 views

Passing command-line arguments to 'truffle test'

I have a JS script which I pass to truffle test from command line: truffle test my_script.js I would like this script to take an input argument (retrieved via process.argv[2]). Does `truffle ...
2
votes
3answers
533 views

writing tests in solidity for functions returning multiple values

I have a function that returns multiple values function getInfo(string id) returns(string x,string y){ bytes32 _id= strToBytes(id); return (infostruct[_id].x,infostruct[_id].y) ; } Now i want ...
0
votes
1answer
20 views

BigNumber string error when passed as uint256

I get the following error when passing (new BigNumber('2')).exponentiatedBy(100) big number value as uint256 Error: invalid BigNumber string value (arg="value", value="1....
0
votes
0answers
47 views

Unhandled Rejection (TypeError): Election.methods.addCandidate is not a function

//solidity code function addCandidate(string memory _name) public { candidatesCount++; candidates[candidatesCount] = Candidate(candidatesCount, _name, 0); } //App....
5
votes
3answers
2k views

Undefined results for “web3.eth.accounts” in truffle console

truffle(development)> web3.eth.accounts[0] gives output as "undefined" truffle(development)> web3.eth.accounts instead of showing all accounts details gives the below output Accounts { ...
0
votes
2answers
631 views

How to test contract with multiple accounts / addresses in truffle?

I want to test my truffle contract with multiple msg.sender addresses. Like "the first user sell token, the second user buys this token". For one address I simply write something like contract.buy....
1
vote
1answer
51 views

Issue with Ganche and Truffle with Metamask. Can't load token balance

I'm testing to create a token in Truffle; it compiles fine, but it won't load the balance of the token in to Metamask. I've set the connection correct: it does load the ETH balances of the Ganache ...
0
votes
2answers
251 views

Default getter and setter for mapping in solidity

In my smart contract I've public mapping as mapping (uint=>User) public users where User is a Struct, so is there any way to get the values of this mapping using default getter. For Example : If ...
12
votes
4answers
2k views

What is the real price of deploying a contract on the Mainnet?

I'm trying to deploy a contract on the mainnet, but I've been getting some issues deploying with Truffle. ➜ ballot git:(master) ✗ truffle migrate --network mainnet --dry-run Using network 'mainnet' (...
0
votes
1answer
427 views

Truffle compiling error

I having the error below when I tried compile the contract. Should I downgrade the truffle version? If yes, which version because I couldn't find the appropriate version for sol 0.4.18. Thanks ...
0
votes
1answer
17 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. ...