Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
1
vote
2answers
254 views

Truffle project encounters “Error: Cannot find deployed address”

I am a beginner and was trying to run a truffle project but encountered an error which I am unfamiliar with. I based it off Testing contracts with truffle To explain this is my folder structure. ...
1
vote
0answers
260 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
0answers
393 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 ...
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) ...
1
vote
1answer
362 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 ...
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
170 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 ...
1
vote
2answers
544 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 . ...
0
votes
1answer
306 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 (...
1
vote
0answers
114 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
4k views

truffle test fails with ReferenceError: A is not defined

I am not sure what is missing. I keep getting "Reference error". Please find the details below Step 1 : Ubuntu# truffle compile Step 2: Ubuntu# truffle migrate --reset Using network 'development'....
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
1answer
452 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
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 ...
1
vote
1answer
385 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
522 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
341 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....
1
vote
1answer
896 views

Unlock contract deploy address in Truffle testing using TestRPC?

I'm trying to test a function in a contract that sends ether from itself to another contract address. However in my Truffle tests I keep getting Uncaught Error: Error: could not unlock signer account. ...
7
votes
1answer
2k 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 ...
3
votes
1answer
215 views

fallback-to-build error while installing Truffle in Ubuntu 16.10

I was installing Truffle in Ubuntu 16.10 using sudo, but I got the following error message: npm WARN wrtc@0.0.63 license should be a valid SPDX license expression npm ERR! Linux 4.4.0-59-...
1
vote
1answer
483 views

Regarding Oraclize call in smart contract

I have two functions which uses Oraclize call.I have to call these functions one after other / or simultaneously. Sample code for your reference :- pragma solidity ^0.4.0; import "./usingOraclize....
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 ...
0
votes
1answer
258 views

Is there a way to programmatically withdraw money from address?

I am trying to write a test using the Truffle framework and for one of the tests I need to send the contract some ether. Is there a way that I can programmatically make a specified ether account send ...
1
vote
0answers
270 views

How does Truffle Deployer translate arguments from JavaScript to Solidity?

I have a Truffle migration that looks something like this; var MyContract = artifacts.require("./MyContract.sol"); module.exports = function(deployer) { deployer.deploy(MyContract,[ { "...
3
votes
1answer
646 views

Truffle 3.0 upgrade changes, migration and javascript errors

Hey I'm trying to upgrade to Truffle 3 and it's a complete mess. The migrations wont work as there are two errors: Error encountered, bailing. Network state unknown. Review successful transactions ...
0
votes
1answer
2k views

Testing contract function after transaction with Truffle

I try to test this contract with Truffle but the test of checkGoalReached function Fail and I do not understand why. The code to reproduce this problem is available here With Remix Solidity IDE, the ...
7
votes
1answer
2k views

Truffle : Call that returns contract is returning tx

Using Truffle v3.2.1 and solidity 0.4.4 I have an issue with a Factory contract (that create some kind of contract), to simplify my factory contract look like this : contract HelloFactory { uint ...
8
votes
2answers
4k views

I want to know how to quit the truffle console?

just like the question!! I always kill the progress by kill the main shell. I want to change this way.
4
votes
0answers
419 views

Deploying contracts on geth returns {“jsonrpc”:“2.0”,“error”:{“code”:-32600,“message”:“EOF”}}

I'm trying to connect geth with truffle to deploy my contracts to my testrpc. When I run truffle deploy it's running but when I do http://localhost:8545/ it's throwing {"jsonrpc":"2.0","error":{"...
0
votes
1answer
83 views

Having trouble getting uint value from contract

I'm trying to retrieve a public variable from a contract: pragma solidity ^0.4.4; contract Test_Uint { uint public something; function Test_Uint() { something = 42; } } Note ...
4
votes
1answer
636 views

Is the address used to deploy contracts in JS tests in truffle always accounts[0]

I've noticed that the deploying address in my truffle .js tests is equal to the address at accounts[0]. Since it's important to me to test the ownership of a contract, I'd like to know if it's ...
3
votes
1answer
875 views

Truffle compile pragma 4.10

In my contracts i'm using ether transfers which requires Solidity compiler 4.10. With newly updated truffle and solcjs version 4.10. I still get the following error using Truffle to compile the ...
2
votes
1answer
98 views

Ethereum Contract testing

I'm trying to test one of my functions in a contract which returns a bool value, and in the process of debugging I tried to retrieve the output using console log and I get the following hash: ...
1
vote
0answers
164 views

Using solc with Truffle

As per the title, I haven't found anywhere (neither in Truffle Docs nor googling) how to use solc with Truffle (I am on Ubuntu 16.04). For example, let's say I wanna use new require and assert ...
3
votes
1answer
1k views

Truffle SWARM and IPFS Integration

I am now able to use truffle to deploy my contracts in my private blockchain. Now I want to understand how to integrate truffle with SWARM and IPFS for web app deployment. It will be helpful if you ...
7
votes
1answer
2k views

Simulating the passage of time with testrpc

Any tips on how to simulate real network conditions on the testrpc testing client using truffle? I have some functions that look at blocknumber and try to deal with passing time. Has anyone come up ...
1
vote
1answer
94 views

Transaction not being recorded

I'm writing a snippet of code that should call an API and record the response to the chain: function(APIResponse) { // Write to chain console.log(`API responded with:\n${APIResponse}`); ...
4
votes
2answers
3k 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 ...
2
votes
1answer
1k views

Cannot truffle migrate project

Not having issues compiling project. When I truffle migrate I receive this error: Using network 'development'. Running migration: 1_initial_migration.js Replacing Migrations... Migrations: ...
1
vote
1answer
238 views

Why does this transaction (truffle metacoin example) not require gas?

In the truffle metacoin example why does this line not require {gas: xxxx}? Is it that this transaction doesn't need gas or that truffle sets some sort of default gas? return meta.sendCoin(receiver, ...
1
vote
0answers
245 views

mismatch when testing fund withdrawal with truffle + testrpc

I'm trying to test a withdrawal function of my contract through truffle over testrpc. The function is following the "withdrawal from contracts" patter described here. Essentially a notifyPayment() ...
1
vote
1answer
932 views

How do I define mapping in solidity where each value is array of Struct?

I'm trying to define a mapping, where each value should be an array of struct. Not sure, if this is possible? If yes then what wrong I'm doing here? After defining, I also need to push values to the ...
3
votes
1answer
2k views

Truffle Smart Contract Testing does not reset state

I have the following javascript test for a simple ERC 20 token. Which on the call return token.balanceOf.call(accounts[2]); will fetch some old data and fail from a previous test transaction writting ...
2
votes
2answers
1k views

Truffle - Migrate Contract to a private network in Azure

I try to migrate a Smart Contract to a private network running in Azure. It works fine with testrpc but when I try to migrate it to the (remote) private network I always get the following error: ...
1
vote
2answers
1k views

An online voting system using blockchain technology [closed]

i gotta develop an online voting system for the student elections using blockchain technology for my university project. following are the basic requirements for my system: 1. students should be able ...
2
votes
0answers
503 views

Truffle - Migrations cannot be found

I have recently done a fresh install of truffle v2.1.1 as I want to compare this version to the recently updated version. truffle init Works as expected. However, when doing; truffle migrate --...
1
vote
1answer
212 views

Best practices for truffle app

Hi I'm wondering what are some best practices in terms of directory and file structure when building a truffle application, specifically within the app directory. I'm building a Dapp with too many ...
1
vote
1answer
391 views

Truffle V3.1.9, error running migrations

Hey I'm updating my truffle project from V2 to V3, and I am getting this error after migrating: sudo truffle migrate --network development Using network 'development'. Running migration: ...