Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to connect to Bitcoin? #26

Open
lessmore92 opened this issue Nov 19, 2020 · 3 comments
Open

How to connect to Bitcoin? #26

lessmore92 opened this issue Nov 19, 2020 · 3 comments

Comments

@lessmore92
Copy link

Hi,
How to connect to Bitcoin?

@simon-jentzsch
Copy link
Contributor

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

@lessmore92
Copy link
Author

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

@simon-jentzsch
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants