bitcoin core – Can mediantime be used as a proxy for expected time of the most recently mined block?

on

|

views

and

comments


I’m using Bitcoin Core CLI to get block info:

.\bitcoin-cli.exe getblockchaininfo

Among other things, this returns two items:

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

I understand the mediantime is the median of the time value for the past 11 blocks, and is used as a check to ensure the miner used a valid timestamp value for the time of the block they just mined.

If I add 50 minutes to that mediantime value, is that a reasonably good proxy for when the most recently mined block would have been mined? Intra block time is designed to be 10 minutes, but varies because of difficulty and the unpredictable nature of hashing, so of course it won’t be exact.

I’m using the following in Powershell to display the most recently mined block number, along with the time it was mined, and when it was expected to be mined, just for my own edification:

[System.String]$block_chain_info = (.\bitcoin-cli.exe --datadir=E:\BitcoinCore\Data 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 past 11 blocks
    $block_expected_time = $epoch.AddSeconds($bci.mediantime + (50 * 60));
    Write-Output "Current Block Number is:    $($bci.blocks)";
    Write-Output "Block Time is:              $($block_time.LocalDateTime.ToString{s})";
    Write-Output "Block Expected Time is:     $($block_expected_time.LocalDateTime.ToString{s})";
}
Else
{
    "Could not obtain block chain info from the Bitcoin Core CLI";
};

I’m in the Central Standard Time timezone, so for the most recent block, it shows:

Current Block Number is:    839816
Block Time is:              2024-04-18T13:46:27
Block Expected Time is:     2024-04-18T13:33:41

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

Bitcoin Core RPC client version v27.0.0
Copyright (C) 2009-2024 The Bitcoin Core developers

Share this
Tags

Must-read

The Great Bitcoin Crash of 2024

Bitcoin Crash The cryptocurrency world faced the hell of early 2024 when the most popular Bitcoin crashed by over 80% in a matter of weeks,...

Bitcoin Gambling: A comprehensive guide in 2024

Bitcoin Gambling With online currencies rapidly gaining traditional acceptance, the intriguing convergence of the crypto-trek and gambling industries is taking place. Cryptocurrency gambling, which started...

The Rise of Bitcoin Extractor: A comprehensive guide 2024

Bitcoin Extractor  Crypto mining is resources-thirsty with investors in mining hardware and those investing in the resources needed as the main beneficiaries. In this sense,...

Recent articles

More like this