Questions tagged [ganache]
For questions about using the Ganache personal blockchain testing environment.
427
questions
0
votes
0answers
4 views
Can you use Ganache to test create wallet using web3py?
I am using the web3.py library using the web3.eth.account.create () to create my own wallets, my question is if there is any way to use the Ganache services as Provider to be able to perform tests ...
0
votes
0answers
8 views
VM Exception while processing transaction: revert - buying transaction
Hey bit of a newbie to ethereum dev over here. I'm building a marketplace for ERC 721, currently, i've been getting this error when I called in buying method.
Contract code:
function buyJam(...
1
vote
2answers
25 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 ...
0
votes
1answer
15 views
Ganache Smart Contract
is it possible to use a smart contract of an existing token in ganache for testing ?? that is, I don't have to create my smart contract
0
votes
1answer
27 views
Truffle test doesn't connect to Ganache
I'm using Truffle and Ganache for my development environment. Using the truffle console or truffle external scripts everything works fine, but truffle test does not seem to be connected to Ganache:
...
1
vote
1answer
16 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....
0
votes
1answer
232 views
IPFS dapp hosting
I have uploaded the dapp frontend folder along with contracts json files on the IPFS using
ipfs add <path>
ipfs name publish <hash>
commands. I am running Ganache for in-memory virtual ...
2
votes
1answer
112 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 ...
0
votes
0answers
22 views
Nodejs API to Solidity data transfer
I want to know that how can I transfer Nodejs API call response to Html, where for every call or response gas will be consumed by help of Solidity from the Ganache Ethereum account.
1
vote
1answer
83 views
Truffle migrate ERC820Registry
I use Truffle and Ganache and I want to test some contracts that use the ERC820 Registry. I'm new to Truffle (and JavaScript in general) and I'm struggling to follow the instructions described in EIP-...
0
votes
1answer
58 views
Web3 event listener - timing issue when immediately retrieving contract values
I'd like to be able to immediately get a struct value from a mapping after calling a function that updates the struct, however, when testing with Ganache, sometimes the event arrives to the listener ...
0
votes
1answer
223 views
Manage accounts in Remix Web3 Provider env connected to a TestRPC client node
When I run the TestRPC client (ganache-cli), it provides me with 10 different accounts and private keys along with a local server at localhost:8545
Available Accounts
(0) ...
5
votes
1answer
362 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 ...
2
votes
1answer
237 views
Is it possible that Ganache can handle a private key without an “0x” prefix, but Parity cannot?
I am trying to sign and send a transaction as follows:
let signedTx = await web3.eth.accounts.signTransaction(options, PRIVATE_KEY);
let txReceipt = await web3.eth.sendSignedTransaction(signedTx....
0
votes
3answers
1k views
truffle migrate --network ropsten issues
When i run truffle migrate --network ropsten i don't see the contract deployment but just
Compiling your contracts...
===========================
> Everything is up to date, there is nothing to ...
0
votes
0answers
27 views
Owner of contract is set to contract address?
I just testing a contract with truffle and Im wondering why the owner of the contract is set to the contract address itself.
Migrations:
const contractA= artifacts.require("ContractA");
...
0
votes
0answers
20 views
How to reserve ethereum addresses for data init
I would like to give each of my preloading users a blockchain address. I have used Sequelize to sync my database with the data. How to ensure all my users have their unique blockchain addresses?
I am ...
1
vote
1answer
23 views
Solidity: ParserError: Expected pragma, import directive or contract/interface/library definition. function
I am using Truffle together with Ganache and I can't get this code to run:
pragma solidity >=0.4.21<0.6.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@...
2
votes
1answer
39 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, ...
0
votes
2answers
181 views
web3 erroneously returning error
This is strange. My web3 script to deploy a contract seems to work, but always activates the .on('error', fcn) clause even though there is no error.
The message says Transaction has been reverted by ...
0
votes
1answer
119 views
Out of Gas when using Web3py
I have a contract that I am trying to deploy using Web3PY that is failing with:
VM Exception while processing transaction: out of gas.
It deploys with no errors when using Web3 on node.
I am running ...
0
votes
1answer
84 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 ...
3
votes
1answer
302 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:
...
1
vote
1answer
87 views
ganache-cli 127.0.0.1:8080 bad request
Alright, it looks like everything in the terminals is running well. The contract looks to be deployed successfully. It seems like there's supposed to be an API or something I can access via looking up ...
0
votes
1answer
52 views
Gas amount to store a contract?
i'm trying to run truffle migrate and it gives me always this error. Error: The contract code couldn't be stored, please check your gas amount.
MBP-de-Alicia-2:smartContracts alicialombarte$ truffle ...
2
votes
2answers
902 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')
...
0
votes
1answer
111 views
Problem with loading my front end local host due to metamask
I have been trying this Dapp university tutorial online and after following it meticulously I've come across this problem. I suspect it's metamask as the video said if I get this loading message I ...
1
vote
1answer
154 views
Simple Open Auction example - how to run it?
I'm trying to run Simple Open Auction, compiled successfully in Remix. I receive "Exception while processing transaction: revert" when I try to enter recipient account addresses from Ganache, or "...
1
vote
0answers
15 views
Create account with initial fund using web3
Is it possible to create an account with initial fund using web3?
Every time I create a new account I had to do fund transfer to add initial fund. If there is way to fund the account with minimum ETH ...
0
votes
1answer
96 views
Compiled solidity contract run out of gas on deployment
I have a solidity contract that compiles ok (0.5.1 compiler version), but it runs out of gas if I deploy the whole of it. If I comment some of the external methods of the contract, it compiles and ...
0
votes
1answer
28 views
compiling a smoke test
I was testing my ganache compiler to see if it is working and I came across the most ridiculous set of errors
This is my code:
pragma solidity ^0.5.0;
contract Token {
string public name = "My ...
0
votes
2answers
147 views
Fetch the last state of particular asset for particular date
I have one smart contract, in which I am doing mapping of machine id and user id mentioned as below:
mapping(bytes32 => uint256) public machineAllocs;
machineAllocs[machineId] = userId;
Now, I am ...
0
votes
1answer
101 views
My metamask extension is not getting connected to ganache local block chain
This is my Html code :
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
...
1
vote
1answer
753 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 ...
2
votes
1answer
557 views
openzeppelin,VM Exception while processing transaction: revert
using openzeppelin-solidity to create crowdsale.
Then I use this statement to Buy Token:
MyCrowdsaleInstance.sendTransaction({
from: purchaser[1],
value: web3.utils.toWei("0.5", "ether"),
...
1
vote
1answer
105 views
Modify storage in Ganache or Hardhat Network?
I have an orchestrated contract with a function that can only be called by another contract.
While struggling to find an elegant solution for writing a unit test, I realised that I could circumvent ...
0
votes
1answer
72 views
Calling overloaded function from geth client
Attaching a geth client to a ganache-cli instance:
$ geth attach http://localhost:8550
Welcome to the Geth JavaScript console!
instance: EthereumJS TestRPC/v2.0.2/ethereum-js
coinbase: ...
0
votes
1answer
156 views
How to get block size and block mining time while using ganache and truffle
I am using truffle framework and Ganache (GUI) as emulator.
I want to know the size of the generated block.
Also I want to know the time required to mine/generate/create a block after the command.
I ...
1
vote
1answer
632 views
Cannot connect to ganache-cli with web3 and nodejs
from package.json:
"ganache-cli": "^6.3.0",
"web3": "^1.0.0-beta.41",
in my createContract.js
const Web3 = require("web3");
const ganache = require("ganache-cli");
console.log('ganache.provider :', ...
0
votes
0answers
21 views
Should an account be associated with a node
When i use await web3.eth.accounts.create(); to create a account and write something to smart contract in ganache, i get sender account not recognized.
But I get executed properly when i create an ...
0
votes
1answer
102 views
Create a new contract from other contract by connecting to ganache-cli
I am trying to create a contract from other contract on gnache-cli using remix web3 provider but getting following error:
VM Exception while processing transaction: revert
The issue is that when I ...
0
votes
0answers
24 views
Transfer ether in solidity 0.5.16 with truffle
I am currently working with Truffle and Ganache, therefore I use Solidity compiler version 0.5.16. With that version I have some problems to send ethers. I want to transfer ether to a specific address....
1
vote
0answers
19 views
Uniswap addLiquidity Error: “revert TransferHelper: TRANSFER_FROM_FAILED”
I'm having issues with the addLiquidity() call failing due to what likely seems to be an approval issue and producing the following error code:
Internal JSON-RPC error. { "message": "VM ...
1
vote
1answer
180 views
Once i use selfdestruct(owner) then `Attempting to run transaction which calls a contract function, but recipient address is not a contract address`
How do I fix this? I've already tried truffle migrate --reset and/or deleting the .json files.
1
vote
1answer
93 views
How to test your smart contract against currently existing ones on mainnet locally using Truffle?
Background
I am fairly new to smart contracts and am currently experimenting using Ganache and Truffle to test on my local machine.
My goal would be to have the smart contract interacting with other ...
1
vote
1answer
109 views
Ganache Invalid JSON RPC response: “”
Trying to connect Ganache GUI running on port 7545 to web3.js. Getting the below error whenever trying to call any of the functions of web3 -
> web3.eth.getBalance("...
4
votes
1answer
455 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 ...
1
vote
1answer
502 views
Web3 - Cannot read property 'clearSubscriptions' of undefined
While creating a web3 instance, and attempting to call setProvider with a valid provider (Ganache), I get a TypeError.
TypeError: Cannot read property 'clearSubscriptions' of undefined
Steps to ...
0
votes
1answer
19 views
Out of gas for a transaction on ganache
I am developing an NFT using truffle, and I struggle to make my mint() function work :
function mint(uint256 tokenId) public onlyElevated whenNotPaused returns (uint256) {
require(totalSupply() &...
2
votes
1answer
183 views
Branch a Truffle test into various Ganache blockchain states
I am currently testing a contract that can evolve in different ways, depending on the interaction between parties. But all these possible scenarios share the same initialization.
So, the question I ...