Questions tagged [ganache]

For questions about using the Ganache personal blockchain testing environment.

Filter by
Sorted by
Tagged with
15
votes
1answer
7k 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 ...
11
votes
1answer
3k 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 ...
8
votes
3answers
6k 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 ...
6
votes
1answer
758 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 { } ...
5
votes
1answer
515 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
2answers
1k 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 ...
4
votes
2answers
768 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
462 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
1answer
934 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
36 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
71 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
1answer
261 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
1answer
152 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 ...
3
votes
2answers
2k 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 ...
3
votes
1answer
526 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
293 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
1answer
503 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
124 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-...
3
votes
1answer
93 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
0answers
31 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 ...
3
votes
0answers
41 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-...
3
votes
0answers
121 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 ...
3
votes
0answers
135 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 ...
3
votes
2answers
113 views

Check your gas amount error ERC721

I am trying to deploy contracts to Ganache for testing using Truffle, but no matter what I set gas price / gas limit / gas to both in truffle.js and Ganache itself, it always get check gas amount on ...
3
votes
1answer
450 views

Ganache (UI) save blockchain

I am running a testnet on Ganache UI. But when I deploy a contract and close and reopen ganache, there are no blocks and the contract deployment is gone. Is it possible to save/load a blockchain ...
2
votes
1answer
2k 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: ...
2
votes
3answers
362 views

Want to run a local fork of Ropsten

I would like to run a local fork of Ropsten to interact with some of the smart contracts without having to fill up from the tap. My plan was to start a light parity node as follows: parity --chain ...
2
votes
1answer
891 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. ...
2
votes
2answers
127 views

Is drizzle a contracts lib?

I'm researching about smart contracts, and been seeing a lot of truffleframework, ganache and drizzle. In the other hand, only found broad descriptions of those tools: "Drizzle is a collection of ...
2
votes
2answers
75 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 ...
2
votes
1answer
141 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?
2
votes
1answer
788 views

How to connect ethereum wallet to ganache? [closed]

Can anyone list out the steps on how to connect the ethereum wallet to ganache? Thanks in Advance
2
votes
1answer
770 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, ...
2
votes
1answer
2k 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, ...
2
votes
1answer
956 views

Can I save my Ganache private blockchain instead starting a new one every time?

Every time I turn my computer off or even change settings on Ganache (I need to restart) I lose the state of the blockchain and it creates a new one, I have to redeploy my contracts, etc. Is there a ...
2
votes
1answer
20 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?
2
votes
1answer
168 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(...
2
votes
1answer
67 views

When do you use ganache-cli and when do you use ganache-core?

I have seen two usages over the internet 1. const ganache = require("ganache-cli"); web3.setProvider(ganache.provider()); 2. const ganache = require("ganache-core"); web3.setProvider(ganache....
2
votes
1answer
64 views

Calling payable state changing function on client side with metamask in ethereum infura testnet

I can't seem to find an answer for my problem, or it's either impossible and I'm missing something, or it's trivial and I'm missing something. I have this function on client side: const bet = web3....
2
votes
1answer
266 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; ...
2
votes
1answer
76 views

How to add Truffle signing keys to MacOS keychain

Debated what Stack Exchange to go to for this, but I thought I'd start here since it's related to setting up a local Ethereum dev environment. I downloaded and have been using the Ganache command-line ...
2
votes
1answer
51 views

Can't access test network's accounts

So I've updated my framework and with it the web3,js lib. When I run the console and attempt to get an account from my test network by web3.eth.accounts, it won't display a list of the accounts like ...
2
votes
1answer
68 views

Oraclize a restfullAPI using a specific number represented by the variable z

Hello I made a restfull API on my own (python file jsonify + localtunnel) on a localhost using a specific number (in this case 141) represented by the variable z. This variable should go into DevCoin ...
2
votes
1answer
140 views

Contract call with ether and gas fails with revert

Testing with Truffle and solidity on localhost ganache network: Works: function dosomething(string a) { //do nothing } testing with: TokenFactory tf = TokenFactory(TokenFactoryAddress); ...
2
votes
2answers
860 views

Cannot read property '2' of null

pragma solidity ^0.4.23; import'./ID.sol'; import'./Whitelisted.sol'; contract IDFactory is Ownable { Whitelisted whitelist; event IDCreated(uint id, address idContractAddress); ...
2
votes
1answer
251 views

Dealing with block delays in unit tests

Consider the following Truffle Unit Test written in JavaScript: const Lease = artifacts.require("./Lease.sol"); contract("Lease", async (accounts) ...
2
votes
1answer
168 views

What are the other 2 mnemonics represent for when I launch ganache?

I download the Ganache on Windows, it gives me 10 accounts and 12 mnemonics when I launch it, I think that the first 10 mnemonics are represent for 10 accounts, but what are the other 2 mnemonics "...
2
votes
1answer
158 views

Is there any specific configuration needed for Oraclize ethereum-bridge to support oraclize_newRandomDSQuery()?

I am using ganache-cli and ethereum-bridge in order to test oraclize locally. Other calls to oraclize, such as oraclize_query("URL","..."), work just fine. I am only having trouble with ...
2
votes
1answer
183 views

Contract Deployed via Truffle doesn't work, Remix deployed contract does work. Why?

So, I am developing (or trying to) with Truffle against ganache. When I do "truffle migrate" I get: Using network 'development'. Running migration: 1_initial_migration.js Replacing Migrations......
2
votes
1answer
831 views

why connect to local ganache doesn't need contract address [duplicate]

Here is my code: $.getJSON('Adoption.json', function(data) { // Get the necessary contract artifact file and instantiate it with truffle-contract var AdoptionArtifact = data; App....