Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
147 views

Truffle. Type index error (Error: Error: VM Exception while executing eth_call: invalid opcode)

I have got error if i try call method getArrayData() contract ManagerDb { struct ManagerStruct { bytes32 firstname; bytes32 lastname; bytes32 email; uint index; ...
0
votes
2answers
145 views

A contract that seems to work fine isn't doing anything

I'm having a problem with a smart contract I have deployed on a local testrpc network. I'm using truffle, nodejs and web3js. I am running that testrpc network on Ubuntu 16.04, and into it there's is ...
1
vote
2answers
788 views

How to build a web interface that allows users to carry out transactions on a private blockchain?

I'm just getting started with Ethereum. To understand the platform better, I intend to build a web interface for a voting contract. User should be able to make authenticated transactions to vote on a ...
1
vote
0answers
285 views

Trying to Deploy a contract Factory on Truffle

I am trying to deploy a contract factory that creates multiple other contracts. The problem is they are both in the same solidity file. When migrating and deploying I can only access the Factory ...
0
votes
1answer
399 views

Testing contract interactions with Truffle

I have 2 contracts, User and Registry, interacting and I want to test their interactions with Truffle. Currently my test(s) for User are contract('User', function(accounts) { // many tests here ...
1
vote
1answer
265 views

switching signer off when using parity as development network

I successfully created a private network with some accounts with lots of ETH following the instructions on parity's github but when I try to create a transaction the signer wants me to validate each ...
1
vote
2answers
246 views

Calling values from Solidity contract

I'm trying to create a contract where I can save and then call a person's 'first name', 'last name' and 'age' within the truffle console. I'm able to save using the addPerson method, but every time I ...
1
vote
1answer
888 views

Truffle - can deploy to ropsten but not mainnet

I am trying to deploy a contract to the mainnet. My truffle.js looks like this: require('babel-register') module.exports = { networks: { "live": { network_id: 1, host: 'localhost', ...
1
vote
0answers
204 views

evm_mine in parity dev chain. Fast forward time in Development Chain

Everybody loves testrpc, except me. So, I like to write unit test against real parity dev chain node. The question is how to fast forward timestamp(create new blocks) ? function advanceBlock() { ...
0
votes
1answer
2k views

How to connect to contract via javascript deployed using truffle

I have deployed a contract using truffle on the testrpc network. I need to write a Javascript code that can connect to the contract and run the functions of the contract but I can't figure out how to ...
5
votes
2answers
250 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
801 views

Basic testing with Truffle (not changing contract's state)

I'm just starting to use Truffle to test this contract pragma solidity ^0.4.11; contract Basic { bytes32 value; function Basic() { value = "mcansado"; } function getValue() ...
0
votes
1answer
120 views

VM Exception: Contract from within a contract

I am following this example to experiment with contract from within a contract (using testrpc). contract Product { bytes32 public Name; function Product (bytes32 _Name) { Name = ...
6
votes
1answer
5k views

Truffle and Node JS

The dApp I'm building requires a traditonal backend and as a result I need to use Node.js and MongoDB alongside Truffle. Does anybody know how to set Node to work with Truffle? Thanks!
5
votes
2answers
4k views

How would you integrate Ethereum smart contracts into an existing node/react project?

I have an existing node/graphql/mongodb/react/redux project that is in beta and I would like to integrate Ethereum smart contracts to be able to save transaction information into the block chain. Is ...
4
votes
1answer
608 views

Solidity, Ethereum ICO, Truffle and my head exploding

I am trying to somehow end up with a solidity code (for an Ethereum token and a Crowdsale contract), that I can paste in the source code bar in Ethereum Wallet and deploy the Token and the Crowdsale ...
2
votes
2answers
269 views

Difference of behavior between Metamask and direct connection to testrpc

I’m guessing there is an obvious answer to this question but I’m just completely missing the point. I have a very simple contract with 2 functions: a setter that changes a bunch of fields, and a ...
8
votes
2answers
7k views

How do you get the balance of an account using truffle/ether-pudding?

Is there an ether-pudding way to get the balance of a contract/account, or should I just use web3.eth.getBalance(account)?
0
votes
1answer
509 views

Can't access smart contract published with truffle in testrpc from javascript

I'm trying to develop a simple smart contract that sends Ether from one address to another and I can't make it work. I'm using Ubuntu 16.04, truffle 3.4.7, node 7.10.1 and solidity 0.4.13. The ...
2
votes
0answers
288 views

Truffle Contract transaction doesn't wait to be mined

I have a thing that has been annoying me when using truffle-contract, ever since updating from Truffle 2 to Truffle 3. I am no longer able to run transactions synchronously - even though it is stated ...
6
votes
4answers
2k views

How to use Truffle with Solidity 0.4

I just tried to set up a truffle project and tried to compile a contract I have already written. When I do so I get the following error message: /usr/lib/node_modules/truffle/node_modules/solidity-...
7
votes
2answers
2k views

What are the best practices to keep your ethereum smart contract code from being copied and reused?

I'm new to smart contract development. I have built a couple of sample projects and deployed those to my private network. So now I am doing some research on best practices in regards to smart contract ...
4
votes
1answer
688 views

Error: invalid address during truffle migration process in Rinkeby network

I can't deploy my contract to Rinkeby network through truffle migrate --reset --network rinkeby. My truffle.js file looks like this: { networks: { rinkeby: { { ...
6
votes
2answers
2k views

Cannot read property 'call' of undefined

I am running HelloWorld contract. pragma solidity ^0.4.2; contract HelloWorld { uint public balance; function Helloworld(){ balance = 1000; } } After truffle compile and truffle ...
8
votes
1answer
724 views

Migrating solidity program testrpc+truffle - Error: Invalid JSON RPC response: “” at Object.InvalidResponse

I am trying to make a truffle application. truffle compile : working fine making a 'build' folder with .json files in it. truffle migrate : Gives the following error I am running testrpc in ...
0
votes
1answer
213 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
1answer
615 views

Problems with UINT values when testing with mocha/chai

I am testing at the moment some smart contracts with truffle(mocha/chai/chai-as-promised) and have the following problem: I have a getter, and this getter delivers an UINT value, then when I try to ...
1
vote
1answer
263 views

Contract won't deploy (Truffle, React + Redux Box)

I am trying to develop a smart contract that would allow for multisig actions. So if I, for example, want to add admin to AdminStorage I will need consent of a number of admins. It's exactly like ...
3
votes
0answers
134 views

Not able to successfully do transactions of default MetaCoins(from Truffle) on local testnet on MetaMask

I have installed truffle and ran the default contract provided by truffle. I successfully compiled,migrate and put the default dapp on local testnet http://localhost:8080/.I am able to see the dapp ...
2
votes
0answers
202 views

How can I get my dapp interface to work on Mist? I'm using truffle framework and it works with Metamask

I can't get my interface to work on Mist using truffle contract abstraction. After building and testing successfully with Metamask I thought I'd test it on Mist as well and, surprise, it doesn't work. ...
4
votes
1answer
576 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 ...
2
votes
0answers
635 views

How to connect frontend with contract backend using truffle?

Right now I'm having some trouble understanding how it all fits together if I want to make a Dapp. I did create a contract and the frontend using truffle. Then I compiled it and deployed it to ...
2
votes
1answer
568 views

Solidity Truffle React TestRPC: Invalid address error while creating transactions through React app

I am writing a simple contract which is basically a registry. I am using testRPC for my ethereum testing. Following is my contract on Truffle: notary.sol pragma solidity ^0.4.11; contract notary { ...
3
votes
0answers
351 views

Unit testing with chai-as-promised: how to test for two possible errors with rejectedWith()?

I am new to asking questions here and I am sorry if my question is not correctly asked! I am currently testing some smart contracts with truffle and have some problems with testing for exceptions. ...
6
votes
2answers
684 views

Can a solidity contract count how many times it has been instantiated?

After the deployment of the contract, let's say MyContract, can we literally count how many times MyContract has been instantiated? Here's the code of MyContract: contract MyContract { uint ...
1
vote
2answers
1k views

Truffle Build doesn't work

module.exports = { build: { //"index.html":"index.html", //"app.js": [ //"javascripts/app.js" //], //"app.css": [ //"stylesheets/app.css" //], //"images/": "images/" }, networks: { development: ...
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 ...
1
vote
1answer
439 views

“Public DNS” v.s. “Public IP” of AWS for running geth RPC

In my AWS ec2 instance, I run geth and specify --rpcport and --rpcaddr using "Public DNS" like this: geth --datadir "./signer1/data" --networkid 55661 --port 2000 --rpc --rpcport 5566 --rpcaddr "ec2-...
2
votes
1answer
209 views

MetaMask/Web3js ERR_CONTENT_LENGTH_MISMATCH issue

I've deployed my contract with a UI to Ropsten via truffle and ran npm run build and npm run dev to start the server. As soon as I launch localhost (with the account in MetaMask selected) in the ...
5
votes
2answers
2k views

Truffle test with async/await

Has anyone got Truffle tests to work with async/await? My sample code for testing require('babel-polyfill'); var ERCToken = artifacts.require("./ERCToken.sol"); var Proxy = artifacts.require("./...
1
vote
1answer
260 views

Network time discrepancy affecting sync

I'm trying to deploy a contract to the Ropsten testnet using Truffle. Already tested on testrpc, worked smoothly. I keep getting the error "Exceeds block gas limit" when I try to deploy to testnet. ...
5
votes
1answer
2k views

How to deploy truffle contracts to Rinkebey?

What are the parameters that I have to specify to be able to deploy solidity contracts using Truffle in the config file? I am using Metamask to store test ether and have a unique mnemonic to define ...
1
vote
1answer
574 views

failure to verify truffle compiled contract on ropsten.etherscan.io

Recently just pushed my first smart contract from truffle to the ropsten testnet. As you can see from my terminal output below it compiles and was migrated with no problem: Was broadcast to the ...
2
votes
1answer
3k views

How to manually initialize a truffle project? (“truffle init”)

I cannot run truffle init on my company PC. (see Cannot run truffle behind proxy?). I used a network sniffer and found that the connection was reset when trying to establish an SSL connection to ...
1
vote
1answer
661 views

How to generate consistent hash value with Solidity within Truffle?

I would like to generate hash value within Truffle using the web3.sha3() function and the hash value is required to be consistent with that one generated in Solidity. The basic example is sha3(uint256(...
1
vote
2answers
1k views

increment contract value with console call on truffle / testrpc, variable is not persistent

What I want to do is make a smart contract which has a variable that can accrue value. I'd like to have it start off as 0, and then increment it, while periodically checking to verify that my calls to ...
1
vote
0answers
281 views

Using create migration primitive with truffle

I am following this guide doing custom migrations with truffle. When I run truffle create migration deploy_hello_world it creates this path migrations/1501429988_deploy_hello_world.js/migration.js. ...
1
vote
1answer
302 views

How to create conditional unit testing with truffle

I've been using truffle for unit testing and I can't find a way to execute two excludent tests. I mean, I'm creating an ICO contract and my tests depend on lower and upper cap limit, start and end ...
0
votes
0answers
215 views

How to deploy smart contract using truffle , metamask with ropsten network [duplicate]

This question is an extension of Deploying to testnet using Truffle and Metamask Need to deploy smart contracts over ropsten testnet that connected through metamask . I am using truffle framework to ...
0
votes
1answer
316 views

truffle init webpack on Heroku

I'm having a hard time exporting the Truffle sample app on Heroku. I'd like to use it with Metamask. I tried simply pushing the code from my local machine (where the code is working) adding the ...