0

I have created a sample smart contract in the online solidity compiler called Remix and I have also created a private blockchain. Then I also have an ethereum wallet running on this private test network. Can anyone tell me how can I use this smart contract in the ethereum wallet?

1

There are 2 ways.

  1. Deploy the contract using ethereum-wallet and using this directly.
  2. Deploy the contract using remix and add the deployed contract to ethereum-wallet.

Let's see each one by one:

Deploying using Ethereum wallet (or Mist)

  • Start privet blockchain and run ethereum-wallet(or Mist). Make sure Mist is connected to your private network and not the public network.
  • Go to contracts tab in Mist.
  • Click on deploy new contract.
  • Paste the contract code in SOLIDITY CONTRACT SOURCE CODE tab.
  • Choose the owner account from which you want to deploy the contract.If you have multiple contracts, choose the contract you want to deploy. (You may need to specify constructor arguments if your contracts have them).
  • Choose the account from which you want to deploy the contract under thr FROM tab.
  • Click on deploy.
  • Make sure miner is running. (you can type miner.start(4) in geth console to start mining and miner.stop() to stop mining.
  • Once the contract is deployed, you can access the contract in COntracts tab of Mist

Deploying using Remix

  • First, connect your remix compiler to your private network.

  • Go to run tab of remix and under environments, choose Web3 Provider.

  • Under Web3 Provider Endpoint enter Rpc address of your node. (like http://127.0.0.1:8015)

  • Once your node is connected, you can choose the account from the accounts tab and deploy the contract. (I guess you have already done this).

  • Remember you have to run miner if it's not already running to mine your transaction.

  • Once the contract is deployed, copy the address of smart contract and abi.

  • Open your ethereum-wallet, which must also be connected to same private blockchain to which remix was connected.

  • Go to contracts tab and click on Watch contract.

  • Enter the name of contract and the address and abi you just copied. And your contract will be visible under Contracts tab.

|improve this answer|||||
  • while deploying using remix when i gave the rpc address it alerted an error which said "Not possible to connect to the Web3 provider. Make sure the provider is running and a connection is open (via IPC or RPC)." – Monica Mohandas Jan 29 '18 at 11:48
  • I have tried the first method you mentioned and deployed my smart contract. Thank you Prashant.. :) – Monica Mohandas Jan 29 '18 at 11:59
  • Good to hear that I was able to help. And for the second method, remix was unable to connect to your private network. Make sure you have --rpc and --rpcport "some_port" flag set. I guess you will also need rpccorsdomain flag as --rpccorsdomain "*". But do remember don't set rpccorsdomain flag to * in production. It's just for testing. – Prashant Prabhakar Singh Jan 29 '18 at 12:50
0

make sure your private network is running. Then simply open a terminal and do

$ ethereumwallet --rpc path/to/geth.ipc

for example for me

$ ethereumwallet --rpc privateNetworks/geth_PoA/node1/geth.ipc

if you have rpc allowed then

$ ethereumwallet --rpc "http://localhost:8545"

should also work (update the rpc port to your config). From there, use the ehereum wallet UI for deploying contracts. You'll need the bytecode and abi of your smart contract. To get them, do

$ solcjs --abi --bin yourContract.sol

and just copy paste the content in the ethereum wallet under "create contract".

The process is exactly the same for mist.

|improve this answer|||||

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