Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: DUPONDIUS on September 26, 2023, 05:22:06 PM



Title: Time of Confirmation
Post by: DUPONDIUS on September 26, 2023, 05:22:06 PM


Hello.

Is there a way to find out the exact time a transaction was confirmed?


Title: Re: Time of Confirmation
Post by: OmegaStarScream on September 26, 2023, 05:23:19 PM
Hello.

Is there a way to find out the exact time a transaction was confirmed?


Yes, of course. Which block explorer are you using? Blockchair should show you the confirmation time.

Blockchain, on the other hand, shows when the transaction was broadcast and not confirmed. But if you click on the block on which the transaction was confirmed, you will see when that block was mined and that would also represent the first confirmation time.


Title: Re: Time of Confirmation
Post by: Charles-Tim on September 26, 2023, 05:26:08 PM
Input the txid on a blockchain explorer like:

https://blockchair.com
https://blockstream.info/
https://mempool.space/
https://www.blockchain.com/explorer/assets/btc

Edit:
If the transaction is for you and on your wallet, you can see the day and time on some wallets, like Electrum, Bluewallet and many other bitcoin wallets.


Title: Re: Time of Confirmation
Post by: Bitcoin Smith on September 26, 2023, 05:28:05 PM
Its simple you can use the txid of your transaction on blockhain explorer then you can find information about which block the TX was included and at what time too under timestamp.



Title: Re: Time of Confirmation
Post by: Charles-Tim on September 26, 2023, 05:49:49 PM
Its simple you can use the txid of your transaction on blockhain explorer then you can find information about which block the TX was included and at what time too under timestamp.
It is true that he can use the txid to know the time the transaction got confirmed, but no need of looking for the block the transaction was mined, it is of no need and pointless. Once he paste the txid on a bitcoin blockchain explorer, he will see the time.

It is also worth knowing that Tor can be used to access any of the explorer for anonymity reason.


Title: Re: Time of Confirmation
Post by: DUPONDIUS on September 26, 2023, 05:52:28 PM


I'm looking at blockchain, but I don't see.

https://www.blockchain.com/

Can you give me an example?


Title: Re: Time of Confirmation
Post by: LoyceV on September 26, 2023, 05:58:05 PM
Is there a way to find out the exact time a transaction was confirmed?
Yes, of course.
Actually: no! There is no "exact" time in Bitcoin, there's a "block time" and a "received by node time", but those can vary between nodes. Sometimes the previous block has a later time than the current block.

Quote
Blockchair should show you the confirmation time.
This is of course a pretty good estimate most of the time.

Can you give me an example?
Look up a transaction (https://blockchair.com/bitcoin/transaction/07a54cd41cc4dcef67db32c857f2ff29d6a57989b18f0ce2a3a381d82a65038b), check on the left:
Code:
3 days ago Sep 22, 2023 6:13 PM UTC


Title: Re: Time of Confirmation
Post by: albert0bsd on September 26, 2023, 06:02:04 PM
Just make sure that you aren't looking for the time of broadcast (https://bitcointalk.org/index.php?topic=5464433). Not all explore give you the time of broadcast of the transsaction.

most of the blockchan explorer give you the time when the block was confirmed


Title: Re: Time of Confirmation
Post by: DUPONDIUS on September 26, 2023, 07:09:00 PM
Look up a transaction (https://blockchair.com/bitcoin/transaction/07a54cd41cc4dcef67db32c857f2ff29d6a57989b18f0ce2a3a381d82a65038b), check on the left:
Code:
3 days ago Sep 22, 2023 6:13 PM UTC


3 days ago Sep 22, 2023 6:13 PM UTC


Is that the confirmation time?


Title: Re: Time of Confirmation
Post by: BlackHatCoiner on September 26, 2023, 07:22:53 PM
Just make sure that you aren't looking for the time of broadcast (https://bitcointalk.org/index.php?topic=5464433). Not all explore give you the time of broadcast of the transsaction.
There is no such a thing as "time of broadcast". In a peer-to-peer network some nodes receive messages later than others. This is why Bitcoin needed a timestamp server. So that time will be determined by one node; not any, but the one which worked more.

Is that the confirmation time?
Yes. If you check block 808877, you can verify it yourself. It was mined in 2023-09-22 18:13 UTC.


Title: Re: Time of Confirmation
Post by: albert0bsd on September 26, 2023, 07:26:22 PM
There is no such a thing as "time of broadcast".

I agree with you, but seems that you didn't bother in read what i write there... anyway.




Title: Re: Time of Confirmation
Post by: DUPONDIUS on September 26, 2023, 07:53:17 PM


OK.

Thank you very much.


Title: Re: Time of Confirmation
Post by: Bitcoin Smith on September 26, 2023, 11:02:52 PM
Look up a transaction (https://blockchair.com/bitcoin/transaction/07a54cd41cc4dcef67db32c857f2ff29d6a57989b18f0ce2a3a381d82a65038b), check on the left:
Code:
3 days ago Sep 22, 2023 6:13 PM UTC


3 days ago Sep 22, 2023 6:13 PM UTC


Is that the confirmation time?

Yes, it's the time that the TX received its first confirmation.


Title: Re: Time of Confirmation
Post by: pooya87 on September 27, 2023, 04:41:13 AM
A transaction is valid when it is confirmed by miners, validate by nodes and a first confirmation is most important.
In practice if a transaction is included in a block, it is most definitely valid because of the financial incentive miners have to make absolutely sure they are not creating an invalid block and lose the reward for their work.
But technically a confirmed transaction can be invalid, the only way to know if a transaction is valid is if your node has validated it.


Title: Re: Time of Confirmation
Post by: Cricktor on October 01, 2023, 06:40:00 PM
Yes. If you check block 808877, you can verify it yourself. It was mined in 2023-09-22 18:13 UTC.

This may sound petty, but it's not necessarily the time the block was mined but rather the timestamp the miner has chosen to put into the blockheader of block 808877. Both times must not be the same and are allowed to differ by quite some amount. According to one of my nodes and unknown propagation delay of the node's network mining time and block header timestamp seem to be pretty close for block 808877:
Code:
2023-09-22T18:14:35Z Saw new header hash=000000000000000000007761b9076f7e5b29b5f7ef4a74cd4372b1c0631a20c9 height=808877
2023-09-22T18:14:35Z [net] Saw new cmpctblock header hash=000000000000000000007761b9076f7e5b29b5f7ef4a74cd4372b1c0631a20c9 peer=3540
2023-09-22T18:14:35Z UpdateTip: new best=000000000000000000007761b9076f7e5b29b5f7ef4a74cd4372b1c0631a20c9 height=808877 version=0x20008000 log2_work=94.433168 tx=898739166 date='2023-09-22T18:13:57Z' progress=1.000000 cache=27.1MiB(37151txo)


Title: Re: Time of Confirmation
Post by: BlackHatCoiner on October 01, 2023, 07:36:23 PM
This may sound petty, but it's not necessarily the time the block was mined but rather the timestamp the miner has chosen to put into the blockheader of block 808877. Both times must not be the same and are allowed to differ by quite some amount.
Very correct. If we want to be specific, the block time must be greater or equal with the median time of the previous 11 blocks + 1 second, and less than the adjusted network time + 2 hours.

These are the particular lines in validation.cpp that check it:
Code: (https://github.com/bitcoin/bitcoin/blob/5bbf735defac20f58133bea95226e13a5d8209bc/src/validation.cpp#L3749-L3756)
    // Check timestamp against prev
    if (block.GetBlockTime() <= pindexPrev->GetMedianTimePast())
        return state.Invalid(BlockValidationResult::BLOCK_INVALID_HEADER, "time-too-old", "block's timestamp is too early");


    // Check timestamp
    if (block.Time() > now + std::chrono::seconds{MAX_FUTURE_BLOCK_TIME}) {
        return state.Invalid(BlockValidationResult::BLOCK_TIME_FUTURE, "time-too-new", "block timestamp too far in the future");
    }

- GetMedianTimePast() can be found in chain.h (https://github.com/bitcoin/bitcoin/blob/5bbf735defac20f58133bea95226e13a5d8209bc/src/chain.h#L299-L311), and it returns the median time of the past 11 blocks.
- MAX_FUTURE_BLOCK_TIME can also be found in chain.h (https://github.com/bitcoin/bitcoin/blob/5bbf735defac20f58133bea95226e13a5d8209bc/src/chain.h#L24), and it is equal with 7200 seconds (2 * 60 * 60).

According to one of my nodes and unknown propagation delay of the node's network mining time and block header timestamp seem to be pretty close for block 808877:
Code:
2023-09-22T18:14:35Z Saw new header hash=000000000000000000007761b9076f7e5b29b5f7ef4a74cd4372b1c0631a20c9 height=808877
2023-09-22T18:14:35Z [net] Saw new cmpctblock header hash=000000000000000000007761b9076f7e5b29b5f7ef4a74cd4372b1c0631a20c9 peer=3540
2023-09-22T18:14:35Z UpdateTip: new best=000000000000000000007761b9076f7e5b29b5f7ef4a74cd4372b1c0631a20c9 height=808877 version=0x20008000 log2_work=94.433168 tx=898739166 date='2023-09-22T18:13:57Z' progress=1.000000 cache=27.1MiB(37151txo)
Mine received it 2 seconds after yours. You could be the one who sent it to me.  :)
Code:
2023-09-22T18:14:37Z UpdateTip: new best=000000000000000000007761b9076f7e5b29b5f7ef4a74cd4372b1c0631a20c9 height=808877 version=0x20008000 log2_work=94.433168 tx=898739166 date='2023-09-22T18:13:57Z' progress=1.000000 cache=123.6MiB(805657txo)


Title: Re: Time of Confirmation
Post by: philipma1957 on October 02, 2023, 03:50:08 PM
Yes. If you check block 808877, you can verify it yourself. It was mined in 2023-09-22 18:13 UTC.

This may sound petty, but it's not necessarily the time the block was mined but rather the timestamp the miner has chosen to put into the blockheader of block 808877. Both times must not be the same and are allowed to differ by quite some amount. According to one of my nodes and unknown propagation delay of the node's network mining time and block header timestamp seem to be pretty close for block 808877:
Code:
2023-09-22T18:14:35Z Saw new header hash=000000000000000000007761b9076f7e5b29b5f7ef4a74cd4372b1c0631a20c9 height=808877
2023-09-22T18:14:35Z [net] Saw new cmpctblock header hash=000000000000000000007761b9076f7e5b29b5f7ef4a74cd4372b1c0631a20c9 peer=3540
2023-09-22T18:14:35Z UpdateTip: new best=000000000000000000007761b9076f7e5b29b5f7ef4a74cd4372b1c0631a20c9 height=808877 version=0x20008000 log2_work=94.433168 tx=898739166 date='2023-09-22T18:13:57Z' progress=1.000000 cache=27.1MiB(37151txo)

Yeah sometimes the time stamp can be off by 1 to 90 seconds. So if you really poke around on a block’s reported time you may find small time differences. I have posted on this a few times. here and there on this site.


Title: Re: Time of Confirmation
Post by: NotATether on October 03, 2023, 01:32:38 PM
Look up a transaction (https://blockchair.com/bitcoin/transaction/07a54cd41cc4dcef67db32c857f2ff29d6a57989b18f0ce2a3a381d82a65038b), check on the left:
Code:
3 days ago Sep 22, 2023 6:13 PM UTC


3 days ago Sep 22, 2023 6:13 PM UTC


Is that the confirmation time?



It's the approximate time the transaction has been added to a block, but since any node can assemble the transactions into a block at any time, it is not quite reliable.

In the replies above, you can see the "block time" the time when the transaction was added to the block (in seconds since epoch I think). However, actually converting it to a human-readable value is a different story, because of time zones, daylight-saving times, leap-seconds, and so on.