Ganache Issue-Not showing the available networks - blockchain

Iam trying to connect Ganache in mac, when i started Ganache ,its not showing the available accounts and open the server screen - unable to select the host name. It has only one option "hostname of the server 0.0.0.0 - All Interfaces."
I've tried
Restarting Ganache,
Restarting Computer,
Uninstalling from Applications and Reinstalling,
Ganache Downloaded Ganache from
https://trufflesuite.com/ganache/
FYI:i have installed truffle suite
Truffle v5.5.20 (core: 5.5.20)
Ganache v7.2.0
Solidity v0.5.16 (solc-js)
Node v16.15.1
Web3.js v1.7.4
Anyone has idea how resolve this issue.
Thanks in Advance
Laxmi

your truffle.config.js should have this minimum configuration to connect
module.exports = {
contracts_build_directory: "./public/contracts",
networks: {
development: {
// in hte truffle HOSTNAME down set the correct host. "0.0.0.0" should accept this
host: "127.0.0.1",
port: 7545,
network_id: "*",
},
},
compilers: {
solc: {
version: "0.8.13",
},
},
If ganache is running, when you start your truffle project it should automatically connect

Related

Truffle migrate is not deploying to Ganache

I tried command truffle migrate --reset, but it is unable to connect to Ganche
here is the error:
This is the code inside truufle-config.js file:
And these are the RPC server details:
It seems there is a typo in your truffle-config.js: post instead of port.
Try this out:
networks: {
development: {
host: "127.0.0.1",
port: 9545,
network_id: "*"
}
},
Then:
Double check the settings on Ganache match with the ones on truffle-config.js
Check that Ganache is running.
And finally open a new terminal and run the following 2 commands in the same folder where the file truffle-config.js is hosted:
truffle console ––network development
migrate ––reset
Try this out:
networks: {
development: {
host: "127.0.0.1",
port: 7545,
network_id: "*",
}
},
Open the terminal and run the following command in the same folder where the file truffle-config.js is hosted:
truffle console ––network development

Truffle configuration

truffle migrate --compile-all --reset --network ganache
Compiling your contracts...
Everything is up to date, there is nothing to compile.
Unknown network "ganache". See your Truffle configuration file for available networks.
By default you don't need to specify the --network, truffle will automatically connect to Ganache. On the other hand, if you want to have the name ganache configured as a network, you will have to modify your truffle-config.js file as follows:
networks: {
//...,
ganache: {
host: "127.0.0.1",
port: YOUR_GANACHE_PORT, // (default: 5777)
network_id: "YOUR_GANACHE_NETWORK_ID", // (default: *)
},
//...
}
Check this picture to see Ganache port and network_id

Connecting to Google Cloud PostgresSQL Server for local Strapi Application

I have a Google cloud Postgres server set up, and under the production environment I am able to connect to the server correctly. However, when I try to connect to the same cloud server in my local server, it doesn't seem to work. Here's the configuration for my database.js
module.exports = ({ env }) => {
return {
defaultConnection: "default",
connections: {
default: {
connector: "bookshelf",
settings: {
client: "postgres",
host: `/cloudsql/${env("INSTANCE_CONNECTION_NAME")}`,
database: env("DATABASE_NAME"),
username: env("DATABASE_USERNAME"),
password: env("DATABASE_PASSWORD"),
},
options: {},
},
},
};
};
I also have the app.yaml set up as normal. I have also created the .env file to store the relevant env information.
The error I am getting is
error Error: connect ENOENT /cloudsql/my-app-286221:us-central1:blm-resources/.s.PGSQL.5432
Does Strapi in local development support connection to cloud database? Or am I doing something wrong here.
This shouldn’t be a strapi issue. First you need to have an access from outside to google cloud postgres database. I’m not familiar with google cloud services, but from documentation there seem to be a couple of things to do to grant access to database.
More info from documentation:
https://cloud.google.com/sql/docs/postgres/connect-external-app#appaccessIP
Basically you grant access for connection from outside and then you add that connection information to your strapi config file.
I noticed your host: is not pointing to http:// or https:// but to some google server’s local address.

How can i deploy my contract on blockchain network?

I've being trying to create a basic smart contract and deploy it on blockchain using truffle,ganache.When i put this command on my truffle console it throws an error.I've looked for the solution but can't seem to understand where i am going wrong!Can anyone help me out?
This is my migrations 2nd file i.e 2_deploy_contracts.sol
var Election = artifacts.require("./Election.sol");
module.exports = function(deployer) {
deployer.deploy(Migrations);
};
This is my truffle-config.js
module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
// for more about customizing your Truffle configuration!
networks: {
development: {
host: "127.0.0.1",
port: 7545,
network_id: "*" // Match any network id
},
develop: {
port: 8545
}
}
};
Here's the error:
Uncaught:
Error: Election has not been deployed to detected network (network/artifact mismatch)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at Function.deployed (C:\Users\harshad\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\contract\lib\contract\constructorMethods.js:84:1)
at Object.checkNetworkArtifactMatch (C:\Users\harshad\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\contract\lib\utils\index.js:249:1)
I think the private network is not connected to your truffle.
Please check the following:
Private chain development tool (ex.Ganache) is running.
Check the private chain (Ganache) IP and RPC port numbers are the same as in the truffle-config.js file.
It will be the solution of this problem.

Can not connect to Truffle or testrpc with Ganache GUI

I have Ganache GUI from appx from official website on my Windows 10. When I run Truffle or testrpc network in my console (WSL) and try to connect there from Ganache GUI in settings, I get error message next to the textbox with a port:
The port is used by another application; please change it
the port is from Truffle or testrpc. How can I connect there? Thank you.
Ganache UI runs an instance of Ganache CLI (i.e. simulated Ethereum instance previously called TestRPC). If you already have a console window open with an application on port 9545 then Ganache UI cannot start a new instance on that same port.
I add the following to my .zshrc or .bashrc file
# Get WSL Host IP
export WSL_HOST_IP="$(awk '/nameserver/ { print $2 }' /etc/resolv.conf)"
This allows me to surface my host ip, so commands in WSL2 can reach the localhost.
Now create a workspace in Ganache GUI and under the server HOSTNAME settings choose "0.0.0.0 - All Interfaces".
In your truffle project edit the truffle-config.js file and set your network development block to this:
development: {
host: process.env.WSL_HOST_IP,
port: 7545,
network_id: "*" // Match any network id
}
Now when you run truffle migrate, it should connect to the Ganache GUI.
These are the steps that worked for me:
Start ganache-ui
Configure truffle's network in truffle-config.js:
networks: {
development: {
host: "127.0.0.1", // Localhost (default: none)
port: 7545, // Standard Ethereum port (default: none)
network_id: "*", // Any network (default: none)
},
...
Run truffle console (NOT truffle develop)