"bitcoin-cli getclock" Command

This section describes how to use 'bitcoin-cli getclock' command.

If you want to learn the structure of Bitcoin blocks, you can play with the "bitcoin-cli getclock" Command as shown below.

1. Get the number of blocks that have been synchronized on my local Bitcoin Core Daemon so far.

C:\>\local\bitcoin-0.15.1\bin\bitcoin-cli -testnet getblockcount
124188

2. Get the hash of the block at a given height.

C:\>\local\bitcoin-0.15.1\bin\bitcoin-cli -testnet getblockhash 100000
00000000009e2958c15ff9290d571bf9459e93b19765c6801ddeccadbb160a1e

3. Get the summary of a given block hash.

C:\>\local\bitcoin-0.15.1\bin\bitcoin-cli -testnet
   getblock 00000000009e2958c15ff9290d571bf9459e93b19765c6801ddeccadbb160a1e

{
  "hash": "00000000009e2958c15ff9290d571bf9459e93b19765c6801ddeccadbb160a1e",
  "confirmations": 51096,
  "strippedsize": 221,
  "size": 221,
  "weight": 884,
  "height": 100000,
  "version": 2,
  "versionHex": "00000002",
  "merkleroot": 
     "d574f343976d8e70d91cb278d21044dd8a396019e6db70755a0a50e4783dba38",
  "tx": [
    "d574f343976d8e70d91cb278d21044dd8a396019e6db70755a0a50e4783dba38"
  ],
  "time": 1376123972,
  "mediantime": 1376122060,
  "nonce": 1005240617,
  "bits": "1c00f127",
  "difficulty": 271.7576739288896,
  "chainwork": 
     "000000000000000000000000000000000000000000000000004144cfce43f5e8",
  "previousblockhash": 
     "000000004956cc2edd1a8caa05eacfa3c69f4c490bfc9ace820257834115ab35",
  "nextblockhash": 
     "0000000000629d100db387f37d0f37c51118f250fb0946310a8c37316cbc4028"
}

4. Get the hex dump of a given block hash.

C:\>\local\bitcoin-0.15.1\bin\bitcoin-cli -testnet getblock
   00000000009e2958c15ff9290d571bf9459e93b19765c6801ddeccadbb160a1e 0

0200000035ab154183570282ce9afc0b494c9fc6a3cfea05aa8c1add2ecc56490000000038ba
3d78e4500a5a7570dbe61960398add4410d278b21cd9708e6d9743f374d544fc055227f1001c
29c1ea3b01010000000100000000000000000000000000000000000000000000000000000000
00000000ffffffff3703a08601000427f1001c046a510100522cfabe6d6d0000000000000000
000068692066726f6d20706f6f6c7365727665726aac1eeeed88ffffffff0100f2052a010000
001976a914912e2b234f941f30b18afbb4fa46171214bf66c888ac00000000

Last update: 2017.

Table of Contents

 About This Book

 Introduction of Bitcoin

 Bitcoin Blockchain

 Bitcoin Wallet

Bitcoin Core

 Bitcoin Core Programs

 Bitcoin Core Daemon

 Bitcoin Core CLI

 Bitcoin Core CLI Commands

 Access Bitcoin Test Network "-testnet"

 bitcoin-cli Network Commands

"bitcoin-cli getclock" Command

 bitcoin-cli Transaction Commands

 bitcoin-cli Wallet Commands

 "bitcoin-cli encryptwallet" - Set Wallet Password

 "bitcoin-cli walletpassphrase" - Unlock Wallet

 "bitcoin-cli backupwallet" - Backup Wallet

 Bitcoin Transaction

 Bitcoin-Qt - Bitcoin Core GUI

 Bitcoin Mining

 Bitcoin Consensus Rules

 Bitcoin Block Data Structure

 Bitcoin Transaction Data Structure

 blockexplorer.com API

 Copay - Bitcoin Wallet

 References

 PDF Printing Version