Questions tagged [truffle]

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

7
votes
5answers
2k views

Truffle console doesn't work :Unexpected error: Cannot provision contracts while instantiating the console

when I run truffle compile, truffle migrate successfully and then truffle console gives me the following error. strong text **Enexpected error: Cannot provision contracts while instantiating the ...
1
vote
1answer
2k views

how to parse the value returned by truffle ?

I need the value of string. Also, what is the significance of s , e , c . truffle(development)> x.then(function(result) { console.log(result[4]);});}}); undefined truffle(...
2
votes
2answers
5k views

How to send some amount to a Contract in truffle

My contracts were tested in both Browser Solidity and Mist Wallet and it works fine. I am trying to use testrpc and trying to depoy Below is the javascript I am using it on truffle console ...
2
votes
0answers
277 views

How to ensure correct ordering when using a for loop in truffle test

I am using truffle (javascript) to test my solidity contracts and want to automatically run my contract functions a large number of times. I can't figure out how to make a for loop work with promises ...
0
votes
1answer
951 views

truffle - how to invoke functions based on the address elements

// 1) I am invoking a function and getting the entire project list - SUCCESS truffle(development)> hub.then(function(instance){return instance.getProjAddr.call();}) [ '...
4
votes
1answer
3k views

truffle console - return (array of addresses) issue

This problem happens only when I place contracts A and contract B in seperate file. When placed in same file, I get the array elements perfectly Please find the contract below. I was able to ...
3
votes
1answer
488 views

Can Truffle deployer send ether on construction?

If a contract has a payable constructor and needs to be filled on construction, is this possible with the truffle migration workflow?
1
vote
2answers
504 views

Truffle console + javascript

I have a question for you guys. I have 2 contracts: contract House { uint public idHouse; ... } contract ArrayHouse { House[] public arrayHouse; function getHouse(uint n) returns(House){ ...
2
votes
2answers
8k views

truffle console - invoking contract function usage (Version 3)

I have a simple contract like below. I was able to successfully compile and migrate the same. pragma solidity ^0.4.8; contract A { function A() payable { } function getBal() returns(...
7
votes
2answers
3k views

Ethers in testrpc

I am new to Ethereum. I have some questions concerning the use of ethers(in stead of MetaCoins) with truffle and testrpc. 1. By default, do the accounts of testrpc contain the currency in ethers? If ...
3
votes
1answer
2k views

Ether transfer to another account

-I am trying to transfer ether from one account to another using smart contract which is deployed on azure. -when I call receiverAddress.send(amount) in the function in my contract it returns the ...
8
votes
1answer
717 views

Migrating solidity program testrpc+truffle - Error: Invalid JSON RPC response: “” at Object.InvalidResponse

I am trying to make a truffle application. truffle compile : working fine making a 'build' folder with .json files in it. truffle migrate : Gives the following error I am running testrpc in ...
2
votes
1answer
91 views

Unable to set variable from other contract, able to from outside

I've got two contracts, A and B, I set them up in a truffle test separately. A.new()... B.new()... A has a function bar, which sets a public boolean boo to true that is never read anywhere. B has a ...
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 ...
2
votes
1answer
515 views

Error in dapp developed using 'Truffle' framework - Issue in fetching the result from Oraclize-Query

I am developing a dapp using 'testrpc' and 'truffle'-3.1.1.I have also used ethereum-bridge for Oraclize.I have written a smart contract function which calls a url using 'OraclizeQuery'. The ...
3
votes
1answer
392 views

Truffle Migrations missing ConvertLib.sol, etc

Using testrpc v3.0.3 and solidity Getting the above error while deploying this contract in testrpc private net pragma solidity ^0.4.4; import "./ConvertLib.sol"; import "./Agreement.sol"; contract ...
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....
1
vote
1answer
2k views

truffle test - TypeError : myFunction is not a function

I'm using truffle and testrpc to check whether my addMember function works or not. And here is my contract code. /*make Stakeholder*/ function addMember(bytes32 _name, uint256 _threshold, uint256 ...
1
vote
1answer
1k views

What is the truffle command to send token and check balance of token?

pragma solidity ^0.4.8; contract Token { string public name; string public symbol; uint8 public decimals; // address public owner; mapping (address => uint) balances; event ...
3
votes
2answers
787 views

Function call returns 0

Hey can someone help me figure out why this function returns 0, when I call it? The function doesn't throw any errors when I send a transaction to it, but the Ether isn't sent and the variables aren't ...
9
votes
3answers
6k views

truffle migrate fails with: Error encountered, bailing. Network state unknown

Could someone point out what is happening with truffle. "truffle compile" works fine. Please find the below truffle migrate reset output Ubuntu#truffle version Truffle v3.1.2 Ubuntu#truffle migrate ...
1
vote
1answer
792 views

HelloWorld.deployed().balance.call() is not working

I entered the command correctly but I am still getting this error: TypeError: Cannot read property 'call' of undefined at evalmachine.:1:19 at ContextifyScript.Script.runInContext (vm.js:35:29) at ...
2
votes
1answer
176 views

Truffle migration error using powershell

When I write out truffle migrate, I get the following error line with a list of other directory paths. Error: Invalid JSON RPC Response: "" This is my deploy contracts file: var ConvertLib = ...
1
vote
1answer
2k views

Sending test ether on Testrpc

I'm using Truffle Version 2.1 and I'm trying to send test ether to my contract using Testrpc. I run testrpc -u 0 -u 1 And the accounts shows a balance of 99351632199997083360 wei I'm trying to send ...
3
votes
1answer
645 views

Truffle 3.0 upgrade changes, migration and javascript errors

Hey I'm trying to upgrade to Truffle 3 and it's a complete mess. The migrations wont work as there are two errors: Error encountered, bailing. Network state unknown. Review successful transactions ...
1
vote
1answer
386 views

Truffle V3.1.9, error running migrations

Hey I'm updating my truffle project from V2 to V3, and I am getting this error after migrating: sudo truffle migrate --network development Using network 'development'. Running migration: ...
2
votes
1answer
296 views

Upgrade to Truffle 3.0, compile error

I installed truffle V3.1.1 and whether I try truffle init or truffle init webpack, I am unable to compile the example contracts. sudo truffle compile /usr/lib/node_modules/truffle/node_modules/...
0
votes
1answer
245 views

Function returns true for call, but variables show no change

Hey I think this may be a problem with the javascript side or Truffle, but the following function is returning true when I call it, but when I send a transaction to it, the test ether seems to ...
2
votes
1answer
513 views

How to test a contract on Truffle with multiple nodes?

I am a Truffle user. I would like to create one contract and test this. When testing, I'd like to setup three nodes, link them, access the contract and test it. Is this possible? Or am I doing strange ...
7
votes
5answers
3k views

Not enough funds for a transaction example in testrpc

I try to test one of my first Smart Contract in Solidity, a simple sub currency example, as you can see below : pragma solidity ^0.4.0; contract Coin { address public owner; mapping (address =&...
5
votes
1answer
446 views

Oraclize + Testrpc + Truffle. Results aren't updating in contract

In my contract I am just doing a basic query to WolframAlpha function testOracle(){ oraclize_query("WolframAlpha", "random number between 0 and 100");} I also have the __callback function: ...
2
votes
0answers
216 views

Error in dapp developed using 'Truffle' framework -Smart contract function call won't get executed

I am developing a dapp using 'testrpc' and 'truffle'.I have also used ethereum-bridge for Oraclize.I have written a smart contract function which calls a url using 'OraclizeQuery'. The following is ...
2
votes
1answer
513 views

Error running Truffle migrate

Does anyone know why the below occur. Command: truffle migrate --reset Error encountered, bailing. Network state unknown. Review successful transactions manually. Error: VM Exception while ...
0
votes
1answer
298 views

Smartcontract function call won't get executed in dapp developed using 'Truffle' framework

I am developing a dapp using 'testrpc' and 'truffle'.I have also used ethereum-bridge for Oraclize.I have written a smart contract function which calls a url using 'OraclizeQuery'.I have added the ...
25
votes
1answer
15k views

How to update a deployed smart contract? [duplicate]

I've started developing smart contracts with Truffle and when I edit a contract I always redeploy it by adding another migration script. There are two things that I wonder about: Is this the way it ...
16
votes
2answers
10k views

Problem with Truffle Console: Cannot read property 'call' of undefined

I´m having problem with the basic HelloWorld example coded in Solidity and managed with truffle with testrpc. pragma solidity ^0.4.2; contract HelloWorld { uint public balance; ...
1
vote
1answer
295 views

How to fetch specific data based on user input from url using Oraclize?

I am using 'testrpc' and 'truffle' for development. The following is the contract code used. pragma solidity ^0.4.0; import "./usingOraclize.sol"; contract WeatherApiCall is usingOraclize { ...
6
votes
1answer
3k 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?
3
votes
1answer
5k views

Account is locked, after running Truffle migrate command [duplicate]

I am new to this technology and I am trying to Deploy the contract to Ropsten test network. I have my geth running in one terminal. In my truffle console I have an account with some ether. I unlock it,...
1
vote
2answers
706 views

Compile errors on sample project in Truffle 3.0.2

I tried to compile some smart contracts in truffle 3.0.2 (which works without problems in browser solidity and even older versions of truffle) and got compile errors. So I created a sample truffle ...
2
votes
1answer
426 views

How to display the result returned from Oraclize's _callback function in dapp frontend?

I am using testrpc as client and truffle as development framework.And also using ethereum-bridge for Oraclize. This is the contract code.I have downloaded the 'Oraclize API' (oraclizeAPI_0.4.sol)from ...
1
vote
1answer
807 views

I want to use crypto-js module in truffle / app.js

I want to use npm module "crypto-js" in app.js of truffle_project. But I can't use it. app.js: var CryptoJS = require("crypto-js"); // ... I build app, then I open build/index.html by browser, I ...
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'...
1
vote
1answer
662 views

How to run contracts with 'Oraclize' using truffle?

This is the contract code.I have downloaded the 'Oraclize API' (oraclizeAPI_0.4.sol)from the Oraclize github repo.I have added this file to the truffle contracts folder, and rename the file to ...
1
vote
1answer
543 views

Function calling constructor of another contract seems to silently fail

Ok so I am trying to initialize a new contract. From what I understand, creating this contract will only return a transaction hash. So I'm trying to access the new contract from data structures in the ...
0
votes
1answer
348 views

A promise was created in a handler but was not returned from it

Hey I'm new to javascript promises. I am getting several errors stating a promise is created but not returned. How do you return from a promise?
1
vote
2answers
246 views

Calling values from Solidity contract

I'm trying to create a contract where I can save and then call a person's 'first name', 'last name' and 'age' within the truffle console. I'm able to save using the addPerson method, but every time I ...
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 ...
3
votes
1answer
483 views

Is it possible to interact with multiple contracts in the same .sol file using Truffle?

Instead of separating each contract into it's own file, I'm wondering if/how I can interact with each individual contract one in a single .sol file through truffle console. Thanks.
1
vote
0answers
314 views

Truffle overwrite MetaMask web3 wrong msg.sender address

Considering this contract : pragma solidity ^0.4.7; contract Test { function Test() { // constructor } function getMsgSender() constant returns (address account) { ...