current position:Home>How to deploy truss to remote private chain

How to deploy truss to remote private chain

2022-02-03 20:53:23 Q & A of Denglian community

I use it locally truffle Built a project , I want to deploy the above contract to Ethereum. This is my configuration file

development: {      host: "115.159.21.194",     // Localhost (default: none)      port: 7545,            // Standard Ethereum port (default: none)      network_id: "*",       // Any network (default: none)    },

This is my deployment script

var Note = artifacts.require("./noteContract.sol");var web3 = new Web3(new Web3.providers.HttpProvider('http://115.159.21.194:7545'));module.exports = function (deployer) {  deployer.deploy(Note, {from:web3.eth.accounts[0]});};

This is my geth Start command

geth --rpc --rpcport "7545" --rpcaddr "0.0.0.0" --rpccorsdomain="*" --rpcapi eth,web3,admin,personal,net --datadir data --port "30303" --nodiscover --networkid 1024 --allow-insecure-unlock console 2>>geth.log  

This is the reason for the error

PS C:\Users\Administrator\Desktop\ project \wallet> truffle migrateCould not connect to your Ethereum client. Please check that your Ethereum client:    - is running    - is accepting RPC connections (i.e., "--rpc" option is used in geth)    - is accessible over the network    - is properly configured in your Truffle configuration file (truffle.js)

What's the problem ...




Take the answer 1:

It's solved . It was not written in the deployment file , Is to introduce the wallet into the configuration file

The core part of the configuration file

var HDWalletProvider = require("truffle-hdwallet-provider");  //  The import module var mnemonic = "medal luxury .....  ..... ... danger faculty spy";  //MetaMask Mnemonics for .development: {      host: "115.159.21.194",     // Localhost (default: none)      port: 7545,            // Standard Ethereum port (default: none)      network_id: "*",       // Any network (default: none)      provider: function () {        // mnemonic Express MetaMask Mnemonics for . "ropsten.infura.io/v3/33..." Express Infura Project on id        return new HDWalletProvider(mnemonic, "http://115.159.21.194:7545", 0);   // 1 Means the second account ( from 0 Start )      }    },





Other answers 1:

copyright notice
author[Q & A of Denglian community],Please bring the original link to reprint, thank you.
https://en.netfreeman.com/2022/02/202202032053204992.html

Random recommended