Questions tagged [truffle]

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

556 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1
vote
0answers
385 views

“truffle migrate” running all migrations everytime

I have a very weird behavior happening whenever I run "truffle migrate". Ideally, as per the documentation, it states: This will run all migrations located within your project's migrations ...
1
vote
0answers
234 views

Invalid number of arguments to Solidity function

I have a function in my contract. First takes argument, the second one does not. Everything works fine until I change the name of the second one into the same one as the first one and create ...
1
vote
0answers
1k views

Error: VM Exception while processing transaction: revert

Getting a Error: VM Exception while processing transaction: revert error when migrating or testing a tutorial smart contract on Truffle in the terminal. I'm currently going through a tutorial creating ...
1
vote
2answers
1k views

unable to uninstall truffle

I am unable to uninstall truffle using this command npm uninstall -g truffle Current ver is 4.1.5 , I want to uninstall and reinstall v4.1.4 as code seems to be breaking while compiling and v4.1.4 ...
1
vote
1answer
124 views

are truffle tests inconsistent?

Im currently testing my contract and I've written truffle tests in js for the first time. Rarely (1 out of 10 times?) I get unexpected results: This is the code structure I use: var contract = ...
1
vote
0answers
155 views

Truffle migrate:The method eth_accounts does not exist/is not available

I have both my local geth node and geth console running in the background. geth console command : geth --rinkeby --rpc --rpcapi = "personal,eth,network,web3,net" --ipcpath "~/Library/Ethereum/geth....
1
vote
0answers
300 views

Error: authentication needed: password or unlock when deploying a contract with truffle

i am using angular with truffle. I am trying to deploy a contract through truffle migrate. here is my 2_deploy_contracts.js var contractFacotry = artifacts.require('./contractFactory.sol'); module....
1
vote
1answer
557 views

Problem with truffle console : Cannot read property 'call' of undefined

I have a problem when executing the code HelloWorld.deployed().balance.call().then(console.log) This error introduced: Cannot read property 'call' of undefined This problem is similar to this ...
1
vote
0answers
283 views

Drizzle React Component ContractData for array returns empty

<ContractData contract="TheContract" method="getData" methodArgs={[accounts[0], "0", { from: accounts[0] }]} /> and a contract view function function getData() public view returns (...
1
vote
2answers
186 views

How to inherit an interface?

This code works - taken from Wiki - pragma solidity ^0.4.18; contract ERC20Interface { function transfer(address to, uint tokens) public returns (bool success); } contract FixedSupplyToken is ...
1
vote
2answers
168 views

How secure is an Oracle?

I am working on oracles. I saw this link - https://kndrck.co/posts/ethereum_oracles_a_simple_guide/ The code works, I tested it. But what is the issue to me, is the code actually secure? Can someone ...
1
vote
0answers
134 views

Transaction runs out of gas with MetaMask on a simple function

MetaMask calculated automatically the gas needed for every transaction, but for one in particular, it always returns the error "out of gas" if I use the default amount. The function is really simple ...
1
vote
1answer
472 views

Latest Zeppelin SampleCrowdsale.sol token moved outside of contract?

Really new to Solidity, but I was following this guide: https://blog.zeppelin.solutions/how-to-create-token-and-initial-coin-offering-contracts-using-truffle-openzeppelin-1b7a5dae99b6 Only, I used ...
1
vote
0answers
129 views

Zeppelin Solidity Destroy and Send

I wan to implement zeppelin's destructible in my contract so destroyAndSend() after a function finishes executing, like this (pseudo-code): pragma solidity 0.4.19; import 'zeppelin-solidity/...
1
vote
1answer
226 views

Truffle test case to unit test withdrawal pattern

How can I test the withdraw() function in a truffle javascript test case for the below contract? The problem is, If I use the msg.sender from the same contract, the before and after balance will be ...
1
vote
0answers
80 views

Unexpected revert during selfdestruct

I experience unexpected revert in the line where I invoke bidEnd. it("should create second contract and remove it", function(done) { BiddingsFactory.deployed().then(async function (...
1
vote
1answer
41 views

What are the inputs to the truffle Txn?

I am testing truffle now and I want to know more about what it deploys and how. It seems to use two txns. I have some results - Running migration: 2_deploy_contracts.js Deploying CA12... ... ...
1
vote
0answers
130 views

DocstringParsingError when using natspec with internal or private functions

Ethereum's natspec mentions: You are welcome to use similar comments for your internal and private functions, but those will not be parsed. However, when documenting internal functions, I get ...
1
vote
0answers
71 views

Blocking an application untill metamask shows the transaction is complete

I’m creating a DAPP where I’m using Metamask for submitting the transaction. I have a requirement where when a user accepts/submits the transaction, a modal needs to appear on the page, blocking the ...
1
vote
0answers
269 views

Web3 Eth Filter does not seem to work

I am using Ganache as my test network and I am running React as my front end. My ComponentWillMount() is as follows: componentWillMount() { getWeb3 .then(results => { this.setState({ ...
1
vote
0answers
62 views

Issue downloading Truffle

I know that the command to download Truffle is 'npm install -g truffle'. When I enter this command using the command prompt, which website does it download the packages from? Does it download from ...
1
vote
1answer
209 views

No output when writing data to IPFS and storing its hash through Solidity

So I am using truffle. Following from Creating a form in IPFS for users to enter data [check the code in answer], doing some changes: Contract name - IpfsContract.sol test.js uses the following JSON ...
1
vote
1answer
998 views

rinkeby balance says 0 after syncing even though transaction shows ether was sent

I'm using truffle to deploy a contract on the rinkeby testnet Here is transaction info saying that my address received ether however as shown below, the balance still shows as 0. truffle(rinkeby)...
1
vote
0answers
224 views

How can I create or setup multiple accounts for Rinkeby in a Truffle environment?

I use ethereumjs-wallet along with truffle-wallet-provider to connect my Rinkeby account to Truffle: var rinkebyPrivateKey = new Buffer(process.env["RINKEBY_PRIVATE_KEY"], "hex") var rinkebyWallet = ...
1
vote
1answer
864 views

Can't connect to local rinkeby node from web3.js

I'm developing a Dapp using truffle and I need to connect to a contract that I uploaded on rinkeby using truffle migrate --network rinkeby. Problem is that I'm unable to connect to the rinkeby network ...
1
vote
0answers
30 views

Transaction to release ETH from contract not succeeding

I pasted my contract code below and have deployed to my testrpc. The whole purpose of this contract is to lock up ETH until a specified block number. After that block number is reached, it can be ...
1
vote
0answers
274 views

Testing smart contracts in Solidity

Testing smart contract Via another Testing Smart contract - X.sol contract X{ function reservePlace(string _name) public payable returns (bool isNotReserved) { // use _name to reserve it ...
1
vote
0answers
27 views

How to replicate the state of a deployed contract in development environment

I'm trying to debug a contract that has been deployed, and I'd like to have a debug version that has a contract state as close as possible to the version in production (variable values). The first ...
1
vote
0answers
359 views

Truffle delpoyment Error: unknown account

i am trying to deploy my smart contract on live network, i have successfully deployed the same contract on rinkeby but facing error while on live network, here is the detail 1 - Account balance 0....
1
vote
1answer
1k views

Javascript web3 calls Solidity contract function with extra parameter?

In the http://truffleframework.com/tutorials/pet-shop example, there is the following contract, and the function adopt(uint petId) has only one parameter. contract Adoption { address[16] public ...
1
vote
1answer
186 views

How do I deploy a contract via a contract factory in truffle?

The code below does not set the simpleStorage instance's value to 55, but identical code works when the contract is not generated via a factory
1
vote
0answers
220 views

Testing Contract Payable

Using truffle and truffle test I have the below test code: function testBuyItem() public { uint8 expected = 2; bytes32 expectedName = "Item"; Assert.equal(uint(8), uint(7), "Should ...
1
vote
0answers
385 views

Geth - Web3 : Invalid number of parameters for “MyMethod”. Got 0 expected 1!

I'm using Web3.js (@1.0) and not @0.2 This is really annoying ! My Private blockchain is running thanks to the following command : vgeth --datadir "T:\Programs\Ethereum\Own\" --networkid 2154 --rpc -...
1
vote
0answers
495 views

Token and Crowdsale contracts address problem

I'm testing the creation and deployment of ERC20 token + Crowdsale based on Open Zeppelin on the Rinkeby testnet using Truffle + Geth. The deployment went fine it seems, and through Metamask I was ...
1
vote
0answers
313 views

Truffle constant functions run out of gas, how to simulate a local node

I am new to solidity and web3. I am getting familiar with Truffle, testrpc and web3 1.x. I am also using React as a front end. I know that functions that don't change the smart contract state can ...
1
vote
1answer
700 views

Why do I get VM Exception while processing transaction: revert?

I'm trying to call a function from a contract I've created on ganache-cli through a javascript on a website. Here's the code of the java script: web3.eth.defaultAccount=web3.eth.accounts[0]; var poe ...
1
vote
0answers
255 views

Invalid number of arguments to Solidity function when calling call from unit test

I have a problematic unit test in a suite. It's pretty simple: it("SapienToken deployed with SPN symbol", async function() { let SPN = await SapienToken.new(TokenController.address, Owned.address)...
1
vote
1answer
114 views

How to call variadic function in erc223 contract

There is two transfer function in my contract, And i m trying to call transfer function of erc223 for transfer token to contract address using this function. Token.deployed() .then(function(i) { ...
1
vote
1answer
598 views

Invalid number of arguments error for getter function with no passed arguments

I am receiving this error when trying to call the getUsers getter function from the contract below: Invalid number of arguments to Solidity function. Running on Truffle in develop mode. mapping (...
1
vote
0answers
318 views

Truffle (4.0) test multiple contracts

I'm trying to test a contract that wrote and compiled, and I need to use another deployed contract to test it. I am writing a test for a specific contract and trying to invoke another deployed ...
1
vote
0answers
419 views

“Truffle unbox react” Not Working Properly

I am facing problems running the basic official setup of react and truffle. Here's what I did: truffle init truffle unbox react truffle develop truffle(develop)> compile truffle(develop)> ...
1
vote
2answers
2k views

Out of gas when executing contract via web3 js

I am having a trouble invoking contract via web 3 js in browser. I am using truffle develop and have migrated and run tests successfully. I am also getting the info when I console.log the contract....
1
vote
0answers
126 views

Transaction consumes more gas using MetaMask's injected web3

I have a simple contract: pragma solidity ^0.4.4; contract Counter { uint public count; function Counter() { count = 0; } function inc() { count++; } } And some javascript that ...
1
vote
0answers
133 views

Truffle: How to test for inheritance

I have a Contract B which should inherit from contract A. Using Truffle, how can I test that this is indeed the case?
1
vote
0answers
282 views

Separate contract calling mint from token contract

I have a standard ERC20 token contract with minting functions: pragma solidity ^0.4.11; import "./Stake.sol"; import "./Mint.sol"; contract Token is Stake, Mint { //omitted standard ERC20 text }...
1
vote
0answers
80 views

Solve Git Code Error Contract Crowdsale

I am getting the following error when doing truffle migrate on the following code: https://github.com/CoinFabrik/ico/tree/9ac3487b6103c96958cdabf8b9ce2071a7250cd8 Deploying Crowdsale... Error ...
1
vote
0answers
172 views

How to deploy contracts within the same Truffle project at different times

If I have a Truffle project with two different contracts in it, can I deploy them at two separate times? Can I run an additional command alongside truffle migrate that will allow me to deploy just one,...
1
vote
0answers
266 views

Adding payable to my contract constructor causes the contract deployment cost to be really high ~100 Ether

Here is an abstract/interface contract I created because I want to call this contract which will be deployed before my other contracts. It just holds the addresses of all the contracts I have deployed....
1
vote
0answers
689 views

How can I sign raw transaction generated by truffle?

I can create tokens by the following way. However, I want to sign raw transaction generated by truffle so that I don't need to store my private key online. How can I get raw unsigned transaction? $ ...
1
vote
0answers
55 views

TestRPC crashing

When I run my Truffle test suite locally with testrpc, testrpc sporadically fails with this error: eth_call /usr/local/lib/node_modules/ethereumjs-testrpc/build/cli.node.js:61262 db.get(key, { ...