Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [truffle]

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

0
votes
1answer
74 views

Testing balance of a contract

I'm trying to test the balance of the contract with truffle, but I'm obviously doing something wrong as the test passes. it("should check balance", function() { Lottery.deployed().then(function(...
3
votes
2answers
472 views

Truffle Compile with Solidity 0.5.0

I just upgraded my code to Solidity 0.5 and am trying to use the truffle framework with it. I did update my code in Remix and it does seem to work. The problem I have is that I am unable to compile ...
1
vote
4answers
1k views

Truffle Box at URL https://github.com/truffle-box/bare-box.git doesn't exist

I'm trying to initialize a directory with truffle init, but I'm getting the following error: Error: Truffle Box at URL https://github.com/truffle-box/bare-box.git doesn't exist. If you believe this ...
0
votes
1answer
11 views

Specify different solc compiler for different files in truffle?

I am using truffle, and have a number of x.sol files in the contracts directory, different files require different versions of the compiler - how do i deal with that? I think i SHOULD be able to do ...
0
votes
1answer
76 views

Truffle migrate code with library, interface and contract

Suppose that I have a token contract as follow. How can i write the new migration.js file in truffle to deploy the contract? TestCoin.sol import "openzeppelin-solidity/contracts/math/SafeMath.sol"; ...
0
votes
2answers
77 views

Intracting with dapp using frontend truffle petbox

App = { web3Provider: null, contracts: {}, account: '0x0', init: function() { // Load pets. return App.initWeb3(); }, initWeb3: function() { if (typeof web3 !== 'undefined') {...
0
votes
1answer
84 views

why i get a lot of errors when i use truffle?

Seems that i have a lot of lost dependencies for example installing sha3 errors: > node-gyp rebuild C:\Windows\system32\node_modules\sha3>if not defined npm_config_node_gyp (node " C:\Program ...
0
votes
1answer
17 views

How To Connect Web3 With MetaMask?

No tutorial can help me, I have watched almost every major tutorial on Youtube and read a ton of results from Google... I have on my HTML file imported the web3.min.js (copied from Truffle pet-shop ...
2
votes
3answers
587 views

Deploying smart contract with truffle and infura giving me error

I am having trouble deploying my smart contract to the ropsten network using infura and truffle am getting error that says "var sig = secp256k1.sign(msgHash, privateKey); ^ ...
0
votes
1answer
12 views

truffle migrate not working

every time I enter truffle migrate command in the terminal it doesn't does anything but takes some time and nothing happens after that. I am using Truffle version 5.0.4
0
votes
0answers
10 views

“SyntaxError: Unexpected token” on truffle develop

Once I run truffle develop this is the error I am getting. /usr/local/lib/node_modules/truffle/build/cli.bundled.js:33499 Config.search = (options = {}, filename) => { ^ ...
0
votes
1answer
15 views

How I can generate a file.sol from ABI?

I have created an smart contract but the code in the sol file have disappeared. But the jeson file still remains. Can I generate my smartcontract again from ABI ?
1
vote
1answer
49 views

Metamask transaction confirmed but “Internal JSON RPC error”

I am using getWeb3() to instantiate a contract and make calls with, the transaction says that is confirmed but when I open up developer tools there is the following error MetaMask - RPC Error: ...
0
votes
1answer
75 views

Error npm installing consensys diligence takehome bignumber util

``` /sudo npm install Password: Unhandled rejection Error: Command failed: /usr/local/bin/git clone --depth=1 -q -b master https://github.com/debris/bignumber.js.git /Users/quantum/.npm/_cacache/tmp/...
2
votes
1answer
27 views

How to use bignumbers in truffle tests?

I am testing a smartcontract with Truffle V5. All works well if I do not use all decimals. If I set 18 decimals all explodes. The test code is this (from truffle docs): const MetaCoin = artifacts....
0
votes
0answers
11 views

How to interact with my Rinkeby contract via truffle console?

I've been using truffle console to interact with a contract which I developed locally with Ganache. I'd like to be able to call the contract's methods using the console once deployed to the Rinkeby ...
0
votes
1answer
17 views

ParsedContract.sol:1:17: ParserError: Token incompatible with Solidity parser as part of pragma directive

Code : git clone https://github.com/dappuniversity/election https://github.com/dappuniversity/election/tree/2019_update Errors faced : Commands: Compile: truffle compile Migrate: ...
0
votes
1answer
27 views

Smart Contract function keep return Null value?

Hey I am new with Solidity. And I just tried to link my front end view with the smart contract. With the simplest possible approach. My contract:- My JS code:- Console keep printing 'null' I don't ...
0
votes
0answers
13 views

Truffle Deployment

I have created a DAPP using Truffle & Ganache. It is working fine in development server after running the following command. $ganache-cli Deploy the contract. $truffle migrate --reset Run the ...
0
votes
0answers
9 views

UnhandledPromiseRejectionWarning: Error: types/values length mismatch

i am following a tutorial on writing a back-end service using node.js for contract deployed on local environment (truffle, ganache). And i am receiving following error. (node:66103) ...
1
vote
1answer
80 views

Is there a way to auto-compile contracts with truffle?

Say you have a contract and you want it to watch for changes and run truffle compile --reset. Is there a way to do this?
0
votes
1answer
95 views

How do I run javascript code that interacts with deployed contract on ganache test network?

This truffle deployment page describes how to interact with a deployed contract using javascript. But I can't figure out how to execute this code. Should I be using the truffle console?
1
vote
3answers
79 views

Reading the result of a function that change state by using events in Solidity

I would like to get the result of a function by listening its emitted event. These are two pieces of code of my contrats CONTRACT 1: function createTradeableContract() public stopInEmergency ...
1
vote
1answer
17 views

Truffle test, how to get address(0)?

This is going to be short question and may be silly, but I'm literally stuck with a problem, where I need to pass address(0) to function in Truffle Test in JS and don't really know how to do it. In ...
0
votes
1answer
82 views

Vyper: Truffle test read mapping value inside struct

I have the following struct inside my vyper file: races: public({ start: timestamp, end: timestamp, racersBetHash: bytes32[address], racersBetAmount: wei_value[address] }[int128]) Then I ...
2
votes
1answer
80 views

Passing one contract instance as an argument to the constructor of another contract

I need to use the functions of the ERC20 contract in another contract. The ERC20 contract is from the openZeppelin contract library. I found the following code on a website: import "../../...
0
votes
1answer
86 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....
1
vote
0answers
23 views

How to get the returned value of a smart contract function when it called by using cacheSend() in drizzle

I just tried to build a simple DApp using truffle, react and drizzle. My question is how to get the returned value of a smart contract function when it called by using cacheSend() in drizzle? As ...
2
votes
2answers
61 views

Truffle - How to get event?

I can't figure out how can I get event. I was trying with "contract.NewVoting().watch{}" but it says that watch is not a function. I found out that watch has been removed and there is EventEmitter ...
0
votes
0answers
17 views

VM error in Truffle

Running the code below returns a vm error: Error: Returned error: VM Exception while processing transaction: revert at Object.ErrorResponse (node_modules/truffle/build/webpack:/~/web3-eth/~/web3-...
0
votes
1answer
18 views

truffle migrate does not return anything

I am following the tutorial from Truffle to create a "pet shop" contract. I can follow everything until he tells me to truffle migrate. Here is the contract: pragma solidity ^0.5.0; contract ...
0
votes
1answer
84 views

Problems running truffle [duplicate]

I am trying to follow a tutorial to deploy a smart contrat on Ropsten Testnet. I am in part 4. Deploy the contract to Ropsten test network: https://medium.com/@mvmurthy/full-stack-hello-world-voting-...
3
votes
1answer
82 views

Error when deploying contract having struct with many strings

I am using Truffle with Ganache and MetaMask. I have a struct in my contract containing many fields as string data type struct User { string firstName; string lastName ...
1
vote
1answer
16 views

Get a Tx hash from truffle

I have implemented a function call in truffle(web3js): await this.token1.transferFrom(holder1, holder2, transferAmount, {from: holder1}); and now I want to get the tx hash for that specific function....
0
votes
1answer
94 views

How to solve eth_getFilterChanges looping when deploying with truffle (parity)?

I am using truffle migrate and I get some kind of loop which just endlessly prints out eth_getFilterChanges. How can this be solved? I have used this truffle.js module.exports = { networks: { ...
0
votes
1answer
20 views

ERC20 is an abstract contract or an interface and cannot be deployed

i am trying to deploy a test erc20 token with truffle on ganache-cli My migration file name 2_deploy_contracts.js here is the code for it: var erc20 = artifacts.require('./ERC20.sol'); module....
0
votes
1answer
129 views

web3 Uncaught TypeError: Cannot read property 'createBox' of undefined

i'm trying to create simple application by using solidity 5.0.0 , Truffle v5.0.0 and web3 web3@1.0.0-beta.34. but i've gotten Uncaught TypeError: Cannot read property 'createBox' of undefined. ...
1
vote
1answer
113 views

Unable to read contract instance variable from deployed contract with truffle test

I am attempting to write some unit tests as I'm working on the development of some smart contracts, but I've run into an issue that's preventing me from continuing. I'm attempting to check the address ...
2
votes
1answer
50 views

Why do truffle compile or migrate commands fail silently?

Truffle v5.0.3 config: truffle-config.js module.exports = { // See <http://truffleframework.com/docs/advanced/configuration> networks: { development: { host: "127.0.0.1", //also ...
0
votes
1answer
97 views

how do i fix Expected primary expression error

Expected primary expression. j* = 10; ^ $ truffle migrate Error parsing C:\Users\Welcome\Downloads\ethereum-dapp\contracts\Integers.sol: ParsedContract.sol:29:16: ...
0
votes
1answer
89 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
0answers
17 views

Parsing Error while compiling pet-shop tutorial

I am just getting started with smart contract programming and was trying to implement the pet-shop example as per this tutorial https://medium.com/tomochain/how-to-build-a-dapp-on-tomochain-...
0
votes
1answer
12 views

MetaMask repeated errors with LocalHost

Every time I try to send ETH to my locally deployed contract I get errors like this: -While the error message says "out of gas" I know that can't be true since all my accounts have like 100ETH in ...
0
votes
0answers
5 views

Truffle Console detecting a single key press as multiple key presses

So I have installed truffle using: npm install truffle -g, now when running the truffle console some of the key presses are being detected as two key presses for example, pressing up to load the last ...
0
votes
0answers
9 views

TypeError: web3_eth_personal__WEBPACK_IMPORTED_MODULE_0___default.a is not a constructor

I have an application using truffle and webpack. When I run npm run server ( server's definition in package.json is : "server": "concurrently 'webpack --mode development --watch' 'wait-on build/...
1
vote
1answer
95 views

How can I configure node when I run truffle test?

How can I get truffle test to execute node with the --abort-on-uncaught-exception option? I'm guessing that I should probably add something in the Truffle's configuration file (truffle.js), but the ...
18
votes
5answers
4k views

Truffle configuration file name - is it 'truffle.js' or 'truffle-config.js'?

Truffle configuration file is mentioned in several places on the web (GitHub, truffle package on npm, solidity-coverage package on npm, etc.). Some refer to it as 'truffle.js, others refer to it as ...
0
votes
2answers
106 views

How is gas price too low corrected (truffle deploy)?

truffle.js module.exports = { networks: { development: { host: "127.0.0.1", port: 8540, network_id: "*", gas: 4600000, gasPrice: 4000000 // Match any network id } ...
4
votes
2answers
2k views

Source File requires different compiler version

I am using solidity version "pragma solidity ^0.4.20;". When I checked JSON files of contract, compiler version shows : "compiler": { "name": "solc", "version": "0.4.21+commit.dfe3193c....
0
votes
1answer
22 views

Remix vs Truffle project in VSCode [closed]

I do this post to ask your methodologies and customs when developing smart contracts. Between Remix + Ganache and Truffle Project + Ganache. What is more comfortable for you? Why is one better than ...