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
2k views

Deploying to testnet using Truffle and Metamask

Is it possible to deploy a smart contract developed using truffle to testnet using just Metamask (without a local eth client instance running)? I tried importing the private key of metamask wallet to ...
9
votes
2answers
2k views

Truffle: Hanging on “Deploying Migrations…”

I am deploying a contract on a private testnet. I am using Parity. When I type: $ truffle migrate --network my-network-name I get a popup in the Parity interface for a password to my account. I ...
6
votes
1answer
397 views

Is truffle based on node and is it possible to run some kind of node debugger in order to pause the Javascript tests and examine variables?

I am currently developing a Dapp and using truffle test to verify the contract. However, I find that I am also debugging the Javascript that runs the test with a lot of console.log() statements. This ...
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.
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
4answers
2k views

Truffle for Windows: I can't make it work

I've installed Truffle v3.2.1 for Windows. If I try to run: truffle console Could not find suitable configuration file. If I run: truffle create:contract MyContract I get nothing but command ...
1
vote
2answers
3k views

HelloWorld contract using truffle v3.2.1

I made my first very simple HelloWorld smart contract : pragma solidity ^0.4.4; contract HelloWorld { uint public balance; function sayHi() returns (bool success) { balance = 1000; ...
1
vote
4answers
1k views

Truffle sample Dapp doesn't show Metacoin balance when Metamask is active

The sample Truffle Dapp doesn't work when Metamask active. I'm running testrpc, I imported the tesrpc account's private key to Metamask and Metamask is connecting to the local testrpc according to ...
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 ...
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 ...
4
votes
1answer
635 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 ...
4
votes
3answers
2k views

How can I setup Angular with Truffle?

I've been looking for a way to hook up Angular with Truffle for a demo dApp I'm thinking of building but I'm unsure as to how to setup the development environment that would allow me to work with both ...
3
votes
1answer
874 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 ...
3
votes
1answer
640 views

Implementation of Oraclize callback tests with Truffle/Mocha

I'm trying to write tests in Mocha/JS with Truffle for a Solidity function that uses Oraclize. I want to test if the result in the callback of my Oraclize query is correct. As Oraclize needs some time ...
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 ...
18
votes
3answers
7k views

How do I specify a different Solidity version in a Truffle contract?

I've got a contract where I want to use <address>.transfer(), which was released in the latest Solidity version 0.4.10. I have as the first line of my contract: pragma solidity 0.4.10; but ...
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 ...
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 ...
5
votes
3answers
1k views

How to properly catch events using MochaJs

Good day, I'm using mochajs to test my Solidity code using truffle and testrpc. In my contract I got the following event and function: contract store{ event MoneyIn (address _from, uint256 ...
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
93 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}`); ...
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
931 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 ...
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
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
0answers
502 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
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 ...
5
votes
3answers
2k views

accessing truffle contract abstractions from external JS script

When writing tests in truffle (v3.2.1) I can forget about things like a contract's ABI and address and just use ContractName.deployed() to interact with a contract on my testrpc chain. How can I mimic ...
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 ...
19
votes
5answers
17k views

How to listen for contract events in JavaScript tests?

I'm trying to trigger events in my solidity contract to output some debug information in my javascript tests. However the events seem to get never caught. That's the relevant contract code: pragma ...
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 ...
5
votes
3answers
3k views

Truffle deployer.deploy() not working

I'm having problems deploying the contract via Trufflem, using Parity as my client, on the Kovan network. The contract is a slight variation of this one. When I ran $ truffle migrate using the ...
2
votes
0answers
349 views

Truffle/Web3: myContract.method.estimateGas causes BigNumber error

I get the following error when running truffle test: { BigNumber Error: new BigNumber() not a number: [object Object] at raise (/Users/danielyakobian/.nvm/versions/node/v7.5.0/lib/node_modules/...
2
votes
1answer
691 views

Truffle and contract with an Address type constructor parameter

When I add new contract (testrpc) with truffle with parameter of type "address" the reading value of this property seems wrong (always 0x0000000000000000000000000000000000000000), I do not find the ...
0
votes
1answer
160 views

Contract not being initialized

Having issues with a contract creating another contract using Truffle dev environment. Here are my steps - truffle console var node = Node.deployed() node.then(function(instance){node=instance}) var ...
3
votes
1answer
314 views

What are the differences between callback and OAR address

I am using Oraclize with testrpc and truffle and I have confused in some points Now when I choose an address account when run the bridge, why and what is the purpose of the choice. node bridge -a 1 ...
6
votes
1answer
2k views

How to use the testrpc `evm_increaseTime` parameter from truffle console? [duplicate]

I am creating smart contracts with truffle and testrpc. When writing unit tests I wish to change the block time to simulate different times that smart contracts may be called. How does one set ...
6
votes
2answers
4k views

How to interact with contracts using the abstraction in truffle

sorry if this is really basic but I'm a bit stuck. I'm playing with the default MetaCoin contract in Truffle and testing it against testrpc. Reading through the truffle docs (http://truffle....
3
votes
1answer
2k views

Truffle error: Cannot read property 'call' of undefined [duplicate]

I am trying to run the following contract in truffle, which is pretty much the same HelloWorld but I kept the name MetaCoin from the truffle example. I have read this, this, and this posts related to ...
3
votes
1answer
2k views

Truffle.js and Kovan/Ropsten

I am trying to use truffle.js and the testnet. I want to test using Kovan an Ropsten. Here is the doc from truffle - networks: { "live": { network_id: 1, // Ethereum public network // optional ...
1
vote
1answer
149 views

RPC access to a Private Blockchain Error (-32600)

I am building a private blockchain for testing. I have a droplet at digital ocean and I installed the latest geth. The blockchain has mining but only headers and there is no data for content. I am ...
1
vote
1answer
215 views

Question regarding Testrpc evm_increaseTime and oraclise

After creating my contract at t1, which is supposed to be called back from oraclise using Ethereum-bridge at t2. I did a time jump to t2 on testrpc using evm_increaseTime and evm_mine. Yet the ...
9
votes
1answer
2k views

how can I run a truffle test in a debugger? [duplicate]

as a developer I want to run my javascript test in a debugger so as to be able to step through tests and inspect the values of variables. The goal is to run it in a Mocha debug mode
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 ...
0
votes
2answers
910 views

TestRPC Accounts Locked

I'm having difficulty getting going with truffle and testrpc. The steps I've taken are: Create a blank project and initialise with truffle init Start testrpc with testrpc Trying truffle migrate or ...
3
votes
2answers
864 views

Unit Testing Date Time Values

I have a function that makes use of the current time (now). The Contract as a whole is a Crowdfunding token and the cost of tokens differ depending on the date and time that tokens are purchased. ...