Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
6
votes
3answers
1k views

testrpc, contract creating contract not mined?

I'm trying to develop a contract that creates a contract (factory/worker, faucet pattern). Think my issue may be with the tools I'm using: testrpc (local blockchain) Remix Browser Solidity (connected ...
5
votes
2answers
252 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); <- ...
5
votes
1answer
385 views

Truffle error “Don't set config.from directly”

I have parity running on my mac and I can start it with parity --rpcaddr 0.0.0.0 --rpcport 8547 --port 30305 --rpccorsdomain '*' --rpcapi "eth,net,web3" Once It's all sync'd up I then make a new ...
4
votes
1answer
2k views

The send transactions “from” field must be defined!

I am trying to call a function of a contract that has been deployed to Ganache. I am trying to call a function that makes payouts to a few addresses and can be called by owner only. When I am calling ...
4
votes
2answers
4k views

Truffle — Microsoft JScript runtime error [duplicate]

Running truffle from command line gives me this Windows 7 popup message: While init runs successfully. I see file truffle.js in my project folder. How can I handle this gently?
4
votes
1answer
972 views

Truffle Dapp Deployed Contract Access

Which function we need to use in truffle for the communication of second Dapp to the contract deployed on blockchain by first Dapp, because contract deployed by truffle is not accessible by geth node. ...
4
votes
2answers
1k views

truffle deploy to geth failing, generating “receipt not found” repeatedly from geth

I've just installed truffle on an ubuntu virtualbox, and it is failing to deploy to a geth dev setup. Geth gives me a never-ending receipt not found for transaction ...
4
votes
3answers
1k views

Truffle v5 runs out of gas but Truffle v4 deploys the contract

Truffle v4 used to deploy the contract successfully, but Truffle v5 truffle migrate command fails. My process to deploy: 1) delete buidl/ folder 2) truffle compile 3) truffle migrate Truffle v5 ...
4
votes
1answer
8k views

how to know the contract address which truffle is deploying with

I am using truffle migrate --reset --compile-all to deploy the contract to local network but in order to use new web3.eth.Contract(jsonInterface[, address][, options]), i should be able to know ...
4
votes
3answers
1k views

Deploying contracts on geth returns Error: connect ECONNREFUSED 127.0.0.1:8545

I'm using truffle (which uses pudding) to deploy contracts to my testrpc. No I'm running a geth instance locally with: geth --mine -rpccorsdomain "*" --ipcapi "admin,eth,miner" --rpcapi "eth,...
3
votes
1answer
649 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 ...
3
votes
2answers
558 views

simple dapp with React “issues with solidity”

i am trying to build a simple app (will improve once i get the simple one to work)I created a new Reactapp, added both the contracts and migrations directories and i use ganache and metamaks. I have ...
2
votes
4answers
3k views

Unable to install Truffle - Command Not Found

I am unable to install Truflle on my Windows 10. I am running latest versions of npm and node. I have tried uninstalling and then reinstalling but it still doesn't work. I have installed Truffle ...
2
votes
1answer
1k views

Web3 not being detected - google chrome extension

I am working on a google chrome extension that operates when a user opens up a new tab. Upon opening a new tab, my dapp should connect to the user's web3 provider. However, no web3 is being detected. ...
2
votes
1answer
890 views

Is it possible to divide my crowdsale contract into multiple files in order to solve gas issue?

I'm trying to deploy a crowdsale contract, which is using open zeppelin, on ropsten network but I got gas related error. The error says "please check your gas amount". How can I solve it? I think this ...
2
votes
1answer
2k views

Deploying to testnet using Truffle and Metamask

Is it possible to deploy a smart contract developed using truffle to testnet using just Metamask (without a local eth client instance running)? I tried importing the private key of metamask wallet to ...
2
votes
1answer
581 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 ...
1
vote
1answer
307 views

Why the balance that I see in the Ropsten isn't reflected in Truffle console?

This is my account #1: http://ropsten.etherscan.io/address/0x6bc701e7c3b642fc12a3a6f7d1144b8200a26401 and I sent some ETH to account #2: https://ropsten.etherscan.io/address/...
1
vote
1answer
584 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 ...
1
vote
1answer
44 views

How could return events of specific args?

In my solidity contract, I just have one event which is: transferOwnerShip (uint id, address indexed newowner); and I want to filter the events log in order to retrieve only the events that belong ...
1
vote
0answers
395 views

Truffle v3.2.5 migration error: contract code couldn't be stored

I'm using Truffle 3.2.5 and Parity to try and migrate a project to Ropsten. I've tried changing the gas amount per the error's advice. I'm running a full Parity node on the same machine, so my truffle ...
1
vote
1answer
1k views

Cannot run truffle behind proxy? [duplicate]

I've installed truffle and related software on my office PC. I've set the proxy server for node.js. The truffle init got the following error. Is it proxy issue? H:\work\eth> truffle.cmd init ...
1
vote
3answers
1k views

“Truffle test” fails in petshop tutorial

I don't know what this error means or how to fix it. I try to follow the tutorial located here and when I get to the point where I have to run "truffle test" I get the following error. with ...
1
vote
1answer
36 views

Truffle Javascript tests won't change Contract State (Contract State won't Change)

I reviewed a similar answer but it didn't work. Right now I'm starting with an Example trying truffle, I did a small Echo project based on the Pet Store Box from Truffle. And i'm having some problems: ...
1
vote
1answer
358 views

Transaction not found after 50 blocks on mainnet

I updated geth & truffle today. Now I'm getting "Transaction not found after 50 blocks" when trying to deploy to mainnet. I tried setting my gas higher than anything on http://ethgasstation.info/...
1
vote
1answer
469 views

Truffle Drizzle ContractData call keccak256 error

I started with truffle unbox drizzle then made use of my contract. I can make use of the ContactForm without error in App.js: <ContractForm contract="TheContract" method="addData" labels={["...
1
vote
1answer
596 views

Undefined in truffle-contract initialization

why I always have undefined from contract(_contract).setProvider(this.web3Provided); Component: import React, {Component, PropTypes} from 'react'; import { default as Web3 } from 'web3'; import { ...
1
vote
1answer
1k views

Setting up private network w Geth, can't unlock account and deploy contracts

I have set up a private network with Geth with the following command: geth --datadir="PathToDatadir" --mine -minerthreads 2 -verbosity 3 -maxpeers 5 --ipcapi "admin,debug,eth,miner,net,personal,shh,...
1
vote
1answer
422 views

Truffle Tutorial pet-shop with test-rpc adopt button doesn't work

I have followed the tutorial exactly like they showed in their page: http://truffleframework.com/tutorials/pet-shop except the following changes because they use "ganache" (currently bugged and ...
1
vote
1answer
1k views

How to migrate a contract that has a constructor parameter of address type via truffle

as the official simple of solidity contract SimpleAuction { … function SimpleAuction(uint _biddingTime, address _beneficiary) { beneficiary = _beneficiary; auctionStart = now; ...
1
vote
1answer
362 views

Setting up a truffle project

I'm reading truffles's docs and am trying to build a custom project with a contract and a few test cases (written in a js file). I need to do this because testrpc is (considerably) faster than geth. ...
1
vote
1answer
245 views

Unit test in truffle fails

pragma solidity ^0.4.23; contract adding{ uint256 public total; function add(uint256 val1,uint256 val2) public returns(uint256){ total = val1+val2; return total; } } The above code ...
1
vote
1answer
521 views

Error: The contract code couldn't be stored, please check your gas amount or exceed gas limit

I keep getting the error please check your gas amount or exceed gas limit. The truffle config file module.exports = { networks: { development: { host: 'localhost', ...
1
vote
1answer
375 views

Account balance does not decrease after send ether

For example here is my example function in smart contract: function adoptCreeptomas(uint256 beastQuantity, address referrer ) public payable whenNotPaused { msg.sender.transfer(50); } And then I ...
1
vote
1answer
382 views

Accessing/Modifying Options Parameters in Contract

I'm using truffle and metamask to deploy a very simple contract that enables the transfer of ether from one test account to another. How do I use my JavaScript file to access the options parameters ...
1
vote
1answer
418 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: ...
1
vote
1answer
211 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
2answers
1k views

Identifier not found or Not Unique testing contract truffle

Created a simple HelloEthereum.sol contract: pragma solidity ^0.4.17; contract HelloEth { string message; function HelloEth() public{ message = "Hello Ethereum!"; } ...
1
vote
2answers
908 views

How to Compare Two Arrays in Solidity

How can I compare two arrays in Solidity (with Truffle test framework)? MyContract.sol -- pragma solidity 0.4.19; contract MyContract { uint[] public myArr; MyContract(uint[] _initArr) ...
1
vote
3answers
430 views

When creating a new contract I receive a “contract code couldn't be stored” error but the contract is still created

Sale.new({ from: state.account, value: value, gas: 4000000 }).then((instance) => { // do something with instance }).catch((err) => { alert(err) }) When the above code runs I sometimes ...
1
vote
2answers
502 views

TypeError: Name has to refer to a struct, enum or contract when compiling a contract

I'm getting a weird error while compiling a contract in Solidity, I think it's because I'm using Solidity v0.5.0 and it was written with a previous version. Here's the code: pragma solidity ^0.4.2; ...
1
vote
0answers
72 views

error in WebSocket connection

error : browser-sync-client.js?v=2.26.3:15 WebSocket connection to 'ws://localhost:3000/browser-sync/socket.io/?EIO=3&transport=websocket&sid=mW3 please i need help on this. i was getting ...
1
vote
1answer
803 views

HelloWorld.deployed().balance.call() is not working

I entered the command correctly but I am still getting this error: TypeError: Cannot read property 'call' of undefined at evalmachine.:1:19 at ContextifyScript.Script.runInContext (vm.js:35:29) at ...
0
votes
1answer
553 views

Cannot connect to testrpc

I have a testrpc running on a virtual machine (Ubuntu 16.04) and it works properly when I interact with it using the truffle console. My only goal is to call a smart contract that simply sends ether ...
0
votes
1answer
129 views

Getting error in the contract code “please check your gas amount”

I am getting this error: Error: The contract code couldn't be stored, please check your gas amount. This is when I am importing one extra contract with the name of TimedCrowdsale from ...
0
votes
0answers
58 views

command line brings up code instead of running commands [duplicate]

I am trying to run truffle commands on commandline but it brings up the code file instead like this
0
votes
0answers
28 views

Cant call solidity function from app.js while sending transaction

Solidity function As i want to call function so that oraclize can send query function betOnTeam(uint team) payable public { update(); emit LogInfo("Oraclize query was NOT sent, ...
0
votes
1answer
441 views

Truffle Exec Gets Stuck [closed]

I want to exec a script in the truffle console. script const artifacts = require('./build/contracts/Message.json') const contract = require('truffle-contract') const Message = contract(artifacts); ...
0
votes
1answer
393 views

Upgrading to solidity version 0.5.0 getting deployment failed error with same smartcontract perfectly deployed on 0.4.24

The same smart contract is running smoothly in solidity version 0.4.24 but now when I update the solidity version and solving a lot of bugs inside my smart contract I intended to deploy that in ...
0
votes
0answers
39 views

Truffle test including mainnet contract - Error: Cannot create instance of Whitelist; no code at address

Problem with the error Error: Cannot create instance of Whitelist; no code at address 0x6198149b79AFE8114dc07b46A01d94a6af304ED9 How do I have to setup truffle so that I can run a test which includes ...