reading time

Article

reading time

Nov 07, 2018

Free Public Ethereum Service

separator
reading time

4 min

reading time

Jonny Huxtable

Ever since we released our app, we’ve had a complete dependency on Metamask & Infura to fetch all the data from our contracts on-chain. Even though this has been working for the most part, it has proved slightly problematic and hinders the amount we can do within the UI.

With that in-mind, I’m happy to say that we’ve recently opened up public and free Ethereum RPC’s for both Main and Ropsten networks.

This allows us to work on removing the dependency on Metamask within our app, so it can be viewed entirely within your own browser with no wallet provider installed.

Along with the RPCs typical usage, these endpoints can be used to run your own Chainlink node!

Edit 10/01/21: Ropsten public RPC has been depreciated due to issues client stability, endpoints for Rinkeby & Goerli added.

We want to give back to the community.

Since we first released this service in November ’18, we now see around 300 requests a minute to, or around 103,000 requests every day at peak levels.


 

Chainlink Node Support

Since we’re working on LinkPool, it wouldn’t be right of us to open these endpoints and not take considerations of potential node operators who want to launch their own Chainlink nodes with incredible ease in aim to learn and gain experience for the future.

Since we have WebSocket endpoints for various ETH networks, mainnet and testnets, it allows you very quickly launch your own node(ensure Docker is installed):

docker run -it \
--name chainlink \
-p 6688:6688 \
-v ~/.cl_ropsten:/chainlink \
-e ETH_URL=wss://goerli-light.eth.linkpool.io/ws \
-e ROOT=/chainlink \
-e LINK_CONTRACT_ADDRESS=0x20fe562d797a42dcb3399062ae9546cd06f6328 \
-e ETH_CHAIN_ID=3 \
-e LOG_LEVEL=debug \
-e CHAINLINK_TLS_PORT=0 \
-e CHAINLINK_TLS_HOST=localhost \
smartcontract/chainlink:latest local node

If you run the above command, you’ll see a node spin up and then connect to our ETH WS RPC as defined above. Since the URL provided is the Ropsten one, it’ll be on the Ropsten network. To do the same for main-net, simply change ETH_URLCHAIN_ID and LINK_CONTRACT_ADDRESS like so:

docker run -it \
--name chainlink \
-p 6688:6688 \
-v ~/.cl_main:/chainlink \
-e ETH_URL=wss://main-light.eth.linkpool.io/ws \
-e ROOT=/chainlink \
-e CHAINLINK_DEV=true \
-e LINK_CONTRACT_ADDRESS=0x514910771af9ca656af840dff83e8264ecf986ca \
-e ETH_CHAIN_ID=1 \
-e LOG_LEVEL=debug \
-e CHAINLINK_TLS_PORT=0 \
-e CHAINLINK_TLS_HOST=localhost \
smartcontract/chainlink:latest local node

After entering your chosen password into the node on start-up, then you should be seeing new block headers being received and then be able to log-in to your operator UI:

Chainlink Operator UI Login Screen

Just for the sake of simplicity in this article, I’ve included all the environment variables in the Docker command. We’ve got a more detailed setup guide located on our documentation:


 

RPC Usage & Design

The RPC’s are a typical Ethereum endpoint, the same as Infura as an example. It allows you to perform standard RPC calls, such as:

> curl https://main-light.eth.linkpool.io -X POST -d 

'{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}' -H 

"Content-Type: application/json"

{"jsonrpc":"2.0","result":"0x42e37e","id":1}

Same for Websockets, for example:

wscat -c wss://main-light.eth.linkpool.io/ws
> {"id": 1, "method": "eth_subscribe", "params": ["newHeads"], "jsonrpc":"2.0"}
< {"jsonrpc":"2.0","result":"0x588d8f80e36e89ca","id":1}
< {"jsonrpc":"2.0","method":"eth_subscription","params":{"result":{"author":"0x15cfa7133ef2862df66377fe6c3bcb9f04b792e9","difficulty":"0x2a269d69e","extraData":"0x544553544e45542d32205768616c6573627572672045544820506f6f6c","gasLimit":"0x7a1200","gasUsed":"0x7d043","hash":"0x8e6126864f2af417c5af7e9e917b02030382554ef505c77629aa5899581c3f8f","logsBloom":"0x00000000000000000000000000000000000000000000000000808000000000000000000000000000200000000000000000000000000000000000000400000000000000000000000000000000000000000001000000000000000000000000000000000000000000000100000000000000000000200000000000000000000000400000000000000000000000000000004000000000000000000008000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000","miner":"0x15cfa7133ef2862df66377fe6c3bcb9f04b792e9","number":"0x42e38e","parentHash":"0xe44a579012dafe661b36e2d2a27639698889340c93c6d355a9f6a26328f2af9d","receiptsRoot":"0xa922a36916f6e64c52a077f1dc36dae5310c0f0117daa15eea4b1b8324b1aed2","sealFields":["0x0ba8ae572cf214fb2e23486d35dcbb28abbc13cc67371445b2e4da85c6713f49","0x42a1077000c4fbf6"],"sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","size":"0x21f","stateRoot":"0x3db1c9043944e190711cd77797511e728a17fb30e5c2bdca9411300da88cb5e9","timestamp":"0x5be2f2bd","transactionsRoot":"0xaba989e6bbcf4ca12900025bd775403c6d0db7b636e0decd2707b40c398793eb"},"subscription":"0x588d8f80e36e89ca"}}

The design of these endpoints is to ensure they’re lightweight as possible, since these are completely open & public endpoints, we’ve ensured that the service doesn’t run out of capacity and can facilitate the correct amount of requests and open WS subscriptions.

To break it down in more detail, we’re running auto-scaling light nodes that all use our full nodes as reserved peers. With using our full nodes as reserved peers, it means we can rely on the security and speed of our full nodes to always retain integrity in the light nodes.

From monitoring, new block headers are being sent to the light nodes as soon as the full node receives them. We also implement custom healthchecks, so if a light node did fall out of sync, it’s automatically recovered and any clients to that node are then re-balanced to other healthy hosts.

Caveats

Since these are light nodes and are load-balanced, there are some caveats if you was to use our endpoints as your Metamask RPC or default ETH client.

  • Degree of latency randomness in eth_call requests to contracts. Since the light nodes only store current state and rely on some P2P communication with full nodes, there’s some latency variance in the standard RPC (Not Websocket).
  • Use of eth_getLogs. Due to using light clients, this is limited to only 1000 blocks from the latest height. This will not cause an issue with Chainlink nodes unless you have downtime of over 3 hours. If you exceed that, any requests made for your node after 3 hours will not be responded to.
  • We do not offer an SLA for this endpoint, although we monitor and treat this service as we do any of our live production services. Preemptive alerting, health checks, constant monitoring etc.

Although as explained above, since these light nodes always peer to our full nodes, the security of them is always retained by our independent validating nodes.

We’ll carry on to look at improving this public service when we can, but any progress is tied directly to the improvement of the Parity light clients.

EDIT 27/05: A lot of improvements have been made to light clients since we’ve first released this service, and with our RPCs flawless uptime, we’ve updated the article to reflect that.


 

That’s all! Any questions around these endpoints or the usage of them, get in-touch with us over our usual channels:

Related Articles