Former End User Consultant, Current Software Developer, and a Master's degree holder in Data Science and Engineering.
"use strict"
const blockHeight = "0"
const { NodeClient } = require("bclient")
const { Network } = require("../bcoin")
const network = Network.get("main")
const clientOptions = {
network: network.type,
port: network.rpcPort,
apiKey: "api-key",
}
const client = new NodeClient(clientOptions)
;(async () => {
const blockByHeight = await client.getBlock(blockHeight)
const script = blockByHeight.txs[0].inputs[0].script
const scriptBuffer = Buffer.from(script, "hex")
const message = scriptBuffer.toString()
console.log(message)
})()