bitcoin core – Can mediantime be used as a proxy for anticipated time of probably the most not too long ago mined block? – CoinNewsTrend

bitcoin core – Can mediantime be used as a proxy for anticipated time of probably the most not too long ago mined block?


I am utilizing Bitcoin Core CLI to get block data:

.bitcoin-cli.exe getblockchaininfo

Amongst different issues, this returns two objects:

  "time": 1713464903,
  "mediantime": 1713461780,

I perceive the mediantime is the median of the time worth for the previous 11 blocks, and is used as a examine to make sure the miner used a sound timestamp worth for the time of the block they only mined.

If I add 50 minutes to that mediantime worth, is {that a} fairly good proxy for when probably the most not too long ago mined block would have been mined? Intra block time is designed to be 10 minutes, however varies due to issue and the unpredictable nature of hashing, so in fact it will not be actual.

I am utilizing the next in Powershell to show probably the most not too long ago mined block quantity, together with the time it was mined, and when it was anticipated to be mined, only for my very own edification:

[System.String]$block_chain_info = (.bitcoin-cli.exe --datadir=E:BitcoinCoreData getblockchaininfo);
If ($block_chain_info -ne $null)

    [System.Object]$bci = (ConvertFrom-Json $block_chain_info -ErrorAction SilentlyContinue);
    $epoch = New-Object DateTimeOffset(1970,1,1,0,0,0,0);
    $block_time = $epoch.AddSeconds($bci.time);
    #mediantime is the median time of the previous 11 blocks
    $block_expected_time = $epoch.AddSeconds($bci.mediantime + (50 * 60));
    Write-Output "Present Block Quantity is:    $($bci.blocks)";
    Write-Output "Block Time is:              $($block_time.LocalDateTime.ToStrings)";
    Write-Output "Block Anticipated Time is:     $($block_expected_time.LocalDateTime.ToStrings)";

Else

    "Couldn't receive block chain data from the Bitcoin Core CLI";
;

I am within the Central Normal Time timezone, so for the newest block, it exhibits:

Present Block Quantity is:    839816
Block Time is:              2024-04-18T13:46:27
Block Anticipated Time is:     2024-04-18T13:33:41

In case it issues, my bitcoin-cli --version is:

Bitcoin Core RPC shopper model v27.0.0
Copyright (C) 2009-2024 The Bitcoin Core builders



Supply hyperlink