Questions tagged [truffle]

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

567 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
0answers
207 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
204 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
81 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
0answers
170 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
123 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
71 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
0answers
622 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
237 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
200 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
196 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
75 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
1answer
265 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
168 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
2answers
83 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
174 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
2answers
151 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
45 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
334 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
0answers
480 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
244 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
246 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
680 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: ...
0
votes
1answer
330 views

Passing command-line arguments to 'truffle test'

I have a JS script which I pass to truffle test from command line: truffle test my_script.js I would like this script to take an input argument (retrieved via process.argv[2]). Does `truffle ...
0
votes
1answer
870 views

Error encountered, bailing. Network state unknown. Review successful transactions manually. Error: VM Exception while processing transaction: revert

Googled around and nothing could solve this error. truffle migrate --network development Using network 'development'. Running migration: 2_deploy_contracts.js 1520374082 1522102082 1000 '...
0
votes
1answer
452 views

problem starting ganache

I'm using truffle with ganache GUI. It worked fine at first, but now I am unable to start it. (I made it executable) When I run ./ganache.AppImage I get this message: installed: X-AppImage-BuildId=...
0
votes
1answer
292 views

Can I find constructor arguments from truffle artifact?

I'm in the process of verifying my contract on Etherscan. Etherscan asks for ABI-encoded constructor arguments during the verification process, though I was a bit silly and don't quite know what they ...
0
votes
1answer
187 views

Loading truffle library in remix browser IDE

Besides writing smart contracts in the browser, I would also like to write my test in this IDE. Any suggestions how to load the truffle files in http://remix.ethereum.org? I appreciate your help!
0
votes
2answers
331 views

how to debugg truffle tests with built in debugger

So I'd like to use the commandline debugger in truffle. To test I simply run truffle test I have an empty truffle.js file. I can get my transaction ID in the javascript tests. When I run: ...
0
votes
0answers
442 views

Running Npm init on powershell but its stuck and I can't proceed

I can't run truffle commands on windows powershell so I went to do the steps that I got here. However npm init got me stuck and I can't proceed: Here is the stuck screen: EDIT: After I uninstalled ...
0
votes
1answer
304 views

Truffle test: error when passing more than one file as input

I have several test files, which I can successfully execute via truffle test (having started a ganache-cli process). For example: ganache-cli truffle test test/test1.js truffle test test/test2.js ...
0
votes
1answer
318 views

How can i connect external AWS server's truffle in browser?

I have deployed geth, truffle, testrpc whichever needed in live AWS server. All the configurations are working properly. I have initiated 'truffle develop' and 'npm run dev'. Both are working fine. ...
0
votes
0answers
235 views

How can I write a test that fails a “requires(…)” in Solidity?

If calling a function in a contract would result in a failed require the whole test passes, even if the asserts are incorrect. This is extremely confusing. Look at the simple example below, which ...
0
votes
1answer
291 views

Comparing msg.value using javascript test always fails

So I have this solidity function: function claimGoodTest(uint256 typeId) public payable { if (msg.value < 4000) revert(); } I test it with the following: var result = await contract....
0
votes
0answers
433 views

Add accounts to truffle test environment at run time

I would like to add the keys and unlock some additional addresses at runtime for my truffle tests. Why? I have the need to create address from a seed generated elsewhere in my test so the private ...
0
votes
2answers
179 views

Program for interacting with deployed contracts via a GUI?

So I've deployed a contract to Rinkbey using truffle, and now I'd like to play with it. I'd like something that builds a GUI for me from the ABI like EthFiddle does. I just want something that lists ...
0
votes
1answer
425 views

Running A Smart Contract With Two Nodes on Truffle

We have installed truffle to two nodes and we initialize our private blockchain with: $geth --datadir node init genesis.json Then we run geth on both nodes with: $geth --datadir node --nodiscover -...
0
votes
1answer
211 views

Trouble while installing truffle-contract module

When I run the command sudo npm install truffle-contract it gives me this error: npm ERR! code 1 npm ERR! Command failed: /usr/bin/git clone -q https://github.com/debris/bignumber.js.git /home/ubuntu/...
0
votes
1answer
408 views

Empty/null address handling in truffle pet shop tutorial

I am trying out the Truffle Pet Shop tutorial and it seems to be working all well except for a small issue. My solidity function getAdopters() returns an address[16] function getAdopters() public ...
0
votes
1answer
55 views

Unable to change the length of a global 2D storage array

I am facing difficulties changing the length of a global 2D storage array. It seems to be working correctly on Remix IDE, but when I try to test it on ganache-cli (formerly known as testrpc) - either ...
0
votes
1answer
98 views

Truffle testing not reading contract

Here's my solidity: contract Oracle { mapping(uint => uint) oracle_values; modifier onlyOwner { require(msg.sender == owner); _; } function Oracle() public { owner = msg....
0
votes
0answers
428 views

Truffle: errors when I try to access variables of a ERC20 token contract

I got a few errors when I try to access variables of a ERC20 token contract. The contract is the "Sample fixed supply token contract" from https://theethereum.wiki/w/index.php/ERC20_Token_Standard ...
0
votes
1answer
148 views

Deploying with Truffle

I deployed a contract through remix and then I run the following code MyContract.deployed() .then(instance => { c = instance; return c.getCreator(); }) .then(result => { ...
0
votes
1answer
381 views

Error: Invalid address

I keep encountering an error saying invalid address. Why is this? const Web3 = require('web3'); const contract = require('truffle-contract'); const MyContract = require('../build/contracts/...
0
votes
1answer
60 views

When closing node (geth ropsten) I cannot save created accounts

I am pretty new to this. I downloaded the ropsten blockchain using a geth command line. Then, using Truffle, I created an account, but when I closed my node (ctrl - c on the geth command line) and ...
0
votes
0answers
171 views

Log data along with transactions on the blockchain

I have a smart contract and on my web interface I'd like to display the 5 latest transactions. Currently these include any ether being sent to my contract which are retrieved using web3.eth....
0
votes
1answer
344 views

Truffle testrpc - public variable getter method error

I'm running into a weird issue where I couldn't retrieve the value of a public variable in truffle console. It's a public variable used as a counter to track the number of records added. I spent ...
0
votes
0answers
26 views

What's the best way to monitor contract variables whilst developing?

I'm running a contract locally using Truffle, is there a way I can keep track of the variables in real-time whilst interacting with it on the front-end (Web3). I guess what I'm looking for here is ...
0
votes
1answer
427 views

Accessing Web3 in trufflebox's react-auth-box

Hi I am using trufflebox boilerplate react-auth-box. Created a new component called Foo where I am trying to access the web3 object that has been mapped from Store to this.props. However the console....
0
votes
0answers
201 views

Why does truffle console not start?

Trying to follow the tutorial on Medium, I would like to open the truffle console (Ubuntu 16.04). I get the following output: mzh@021-voting $ truffle console Error: Invalid JSON RPC response: "" ...