0

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.

  • In order to access your blockchain node, you should have proper access to it. Make sure that the client which is running blockchain, is allowing remote access. – Ayushya Mar 22 '18 at 4:53
1

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)

0

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.

  • Thanks @haduart. I am getting the below error while connecting with truffle. Could 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) – Amit Modi Sep 12 '17 at 13:25
  • @Armit-modi I don't know if this response could help you: truffle how to detect test environments If not also make sure that the post is publicly available from your EC2 node. – haduart Sep 12 '17 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.