Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. const Client = require('bitcoin-core');
  2. const client = new Client({password: "123", username: "123", network: 'regtest', port: 18444 }); // Port was changed to 18444
  3.  
  4.  
  5. client.getBlockHash(2) // For block number 2
  6. .then(data => client.getBlock(data))
  7. .then(data => client.getTransaction(data.tx[0]))
  8. .then(data => client.getTxOut(data.txid, 0, true))
  9. .then(data => console.log(data))
  10. .catch(err => console.log(err))
  11.  
  12. { height: 111,
  13. bestblock: '1aabfd35913adf84f515f1cc2bdb897aeaf8f419e89d0c772a7e4d62632a33be',
  14. transactions: 111,
  15. txouts: 111,
  16. bytes_serialized: 7659,
  17. hash_serialized: '55ad9fd3a107feaa33cc6f7b41fc9fb4259ad9f1c88cce9c3e1947574fad68d3',
  18. total_amount: 5550 }
  19. { bestblock: '1aabfd35913adf84f515f1cc2bdb897aeaf8f419e89d0c772a7e4d62632a33be',
  20. confirmations: 110,
  21. value: 50,
  22. scriptPubKey:
  23. { asm: '0349bd218c6ee64537cccf9320b94e3340dda95e47c823ed2c6941161d91fb41ea OP_CHECKSIG',
  24. hex: '210349bd218c6ee64537cccf9320b94e3340dda95e47c823ed2c6941161d91fb41eaac',
  25. reqSigs: 1,
  26. type: 'pubkey',
  27. addresses: [ 'n1E6nKwEzLC6mRU8F2Axs27eJKn6fz8cWN' ] },
  28. version: 2,
  29. coinbase: true }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement