We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
5
votes
1answer
1k views

Web3.js or Web3.py ? What is the more mature API to interact with Ethereum?

I'm started a new Dapp project, and I trying to find the best way for a quick prototype (back and front end dev). I most familiar with Python, so I search every element than I can to build a Dapp in ...
5
votes
2answers
5k views

passing String object with “0x..” value as bytes32 to a solidity function

I'm having trouble to pass bytes32 to a solidity function from javascript. It's converting to an incorrect bytes32 in solidity. The javascript is a test, running with truffle v3.3.1 on testRPC v3.0.5....
5
votes
3answers
2k views

accessing truffle contract abstractions from external JS script

When writing tests in truffle (v3.2.1) I can forget about things like a contract's ABI and address and just use ContractName.deployed() to interact with a contract on my testrpc chain. How can I mimic ...
5
votes
1answer
2k views

“this._eth.sendTransaction is not a function” when executing method in Web3

I'm using react-web3 (which basically gives me a web3 object back) and I'm trying to make my contract work. This is the code I'm using: const web3 = window.web3; const contract = new web3.eth....
5
votes
3answers
1k views

How to properly catch events using MochaJs

Good day, I'm using mochajs to test my Solidity code using truffle and testrpc. In my contract I got the following event and function: contract store{ event MoneyIn (address _from, uint256 ...
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: ...
5
votes
1answer
468 views

Having issues using the Drizzle library in React

Using Ubuntu 16.04 Greetings, all I was following the tutorial for getting Drizzle up and running located here. I advanced to this step when I attempted to run the app using the "npm start" command ...
5
votes
1answer
1k views

You must deploy and link the following libraries before you can deploy a new version of Contract

I made my custom library and try to using on my own project. Below is the 2_deploy_contracts.js module.exports = async(deployer, netowrk) => { await deployer.deploy(OptionStorage, ownerAddress); ...
5
votes
1answer
1k views

Truffle does not add “networks” to build/contracts/contract.json after migration

Problem Truffle does not add "networks" to build/contracts/contract.json files after migration. Versions running Truffle v4.0.1 (core: 4.0.1) Solidity v0.4.18 (solc-js) EthereumJS TestRPC v6.0.3 (...
5
votes
3answers
449 views

difference between “deploy” and “new”?

So I'm using truffle and I notice that I seem to be able to deploy a contract's bytecode by calling deployer.deploy(MyContract); But I've also seen people run: myContract = await MyContract.new();...
5
votes
2answers
4k views

How would you integrate Ethereum smart contracts into an existing node/react project?

I have an existing node/graphql/mongodb/react/redux project that is in beta and I would like to integrate Ethereum smart contracts to be able to save transaction information into the block chain. Is ...
5
votes
1answer
1k views

Accessing testrpc addresses from solidity tests

I'm consulting truffle's docs on how to test contracts directly in solidity. http://truffleframework.com/docs/getting_started/solidity-tests I'd like to figure out a way to refer to existing testrpc ...
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 ...
5
votes
1answer
446 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 ...
5
votes
1answer
2k views

How to access test accounts created by TestRPC from a Solidity test with Truffle?

With Javascript tests, it is possible to access the accounts which TestRPC creates using: contract('MetaCoin', function(accounts) { // tests here can access accounts[n] to get the public keys } ...
5
votes
2answers
2k views

Truffle test with async/await

Has anyone got Truffle tests to work with async/await? My sample code for testing require('babel-polyfill'); var ERCToken = artifacts.require("./ERCToken.sol"); var Proxy = artifacts.require("./...
5
votes
2answers
250 views

Sending ethers with mocha.js and truffle might result in larger sums than intended

Good day, I have a contract General and a library GenLib. library GenLib{ event MoneyIn (address _from, uint256 _amount); function moneyIn() { MoneyIn(msg.sender, msg.value); <- ...
5
votes
1answer
523 views

Contract factory function running out of gas during Truffle test

Using openzeppelin library and truffle I am trying to make a Contract Factory that creates ERC20 tokens. I prefer to test it with Truffle using solidity and not javascript. Here is the code from the ...
5
votes
1answer
1k 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 ...
5
votes
2answers
2k views

Unit tests written in Solidity, how to change msg.sender address, msg.value,

I would like to know if it's possible to change the address of the message sender of contract's function call when writing unit tests in solidity. It really should be, I was trying to find out how but ...
5
votes
1answer
1k views

Contract migration error: The contract code couldn't be stored, please check your gas amount

I am trying to deploy my simple ERC20 token with locally installed Truffle, but received this error: truffle migrate --reset Using network 'development'. Running migration: 1_initial_migration.js ...
5
votes
1answer
2k views

Getting new BigNumber() not a number: [object, object] error

I am getting a BigNumber() error from the standard token function balanceOf(). The function returns uint256, but it seems like it's returning an array of objects. Here is my javascript testing in ...
5
votes
3answers
956 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 ...
5
votes
1answer
1k views

Watching Solidity event gives error: TypeError: watch is not a function

I am trying to watch a Solidity event in my React app, but I keep getting the following exception error thrown: TypeError: MyEvent.watch is not a function I am sure the event is present in ...
5
votes
1answer
317 views

Using truffle migrations for seeding lots of data inside a smart contract?

I have been developing a smart contract (ERC-721 compliant) which needs to be populated with lots of various pieces of data. Approximately 300 ERC721 tokens need to be minted inside the contract at ...
5
votes
3answers
1k views

How to change settings for truffle develop?

I'm trying to change the settings for my truffle develop node, but the values in truffle.js don't seem to work. Here's what I have there: networks: { development: { host: "127.0.0.10", ...
5
votes
1answer
477 views

Printing uint256 value to console while debugging with Truffle

I am trying to figure out how to print values to the console while doing truffle debug <txhash>. So far I have tried using an event called "TestValue", but I am not seeing the output in the ...
5
votes
2answers
415 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?
5
votes
1answer
908 views

Why are my contracts showing as not deployed in Truffle?

I'm trying to use Truffle to test some contracts by following their docs. As specified, I have installed truffle, testrpc, created the migration contract and worked fine. Ran truffle compile $ ...
5
votes
1answer
355 views

Getter function on solidity

what mistake did I make? pragma solidity ^0.4.0; contract Getter_check { uint public data = 50; function f() constant returns (uint r) { r = data; } } pragma solidity ^0.4.0; ...
5
votes
1answer
2k views

How to deploy truffle contracts to Rinkebey?

What are the parameters that I have to specify to be able to deploy solidity contracts using Truffle in the config file? I am using Metamask to store test ether and have a unique mnemonic to define ...
5
votes
2answers
695 views

Events being fired twice

Given a function and a event in a contract: event OtherCreated(address other, address addr1, address addr2); function doSomething(address addr1, address addr2){ if(aBool == true){ ...
5
votes
1answer
380 views

Truffle error “Don't set config.from directly”

I have parity running on my mac and I can start it with parity --rpcaddr 0.0.0.0 --rpcport 8547 --port 30305 --rpccorsdomain '*' --rpcapi "eth,net,web3" Once It's all sync'd up I then make a new ...
5
votes
0answers
167 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
1answer
8k 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 ...
4
votes
1answer
1k 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 ...
4
votes
2answers
1k 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 ...
4
votes
2answers
870 views

what is the role of Migrations.sol contract in truffle project?

I have started working with truffle since 4 months and I don't give importance to Migrations.sol, I thought it's just a "get started" contract. But when I removed it caused a problem. can anyone ...
4
votes
1answer
4k 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 (...
4
votes
2answers
4k views

Deploying a Contract at Test Time with truffle

I'm having trouble getting my test harness set up in truffle. I have 2 contracts. The first is an Issuing authority and in order for the second to be deployed, the creation address must be ...
4
votes
2answers
4k views

Truffle — Microsoft JScript runtime error [duplicate]

Running truffle from command line gives me this Windows 7 popup message: While init runs successfully. I see file truffle.js in my project folder. How can I handle this gently?
4
votes
3answers
930 views

Iterating through an array in JS and simple promises (web3/pudding)

This might be more to do with my lack of understanding some JS basics however it's in ethereum/web3 context so here it goes. I have a public array posts in my contract and a global variable in JS of ...
4
votes
1answer
2k views

Manually set web3 version in truffle?

The version of web3 in Truffle v4.0.5 is v0.20.3. Is it possible to manually upgrade the web3 version? Similar to this question about web3 in geth. (It's hardcoded.) Somewhat relevant to this issue.
4
votes
2answers
2k views

How much does it cost to upload a smart contract?

I'm using a local Ethereum testnet and it seems to me that the price of uploading a smart contract is a bit too high. This is the code for the smart contract: contract Transfer { address owner; ...
4
votes
1answer
4k views

Truffle mingration: Error: authentication needed: password or unlock

I deploying contract using Truffle and got an error Error: authentication needed: password or unlock. I already checked related questons and found only ugly hacks like "unlock desired account directly ...
4
votes
2answers
460 views

How to connect two truffle instances?

How can we connect two truffle applications with each other? E.g., if we have two metacoin applications, how can these two communicate with each other?
4
votes
3answers
789 views

Truffle migration contract not found - but it's there!

I have a feeling this is going to be a forehead-slapper, but here goes... I'm attempting to run Truffle's "Pet Shop" demo app on AWS. The truffle compile command ran fine, with a few non-fatal ...
4
votes
1answer
980 views

Sign data with private key inside a truffle test file

I've got a contract method that checks the signer of a message using the solidity ecrecover function. In my truffle test file I now want to check if this is done correctly. Therefore I need to sign a ...
4
votes
4answers
467 views

Truffle Drizzle-box fails with TypeError: (0 , _drizzle.generateContractsInitialState) is not a function

Right after unboxing Drizzle-box I'm getting a TypeError: (0 , _drizzle.generateContractsInitialState) is not a function. Ganache is running on localhost:8545, contracts are deployed, Metamask ...
4
votes
1answer
502 views

Should I use new() or deployed() in Truffle unit tests?

What's the difference in using new() or deployed() when creating a contract instance to use in Truffle unit tests? Should I use // VERSION A it("should work", async () => { let instance = await ...