Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
7
votes
1answer
2k views

Truffle : Call that returns contract is returning tx

Using Truffle v3.2.1 and solidity 0.4.4 I have an issue with a Factory contract (that create some kind of contract), to simplify my factory contract look like this : contract HelloFactory { uint ...
7
votes
4answers
1k views

Truffle: Migrate to ropsten - fails silently

When I run the following command I receive no output whatsoever: truffle migrate --network ropsten This is just after creating a new project using truffle init and creating a single contract. When ...
7
votes
5answers
4k views

Change truffle develop port

When I run truffle develop it starts a testnet listening at localhost:9545. Is there a way to change the port this testnet is running on? EDIT: I'm not looking for a way to configure which network ...
7
votes
1answer
600 views

Truffle unbox drizzle not working properly

truffle version = 4.1.4 truffle unbox drizzle truffle compile truffle migrate npm run build npm run start this gets me this error: Truffle Drizzle-box fails with TypeError: (0 , _drizzle....
7
votes
2answers
2k views

Conversion of address to string in Solidity

The Solution given in Convert address to string did not help. Motive: To convert an address to string type so that I can use it as a parameter to a function for which string type is necessary. Code ...
6
votes
1answer
9k views

how to know the contract address which truffle is deploying with

I am using truffle migrate --reset --compile-all to deploy the contract to local network but in order to use new web3.eth.Contract(jsonInterface[, address][, options]), i should be able to know ...
6
votes
1answer
5k views

Truffle and Node JS

The dApp I'm building requires a traditonal backend and as a result I need to use Node.js and MongoDB alongside Truffle. Does anybody know how to set Node to work with Truffle? Thanks!
6
votes
2answers
4k views

How to interact with contracts using the abstraction in truffle

sorry if this is really basic but I'm a bit stuck. I'm playing with the default MetaCoin contract in Truffle and testing it against testrpc. Reading through the truffle docs (http://truffle....
6
votes
3answers
3k views

Return value of low-level calls not used

I'm attempting to use the function send() in Solidity I've got this error when i try to compile my contract with truffle : Warning: Return value of low-level calls not used. any idea about it? ...
6
votes
1answer
3k views

How does Truffle work without a web3 provider?

I have a question about the init project with Truffle. I can't understand how - in app.js - they use the deployed contract without a web3 provider, like this: var provider = new Web3.providers....
6
votes
2answers
763 views

Can a solidity contract count how many times it has been instantiated?

After the deployment of the contract, let's say MyContract, can we literally count how many times MyContract has been instantiated? Here's the code of MyContract: contract MyContract { uint ...
6
votes
3answers
4k views

Truffle solidity tests: out of gas & exceeds block gas limit

I am trying to run some basic test w/ my contract, written with Truffle's Solidity tests (tests written in Solidity). When runninng truffle test, I get Error: VM Exception while processing ...
6
votes
1answer
1k views

invalid JUMP after upgrading truffle & testrpc

I have a contract with a method add() where I read the value msg.value and change the contract informations. before upgrading, I was calling this method in my test with return contract.add({from: ...
6
votes
4answers
2k views

How to use Truffle with Solidity 0.4

I just tried to set up a truffle project and tried to compile a contract I have already written. When I do so I get the following error message: /usr/lib/node_modules/truffle/node_modules/solidity-...
6
votes
2answers
4k views

How to configure Truffle to use the Ganache GUI instead of ganache-cli (TestRPC)?

I'm using Truffle v4.0.1 (core: 4.0.1) with the default configuration (ganache-cli aka TestRPC) on Ubuntu and it works fine, but I'd like to use the Ganache GUI. However, I can't find any ...
6
votes
2answers
7k views

Simplest way to integrate Infura with a Web3/Truffle app?

I have a Truffle/Web3 app which has this code in app.js (by default) which runs when the page is loaded: $(document).ready(function () { if (typeof web3 !== 'undefined') { console.warn('Using ...
6
votes
3answers
3k views

Truffle + INFURA for deployment

I've recently started to use Truffle to automate/speed up my development. As I'm still getting the grasp of it I've come up with a barrier when trying to use INFURA for migrations. INFURA nodes don'...
6
votes
3answers
2k views

I get error couldn't find module 'ethereumjs-wallet/hdkey'

I was running this code deploy.js const HDWalletProvider = require('truffle-hdwallet-provider'); const Web3 = require('web3'); const { interface, bytecode } = require('./compile'); const provider = ...
6
votes
1answer
3k views

Error : Could not connect to your Ethereum client with the following parameters:

Im creating my dapp with following below tutorial. http://www.dappuniversity.com/articles/the-ultimate-ethereum-dapp-tutorial however Im facing an error when I run truffle console it shows >...
6
votes
1answer
4k views

What is the difference between Truffle and Remix?

Please list the differences between Truffle and Remix. Where is the use of both applicable? Can somebody list this using an example?
6
votes
1answer
544 views

Best practice for sharing truffle build files between developers

I am working on a few projects using truffle, as you know truffle compiles and migrates contracts to various ethereum networks e.g. MyContract.sol produces MyContract.json which contains a reference ...
6
votes
1answer
677 views

Truffle exits with “Error: The contract code couldn't be stored, please check your gas amount.” error when migrating the 1_initial_migration.js

I am trying to migrate the basic truffle example (the one created via truffle init) to rospten using Parity but I get the following error even thought the contract is correctly deployed on Rospten: ...
6
votes
3answers
1k views

testrpc, contract creating contract not mined?

I'm trying to develop a contract that creates a contract (factory/worker, faucet pattern). Think my issue may be with the tools I'm using: testrpc (local blockchain) Remix Browser Solidity (connected ...
6
votes
1answer
3k views

How to set a sender address when deploying a contract with Truffle?

I don't seem to find the answer to what looks like a really basic question. How does one specify a sender address when deploying a new contract using Truffle ? My contract is owned. So most of my ...
6
votes
2answers
3k views

Creating contracts via new doesn't work

According to the official doc, a contract can create a new contract using the new keyword. But it does not work when I test the code from this post. My dev environment is truffle 2.1.1 and testrpc (or ...
6
votes
2answers
2k views

Cannot read property 'call' of undefined

I am running HelloWorld contract. pragma solidity ^0.4.2; contract HelloWorld { uint public balance; function Helloworld(){ balance = 1000; } } After truffle compile and truffle ...
6
votes
1answer
2k views

How do I manage unlocking accounts in a test in Truffle

I have a test that exercises a contract function across different accounts. How do I unlock these accounts in the context of the test? contract('MyContract', function (accounts) { it("should ...
6
votes
1answer
625 views

Event.watch gets fired infinitely many times

I am trying out truffle + web3 + ethereumjs-testrpc. In the app I have the following code: window.onload = function() { var meta = MetaCoin.deployed(); var event = meta.Transfer({}, {fromBlock: 0,...
6
votes
1answer
908 views

Not enough components (4) in value to assign all variables (6)

This is an exception on compilation I am getting with truffle. The code I am running builds a store from a container contract and then makes a call to get a product from it. Store s = Store(saddress)...
6
votes
1answer
530 views

Reset balance in truffle test accounts after each test

I am writing unit tests for a function where I am sending tokens from one address to other in exchange of ether. I ran these tests a few times and now I am left with 0 ether in one account. I tried ...
6
votes
3answers
7k 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 ...
6
votes
1answer
4k views

Truffle Dapp only works when I first use `truffle migrate --reset`

When I first load my Dapp with testrpc the functionality doesn't work until I use the command truffle migrate --reset Any ideas why?
6
votes
1answer
512 views

Workflow for Dapp Development

There is so much information out there that turns around this point that I decided to make a post, can someone please help out? Does that sound correct as a work-flow for medium/large size projects ?:...
6
votes
2answers
2k views

Getting error message from require()

I know that the latest Solidity supports error messages in require/revert (require(stuff, "problem")). Are there any clients that can get this message? Will I be able to see it if I execute the ...
6
votes
1answer
270 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 (...
6
votes
3answers
379 views

Why does truffle always fail with “Error: Don't set config.from directly. Instead, set config.networks and then config.networks[<network name>].from”

I have a problem that suddenly appeared, and now I get it every time that I try to run truffle test or truffle migrate, regardless of which project it is. I've even tried fetching the Petshop from the ...
6
votes
1answer
2k views

function.call() behaves differently to function() in truffle test

I'm using Truffle 4.0.1 and Node 9.2.1 In my solidity smart contract I have a function function finalize() public onlyOwner { require(!isFinalized); finalization(); // does some stuff ...
6
votes
2answers
515 views

Skipping blocks when using testing with Mocha on Truffle and testrpc?

I have a contract that requires that things only happen at certain block numbers. I was wondering if there was a way to "skip" a set number of blocks?
6
votes
3answers
2k views

Interacting with a deployed contract: How can I mint a token based on the Open Zeppelin Standard

Please excuse what seems to me a basic question, as I am very new to this: I'm using the truffle framework to deploy a smart contract. Playing around with Open zeppelin standard tokens, I've issued ...
6
votes
2answers
2k views

What are explicit steps to deploy dapp to mainnet?

There doesn't seem to be much documentation on how to transition your truffle DApp from working locally to being migrated to the mainnet. Below are some steps I generally would think are necessary: ...
6
votes
1answer
436 views

Is truffle based on node and is it possible to run some kind of node debugger in order to pause the Javascript tests and examine variables?

I am currently developing a Dapp and using truffle test to verify the contract. However, I find that I am also debugging the Javascript that runs the test with a lot of console.log() statements. This ...
6
votes
1answer
245 views

Is there a way to test an onlyOwner function from a Truffle/Solidity unit test?

I have a contract with a function marked as onlyOwner (from OpenZeppelin, so only the address that deployed the contract can call it). pragma solidity ^0.4.17; import "./Ownable.sol"; contract ...
6
votes
1answer
624 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 ...
6
votes
1answer
728 views

Problem with start() in web3-provider-engine

While trying to connect to a provider(infura) I get the above error below is the full stack trace: bundle.js:54318 Uncaught TypeError: this.provider.sendAsync is not a function at Web3Subprovider....
5
votes
1answer
5k views

How to deploy contracts that take parameters in their initialisers using Truffle? [duplicate]

I'm trying to build a smart contract with Truffle. I can compile it just fine, but when I try to deploy it on the network, I don't get an option to pass in the initialiser parameters and thus the ...
5
votes
1answer
2k views

Truffle migrate vs Truffle deploy

Is there any difference between truffle migrate and truffle deploy, as of now what I observed is both the command perform deployment on desired networks one recognizable difference which we can see ...
5
votes
2answers
7k views

How to get deployed contract address using Truffle 3.x console?

I opened truffle console and when I type my contract's name, I see a very long message on the console but not sure How do I deploy the contract and find the deployed contract address. Kindly advise.
5
votes
2answers
2k views

Remove trailing zero from web3.toAscii() conversion

I have a contract that returns a bytes32 type variable and I'm currently testing it with truffle and javascript. The original data ['Roberto', 'Juan', 'Andrea'] This array is what i get as a ...
5
votes
1answer
1k views

How can I import the accounts from truffle develop into MetaMask?

I use truffle develop. It seems to me that the accounts in truffle develop are persistent. Pleas correct me if I'm wrong. How can I import the accounts from truffle develop into MetaMask?
5
votes
1answer
5k views

Deploying abstract contracts and interfaces

I am trying to create a basic inheritance hierarchy with abstract/virtual formalisms. Consider the following two contracts: Abstract Contract (IUser.sol): contract IUser { function addUser (...

1 2
3
4 5
44