Questions tagged [ganache]

For questions about using the Ganache personal blockchain testing environment.

Filter by
Sorted by
Tagged with
23
votes
3answers
13k 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 ...
17
votes
5answers
7k 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.
17
votes
1answer
11k 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 ...
14
votes
2answers
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 ...
14
votes
1answer
18k 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? ...
10
votes
7answers
6k 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 ...
7
votes
2answers
5k 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 ...
6
votes
4answers
6k 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 ...
6
votes
1answer
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 { } ...
6
votes
5answers
1k 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 ...
6
votes
2answers
3k 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 ...
5
votes
3answers
5k 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....
5
votes
1answer
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. ...
5
votes
1answer
815 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 ...
5
votes
1answer
542 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 ...
4
votes
1answer
5k 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: ...
4
votes
1answer
2k 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/ --...
4
votes
2answers
1k 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) ...
4
votes
2answers
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....
4
votes
4answers
584 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 ...
4
votes
2answers
839 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 ...
4
votes
1answer
827 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-...
4
votes
2answers
1k 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; ...
4
votes
1answer
3k 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, ...
4
votes
2answers
393 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]}); ...
4
votes
1answer
1k 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 ...
4
votes
0answers
381 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 ...
4
votes
0answers
118 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-...
4
votes
1answer
219 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 ...
4
votes
0answers
408 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 ...
4
votes
1answer
615 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 ...
4
votes
0answers
600 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 = ..., ...
3
votes
3answers
1k 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 ...
3
votes
1answer
1k views

ganache-cli doesn't have enough funds to send tx – number increases proportionally to however much I initialize a wallet with

I'm trying to write a simple function to send a transaction using web3 and ethereumjs-tx that empties the wallet of an account (call this account A) into another account (account B). However, no ...
3
votes
1answer
125 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 ...
3
votes
1answer
2k 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 ...
3
votes
1answer
401 views

Difference between Puppeth and Ganache

I am trying to set up a local blockchain and started to read about Puppeth to manage the blockchain and also read about Ganache (this one I already tested a bunch of stuff), but never heard about a ...
3
votes
1answer
366 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?
3
votes
1answer
1k views

How do I work with the latest version of solidity?

A new version of Solidity was added fairly recently, and one of the feature it adds is messages on require. I would like to use them but I'm not sure how I can do that. I'm using Ganache and truffle, ...
3
votes
2answers
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 ...
3
votes
1answer
83 views

Ethereum Signing using HSM

I tried signing a Message using the SHA256withECDSA algorithm . It gives a different signed(r,s) output everytime. When i try to recover the address using the ecrevover method .it gives me a different ...
3
votes
2answers
1k 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,...
3
votes
1answer
447 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(...
3
votes
1answer
403 views

Can't send data to non-contract address using web3 1.0.0 and ganache

Problem According to this question, it is possible to send data to a non-contract address in Ethereum. However, if I run my code which sends ether from the first account to the second account on ...
3
votes
2answers
703 views

Signing transactions with Ledger Nano S on Ganache with Metamask

I am trying to sign transactions and move funds on a private Ethereum Blockchain with my Ledger Nano S on MetaMask. So far I have tried to do so in Ganache and via blockchain setup via custom RPC. ...
3
votes
1answer
1k views

Web3.py Could not transact with/call contract function, is contract deployed correctly and chain synced?

I am trying to call a contract function deployed in Ganache. I am pretty sure the contract is deployed because I can transact() and work with other functions. But when I call() it, I get this error: ...
3
votes
2answers
1k views

ganache-cli: how to persist new created accounts

I start my service by: ganache-cli -d --gasPrice 0 -q --db=./db This persists my 10 defaults created accounts, but when I create new accounts using Web3: web3.eth.personal.newAccount('password') ...
3
votes
1answer
107 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 ...
3
votes
1answer
188 views

Uniswap GUI on forked mainnet

I have created a forked mainnet in Ganache which is working well using the CLI. However I would like to have access to the UNISWAP GUI. If I open Uniswap and change my metamask settings to localhost, ...
3
votes
2answers
726 views

Metamask injects one account in web3, but calls contracts using another account

Building a React app, MetaMask injects web3, I get accounts[0] from getAccounts(), then pass it to my contract functions together with other parameters. I want my modifiers to lock incoming function ...

1
2 3 4 5
10