Stack Exchange Network

Stack Exchange network consists of 175 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 [truffle]

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

6
votes
0answers
215 views

Truffle debug on function call show null variables

With a truffle version of 4.1.0, using truffle debug on a call of my contract function below: function Deposit (uint256 timeout, bytes32 hash, address recipient) public payable returns (...
5
votes
0answers
157 views

Dapp Development using Truffle framework getting error

I am using truffle framework, which has pudding functionality. I have compiled the same contract on the both Dapps and deployed it on the one Dapp. Now i am trying to access it from another Dapp using ...
4
votes
0answers
200 views

How to get Truffle to generate artifacts for contracts outside of project?

Say I have a contract MyToken.sol which has already been deployed to a public Ethereum network. Its source is maintained in an external repository and is included in my package.json file so that it ...
4
votes
0answers
146 views

Running a geth light client, how do I resolve the error: “No trusted canonical hash trie”?

I've been running a geth light client to deploy smart contracts through Truffle Migrations to mainnet. I'm getting: "Error: No trusted canonical hash trie". Any help in what this entails and how to ...
4
votes
0answers
221 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", &...
4
votes
0answers
556 views

Truffle migrate Error Invalid number of arguments to Solidity function

Truffle 4.0.1 I've got a contract declared "is Pausable" (OpenZeppelin framework) and I want to pause it as part of the deployment logic. I'm getting an error, however, when invoking pause() Error: ...
4
votes
0answers
467 views

How can I retrieve transaction hashes using web3 batch requests?

When I send a transaction using Truffle's contract wrappers - or using plain web3 sendTransaction() - I get a tx hash back that I can use to confirm the tx has completed. While using batch requests (...
4
votes
0answers
219 views

how to get revert at the previous timestamp of evm in testrpc

I am testing my contracts so at some point i need to increase the timestamp of evm that i achieve through evm_timeIncrease but now i want to execute some functions on the basis of current timestamp ...
4
votes
0answers
268 views

Storing a truffle contract interface in version control

What I'm doing When I compile and deploy a contract using Truffle, I get a .json build artifact that contains information about where the contract is deployed on the network (its address). So far I ...
4
votes
0answers
414 views

Deploying contracts on geth returns {“jsonrpc”:“2.0”,“error”:{“code”:-32600,“message”:“EOF”}}

I'm trying to connect geth with truffle to deploy my contracts to my testrpc. When I run truffle deploy it's running but when I do http://localhost:8545/ it's throwing {"jsonrpc":"2.0","error":{"...
3
votes
0answers
94 views

Truffle test of two transactions during the same block

I'm trying to test a solidity function that only allows it to be called once per block. E.g. (my desired functionality): Tx1 calls Fn during block #100, and when successful sets a boolean flag for ...
3
votes
0answers
111 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 ...
3
votes
0answers
49 views

Many Contract Testing strategies

I'm trying to wrap my brain around how to effectively test multi "projects" in Truffle, assume a simple ganache setup, also assume that these contracts seem to work, in remix, and in unit tests, but, ...
3
votes
0answers
247 views

Testing solidity default function with Truffle and async/await

I am developing a crowd sale contract in solidity. The fallback function is payable so that investors can send ether to the contract. If incoming transaction is accepted then information about the ...
3
votes
0answers
62 views

Methods and constants order in the contract ABI

Is it possible to annotate methods and constants order in the contract ABI before compilation?
3
votes
0answers
240 views

Invalid JSON RPC response: {“id”:6,“jsonrpc”:“2.0”}

I'm following this tutorial https://medium.com/@ConsenSys/a-101-noob-intro-to-programming-smart-contracts-on-ethereum-695d15c1dab4 I have downloaded the code from github repo. I'm using ganache as ...
3
votes
0answers
462 views

Contract not stored and out of gas in migration at Truffle ganache

I am facing this issue regularly while trying to migrate bunch of contracts but it get failed because of this issue . I am running over testrpc , i tried lot of recommendations over stack exchange and ...
3
votes
0answers
258 views

Problem migrating contract using truffle. Unknow account message

I am trying to migrate a contract using truffle but I get a "Unknown account" message eventhough I tried various ways to unlock the account beforehand. Am I missing something? Any help really ...
3
votes
0answers
131 views

Not able to successfully do transactions of default MetaCoins(from Truffle) on local testnet on MetaMask

I have installed truffle and ran the default contract provided by truffle. I successfully compiled,migrate and put the default dapp on local testnet http://localhost:8080/.I am able to see the dapp ...
3
votes
0answers
327 views

Unit testing with chai-as-promised: how to test for two possible errors with rejectedWith()?

I am new to asking questions here and I am sorry if my question is not correctly asked! I am currently testing some smart contracts with truffle and have some problems with testing for exceptions. ...
3
votes
0answers
104 views

Ethereum pudding transaction hash

Is it possible to get the transaction hash of a function call in Ethereum Pudding/ Truffle?. It seems that it works straight forward with web3 but Pudding is hiding it?
2
votes
0answers
16 views

Truffle exec ETIMEDOUT

I'm running a batch script that would create up to hundreds of concurrent transactions and wait for their completion truffle exec scripts/....js --network rinkeby ... everything works but after ...
2
votes
0answers
47 views

Why truffle deploy fail with address value=0 after I upgrade to version 5.0.5?

I have a truffle 2_deploy_contracts.js something like this : const sample = artifacts.require('./Sample.sol'); module.exports = function(deployer) { deployer .then(()=>deployer.deploy(...
2
votes
0answers
39 views

Function call always returns 0

Working with a simple contract to get the hang of this. I can't seem to get the correct value back from my contract function. It always outputs 0. Truffle version: 4.1.15 Contract: pragma solidity ...
2
votes
0answers
100 views

Error when I try to deploy with infura

Running migration: 1_initial_migration.js Deploying Migrations... ... 0x0ed88dd40f380a805ed0ba1b5b0a9d8178321ab6da9e5c0cb247f5700337b173 Migrations: 0xcfc4ba0488f20c7a2bb24e735f43e240bf249bc8 Saving ...
2
votes
0answers
47 views

web3: getPastEvents works in Truffle on instance, not in web3 script on page

I am looking to collect the previously logged events of a certain type using getPastEvents. It does not seem to work in my web3 script on my site but it does work in truffle console on a deployed ...
2
votes
0answers
34 views

Tracking Non-Deployer Transaction Gas Use In Truffle Migrate

In Truffle, gas used by a Migration in deployer.deploy() is tracked by a Reporter using events emitted by the Migration. If I have code of the form: deployer.deploy(MyContract) .then(instance =>...
2
votes
0answers
34 views

IntelliJ + truffle tests

I would like to run truffle tests from IntelliJ. I found a tutorial here: https://charterhouse.github.io/2017/05/12/running-truffle-unit-tests-in-intellij-idea.html Unfortunately, it does not seem ...
2
votes
0answers
97 views

Installing Truffle without npm

I'm a student trying to install a truffle test RPC client (just for simple contract deployment in small scale). I am using a remote Ubuntu machine in my university, and i don't root privileges. ...
2
votes
0answers
43 views

Unable to send large transactions on ethereum private chain

I have a small contract pragma solidity ^0.4.17; contract A10test{ mapping(uint=>string) public data; uint public revisionNo=0; function setdata(string _data) public { data[revisionNo] = ...
2
votes
0answers
135 views

Transaction not mined error when deploying to quorum maker server

I get the following error when attempting to deploy my zeppelin erc20 token to a quorum server(used quorum maker). (master) $ node migrations/2_proj.js ``````` transactionHash ...
2
votes
0answers
71 views

Using OpenZeppelin's increaseTime.js

I'm writing a test for a time-dependent solidity function. I'd like to use the increaseTime.js helper from v1.12.0 of OpenZeppelin's library. When I try to call this helper inside my test, I get an ...
2
votes
0answers
105 views

How to implement percentage deposit function to smart contract

I need to implement on the deposit function when the ownerAddress is doing a deposit a 10% to be freeze in the smart contract and and if the ownerAddress want's to call the returnDeposit function by ...
2
votes
0answers
132 views

Getting Json file from remix

I have been deploying contracts on rinkeby but we are almost done to go to mainnet. I have been comparing deployments with truffle and remix and there is a huge difference in gas uses, so I would ...
2
votes
0answers
121 views

Send ERC20 Tokens from Fixed Supply Token Contract to TokenCrowdSale Contract

For ICO Crowd Sale I have created 2 contracts one is MyToken.sol & other is MyTokenCrowdSale.sol. MyToken.sol creates fixed supply ERC20 tokens. contract MyToken is DetailedERC20, StandardToken { ...
2
votes
0answers
30 views

Orders Facilitator Contract has not been deployed to detected network

I'm trying to deploy a simple contract to truffle. This is very confusing now because truffle has it's own network built into it, yet the tutorial I'm following uses test-rpc. I've looked at a few ...
2
votes
0answers
119 views

calling method from another contract throws Revert

I have a smart Contract "RecommendContract" contains this method: function addVacancy(address sender, bytes32 vacancyId, uint256 incentive) external { Vacancy vacancy = vacancies[...
2
votes
0answers
181 views

Truffle deployment with metamask to ganache leads private key error

I'm using Truffle, web3js and Metamask to build a webapp. I'm using ganache for local testing. I'm trying to deploy a contract with import TruffleDeployer from 'truffle-deployer'; import ...
2
votes
0answers
106 views

Import contracts, compiling and deployment

quick question. I have a set of contracts A,B,C. A contains import 'B' and import 'C'. Should I just compile A and then deploy it on the blockchain for the functions in B and C to be implemented ...
2
votes
0answers
269 views

Unexpected behavior with `block.timestamp` in truffle test

I am doing some experiments with block.timestamp(which is now's alias). I wrote some code to see if block.timestamp really represents the timestamp of the last mined block. From the documentation: ...
2
votes
0answers
227 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 ...
2
votes
0answers
151 views

How to get meaningful error msg from truffle unit test?

I am writing unit tests in truffle. No matter it's solidity unit tests or js unit tests, all of the error msg I can get is: Error: VM Exception while processing transaction: revert at Object....
2
votes
0answers
41 views

Configure Truffle to automatically run tests before contract deployment

How do I configure Truffle to automatically carry out all my tests before it deploys the smart contract? Ideally, it should also halt deployment in case of any test errors.
2
votes
0answers
168 views

Reduce gas usage in contract that creates other contracts

I have a contract that is exceeding block gas limits (using something like 8000000 gas) when I deploy it. I think it is because it is importing a bunch of other contracts and has functions that create ...
2
votes
0answers
325 views

truffle assert equal not accurate for small differences

For some reason my truffle test suite "should send coin correctly" passes when it shouldn't. I'm just running a test suite on the standard ERC20 code found on ethereum.org. When you take 1e+21 -1010, ...
2
votes
0answers
234 views

transfer function is not working for the smart contract

Below is the Scenario of the problem: I made some changes in the real concept because it will hard to understand the problem so I try to make it real simple. I make a contract to facilitate some ...
2
votes
0answers
251 views

Using Truffle with Node JS (MongoDB)

I am trying to use truffle along with a MongoDB database which means that I need multiple ports. For local testing, I have been starting up my RPC, switching the port that the app is listening, and ...
2
votes
0answers
46 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
282 views

Upgrading the truffle Migrations contract

In the standard truffle migrations contract the purpose of the upgrade function is upgrade the Migrations contract itself by copying the last_completed_migration of the old Migrations contract to the ...
2
votes
0answers
660 views

Sign transaction using truffle-contract

Is it possible to call contract methods protected with modifier like onlyOwner without access to the node with the keyfile using only private key? I know that I can create raw transaction and sign it ...