We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Here you can find an instruction on how to sign a Bitcoin transaction with KeyChain.
Start with the command `wscat -c ws://localhost:16384/, then select a key.
{ "command": "select_key" }
const bitcoin = require ('bitcoinjs-lib'); const publicKey = 'YOUR_PUBLIC_KEY'; // 08d6770d8219923fe25a4d6aeb2c171253d5de3bc225f09dbfb2cb93ed837be1a80fdd3af5046b8f1f5412e5b321dcc3c25be9f4dd285250421ea55071794277 const publicKeyCompressed = Buffer.from(`03${publicKey.substr(0, 64)}`, 'hex'); const keyPair = bitcoin.ECPair.fromPublicKeyBuffer(publicKeyCompressed, bitcoin.networks.testnet); const address = keyPair.getAddress();
In case you work with testnet - https://coinfaucet.eu/en/btc-testnet/
const fetch = require('node-fetch'); const API_URL = 'https://test-insight.bitpay.com/api'; const address = 'YOUR_ADDRESS'; // myLrbwvwJN59quivKSxCxgiqLdCw8m7aDf fetch(`${API_URL}/addr/${address}`) .then( data => data.json() ) .then(({ balance }) => console.log('BTC Balance: ', balance));
You can find an example of the code here