Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 662 Bytes

get-block.md

File metadata and controls

34 lines (25 loc) · 662 Bytes
layout
default

Getting information of a block, specified via it's block height

Code

"use strict"

const { NodeClient } = require("bclient")
const { Network } = require("../bcoin")
const network = Network.get("main")

const blockHeight = "406267"

const clientOptions = {
  network: network.type,
  port: network.rpcPort,
  apiKey: "api-key",
}

const client = new NodeClient(clientOptions)
;(async () => {
  const blockByHeight = await client.getBlock(blockHeight)
  console.log("By height: \n", blockByHeight)
})()

## [Get information of unspent transaction outputs -->](./get-utxo.html)

back