Connecting dApp to Harmony RPC node with GetBlock RPC provider

Getting Harmony API endpoint

  1. Set up account on GetBlock: you can sign up with either e-mail address or MetaMask wallet:
  2. Create New Project by clicking ‘+’ and choosing the name for it.
  3. In the list of protocols choose ‘Harmony’ mainnet and click ‘Get’ to obtain our RPC endpoint address.
  4. That’s it: now you can use your endpoint (……/mainnet/ ) to connect to Harmony.
  5. You can switch between JSON RPC and WebSockets interfaces.

Testing Harmony API endpoint by GetBlock

  1. Let’s try it: via the Postman API platform we can retrieve the header of the latest Harmony block. To do so, let’s create a new API request.
  2. We need to set POST as a type of request and our endpoint URL as an API key. Let’s take the request sample here: (‘Sample Curl Request’ field)
  3. Then, we need to copy the request to ‘Body’ field, choose ‘RAW’ as a type of data and JSON as a format.
  4. Click ‘Send’. We’re good to go: in ‘Response’ field, we can find the information we requested.