3

I have been using web3 nodejs and infura.io to build apps that interact w/ the Ethereum Blockchain and it is all great but I don't like the idea of a failure point my my apps because they rely on a third party (I.e. infura.io). How does one interact w/ the blockchain without use of a third party, obviously this is possible since infura themselves must be doing it

2 Answers 2

5

Infura is basically just running a bunch of nodes to which it provides access for you. So you just need to run your own node.

There are a few different node clients available; the most popular are Geth and Parity. You can choose any client you wish. So just download the client program, read instructions and start synchronizing the node with the blockchain. Once it's fully synchronized you can use it the same way you'd use Infura (and in many other ways as well).

2
  • 1
    Thanks, "GETH" is a good place for me to start researching. I just needed a term I could put in google to start bringing up more info but was hitting a wall since all the top result blogs are written about using third party APIs, the term 'GETH' is bringing up good results for me. Oct 28, 2019 at 20:50
  • 2
    You can use your own node with extended API compared to Infura, like for instance managing your own wallets via the personal RPC API, which IMO is a very important difference worth mentioning. Oct 28, 2019 at 21:22
3

If your goal is to eliminate single points of failure in your system, you need to study how peer to peer applications like geth achieve resilience.

Replacing infura by a node that you own and control is a good first step as infura is used by a lot of dapps and could be the target of an attack to take dapps down. However, by doing this, you're simply replacing a point of failure by another.

What geth does during the peer discovery phase is connecting to a list of trusted bootnodes. These bootnodes can inform your geth node about the addresses of other nodes. This way you end up with a list of peers to sync from.

If a node falls, there are plenty of other nodes to relay the informations, and the network can continue to operate. If all the trusted bootnodes fall, the network stops functioning.

Now how to achieve the same level of resilience in a dapp? If your app runs in the browser, it's not going to be easy. The technology is simply not mature enough to do the same kind of peer discovery in javascript. The idea is to have what we call a light client. This kind of client can discover peers like geth does, but won't try to synchronise the gigabytes of data needed to operate. These things are still in development.

If your app is a desktop app, you can embed a geth node in your app like AKASHA did.

5
  • Application runs in C and/or JS. Is there any reason you need a geth node to broadcast to the network, or can I just use a pre-determined massive list of trusted nodes and it broadcasts iteratively until one succeeds Nov 4, 2019 at 14:50
  • 1
    You could broadcast your transactions to a list of infura-like RPC endpoints yes. They usually expose a subset of the API that is enough to do everyday tasks. You will notice that there are not a lot of these public endpoints however. We call these RPC endpoint providers Blockchain as a Service. See Cloudflare, Infura, Chainstack, BlockCypher, and BlockForm (my own). The problem with this is that wallets like MetaMask don't support falling back to backup RPC endpoints. They are working instead on implementing light clients, which will be the clean way of solving the problem.
    – Kivutar
    Nov 5, 2019 at 1:59
  • I already use infura, I could use a list of various services that offer said enpoints but I'd rather just directly broadcast the transaction myself without relying on a third party. Nov 5, 2019 at 2:34
  • 2
    To directly broadcast, without a relay / single point of failure, you need the p2p stack that ethereum nodes use. The quickest way would be to embed a light ethereum client (like geth in light sync mode).
    – Kivutar
    Nov 5, 2019 at 3:05
  • Thanks! Looking into "light" geth now Nov 5, 2019 at 3:06

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.