Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Client = require('bitcoin-core');
- const client = new Client({password: "123", username: "123", network: 'regtest', port: 18444 }); // Port was changed to 18444
- client.getBlockHash(2) // For block number 2
- .then(data => client.getBlock(data))
- .then(data => client.getTransaction(data.tx[0]))
- .then(data => client.getTxOut(data.txid, 0, true))
- .then(data => console.log(data))
- .catch(err => console.log(err))
- { height: 111,
- bestblock: '1aabfd35913adf84f515f1cc2bdb897aeaf8f419e89d0c772a7e4d62632a33be',
- transactions: 111,
- txouts: 111,
- bytes_serialized: 7659,
- hash_serialized: '55ad9fd3a107feaa33cc6f7b41fc9fb4259ad9f1c88cce9c3e1947574fad68d3',
- total_amount: 5550 }
- { bestblock: '1aabfd35913adf84f515f1cc2bdb897aeaf8f419e89d0c772a7e4d62632a33be',
- confirmations: 110,
- value: 50,
- scriptPubKey:
- { asm: '0349bd218c6ee64537cccf9320b94e3340dda95e47c823ed2c6941161d91fb41ea OP_CHECKSIG',
- hex: '210349bd218c6ee64537cccf9320b94e3340dda95e47c823ed2c6941161d91fb41eaac',
- reqSigs: 1,
- type: 'pubkey',
- addresses: [ 'n1E6nKwEzLC6mRU8F2Axs27eJKn6fz8cWN' ] },
- version: 2,
- coinbase: true }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement