in3 icon indicating copy to clipboard operation
in3 copied to clipboard

How to connect to Bitcoin?

Open lessmore92 opened this issue 5 years ago • 3 comments

Hi, How to connect to Bitcoin?

lessmore92 avatar Nov 19 '20 00:11 lessmore92

on the commandline this works as

in3 -c btc -f 5 getrawtransaction f84f182e531d0c33b6952c57a8b3e1edecc1851a273dbdd0db2404213bcec8d6 true
in3 -c btc -f 5 getblockheader  00000000000000000002596ec480fb2aa28dad2ef020a74c406a9bd73901950d true

in ts

import { IN3 } from 'in3-wasm'

async function showBlock() {
  // create new incubed instance
  const client = new IN3({
    chainId: 'btc'
  })

  // send raw RPC-Request
  const lastBlock = await client.btc.getBlockHeader(
      '00000000000000000002596ec480fb2aa28dad2ef020a74c406a9bd73901950d'
  )

  console.log("Blockheader: ", JSON.stringify(lastBlock, null, 2))

  // clean up
  client.free()

}

showBlock().catch(console.error)

But since this feature is not officially released yet ( but already included in the last binaries) in the next weeks (after finishing up the tests) we will anounce it and explain more in a blogpost.

But feel free to already hava a look at the documentation: https://in3.readthedocs.io/en/develop/bitcoin.html

simon-jentzsch avatar Nov 19 '20 16:11 simon-jentzsch

Can we use IN3 client to develop an app like a SPV wallet?

lessmore92 avatar Nov 19 '20 19:11 lessmore92

of course! But at the moment incubed is able to verify transactions and blocks. What we are not able to verify yet, is a balance of an account, since this means you would need to proof, that those tx outputs have not been spent. We are working on this, but at the moment those balances would be unverifified yet.

simon-jentzsch avatar Nov 20 '20 08:11 simon-jentzsch