Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
404 views

Design principles for a file sharing contract

I'm building a file sharing solution, which can benefit from the public ledger. I picture, that each file would have its own contract with an owner, and list of Addresses and their permissions on the ...
5
votes
3answers
4k views

Build an application with Truffle + React + Redux

I'm looking for some examples about how to build a Dapp with Truffle + React + Redux. I'm able to only find this old tutorial https://www.youtube.com/watch?v=GPP6uAq15d8. Does anyone have some other ...
3
votes
1answer
1k views

Parity mining on --chain dev for truffle migrate

I am using Parity to create a custom app and so I am using it locally on --dev. "$ truffle migrate" fails, I think because there is no balance in the account. It says: Error: Insufficient funds. ...
1
vote
2answers
519 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){ ...
1
vote
1answer
532 views

Call a function from an account

Knowing that account0 = 0x2ac971cfceb478a3db5a43598e098839007cec34 account1 = 0x55990a8c443a0eb296cff4bece4c54350185b019 I started testrpc. After that, I called a function buyItem(moneyPaid,{from:...
9
votes
1answer
7k views

Could somebody please explain in detail what this Ethereum contract is doing?

I am new to ethereum & blockchain technology and trying to understand somethings(Etheruem, Truffle, DApps etc.) here and there from the internet. From Ethereum official website, Create a ...
1
vote
1answer
587 views

Undefined in truffle-contract initialization

why I always have undefined from contract(_contract).setProvider(this.web3Provided); Component: import React, {Component, PropTypes} from 'react'; import { default as Web3 } from 'web3'; import { ...
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
305 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 ...
5
votes
2answers
3k views

Constructor initializing another contract

I have a contract which is creating an instance of another contract. I am confused about deploying the contracts in Truffle. Does the constructor get initialized when deployed?
3
votes
1answer
525 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?
0
votes
1answer
954 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
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 ...
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 ...
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 ...
2
votes
1answer
526 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
512 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
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 ...
3
votes
2answers
856 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 ...
2
votes
1answer
299 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/...
1
vote
1answer
802 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 ...
26
votes
1answer
16k 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 ...
0
votes
1answer
258 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 ...
1
vote
1answer
434 views

How to access variables defined in struct using 'Truffle'?

This is the sample contract given :- contract User { string public userName; mapping(address => Service) public services; struct Service { ...
2
votes
1answer
545 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 ...
2
votes
1answer
516 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 ...
5
votes
1answer
448 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
222 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 ...
0
votes
1answer
299 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 ...
1
vote
1answer
302 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 { ...
4
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
712 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
437 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
886 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 ...
1
vote
1answer
664 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 ...
0
votes
1answer
423 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
1answer
557 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 ...
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 ...
1
vote
0answers
329 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) { ...
1
vote
1answer
463 views

Truffle serve not finding css and javascript files

the directory is getting served wrong in truffle and I can't figure out where to change it.... The terminal response is... Couldn't find file at .//app/app.js. My build file....... module.exports =...
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: ...
3
votes
1answer
1k views

Preset testRPC account balances not showing up in Solidity contract mapping, during truffle console session

I notice that preset balances in testrpc, like this: unix$ testrpc --account="privKey1,balance1" --account="privKey2,balance2" ... don't get passed to this Solidity data structure: mapping(address =...
1
vote
1answer
168 views

Ethereum Contract Issue

I have written a contract Transfer and the functions defined in the contract Transfer is used in another contract SecondTransfer.I have defined a constructor in the contract Transfer and initialized ...
3
votes
1answer
3k views

How to find out the value using call() method in truffle and testrpc?

pragma solidity ^0.4.2; contract Transfer { address public owner; mapping (address => uint) balances; // constructor ...
2
votes
2answers
472 views

Where does web3 come from?

I used Truffle to setup a basic example dapp, which includes a frontend javascript file in which I see the following lines: window.onload = function() { web3.eth.getAccounts(function(err, accs) { ...
19
votes
1answer
4k views

What is truffle?

What is the truffle framework? Who can use it, who should use it? And what are the benefits?