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
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 ...
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
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
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 ?
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 ...
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
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
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
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
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
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 ...
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
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
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....
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
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/...
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 ...
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 ...
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 ...
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 ...
1
vote
1answer
24 views

Debugging a VM error in solidity

I'm getting the following error while running a test in truffle: Error: Returned error: VM Exception while processing transaction: revert Now, the code is simply to big and complicated to run ...
0
votes
1answer
27 views

infura don't catch event

when i'm working on ganache all event that i have emit are store in my nodejs server but when i turn to kovan or ropsten my server don't catch event . i'm working with infura this my code no ...
0
votes
1answer
26 views

Unhandled Rejection (Error): invalid string value (arg=“x”, coderType=“string”, value=5)

Using Truffle unbox react to unbox a boilerplate. received the following error from running npm run start Changes: Addition of "memory" parameters in the simpleStorage.sol Changed unit to string in ...
1
vote
0answers
20 views

Event Watching Web3 v1 in Truffle test

I want to test off chain data input in truffle testing. So basically I kick off a test and then need to wait for another program to do something. In the old web3, this worked great: function ...
1
vote
0answers
40 views

“before all” hook: prepare suite

This is the error code: Adoption.sol code: TestAdoption.sol code: I dont know how to solve this, it fails when i try to use this comand: "truffle test". Thanks.
1
vote
1answer
14 views

Issue with Contract function return value data type

I am using a simple contract Contract code contract Bank { address public owner; mapping(address => uint) private customerBalance; event fallbackCalled(address, uint256); event ...
0
votes
1answer
33 views

Invalid bytes32 value [duplicate]

I am trying to learn about solidity so I just watch a tutorial about it, I already copy the same code as the tutorial but there is an error with bytes32. Here it is: That is the deploy code: And ...
0
votes
2answers
19 views

Truffle console keep showing “undefined”. Solved by rolling back to v4 stable

I have updated my truffle version to the latest v5.0.3. By running truffle version, I can get the following version statements. Truffle v5.0.3 (core: 5.0.3) Solidity v0.5.0 (solc-js) Node v10.8.0 ...
0
votes
1answer
146 views

Truffle does nothing and shows no output when running tests

I am switching machines and ran into a weird issue with truffle. Truffle is set up properly on my old machine. I can compile and run tests without any issues. To my knowledge, I set up everything ...
0
votes
1answer
24 views

Execution gas cost

I use web3 and truffle to get info about my testnet transactions. There are few fields about gas used per transaction, such as: gasPrice, gas, gasUsed. But how to get field 'execution cost'?
0
votes
2answers
47 views

How can I select a single account in Ganache? [duplicate]

Ganache (v1.2.3) provides a list of 10 accounts. They can be easily selected by selecting web3.eth.getAccounts();. However web3.eth.accounts[0] returns undefined as shown below. Not sure how to ...
0
votes
0answers
42 views

Web3 Contract Constructor Error

Currently getting this error in my Browser's Console: My current set up is as follows: Truffle v5.0.3 (core: 5.0.3) Solidity - 0.5.0 (solc-js) Node v8.9.4 Here's my code - and note that I'm using ....
1
vote
0answers
27 views

Solidity Compiler won't upgrade

I updated to the latest version of Truffle using: npm uninstall -g truffle followed by: npm install -g truffle I verified this succeeded by doing: truffle --version and got this: You can ...
2
votes
0answers
43 views

Error when I try to deploy with infura

Running migration: 1_initial_migration.js Deploying Migrations... ... 0x0ed88dd40f380a805ed0ba1b5b0a9d8178321ab6da9e5c0cb247f5700337b173 Migrations: 0xcfc4ba0488f20c7a2bb24e735f43e240bf249bc8 Saving ...
0
votes
0answers
12 views

How do I solve this error involving web3 and webpack in my truflle-react box based project?

The project is a truffle-react trufflebox, a bounties creating and solving application. It uses Truffle v5.0.1. This is the home page. Below is the page that displays when you click on the 'Become a ...
0
votes
0answers
44 views

How to call contract method from specific address and private key without Metamask check

Good morning, I need to known how call contract method in javascript from specific address(and relative private key) without the check of Metamask. I explain better. This is an example of js code, ...
1
vote
0answers
19 views

web3: getPastEvents works in Truffle on instance, not in web3 script on page

I am looking to collect the previously logged events of a certain type using getPastEvents. It does not seem to work in my web3 script on my site but it does work in truffle console on a deployed ...
0
votes
1answer
23 views

Calling Protected Function From Another Contract

I am trying to call a function in another contract, that is protected with an openzepellin Role library. I am calling availableFunction on the javascript side, which in turn calls protectedFunction. ...
1
vote
0answers
49 views

Error deploying smart contract with web3.js and Truffle HD wallet provider

My web3 version is 1.0.0-beta.41, node version is 10.15.1 solc compiler is 0.4.25 compile.js is successfully compiled with interface and bytecode exports. My deploy.js file const HDWalletProvider ...
0
votes
1answer
17 views

How to deploy a dapp which uses multiple blockchain

I am a newbie and started learning dapp on ethereum. Up till now, I wrote smart contracts; created frontend with html, css and js; deployed smart dapp on either private network(geth, ganache) or ...
1
vote
1answer
155 views

DOMException: Failed to execute 'postMessage' on 'Window' error when using Metamask and truffle Ganache

I faced Uncaught (in promise) DOMException error like below when I was developing Nuxt web app with Metamask(chrome) and truffle Ganache. Uncaught (in promise) DOMException: Failed to execute '...
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: ...
1
vote
2answers
49 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; ...
0
votes
1answer
45 views

Truffle test scripts - Help Please [duplicate]

I want to know if my syntax is correct not how to catch a revert. the task is: Call bid method from accounts[1] of Auction.sol using auctionInstance and pass itemId=0, count=6 as arguments it("...
0
votes
1answer
14 views

Javascript Read Message Value Received

In my smart contract, I have a function that sends ether to the caller using the msg.sender.send() function. I need to check that the value being returned by the function is correct (i.e. the amount ...
2
votes
1answer
16 views

Contract Not Deploying In Truffle Tests

I am trying to do a simple test on Truffle, but it seems that the deployed() promise is never being executed. var MyContract = artifacts.require('MyContract') contract('MyContract', function(...
5
votes
2answers
37 views

Is it safe to commit truffle build files to Github (open source)?

Regarding the json build files that Truffle produces based off of my smart contract, is it safe for this information to be treated as public? I just want to be sure it doesn't contain any sensitive ...