Skip to content

Instantly share code, notes, and snippets.

View ordishs's full-sized avatar

Simon Ordish ordishs

View GitHub Profile
@ordishs
ordishs / verify.js
Last active March 15, 2024 00:30
Small example of the steps needed to verify the merkle proofs of a transaction provided by WhatsOnChain.
const crypto = require('crypto')
const assert = require('assert')
function sha256 (buffer) {
assert(Buffer.isBuffer(buffer), `Argument must be a buffer, received ${typeof buffer}`)
const hash = crypto.createHash('sha256')
hash.update(buffer)
return hash.digest()
}