3

i have downloading blockchain with --syncmode "light" using this command

geth --syncmode "light" --cache 1024 --rpc --rpcaddr 127.0.0.1 --rpcport 8545 --rpccorsdomain * --rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3

and blockchain seems to be up to date with every new block..

Now what should i do to start mining and work with web3 to connect to geth?

2 Answers 2

7

In this thread, we had a long discussion how to reduce the size of the chaindata folder when running a node. I suggested to use the Light mode of geth.

However, a light client cannot mine. It does not have the necessary data locally to execute the transactions and perform the consensus. So with a light client, you can broadcast transactions to the network through web3, browse wallets and balances but you can't mine

1
  • 1
    yes Greg, with previous thread discussion im able to work with light mode. Can you please point me to a URL where i can learn to connect with web3 and create wallet websites where all registered users can have their wallet address and they can deposit and withdraw ETH
    – shawn
    Feb 19, 2018 at 9:56
2

Using geth light mode you can't mine coins. Light mode will broadcast transactions to the Eth network.

You can mine in two ways:

  1. Via RPC/IPC: Attach Geth with RPC and run miner.start()

    $> geth attach [IPC/RPC]

    $> miner.start()

  2. Geth command: --mine option along with geth other options. I'll recommend 1st option is best way. Because you can enable and disable any time. Still you can control mine via 1st step.

Advice:

I recommend to you don't expose admin,db,miner as a part of --rpcapi. Because if some one try to connect your IP via Web3 Clients, they can stop mining related stuff or any other related

4
  • 1
    thanks for your time @Jitendra since we can not mine with Light mode. We can not use geth attach [IPC/RPC] option Correct? It can be used only with --fast mode? Can you please guide me to a step by step link that can make me able to connect with RPC and web3? So i can learn to connect with Light mode using web3 and develop any website for such requirements
    – shawn
    Feb 19, 2018 at 9:53
  • 1
    @shawn As far as i know you can attach geth with ipc and rpc, it does n't matter which node your running. And check copy ip address and paste in web3 http provider. If your unable to connect let me know. I'll suggest some other way Feb 19, 2018 at 10:19
  • 1
    Actually after installing Light blockchain, i want to learn using web3 but im not sure what is next step to go with... I really dont know how to connect with RPC or IPC i just have got these lines of code to connect with Ethereum blockchain, but im not sure how i can make them executed to see some results.. var Web3 = require('web3'); var web3 = new Web3(Web3.givenProvider || "ws://localhost:8545"); i have npm installed and installed web3 too with npm install web3. but i dont know what is next
    – shawn
    Feb 19, 2018 at 10:52
  • 1
    im able to connect with my Light mode node using web3. And with infra API URL too with web3... I have one question, Can we send ether to any address from my Light mode infra?
    – shawn
    Feb 19, 2018 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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