Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
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
428 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
203 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
249 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
563 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
643 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
279 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
300 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
215 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
314 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
336 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
164 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
526 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
185 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
1
vote
1answer
1k views

TestRPC/Truffle - how to change accounts?

I deployed a contract under with Truffle. I am able to use my contract as user: web3.eth.accounts[0]. What if I wanted to use this deployed contract object as a different user, say: web3.eth.accounts[...
0
votes
1answer
270 views

Cannot call function and send write-Transaction from geth-console

I have a contract which has this function: function registerSensor(bytes32 name, bytes32 unit, bytes32 location) returns (bool success) { sensors[msg.sender].exists = true; sensors[msg.sender]...
1
vote
3answers
1k views

Cannot “npm install -g truffle-expect truffle-config web3”?

I'm trying to setup development environment of truffle but I got the following error when running npm install -g truffle-expect truffle-config web3 on Windows 10 enterprise N on Azure. PS C:\Windows\...
1
vote
0answers
438 views

Call functions in Truffle as different account [duplicate]

I'm trying to create some unit tests in Truffle to call functions in a contract as a different account, so I can properly test the contract. I can do this in javascript with { from: account } but I'd ...
0
votes
1answer
773 views

How to return the index value of an Enum?

I am trying to build a simple double escrow contract. I have an enum for the state: enum State { Created, Locked, Inactive } State public state; When I try to interact with the contract through the ...
6
votes
1answer
3k 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?
2
votes
2answers
504 views

Running a truffle app outside of localhost? [duplicate]

I have deployed a contract to the ropsten test network with Truffle and can interact with the app at http://localhost:8080 (after running npm run dev and with geth connected to ropsten). However, if I ...
0
votes
1answer
294 views

Solidity contract functions not returning correctly with Truffle, but working on Remix

I'm testing my contracts using Truffle, but my functions are not returning the correct uint, despite doing so when testing in Remix. This is my Test.js code: var EventContract = artifacts.require("./...
5
votes
2answers
687 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){ ...
2
votes
1answer
2k views

truffle migrate with testrpc vs geth testnet [duplicate]

Truffle migrate works when I use testrpc but not geth. Here's what I did for testrpc: In one console node-modules/.bin/testrpc In another truffle console compile migrate resulting in Using ...
2
votes
1answer
838 views

MetaMask + Truffle Invalid Address Error

I'm setting up a dApp (truffle framework) with an escrow contract that holds the money from the buyer of a product before it's released to the seller. When the user clicks "order", I am able to do an ...
2
votes
1answer
442 views

How to Set the gas limit for the Genesis.json in a Private chain?

I want to know on what basis the gas limit is set I have some of the contracts to be implemented in a private which for which i used a genesis block with gas limit 2100000 , but while deploying the ...
2
votes
2answers
260 views

Instance variables not being assigned

I'm trying to assign values passed into a constructor to the instance variables but the assignment doesn't seem to be working and all the values are set to null. contract MarketMaker { address ...
1
vote
0answers
146 views

What is the ether-pudding / truffle-artifactor front end?

I am trying to figure out how to interact with a smart contract deployed through truffle. I am looking at the truffle documentation here. They are describing how to call a function in a deployed ...
2
votes
1answer
3k views

Why is this test failing with an invalid opcode error at the transferFrom() call?

I get the following error: 1) Contract: Bencoin should send Bencoin correctly via transferFrom(address, address, uint256): Uncaught Error: VM Exception ...
1
vote
0answers
93 views

Event triggering multiple times

window.getProjectId = function() { Bidding.deployed().then(function(instance) { instance.projectReturn({}, function(error,result) { if(!error) var pid = (result.args.projectId); ...
1
vote
0answers
900 views

Migrating a smart contract to the kovan test network using the truffle framework just hangs

I am trying to deploy a smart contract to the Kovan test network with the truffle framework. When I run truffle migrate --network kovan it just hangs for ages at the following place: Running ...
1
vote
2answers
200 views

truffle console issues without testrpc running

I am attempting to deploy a contract to the ropsten network and having issues with truffle console. I am following this tutorial. When I try to access the console with this command - $ truffle ...
10
votes
2answers
5k views

Manually execute transactions using testrpc and truffle

I started doing a bit of work in the geth console: geth --dev console but have moved to developing using truffle. To debug in the geth console, I'm used to executing the following: eth....
2
votes
1answer
797 views

How to expose accounts in truffle?

I am working with the basic truffle framework. The MetaCoin.sol file which is installed automatically has the following contract MetaCoin { mapping (address => uint) balances; function ...
1
vote
0answers
378 views

truffle: Error: Invalid JSON RPC response: “”

My config: module.exports = { networks: { development: { host: "localhost", port: 8545, network_id: "*" // Match any network id } } }; My geth running on the same port: ...
4
votes
1answer
1k views

truffle migrate fails with Network state unknown, Error: account is locked

I'm trying to run the truffle demo on the ethereum testnet but truffle migrate fails with "Error encountered, bailing. Network state unknown. Review successful transactions manually. Error: account is ...
5
votes
1answer
354 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; ...
2
votes
2answers
1k views

Using contract from another contract

I have deployed one contract named Storage using truffle console code for Storage.sol pragma solidity ^0.4.8; contract Storage { struct EntityStruct { string str_address; uint entityData; ...
0
votes
2answers
281 views

Contract not disbursing MetaCoin to parent account

I've combined MetaCoin and created an Ownable contract to allow for my Relay contract have access to MetaCoin methods and variables. Everything is successfully deployed using truffle. My assumption is ...
4
votes
1answer
603 views

How to use IPFS with truffle framework [duplicate]

How to use IPFS to get the hash of the document and store it on private blockchain (using go-ethereum )? consider truffle framework and solidity as contract oriented language.
2
votes
1answer
309 views

Is it possible to get all entries of a Mapping or Array?

For debugging a smart contract, it would be helpful to see all entries of an Array or Mapping object in the smart contract. When using Truffle, I can see individual elements of a public array with ...
5
votes
1answer
4k views

Error calling a function from another contract: Member “*” not found or not visible after argument-dependent lookup in type

I'm having trouble compiling a contract that calls a function of an imported contract. SilverCoin.sol: pragma solidity ^0.4.11; contract SilverCoin { function abc() constant returns (uint) { ...
0
votes
2answers
2k views

truffle installation on ubuntu 16.04

Trying to install truffle on Ubuntu 16.04 (on window I tried and failed). First I followed the simple instruction to install "npm install -g truffle" and later on followed this link . Still not able ...