Stack Exchange Network

Stack Exchange network consists of 175 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
71 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
259 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
27 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
52 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
211 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
53 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
8 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
68 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
21 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
162 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
57 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
236 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
85 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
116 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
134 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 ...
2
votes
1answer
44 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
1answer
186 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
27 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 ...
1
vote
1answer
368 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
137 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 ...
1
vote
1answer
676 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
35 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
319 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
105 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
1answer
162 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
112 views

Error when I try to deploy with infura

Running migration: 1_initial_migration.js Deploying Migrations... ... 0x0ed88dd40f380a805ed0ba1b5b0a9d8178321ab6da9e5c0cb247f5700337b173 Migrations: 0xcfc4ba0488f20c7a2bb24e735f43e240bf249bc8 Saving ...
0
votes
0answers
28 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
114 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, ...
2
votes
0answers
55 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
33 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
87 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
72 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
2answers
449 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
336 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
249 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
166 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
18 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
121 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
67 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 ...
0
votes
1answer
30 views

How can I interact with my deployed contract?

What is the simplest way of interacting with a Deployed contract, considering that I am the owner of the contract (Token Contract). I use Truffle/Solidity0.5.0/Open-Zeppelin/node10.15.0 nothing ...
4
votes
2answers
1k views

Undefined results for “web3.eth.accounts” in truffle console

truffle(development)> web3.eth.accounts[0] gives output as "undefined" truffle(development)> web3.eth.accounts instead of showing all accounts details gives the below output Accounts { ...
2
votes
2answers
75 views

Truffle - test only function?

I have a large amount of contracts which I'm testing after applying changes. I'd like to add solidity functions which will be compiled only for testing, but not on mainnet nor ropsten. Is this even ...
0
votes
1answer
40 views

Circular reference error in factory contract pattern

I've used the factory model before, but I've never encountered a circular reference error, and I'm having trouble seeing how this could be a circular reference when I'm creating a brand new ...
0
votes
1answer
166 views

How to access in JavaScript multiple return values returned from a solidity function

My contract function returns two values. How to access the multiple return values in JavaScript from a mocha testcase? contract X { function a() pure public returns(uint,uint) { uint p=10; ...
2
votes
0answers
35 views

Tracking Non-Deployer Transaction Gas Use In Truffle Migrate

In Truffle, gas used by a Migration in deployer.deploy() is tracked by a Reporter using events emitted by the Migration. If I have code of the form: deployer.deploy(MyContract) .then(instance =>...
1
vote
2answers
87 views

How to make truffle test work with ethers.js [duplicate]

I prefer the ethers.js library to web3. Is there a way to configure truffle test to use ethers.js instead of web3? Thanks!
1
vote
3answers
810 views

How to upgrade solidity compiler solc to version 0.5.x?

I am using solidity 0.4.24. The latest version has been updated. How to upgrade my solidity version? Is there any commands for it?
0
votes
1answer
154 views

ERC20 Contract - OpenZeppelin - total confusion

Trying to launch a simple ERC20 Token. I'm finding OpenZeppelin's extensive library - where every Contract seems to import about 4 other Contracts - to be both wonderfully well organized - but also ...
1
vote
1answer
144 views

UnimplementedFeatureError: Encoding type “struct BiddingContract.Bidder memory” not yet implemented

The code is broken with the new upgrade v0.5, using Truffle v5.0.1 (core: 5.0.1) struct Bidder { address bidders_address; uint productId; uint bidValue; } struct Product { uint ...
0
votes
1answer
139 views

Truffle and Ganache - do I need to set the same gas-price and gas-limit in both of them?

Or can I set different values? If I can set different values, then how will they be used in the system (i.e., what gas-price and gas-limit will apply in every transaction that I execute)? Here is my ...