I have created a Private Block chain Server on AWS with one Peer. Now if I want to deploy a smart contract at my AWS Node from my local system, how can I do that?
Regards AKM.
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityI have created a Private Block chain Server on AWS with one Peer. Now if I want to deploy a smart contract at my AWS Node from my local system, how can I do that?
Regards AKM.
NOte: This is not recommened with production or main chain. Please follow the instructions if you know what are you doing.
I generally recommend using third party tools like Remix or myEtherWallet to deploy smart contracts easily if you are in test environment.
So you can run geth with these flags
--rpcaddr 0.0.0.0 --rpcport "9816" --rpccorsdomain "*" --rpcapi "web3,eth,admin,debug,miner,personal,net" --wsorigins "*"
Now you can make 9816 port of your instance public for a while and connec remix or MEW for your geth instance and deploy your smart contracts easily. You can close rpc port once you are finished.
PS: If you are running main-net, do not expose RPC calls like this to an external environment. The best way is to deploy contract from your geth instance.
PS: You can follow the artcile for Deploying contract using byteCode (MyEtherWallet and Remix)
If you're using truffle you just need to change the truffle.js so that instead of pointing to your localhost testrpc points to your aws node:
can truffle.js
module.exports = {
networks: {
development: {
host: "localhost", //put here your aws node ip
port: 8545, //make sure the port is open
network_id: "*" // Match any network id or put the network id you
//given during private network setup
from:"Oxbkjfo38438990", //put the address which was generated
//during private network deployment
gas:4600000 //This much gas can deploy almost everything so put
//this
}
} };
Then do the normal truffle compile and truffle migrate.