Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
1
vote
0answers
196 views

evm_mine in parity dev chain. Fast forward time in Development Chain

Everybody loves testrpc, except me. So, I like to write unit test against real parity dev chain node. The question is how to fast forward timestamp(create new blocks) ? function advanceBlock() { ...
0
votes
1answer
2k views

How to connect to contract via javascript deployed using truffle

I have deployed a contract using truffle on the testrpc network. I need to write a Javascript code that can connect to the contract and run the functions of the contract but I can't figure out how to ...
5
votes
2answers
245 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); <- ...
0
votes
1answer
759 views

Basic testing with Truffle (not changing contract's state)

I'm just starting to use Truffle to test this contract pragma solidity ^0.4.11; contract Basic { bytes32 value; function Basic() { value = "mcansado"; } function getValue() ...
0
votes
1answer
113 views

VM Exception: Contract from within a contract

I am following this example to experiment with contract from within a contract (using testrpc). contract Product { bytes32 public Name; function Product (bytes32 _Name) { Name = ...
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!
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 ...
4
votes
1answer
607 views

Solidity, Ethereum ICO, Truffle and my head exploding

I am trying to somehow end up with a solidity code (for an Ethereum token and a Crowdsale contract), that I can paste in the source code bar in Ethereum Wallet and deploy the Token and the Crowdsale ...
2
votes
2answers
265 views

Difference of behavior between Metamask and direct connection to testrpc

I’m guessing there is an obvious answer to this question but I’m just completely missing the point. I have a very simple contract with 2 functions: a setter that changes a bunch of fields, and a ...
8
votes
2answers
7k views

How do you get the balance of an account using truffle/ether-pudding?

Is there an ether-pudding way to get the balance of a contract/account, or should I just use web3.eth.getBalance(account)?
0
votes
1answer
489 views

Can't access smart contract published with truffle in testrpc from javascript

I'm trying to develop a simple smart contract that sends Ether from one address to another and I can't make it work. I'm using Ubuntu 16.04, truffle 3.4.7, node 7.10.1 and solidity 0.4.13. The ...
2
votes
0answers
279 views

Truffle Contract transaction doesn't wait to be mined

I have a thing that has been annoying me when using truffle-contract, ever since updating from Truffle 2 to Truffle 3. I am no longer able to run transactions synchronously - even though it is stated ...
5
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-...
10
votes
1answer
4k views

Truffle migrate fails

I am using testrpc. While running truffle migrate I get the following error: /usr/local/lib/node_modules/truffle/node_modules/truffle-contract/contract.js:671 throw new Error(this....
7
votes
2answers
2k views

What are the best practices to keep your ethereum smart contract code from being copied and reused?

I'm new to smart contract development. I have built a couple of sample projects and deployed those to my private network. So now I am doing some research on best practices in regards to smart contract ...
4
votes
1answer
653 views

Error: invalid address during truffle migration process in Rinkeby network

I can't deploy my contract to Rinkeby network through truffle migrate --reset --network rinkeby. My truffle.js file looks like this: { networks: { rinkeby: { { ...
5
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 ...
8
votes
1answer
720 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 ...
0
votes
1answer
212 views

Why does Truffle create contract when tests contains no transactions?

I tried running tests that were not sending any transactions and ran into two errors that to me make no sens : an authentification error and, when the account has been unlocked, a block gas limit ...
2
votes
1answer
592 views

Problems with UINT values when testing with mocha/chai

I am testing at the moment some smart contracts with truffle(mocha/chai/chai-as-promised) and have the following problem: I have a getter, and this getter delivers an UINT value, then when I try to ...
1
vote
1answer
255 views

Contract won't deploy (Truffle, React + Redux Box)

I am trying to develop a smart contract that would allow for multisig actions. So if I, for example, want to add admin to AdminStorage I will need consent of a number of admins. It's exactly like ...
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 ...
2
votes
0answers
201 views

How can I get my dapp interface to work on Mist? I'm using truffle framework and it works with Metamask

I can't get my interface to work on Mist using truffle contract abstraction. After building and testing successfully with Metamask I thought I'd test it on Mist as well and, surprise, it doesn't work. ...
4
votes
1answer
539 views

Truffle: How to detect test environment while running smart contract test cases?

I'm trying to run some test cases in Travis CI using truffle but I want some of them not to run if the test environment(localhost:8545) is running via "testrpc" because some of my test cases only ...
2
votes
0answers
605 views

How to connect frontend with contract backend using truffle?

Right now I'm having some trouble understanding how it all fits together if I want to make a Dapp. I did create a contract and the frontend using truffle. Then I compiled it and deployed it to ...
2
votes
1answer
547 views

Solidity Truffle React TestRPC: Invalid address error while creating transactions through React app

I am writing a simple contract which is basically a registry. I am using testRPC for my ethereum testing. Following is my contract on Truffle: notary.sol pragma solidity ^0.4.11; contract notary { ...
3
votes
0answers
329 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. ...
6
votes
2answers
646 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 ...
1
vote
2answers
1k views

Truffle Build doesn't work

module.exports = { build: { //"index.html":"index.html", //"app.js": [ //"javascripts/app.js" //], //"app.css": [ //"stylesheets/app.css" //], //"images/": "images/" }, networks: { development: ...
2
votes
1answer
1k views

One .sol File And Multiple Contracts With Truffle

I have the following sol file "Token.sol" pragma solidity ^0.4.2; contract Token { /// @return total amount of tokens function totalSupply() constant returns (uint256 supply) {} /// @param _owner ...
1
vote
1answer
398 views

“Public DNS” v.s. “Public IP” of AWS for running geth RPC

In my AWS ec2 instance, I run geth and specify --rpcport and --rpcaddr using "Public DNS" like this: geth --datadir "./signer1/data" --networkid 55661 --port 2000 --rpc --rpcport 5566 --rpcaddr "ec2-...
2
votes
1answer
191 views

MetaMask/Web3js ERR_CONTENT_LENGTH_MISMATCH issue

I've deployed my contract with a UI to Ropsten via truffle and ran npm run build and npm run dev to start the server. As soon as I launch localhost (with the account in MetaMask selected) in the ...
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("./...
1
vote
1answer
235 views

Network time discrepancy affecting sync

I'm trying to deploy a contract to the Ropsten testnet using Truffle. Already tested on testrpc, worked smoothly. I keep getting the error "Exceeds block gas limit" when I try to deploy to testnet. ...
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 ...
1
vote
1answer
531 views

failure to verify truffle compiled contract on ropsten.etherscan.io

Recently just pushed my first smart contract from truffle to the ropsten testnet. As you can see from my terminal output below it compiles and was migrated with no problem: Was broadcast to the ...
2
votes
1answer
3k views

How to manually initialize a truffle project? (“truffle init”)

I cannot run truffle init on my company PC. (see Cannot run truffle behind proxy?). I used a network sniffer and found that the connection was reset when trying to establish an SSL connection to ...
1
vote
1answer
618 views

How to generate consistent hash value with Solidity within Truffle?

I would like to generate hash value within Truffle using the web3.sha3() function and the hash value is required to be consistent with that one generated in Solidity. The basic example is sha3(uint256(...
1
vote
2answers
1k views

increment contract value with console call on truffle / testrpc, variable is not persistent

What I want to do is make a smart contract which has a variable that can accrue value. I'd like to have it start off as 0, and then increment it, while periodically checking to verify that my calls to ...
1
vote
0answers
278 views

Using create migration primitive with truffle

I am following this guide doing custom migrations with truffle. When I run truffle create migration deploy_hello_world it creates this path migrations/1501429988_deploy_hello_world.js/migration.js. ...
1
vote
1answer
299 views

How to create conditional unit testing with truffle

I've been using truffle for unit testing and I can't find a way to execute two excludent tests. I mean, I'm creating an ICO contract and my tests depend on lower and upper cap limit, start and end ...
0
votes
0answers
214 views

How to deploy smart contract using truffle , metamask with ropsten network [duplicate]

This question is an extension of Deploying to testnet using Truffle and Metamask Need to deploy smart contracts over ropsten testnet that connected through metamask . I am using truffle framework to ...
0
votes
1answer
307 views

truffle init webpack on Heroku

I'm having a hard time exporting the Truffle sample app on Heroku. I'd like to use it with Metamask. I tried simply pushing the code from my local machine (where the code is working) adding the ...
0
votes
2answers
317 views

Cannot assign value to a variable in truffle console and other problems

I'm trying to do very basic things with Truffle 3.4.6 console. I've been able to successfully compile and migrate a contract and access its contents using both: CoinCrowdsale.deployed() CoinCrowdsale....
1
vote
1answer
161 views

Truffle Console 'from' Parameter Ignored

I have this payable fallback function in a contract code: function() is_live() payable { if (msg.value == 0) throw; if (isFinalized) throw; uint256 tokens = safeMult(msg....
3
votes
1answer
4k views

Web3 - Uncaught TypeError: contract.abi.filter is not a function

I have compiled and deployed a simple Hello World contract using truffle: pragma solidity ^0.4.4; contract Greeter { function Greeter() { } function sayHello() returns(string) { ...
0
votes
1answer
508 views

Call not working on declared variable in a contract with truffle

I have created a simple contract with Truffle to test things out. I am using testrpc with this. pragma solidity ^0.4.11; contract HelloSystem { address owner; function HelloSystem() { ...
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 ...
3
votes
1answer
181 views

Can't migrate a project more than once

I'm running a local geth node, and I have a truffle project that was already migrated once, but I'm having issues migrating additional contracts, or even updating past contracts. I create a new ...
0
votes
2answers
1k views

I Can't Open Privet Network On METAMASK [closed]

when i want open PRIVET NETWORK on METAMASK it wont open. i try it in two PC on same local ethernet