Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
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
264 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
414 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
746 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 ...
5
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
497 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
288 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
662 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){ ...
1
vote
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
794 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
427 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
252 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
145 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
90 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
859 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
197 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 ...
9
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
783 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
370 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
345 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
279 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
590 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
293 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
3k 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 ...
1
vote
1answer
546 views

Undeclared identifier when compiling with truffle compile

I have this contract and can't figure out where's the problem. Any ideas? (I'm a noob in solidity, just started a few days ago). HelloWorld.sol file: mapping (address => uint) balances; function ...
5
votes
2answers
4k 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....
1
vote
1answer
403 views

solidity function not being called through web3/JS

I have the following contract (Test.sol): contract Test { bytes32 message = "This is a message."; function setMessage(bytes32 _message) { message = _message; } function getMessage() constant ...
3
votes
1answer
587 views

truffle test - not able to understand why the control jumps to different test case

I am trying to write unit test cases in truffle framework.I am able to write and execute them. However, whenever I have 2 or more test cases the control jumps from 1 test case to another. For ex: In ...
4
votes
0answers
282 views

Storing a truffle contract interface in version control

What I'm doing When I compile and deploy a contract using Truffle, I get a .json build artifact that contains information about where the contract is deployed on the network (its address). So far I ...
2
votes
1answer
832 views

Questions about interacting with contracts using truffle

I have a simple Escrow contract that I've deployed using testrpc. I'm not sure how to interact with the methods once I've created an initialized a new one. Here's the contract: pragma solidity ^0.4....
2
votes
0answers
284 views
7
votes
2answers
1k views

Which one is suitable frameworks for Dapp development(Truffle, Embark, Dapple)? [duplicate]

Right now we have major Dapp development frameworks. Truffle Framework Embark Dapple What are the pros and cons of each one. On what basis this could be chosen. And what each frameworks needs to ...
7
votes
2answers
3k views

truffle migrate Error: “Cannot find module 'truffle-expect'”

I'm following a solidity tutorial right now and I'm currently encountering an error when I run truffle migrate. Also, testrpc is running in another terminal tab, so this issue is unrelated to the ...
1
vote
3answers
422 views

When creating a new contract I receive a “contract code couldn't be stored” error but the contract is still created

Sale.new({ from: state.account, value: value, gas: 4000000 }).then((instance) => { // do something with instance }).catch((err) => { alert(err) }) When the above code runs I sometimes ...
2
votes
1answer
886 views

Error: VM Exception while processing transaction: out of gas. error while processing transactions

MY CONTRACT : pragma solidity ^0.4.6; contract TestContract{ string coaf; string choice; string info; string isin; string recordDate; string exDate; function ...
5
votes
1answer
1k 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 } ...
0
votes
1answer
472 views

How to assign ether value at deployment of contract

I am trying to run this buyer seller contract in truffle using testrpc. I am unable to assign the address and value for seller at the time of deploying contract. Here is my solidity code and deploy.js ...
3
votes
1answer
2k views

truffle always says “.my_function is not a function” [duplicate]

I'm trying to do my first basic smart contract, following this popular HelloWorld tutorial. However whenever I get to the part where I run a function in the truffle console, it is always telling me "....
1
vote
1answer
1k views

Invalid JSON RPC response error when using truffle migrate + geth

I have been able to successfully deploy contracts on the ethereumjs testrpc with truffle without any issues. Now I wanted to do the same on a remote node running geth 1.6.1 but it gives me a JSON RPC ...
4
votes
1answer
5k views

Is it possible to send ether from contract address to my account address using the CloseChannel() function and what will be the Truffle command?

pragma solidity ^0.4.0; contract exchange { mapping (address => uint256) public balances; event PaymentDone(string s); function Channel( uint value) payable { balances[msg....
1
vote
1answer
1k views

Truffle Migrate with my own ethereum Network

I am developing ethereum contract. so i have setup ethereum server. i used this geth --rpc console --datadir "ethdata" --networkid xxxxx --nodiscover --rpcaddr "xx.xx.x.xxx" -rpcport 8545 --...
0
votes
1answer
580 views

How to use truffle and testrpc and simulate function call masquerading as another user?

I have setup testrpc with two accounts using this syntax basically: testrpc -h 0.0.0.0 --account=0x93e707aa1e3ada62,10000000000000000000 --account=0x47e7625a68200ea9,1000000000000000000 I can ...
0
votes
1answer
284 views

Control structure with truffle (assert and require)

When I'm trying to deploy contracts that contain assert and require using truffle I receive Error: Undeclared identifier. e.g: pragma solidity ^0.4.8; contract Owned{ address public owner = ...
2
votes
2answers
1k views

smart contract address checksum

I am going through ethereum blockchain demo's and currently trying to call other contract deployed already on a local ethereum rpc in memory blockchain. Using truffle and ethereum rpc i am testing ...