Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
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
259 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
271 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
647 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 ...
9
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
87 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
638 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
876 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 ...
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
246 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
949 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
505 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
214 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
395 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: ...
9
votes
1answer
2k views

Custom balance accounts testrpc?

I am setting up unit tests with for my contracts using truffle. I am using also testrpc, but having accounts with 2.123...... *10^37 Wei is not very helpful to visualise and debug things. I am trying ...
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
703 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
317 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 ...
1
vote
1answer
151 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 ...
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 ...
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 ...
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
8
votes
1answer
4k views

How to pass arbitrary bytes to a function (2016)

I'm trying to implement a contract which will store bytes blob, a dynamic bytes array. For example I have following struct: Sign { address signer; bytes16 signType; bytes sign; } plus ...
0
votes
2answers
912 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
870 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. ...
2
votes
0answers
163 views

Truffle test resources

I'm looking for some guide that drive me into solidity + truffle unit test (best practice, etc...). The only doc that I have found is the official doc.
1
vote
1answer
247 views

Cannot access variables in contract

This is my contract- pragma solidity ^0.4.0; contract helloworld { uint public balance; function helloworld(){ balance = 1000; } function getBalance() returns(uint) { ...
17
votes
2answers
10k views

Problem with Truffle Console: Cannot read property 'call' of undefined

I´m having problem with the basic HelloWorld example coded in Solidity and managed with truffle with testrpc. pragma solidity ^0.4.2; contract HelloWorld { uint public balance; ...
2
votes
1answer
551 views

Can I execute functions within a contract (transact) from multiple accounts?

I have a contract that is deployed on the local test blockchain. I am using testrpc and truffle for testing my contract. However, I wish to execute functions of the contract from multiple accounts (2 ...
2
votes
4answers
1k views

Contract Method not returning value

I have a contract : pragma solidity ^0.4.2; import "Owned.sol"; contract SGBFactory is Owned { event SGBUpdate(uint sbgID, bool isCreated, string message); // isCreated = true means created, ...
1
vote
1answer
396 views

Design principles for a file sharing contract

I'm building a file sharing solution, which can benefit from the public ledger. I picture, that each file would have its own contract with an owner, and list of Addresses and their permissions on the ...
5
votes
3answers
4k views

Build an application with Truffle + React + Redux

I'm looking for some examples about how to build a Dapp with Truffle + React + Redux. I'm able to only find this old tutorial https://www.youtube.com/watch?v=GPP6uAq15d8. Does anyone have some other ...
3
votes
1answer
1k views

Parity mining on --chain dev for truffle migrate

I am using Parity to create a custom app and so I am using it locally on --dev. "$ truffle migrate" fails, I think because there is no balance in the account. It says: Error: Insufficient funds. ...
1
vote
2answers
513 views

Truffle console + javascript

I have a question for you guys. I have 2 contracts: contract House { uint public idHouse; ... } contract ArrayHouse { House[] public arrayHouse; function getHouse(uint n) returns(House){ ...
1
vote
1answer
532 views

Call a function from an account

Knowing that account0 = 0x2ac971cfceb478a3db5a43598e098839007cec34 account1 = 0x55990a8c443a0eb296cff4bece4c54350185b019 I started testrpc. After that, I called a function buyItem(moneyPaid,{from:...
9
votes
1answer
7k views

Could somebody please explain in detail what this Ethereum contract is doing?

I am new to ethereum & blockchain technology and trying to understand somethings(Etheruem, Truffle, DApps etc.) here and there from the internet. From Ethereum official website, Create a ...