Questions tagged [ganache]

For questions about using the Ganache personal blockchain testing environment.

Filter by
Sorted by
Tagged with
54 votes
6 answers
39k views

Time-dependent tests with Hardhat?

For Ganache, there are several solutions. What about Hardhat? They implemented their own local blockchain, Hardhat Network, which is different to Ganache.
Paul Razvan Berg's user avatar
28 votes
3 answers
17k views

Difference between Ganache and Truffle

What is the difference between this two? I understand that Ganache is like a fake blockchain, but Truffle has that too ? What are the limitations of each and under which circumstance we use either ...
drhanlau's user avatar
  • 425
19 votes
4 answers
40k views

Setup Ganache with Metamask. What and where is a Chain ID?

I am following these instructions. The problem is that the above instructions don't mention Chain ID and it appears Chain ID is required to even make it work. Thus, I'm stuck. What is the Chain ID? ...
GN.'s user avatar
  • 643
18 votes
1 answer
14k views

Member function "transfer" not found or not visible after argument-dependent lookup in contract?

I am having a problem with my smart contract making value transfers. My current environment: Truffle v5.0.0-beta.2 (core: 5.0.0-beta.2) Solidity v0.5.0 (solc-js) Node v8.11.1 I created the ...
Robert Oschler's user avatar
17 votes
9 answers
17k views

The endpoint returned a different chain ID: 0x539 (Ganache)

I am trying to connect Metamask to ganache by creating a custom RPC with the following details: New RPC URL: HTTP://127.0.0.1:7545 Chain Id: 5777 But I keep getting the error message The endpoint ...
Chidi Nkwocha's user avatar
14 votes
2 answers
4k views

Truffle's Ganache VS Testrpc

Is there any major difference between Truffle's Ganache and TestRPC? Do they run irrespective of each other as test blockchains, are there any side effects running both at same time? Is the only ...
jamarcus_13's user avatar
11 votes
6 answers
17k views

UniswapV2 addLiquidity revert ds-math-sub-underflow

I'm trying to use Uniswapv2Router with Truffle and Ganache, but haven't been able to identify what I'm doing wrong. I'm using addLiquidty method as follows: await uniswapV2Router02.addLiquidity(token0....
SergioGaitan's user avatar
10 votes
7 answers
8k views

Failed to deploy to Graph node: Ethereum network not supported by registrar: mainnet

I followed this tutorial on the graph document: https://thegraph.com/docs/quick-start#local-development However, I got an error message after I run yarn deploy-local. Failed to deploy to Graph node ...
user76333's user avatar
  • 167
8 votes
6 answers
11k views

Can not install Ganache GUI on Ubuntu?

I am trying to install Ganache GUI on my ubuntu 18.04. I downloaded the Ganache-2.0.1.AppImage from the site. On the site it says that the package installs automatically when double clicked. But it is ...
Tushar Sharma's user avatar
7 votes
2 answers
7k views

Solidity Exceeds block gas limit during Mocha Tests with Ganache-cli

How can I increase the gas limit in this case? The error message is "n: Exceeds block gas limit" or "base fee exceeds gas limit". I think there is some kind of api I need to set the block gas limit ...
Russo's user avatar
  • 1,784
7 votes
2 answers
5k views

How to properly simulate mining time with Ganache CLI

I am using the Ganache CLI for testing my smart contracts and frontends. I need a way to incorporate a delay into ganache-cli when performing write transactions in order for it to more closely ...
Dan's user avatar
  • 279
7 votes
1 answer
1k views

How to Catch Connection Issues to Web3 Provider using Web3.js

My node.js script is able to successfully connect to the Web3 provider when both the private key (using truffle-privatekey-provider) and the provider host URL are correct. let privateKey = ..., ...
Nyxynyx's user avatar
  • 1,167
6 votes
1 answer
1k views

Advantages of Infura over Ganache?

I'm just starting to use Ganache for building my smart contracts but have seen some youtubers using Infura. After going through the Infura website, to my newbie eyes it seems to be exactly the same ...
Notbad's user avatar
  • 169
6 votes
1 answer
1k views

Is there a maximum number of public functions in a contract?

I have two contracts A and B, both deploy and work correctly in ganache (they both use less than 6M gas). Now I want to create a third contract C that inherit both A and B. contract C is A, B { } ...
Ismael's user avatar
  • 30.6k
6 votes
0 answers
555 views

Truffle test of two transactions during the same block

I'm trying to test a solidity function that only allows it to be called once per block. E.g. (my desired functionality): Tx1 calls Fn during block #100, and when successful sets a boolean flag for ...
jonnyg's user avatar
  • 61
5 votes
1 answer
7k views

How to get private keys on Truffle from Ganache accounts

Doing some ERC-735 tests on truffle+ganache I got stuck when creating claim signatures. They need to be signed from my ganache account, but I don't know its private key. The code to be used is this: ...
Juan Ignacio Pérez Sacristán's user avatar
5 votes
3 answers
7k views

Explorer for Private Blockchain with Ganache

I set up a private blockchain with ganache in the server. Now I want to view the transactions like in the public blockchain explorer. Locally I use Ganache GUI where I can actually track down ...
NinjaMAN's user avatar
  • 419
5 votes
2 answers
2k views

deploying smartcontract to ganache-desktop instead of ganache-cli with brownie

i have a smartcontract developed with brownie. I want to deploy it to ganache. If i run my deployment script brownie run scripts/deploy.py, brownie deploys the smartcontract with ganache-cli. But i ...
Khan's user avatar
  • 325
5 votes
4 answers
2k views

contract.deployTransaction.wait(1) not working in ethers version 6

To be specific I am using ethers version 6.2.3 Error is in this line const deploymentReceipt = await contract.deployTransaction.wait(1); Entire code I am using to deploy contract and wait const { ...
Neeraj Walia's user avatar
5 votes
1 answer
3k views

Can we see events in ganache?

I am using Ganache and wanted to understand where can we see the events in the Ganache UI. I tried checking the events in the transaction and logs tab but I did not find it. Here is one sample code. ...
Ashwinkumar Suryavanshi's user avatar
5 votes
2 answers
3k views

How to insert multiple transactions into One Block in Ganache GUI

Is it possible to enable Ganache GUI to put multiple transactions into ONE block ?. The details about Why i need this thing, is given below; I am going to test Transaction Order Dependence (TOD) ...
Amir Ali's user avatar
  • 447
5 votes
1 answer
1k views

Web3.js + ganache local development: Response to preflight request doesn't pass access control check, CORS error

I am fairly new to DAPP and I am trying to follow an online guide building my first smart contract. Here's the source code: Election.sol pragma solidity ^0.4.2; contract Election { string ...
Latheesan's user avatar
  • 215
5 votes
0 answers
570 views

`eth_getTransactionReceipt` returns the transaction hash not the receipt

I use sol-coverage in a truffle project. Ganache is my development blockchain. I have a lot of tests which end up doing more than a few thousand JSON RPC calls. Due to unbeknownst reasons, the ...
Paul Razvan Berg's user avatar
5 votes
1 answer
825 views

Can't debug transactions that fail during the Web3.js estimateGas() call? No Tx Hash

NOTE: I am doing my work with the Ganache v1.2.2 GUI client on a Linux Ubuntu 18.04 station. There are many revert errors that happen during the estimateGas() call that precedes the actual Web3.js ...
Robert Oschler's user avatar
4 votes
5 answers
4k views

Increase block number on Ganache

How can we increase block.number on Ganache for testing purpose ? If not possible do you know an alternative like passing X fake transactions to artificially increase block.number. Or if we have to ...
Kevin Wad's user avatar
  • 327
4 votes
1 answer
3k views

Attach to ganache-cli using geth

Is it possible to attach with geth to ganache-cli? I start ganache-cli like this: ganache-cli --db ~/ganache -i 15 Then I try to attach to the chain like this: geth --datadir ~/ganache/ --...
user avatar
4 votes
2 answers
4k views

How do I specify the network ID in the config file when migrating/testing contracts on my local ganache?

So my issue is when I run the compile and then migrate commands everything goes smooth, then I try to test by running the truffle test command and it gives me an error saying 'Error: The network id ...
raicobi's user avatar
  • 41
4 votes
3 answers
860 views

Can I detect if my solidity contract runs on testnet/ganache or mainnet?

Is it possible to detect from the smart contract in solidity if it runs on mainnet or testnet? Or if it runs on ganache? Maybe by getting the network ID? But I'm not sure it's possible from the smart ...
cazoute's user avatar
  • 63
4 votes
1 answer
4k views

Uniswap on Ganache

So im trying to write a smart contract that involves using Uniswap. I would like to test my smart contract and was looking into setting up uniswap on my local ganache server, but as I am new, a few ...
StackSatoshis 's user avatar
4 votes
2 answers
1k views

Solidity Error: Exceeds block gas limit

When I start ganache-cli in one terminal window and run ./node_modules/.bin/solidity-coverage (command from documentation) in another I get Error: Exceeds block gas limit at Object....
CodingYourLife's user avatar
4 votes
4 answers
622 views

Truffle Drizzle-box fails with TypeError: (0 , _drizzle.generateContractsInitialState) is not a function

Right after unboxing Drizzle-box I'm getting a TypeError: (0 , _drizzle.generateContractsInitialState) is not a function. Ganache is running on localhost:8545, contracts are deployed, Metamask ...
Dmitry Pasenko's user avatar
4 votes
2 answers
1k views

Can the block number be set back in ganache?

I know about tools like ganache-time-traveler that let you advance the block number. But is it possible to go back to a lower value?
Paul Razvan Berg's user avatar
4 votes
2 answers
2k views

Ganache GUI installation error

node version v12.8.0,npm version 6.10.2 I followed the below steps to install the ganache GUI but I got the error $mkdir ~/ganache $git clone https://github.com/trufflesuite/ganache.git $npm install ...
Darshan's user avatar
  • 65
4 votes
1 answer
731 views

Is Ganache GUI real EVM?

I was wondering whether Ganache GUI is real EVM or just a replica of it. Because its throughput and latency are way better than Geth client. Any comments on it?
kaushik_pm's user avatar
4 votes
2 answers
2k views

Ganache/Web3: "Key not found in database"

I am using Ganache CLI v6.1.0 (ganache-core: 2.1.0)) (started with default settings by running simply ganache-cli), web3 (^1.0.0-beta.33), and my smart contract is written for solidity ^0.4.0. I have ...
Chris Staikos's user avatar
4 votes
9 answers
2k views

Ganache server hostname dropdown not displaying all hostnames?

I am trying to connect Ganache GUI to my WSL2 terminal in Intellij but I randomly encountered a new problem. I find that I cannot specify the hostname of the server other than 0.0.0.0 - All Interfaces ...
developer's user avatar
  • 185
4 votes
1 answer
1k views

Ganache + Truffle: how to deploy a contract without considering the gas

I am working with Ganache and Truffle. I am trying to deploy kind of a huge smart contract, but most of the functions in this smart contract are pre-prod functions, so I do not really worry about real-...
Thanh-Quy Nguyen's user avatar
4 votes
2 answers
2k views

How to compile Solidity ^0.5.5 contract with Node.js?

I am terribly new in Solidity and now I try to learn how to compile a contract in Solidity ^0.5.5 (No versions below). I have the contract as follow (UsersContract.sol) pragma solidity ^0.5.5; ...
Joanmacat's user avatar
  • 171
4 votes
1 answer
4k views

web3js sender account not recognized

Under Ganache, I created some APIs with nodejs to managing a Smart Contract. One API is for the creation of new accounts with newAccount = web3.eth.accounts.create(web3.utils.randomHex(32)); Then, ...
Bruce Wayne's user avatar
4 votes
2 answers
2k views

Ganache Processing becomes very slow (with Automining Option) after consecutive thousands transactions

I am trying to deploy thousands of contracts on Ganache GUI. At first, it process all transactions very fast (deploy contracts and transactions for calling setters functions) . After some transactions,...
Amir Ali's user avatar
  • 447
4 votes
2 answers
874 views

How to test a function call that should fail?

Im using Truffle to test my smart contracts written in Solidity and I would like to mark test as passed if function call/execution fails. Example: await instance.cancelOrder({from: accounts[1]}); ...
Mile's user avatar
  • 41
4 votes
1 answer
4k views

Checking transactions in ganache-cli

Is there a command to enter into the terminal to check past transactions on the locally deployed ganache-cli blockchain? With ganache gui one gets the transactions button. Is there some similar ...
GreyShadow94's user avatar
4 votes
0 answers
507 views

Ganache Error/Bug?: Incompatible EIP155-based V 0 and chain id 1

I'm trying to mainnet-fork using the Ganache UI (instead of ganache-cli which seems to work fine.) The error mentions the chain id. I've used all sorts of chain ids. Mostly 1377 and 1. I'm not really ...
JDOaktown's user avatar
  • 169
4 votes
0 answers
200 views

Does 'estimateGas' behave the same on Ganache and on mainnet?

I noticed that estimateGas behavior in Ganache has changed: In version 6.4.1, it throws an exception if exceeding the gas-limit. In version 6.5.1, it returns the estimation even if exceeding the gas-...
goodvibration's user avatar
4 votes
1 answer
333 views

What can be the difference between Remix VM, Ganache win, ropsten?

I cannot share the code, but in short something based on a payable fallback in a complicated multi contract application has this behavior: 1) tested in remix using VM: perfect 2) tested in remix on ...
Rick Park's user avatar
  • 3,194
4 votes
1 answer
882 views

Remix + Ganache - Cannot call one contract from another

I have an innocent looking contracts that work painlessly in Remix. Test contract can easily call Another if I use JavaScript VM in Remix. I also have ganache-cli running on port 7454. If I connect ...
Amarsh's user avatar
  • 209
4 votes
0 answers
467 views

Difference between execution costs on remix an Ganache?

I created a contract on remix and then deployed it. when I call any function there is an execution cost in gas. I also deployed the same contract on Ganache for testing. I find the execution cost in ...
Mohamed's user avatar
  • 491
3 votes
2 answers
2k views

How to test Uniswap contracts locally?

So far I developed smart contracts in Solidity using Ganache. I didn't have to use Uniswap in any way. Now I'd like to use Uniswap to put some of my ERC-20 token as liquidity. I started reading the ...
Pointer_to_void's user avatar
3 votes
2 answers
1k views

How to increase the number of test accounts?

I have encountered a problem where I need a large number of test accounts. How can I increase the number of test accounts from 10. Remix and ganache only give 10 accounts. I require more than that.
Kashish Khullar's user avatar
3 votes
3 answers
3k views

Truffle test error: Cannot create instance of Vault; no code at address

I'm trying to make a simple test in Truffle using Ganache where I call a function from a smart contract instance. This component will create a Vault and return me its address. My truffle test does ...
Antoine Delia's user avatar

1
2 3 4 5
13