Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
62 views

Why account balance can decrease when gasPrice is 0 and msg.value is 0?

It also spends pretty large amount, which doesn't seem to be related to gasUsed Contract: pragma solidity ^0.4.24; contract Test { bool i; function hello() public { i = true; } }...
0
votes
0answers
55 views

Truffle contract compilation from STDIN or something like this

My contracts have some methods that used only for testing i.e. exposes some internal contract data and I do not want to deploy it to live network. for now Solidity does not supports C-style ...
0
votes
1answer
113 views

web3 js send ether not broadcasting on main net

I am using folowing code sample to send ether between 2 of my own accounts, both have enough funds: "use strict"; var Web3 = require('web3'); var Tx = require('ethereumjs-tx'); // Show Web3 where it ...
0
votes
0answers
91 views

not able to fetch bool value from contract using truffe

Index.html: <input id="txtUser" type="text" placeholder="Enter user name" /> <button id="btnAuthenticate" onclick="App.Authenticate()">Authenticate</button> contract: function ...
0
votes
1answer
1k views

Truffle Error : VM Exception while processing transaction: revert

I am trying to call following function of smart contract from App.js: function addCandidate(bytes32 _name, bytes32 _party) public{ //require(msg.sender == votingAdmin); //if(msg.sender != ...
0
votes
2answers
643 views

Error: VM Exception while processing transaction: revert: When trying to migrate a truffles initialised contract?

I'm trying to migrate/deploy a multi-signature contract through truffles, I am receiving "Error: VM Exception while processing transaction: revert" when the contract starts to migrate/deploy. ...
0
votes
0answers
73 views

Truffle Error: VM Exception while processing transaction: revert [duplicate]

Issue:Not able to return the input string(ofcourse it works in remix). Below is the contract. pragma solidity ^0.4.17; contract samplecontract { function viewuserName(string name) public ...
0
votes
0answers
38 views

How to get 100k ether in testrpc? [duplicate]

Id like to run some unit tests in truffle with huge sums of ether (over 30k ether), but my default accounts only seem to have 100 ether in them. Does anyone know how to increase this? Thanks
0
votes
0answers
42 views

Return remaining ether for user: user lost too much ethers

I writing a smart contract using Truffle and testing for that. I current meet this problem: I send 0.5 ether to smart contract. After that, contract get 0.0016 ether. (tested) Then transfer again ...
0
votes
1answer
113 views

Testing Contract Runs Out of Gas Truffle

Trying to figure out why I get an out of gas error in my truffle tests when I have the following function: function updateField(address someAddress, uint256 someId, bool someBool) public { ...
0
votes
2answers
88 views

Fetch the last state of particular asset for particular date

I have one smart contract, in which I am doing mapping of machine id and user id mentioned as below: mapping(bytes32 => uint256) public machineAllocs; machineAllocs[machineId] = userId; Now, I am ...
0
votes
0answers
613 views

Truffle Test Sell Event Assertion Error

When I test my selling event in truffle.So, the following error comes:- The solidity code is :- event Sell(address _buyer, uint256 _amount); // Buy token function buyTokens(uint256 _numberOfTokens) ...
0
votes
0answers
280 views

Local geth node for Ropsten keeps crashing and lost data

I am creating a local geth node participating in Ropsten to test my smart contract with other smart contracts such as ENS and Oraclize. Somehow I keep running into problem of geth crashing and losing ...
0
votes
2answers
612 views

How to access Truffle deployed contracts with app's javascript code?

I have some smart contracts deployed with Truffle on the local Ganache network, but I don't know how to access it with the app's javascript in order to make function calls to the contract. How would I ...
0
votes
0answers
340 views

How to use MetaMask Web3 with Truffle promises

My project uses the react truffle box, and I use the getWeb3 method that comes with it. After calling that method, I store the web3 object on Redux's state tree via the action creator storeWeb3. ...
0
votes
1answer
199 views

which wallet is usable with ganache test-rpc?

I tried metamask, but unable to send ether between accounts because metamask is trying to estimate gas and gets stuck :( myetherwallet doesn't save my seed so I need to enter it all the time
0
votes
0answers
202 views

Invalid op code from truffle console

I'm following this tutorial for a simple contract. https://blog.zeppelin.solutions/the-hitchhikers-guide-to-smart-contracts-in-ethereum-848f08001f05 After running testrpc, compiled with truffle ...
0
votes
1answer
199 views

How can I use truffle to deploy my contract to a local testnet (not testrpc)?

I followed the steps in the following link to create a local Ethereum testnet, but now I want to deploy a contract to "MyTestNetNode": https://medium.com/@WWWillems/how-to-set-up-a-private-ethereum-...
0
votes
1answer
80 views

Can't use token variable's method at contract that inherit zeppelin crowdsale?

Calling the method of Crowdsale's "token" on the source that inherited Crowdsale of zeppelin v1.8.0 inevitably causes "out of gas". Error: Error: VM Exception while executing eth_call: out of gas ...
0
votes
1answer
892 views

msg.sender.transfer(purchaseExcess); failure in solidity test

Got an exception at the line msg.sender.transfer(purchaseExcess); in my truffle solidity unit test. Any idea the reason? my contract code: function purchase(uint256 _tokenId) public payable { ...
0
votes
0answers
159 views

How to run a truffle unboxed example

I first started GUI version of Ganache. Then I run the following commands to try pet-shop. http://localhost:3002/ is then opened in my browser, When I click "Adopt" for a dog, I see no transactions in ...
0
votes
1answer
1k views

How to interpreter result of web3.eth.getBalance

I got following result from getBalance check: truffle(default)> web3.eth.getBalance('xxxxxxxxxxxxxxx') Can anyone explain what does it means and where the value of ether: BigNumber { s: 1, e: 0, c: [ ...
0
votes
1answer
117 views

A contract works in remix but not when used with truffle

Below is the contract: uint32 firstTimeUserPoints=10; struct struUser{ string orginalName; string originalKshoplink; string orginalDocumentConvention; bool ...
0
votes
0answers
70 views

Gas + balance invariant not maintained on simple contract call

In order to understand reentrancy attacks, I'm using the following Honeypot contract: pragma solidity ^0.4.17; /// @title ReentrancyPot - A contract vulnerable to reentrancy contract ReentrancyPot { ...
0
votes
2answers
272 views

Metamask Transaction does not appear in Ganache

I'm trying to call the storeQueryResults() function of my smart contract in the following way: storeInput: function(event) { var queryResultHandlerinstance; App.contracts.QueryResultHandler....
0
votes
0answers
596 views

Listen to emitted event from front-end

Could somebody please provide me code that works to listen to an event from your front-end. It was working for me and there are a few tutorials that I've tried now to fix it but it still persists with ...
0
votes
0answers
228 views

In truffle Console Works, but when called in Javascript, Metamask hangs, Solidity contract doesn't update

So I have a function where I am asking the user to send two strings and 1 ether at the same time. When I execute the function in the console, the solidity contract is updated. When I execute the same ...
0
votes
1answer
182 views

by using truffle & metamask deployed my contracts, but a error occurred when sending a transaction on web

This is the err information. This is the web I built. Now the problem you see is that when I click the vote button, pay the gas, and send a transaction, but than error occurred. I write my program ...
0
votes
0answers
185 views

Truffle Drizzle: Passing String address results in Invalid Number of Parameters

I have a view function in my contract that takes an address as a parameter and returns a uint: function getNumber(address _address) public view returns (uint) { require(_address != 0x0); ...
0
votes
1answer
63 views

Contract testing works in solidity but fails in truffle - testrpc

I have a contract like this: PublishService.sol, the strings.sol is taken from here. pragma solidity ^0.4.0; import "./strings.sol"; contract PublishService { using strings for *; struct ...
0
votes
0answers
100 views

Error “The contract code couldn't be stored, please check your gas amount” [duplicate]

UPDATE: I manage to figure out what's wrong is in this line var byteCode = compiledCode.contracts[':TestStorage'].***byteCode***; and it should be var byteCode = compiledCode.contracts[':...
0
votes
1answer
258 views

I tried to deploy a contract on Ropsten, but always get the following error

PS D:\nodejs\rff\metacoin> truffle --network ropsten migrate Using network 'ropsten'. Running migration: 1_initial_migration.js Deploying Migrations... Error encountered, bailing. Network state ...
0
votes
1answer
222 views

Cannot use Metamask with my smart contract

I am unable to call my smart contract in Metamask over Ganache. These were the steps I took: developed the contract tested it successfully using truffle test set up a Ganache network and migrated ...
0
votes
1answer
165 views

Why does the transaction stay in queue from more than 240 second

I am running quorum nodes via the Quorum-maker script, and when trying to call functions from my already deployed smart contract, I get this error : Transaction ...
0
votes
1answer
279 views

ganache-cli issue

Until I switched to ganache-cli from testrpc things were working fine. Now I ran testrpc and 10 accounts are displayed as shown below. But I am unable to deploy any contract. it is stuck after this- I ...
0
votes
2answers
71 views

Having trouble figuring out Truffle testing with Javascript

I've started unit testing my contracts with Truffle (using Javascript). I'm fairly new to Truffle and Mocha both, and while I've tried to follow the tutorials, I'm struggling to follow exactly what's ...
0
votes
2answers
159 views

Empty bytes32[] in truffle console

I am trying to get from truffle develop console an array of identifiers using a custom get function but the return array is []. Here is my contract: pragma solidity ^0.4.18; contract MyInfo { ...
0
votes
1answer
688 views

React/Truffle: How to call a function with passing a variable?

I have a React component within which a web3js function queries numbers from Ethereum by using getNumber() function. I want to call another function called setNumber() that takes one uint256, by ...
0
votes
1answer
143 views

Drizzle component returns BigNumber

I am using the following Drizzle (Truffle) component to call a function from a smart contract: <ContractData contract="Market" method="priceOf" methodArgs={this.props.id}/> The result is a ...
0
votes
1answer
599 views

Error: Provider not set or invalid

I'm not able to connect metamask with nodejs. var Web3 = require('web3'); var web3 = new Web3(); if (typeof web3 !== 'undefined') { // Use Mist/MetaMask's provider web3 = new Web3(...
0
votes
1answer
43 views

problem with sequence deployment

I followed this way of deploying contracts using truffle. // Deploy A, then deploy B, passing in A's newly deployed address deployer.deploy(A).then(function() { return deployer.deploy(B, A.address)...
0
votes
1answer
629 views

Ganache with Metamask

Currently I'm using Ganache desktop application for ether transactions and I'm able to view transaction log details in it. But I need to connect it with metamask so that while an ether is transferred, ...
0
votes
1answer
304 views

Deploying new contract inside truffle test case

I was trying to transact between two contracts inside my truffle test case. But not been able to do it. The second contract instance comes back undefined always. As per the truffle documentation, ...
0
votes
3answers
805 views

Implementing a Simple Voting DApp on Ethereum Blockchain

I am new to Ethereum, Truffle and Solidity. I am looking for a good resource to get started on implementing a DApp for Voting on Ethereum Blockchain. Could you please point me to the correct resource? ...
0
votes
0answers
468 views

Contract has not been deployed to detected network when deploying to main net

I'm trying to deploy a smart contract to the main Ethereum network, and I'm having trouble actually getting my front-end to work. I'm using Truffle, Geth, Infura, and web3js. var HDWalletProvider = ...
0
votes
1answer
241 views

Error: The contract code couldn't be stored, please check your gas amount during deploy

I know this issue was discussed before several times, but I cant get the solution to my problem. I'm trying to deploy a contract with Truffle on Ganache. During the deployment in 2_deploy_contracts....
0
votes
1answer
159 views

The contract code couldn't be stored, please check your gas amount while deploying contract

I'm trying to deploy 3 contract in 2_deploy_contract (I deploy all 3) but after the first is deployed I get the following error : The contract code couldn't be stored, please check your gas amount.
0
votes
1answer
25 views

If the contract deploy was recorded as successful on etherscan does that mean the constructor executed?

I've got multiple large contracts. I've been able to deploy to Rinkeby with truffle fine after about 2 or 3 tries with 2 gwei. I tried two times now to deploy to the mainnet. Each time I get invalid ...
0
votes
1answer
238 views

Truffle “Replacing” durring migration

what does "Replacing" mean in migration? a simple test contract C.sol: pragma solidity ^0.4.17; contract C{ uint public ConstructorUint; function C(uint SetConstructorUint)public{ ...
0
votes
1answer
662 views

Out of gas on truffle test

I am following the tutorial on http://truffleframework.com/tutorials/pet-shop I am using Ganache for testing, where i am also deploying the tutorial contract. 1) TestAdoption "before all" hook: ...