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 [ganache]

For questions about using the Ganache personal blockchain testing environment.

1
vote
1answer
26 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; ...
0
votes
1answer
14 views

truffle test get different results between ganache-cli and local geth

When I run truffle test on ganache-cli, it will pass the test but when I run the same truffle test commnad on local geth node, it will fail with error saying invalid address at the method which takes ...
1
vote
1answer
41 views

Doubt in terminologies used in Ganache Interface

I am developing a DApp (an e-commerce app) based on Ethereum. I wrote the solidity contract and interact it with a NodeJS server/web3js API. I am running a Ganache Ethereum RPC client locally. The app ...
1
vote
1answer
30 views

can't call function from contract using web3.js due to gas issue

i'm really new to ethereum and solidity, so any help will be approtiat. i'm building a smart contract and dapp using ganach and web3.js . in my smart contract I have a function(named "add_pilot") ...
1
vote
2answers
85 views

How do I implement simple JS code to deploy a compiled smart contract to ganache-cli? [closed]

Everything I've tried results in strange errors, and it's been difficult to get this working. I've been struggling with this for a while, especially having problems determining which versions of web3 ...
0
votes
2answers
108 views

Truffle compile and migrate not working

I have a geth node running on my laptop. This is the command I used to start geth. geth --port 4321 --networkid 1234 --datadir=./dataDir --rpc --rpcport 8543 --rpcaddr 127.0.0.1 --rpcapi "eth,net,...
2
votes
2answers
80 views

Cannot create property 'from' on string

I'm trying to call a contract method from web3js. The contract is deployed in a local ganache. This is my full code // Instantiate contract const provider = new Web3.providers.HttpProvider("http://...
1
vote
0answers
18 views

Error: Cannot create instance of X; no code at address

Having a little issue. I have deployed a Mock ERC20 contract on development network like so: const ERC20Mock = artifacts.require("ERC20Mock"); module.exports = async function(deployer, network, ...
0
votes
0answers
49 views

Truffle migrate not working with 2_deploy_contracts.js

I have made a sample contract using Truffle's pet-shop. I have also added the 2_deploy_contracts.js file. I have changed the solidity version and also the constructor() public {} to comply with the ...
0
votes
0answers
20 views

Issue with truffle migrate

I'm trying to migrate a simple contract on the ganache blockchain.But when I type 'truffle migrate' command in the terminal.It freezes for some time and then command execution stops without showing ...
0
votes
2answers
57 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
0answers
16 views

Truffle Deployment

I have created a DAPP using Truffle & Ganache. It is working fine in development server after running the following command. $ganache-cli Deploy the contract. $truffle migrate --reset Run the ...
0
votes
1answer
82 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 ...
2
votes
1answer
119 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 ...
0
votes
1answer
87 views

Ganache provider not working with web3

I am trying to run a test script for my smart contract but ganache provider is not being accepted by web3 here is my code. const assert = require('assert'); const ganache = require('ganache-cli');...
1
vote
1answer
64 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
2answers
87 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 ...
1
vote
0answers
56 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 ...
0
votes
0answers
67 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, ...
0
votes
0answers
30 views

Uncaught Error: CONNECTION ERROR: Couldn't connect to node http://localhost:8545

I am running ganache app locally in windows 10 and trying to connect with node app on localhost:8080 but getting below error Please help me!
1
vote
2answers
264 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
69 views

Error processing transaction request: sender doesn't have enough funds to send tx

In a Java project im testing the web3j library. there I have a method that generate a new account to the blockchain public String url = "http://localhost:7545/"; public Admin admin = Admin.build(new ...
2
votes
1answer
38 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(...
0
votes
1answer
33 views

Error generating new account with Web3j

Im using the Web3j library to make transactions with my blockchain (Ganache). I have a method that instantiate a Web3j object and im trying to generate a new account with the given String url = "...
0
votes
1answer
57 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 ...
1
vote
1answer
20 views

Error when trying to open Ganache on Ubuntu: archive type not supported

After downloading a fresh copy of the latest Ganache and double click to run it, the following error is shown: archive type not supported Versions Ubuntu: 16 and 17 All Ganache versions: for ...
0
votes
1answer
43 views

How to change the account that is interacting with the deployed smart contract on Ganache? [duplicate]

When I enter truffle console and start interacting with the deployed contract truffle uses the first address, how to change the address for testing ? user@user:~/workspace/smart-contract$ truffle ...
1
vote
2answers
37 views

How truffle selects the address with which it deploys a smart contract with and where does it gets it's private keys?

I am reading truffle tutorials for deployment smart contract to gauche, I've never deployed any smart contract to real network. Now when migrate (deploy) a smart contract I get these info: ...
1
vote
1answer
27 views

Processing gas cost on a sidechain

I am developing a sidechain that will store data and I want to evaluate the processing of this data in the ethereum network to get the cost in gas. I'm going to develop a smart contract that will ...
2
votes
1answer
40 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 ...
0
votes
2answers
112 views

web3.utils.fromWei(web3.eth.getBalance(web3.eth.coinbase), 'ether').toNumber() gives error

web3.utils.fromWei(web3.eth.getBalance(web3.eth.coinbase), 'ether').toNumber() gives this error: > /usr/local/lib/node_modules/truffle/build/cli.bundled.js:369506 > throw new Error('...
2
votes
1answer
38 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
38 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
0answers
50 views

Invalid opcode on estimateGas 'code': -32000

this is my contract : pragma solidity >=0.4.21 <0.6.0; contract CloudProject { uint public nbCandidates = 0; uint public nbBureau = 0; uint public nPartiPouvoir = 0; ...
2
votes
1answer
56 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 ...
4
votes
1answer
44 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 ...
0
votes
1answer
21 views

SC Truffle Testing: Domain Object Returned?

Working through some tests in Truffle to become more acquainted with the environment but am running into an issue. What I am trying to do Test a smart contract with, among others, the following ...
0
votes
1answer
72 views

Truffle and Ganache-cli test case fails

So I have this setup : truffle and ganache-cli I'm sending some ether to my contract, here is the related part of my contract: mapping(address => uint256) public balanceOf; function () ...
2
votes
0answers
66 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 ...
0
votes
1answer
90 views

Solidity test file reaches gas limit due to imports

I have a sol contract X.sol and a sol test file TestX.sol. X.sol is large: ~4m Gas after optimisation TextX.sol compiles, migrates and executes tests fine when just executing a single test - testY, ...
0
votes
1answer
66 views

Set up backup from private Ethereum (Ganache) [duplicate]

I have created an ethereum application with Ganache and truffle js. i have installed ganache in a server, and th application work. but when i stop the server i lose the the smart contract that i have ...
2
votes
0answers
45 views

issue with persistence of blockchain data in ganache-cli [duplicate]

a request for these users (Richard Horrocks, Achala Dissanayake, shane, flygoing ), please read the questions completely and understand them... then answer them if you actually know something about ...
0
votes
1answer
355 views

ALERT: [ethjs-rpc] rpc error with payload

I am trying to create transaction local blockchain using ganache on When i confirm the transaction i get the error as "{"id":4818399857527,"jsonrpc":"2.0","params":..", please refer screenshot for ...
1
vote
0answers
26 views

access remix addresses within contact

I want to write tests for my simple solidity contract and one of the tests I have is to pass an address dynamically from remix or ganache-cli. Is there a way to access all other addresses from remix ...
1
vote
1answer
37 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-...
4
votes
1answer
137 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 ...
0
votes
1answer
33 views

InterfaceImp constract defined success,but interface function called failed

I'm trying to call a interface function for testing, but it can't work. Here is my test contract: pragma solidity ^0.4.24; interface InterfaceTest{ function testInterface() external pure ...
10
votes
1answer
3k 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 ...
0
votes
0answers
96 views

Using transfer() method but don't see payment in Ganache or Metamask?

I'm using the .transfer() method in my smart contract to pay a particular address. I've checked the Ganache logs and the transaction does not revert and is auto-mined successfully. But I don't see a ...
0
votes
3answers
31 views

Truffle wrapper

ExampleContract { address public miner; constructor(){ address miner = msg.sender; } } I am using truffle and ganache-cli and I executed the following command: truffle migrate --...