Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
15
votes
2answers
2k views

Etherscan: How can I verify a contract with multiple imports deployed with Truffle?

When I deploy a contract with Truffle that has an import statement, and try to verify it on etherscan, my understanding is that I need to paste in the contents of the imported file. I get an error on ...
12
votes
4answers
2k views

Running truffle migrate just opens my truffle.js file and does nothing

I am following this tutorial: http://truffleframework.com/tutorials/building-dapps-for-quorum-private-enterprise-blockchains. I am trying to run truffle migrate on my project but it just opens my ...
0
votes
4answers
403 views

Ways to access the live (and test) Ethereum blockchain

I know that I can access the live Ethereum blockchain (and the test "ropsten" blockchain) blockchain using geth, and I know I can access a fake local blockchain with tools like truffle. What I'd like ...
2
votes
1answer
890 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 ...
0
votes
1answer
499 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 ...
8
votes
1answer
9k views

In the truffle console, how to set and get current account?

I'm using the $ truffle console. I can see my available accounts using truffle(development)> web3.eth.accounts. But when I run some smart contract code, which account is running the contract? ...
4
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 "....
2
votes
3answers
5k views

How to set default address in truffle?

I made four accounts and lost the passwords to the first three. I am trying to run truffle migrate, but I am worried that truffle is trying to use the first address that I created rather than the ...
7
votes
3answers
2k views

Compile error with trivial assertion in Truffle test

Before I did anything serious I just wanted to check the toolchain is working. I wrote a test like this: pragma solidity ^0.4.2; import "truffle/Assert.sol"; import "truffle/DeployedAddresses.sol"; ...
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 } ...
8
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 ...
0
votes
2answers
942 views

truffle migrate (deploy) fails with gas issues

I am trying to deploy contracts using truffle framework. I have multiple contracts, all of them are linked appropriately. Example: Governance contract is the main contract. There are other ...
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 ...
1
vote
1answer
633 views

MetaMask transaction not completed

I'm making a simple dApp that sends funds from one account to another using Truffle + MetaMask on testrpc. In my app.js, I have a pay() function that calls web3.eth.sendTransaction({from: account1, ...
5
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 --...
24
votes
14answers
14k views

Truffle Webpack starts with error: MetaCoin has not been deployed to detected network

I seem to have followed the truffle guide to a T. But when I open my app in a browser for the first time, I'm getting this error in the console: Error: MetaCoin has not been deployed to detected ...
0
votes
1answer
581 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 ...
4
votes
1answer
565 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 ...
0
votes
1answer
285 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 ...
1
vote
0answers
267 views

truffle migrate command gives Error: Invalid Json Response: “”

I've cloned testrpc and have it running in a separate directory. It's set to the default localhost:8545. I've successfully installed truffle and ran truffle-init-webpack, then truffle compile. When ...
1
vote
1answer
1k views

Truffle vs Meteor [duplicate]

I have developed a dApp using Meteor. My question might sound a little dumb but here it goes: What is the difference between Truffle and Meteor? Are they exclusive from each other, is either one or ...
1
vote
3answers
390 views

Deploy Ethereum SmartContract on Azure

I am using truffle to write smart contracts , my code and deployments work well on local ethereum rpc. Now i added another environment in "truffle.js" file with url to my azure "Ethereum Consortium ...
1
vote
0answers
394 views

Truffle v3.2.5 migration error: contract code couldn't be stored

I'm using Truffle 3.2.5 and Parity to try and migrate a project to Ropsten. I've tried changing the gas amount per the error's advice. I'm running a full Parity node on the same machine, so my truffle ...
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
1answer
2k views

Runtime Error: out of gas when calling method on contract

I am using Truffle Framework and TestRPC. I have the following method on my contract: function sendEmr(address receiver, string universalPatientId, string firstName, string lastName, string url) ...
5
votes
1answer
6k views

How to get deployed contract address using Truffle 3.x console?

I opened truffle console and when I type my contract's name, I see a very long message on the console but not sure How do I deploy the contract and find the deployed contract address. Kindly advise.
1
vote
1answer
178 views

constant and visibility specifier in solidity

I am trying to run this code but it throws the errors . Is this possible using visibility specifier and constant once ? pragma solidity ^0.4.0; contract C { function first(uint a) private ...
0
votes
1answer
309 views

MetaCoin contract initializing with no value - Issue with Solidity contract constructor

I'm currently trying to get my contract Guess own another contract, MetaCoin, so that it initializes with 10k MetaCoin. Here is the MetaCoin contract: contract MetaCoin { address owner; mapping (...
12
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....
0
votes
2answers
1k views

truffle migrate fails: intrinsic gas too low

I'm trying to follow the tutorial on using Truffle framework for Ethereum development at https://medium.com/@mvmurthy/full-stack-hello-world-voting-ethereum-dapp-tutorial-part-2-30b3d335aa1f. ...
1
vote
2answers
562 views

Output in truffle

I want to read the result of these code in truffle console . I used truffle v.3.2.5 and testrpc v.3.0.5 If such question return with two parameter exist then provide me a appropriate link . ...
1
vote
0answers
116 views

How to focus on a test in truffle

In JasmineJS and other Unit testing frameworks, there is usually a focus feature which works like this using fit: fit('Crowdsale contract - vault works correctly', function(done){ }); if I want to ...
1
vote
1answer
373 views

Accessing/Modifying Options Parameters in Contract

I'm using truffle and metamask to deploy a very simple contract that enables the transfer of ether from one test account to another. How do I use my JavaScript file to access the options parameters ...
3
votes
1answer
1k views

Unable to migrate contracts to Kovan using truffle.js (testrpc and dev chain works though)

I'm having problems deploying contracts to kovan. I'm able to deploy to testrpc, as well as the parity dev chain, but the exact same process fails on kovan. The contract hangs at: Running migration: ...
6
votes
5answers
8k views

How do I find the exact solidity compiler version used by truffle?

I'm trying to verify a contract I have compiled and deployed onto the network using Etherscan. The contract was compiled using truffle. How do I work out exactly which version of the solidity compiler ...
1
vote
3answers
1k views

Out of Gas error on TesRPC

Hey so I have been just messing around with truffle and I keep getting an out of gas error when I test out the commands after a certain point. Even if I uninstall and reinstall testrpc, the problem ...
1
vote
2answers
816 views

Using Truffle, Metamask and Ropsten to simulate two users

I'm trying to create an environment where I can test that access to a contract is restricted to a given wallet address, so I'm trying to simulate two users... 1) I'm running geth pointing to Ropsten ...
0
votes
3answers
2k views

remove contract on ethereum blockchain using web3 [duplicate]

Is it possible to remove or update already deployed contract using web3 or truffle console or geth console?? if we know the contract details like address and ABI array, and we create a object of ...
1
vote
0answers
81 views

how to use the contract instance for multiple functions?

I am trying to test the exchange where two types of tokens are trading. I want to set those tokens in exchange and trying to trade them between two accounts, but i am unable to get the updated ...
0
votes
3answers
600 views

How can I let TestRpc reveil the public key of a generated account

I suffer a steep learning curve at the beginning. My current goal is to set up a testing environment with TestRpc, Truffle and Web3j (wow). Web3j worked as expected and generated a Java wrapper for ...
1
vote
1answer
390 views

Truffle solidity tests are executed before end of deployment

My contract hierarchy is Token which calls function on TokenBase. The deployment is defined like so: var Token = artifacts.require("./Token.sol"); var TokenBase = artifacts.require("./TokenBase.sol");...
1
vote
1answer
455 views

Problem sending MetaCoin from one account to another using unit test

In Truffle; I am trying to modify the already existing MetaCoin sample unit test in order to better understand how everything works. Below is the unit test they provide which transfers 10 coins from ...
1
vote
1answer
527 views

Error when installing testrpc / truffle on Ubuntu Subsystem on Windows 10

Node version 7.10.0 npm installed Ubuntu Subsystem on Windows 10 I try to install testrpc and truffle. When I install truffle via sudo npm install -g truffle I always get the following error: ...
2
votes
2answers
354 views

What is the {from: account_one} third parameter in metacoin.js test example

When working through the MetaCoin sample project; within the MetaCoin.sol file we have this method: function sendCoin(address receiver, uint amount) returns(bool sufficient) { if (balances[msg....
25
votes
4answers
4k views

what does `deploy.link` exactly do in `truffle`

Please explain use cases for deploy.link() function in migrations in truffle framework. How would you use it and for what.
26
votes
13answers
23k views

How to upgrade solidity compiler in truffle

I couldn't find a way to upgrade a version of truffle solidity compiler. Also curious how to see that information for deployed contracts in truffle console
7
votes
1answer
3k views

How to choose an account to deploy a contract in truffle

How do you select an account to deploy a contract using: 1)Metamask 2)Parity 3)some config file
2
votes
1answer
2k views

ReferenceError: artifacts is not defined running Truffle Test

I am trying to execute the built in until test provided in the metacoin example. I installed Mocha into my project. I then execute this command: npm test from my console. I am getting the following ...