Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: walletrecovery on January 15, 2022, 10:27:02 AM



Title: Is it possible to convert a Bitcoin Core "timesmart" into human-readable format?
Post by: walletrecovery on January 15, 2022, 10:27:02 AM
For example, if you open "wallet.dat" file (for example Notepad++)
we will see "timesmart 1614347716" and my question Is it possible
to convert a Bitcoin Core "timesmart" into human-readable format?

https://i.ibb.co/fXJqQP3/timesmart.jpg (https://ibb.co/0n5mQd0)

Also see topic: https://bitcointalk.org/index.php?topic=5381925.0


Title: Re: Is it possible to convert a Bitcoin Core "timesmart" into human-readable format?
Post by: BlackHatCoiner on January 15, 2022, 10:36:09 AM
Why would you want to convert your wallet.dat into human-readable format? It contains information that makes it difficult to write down with no mistakes, such as your transactions etc., even if it was encoded into a seed phrase. For instance, if it's 1MB then you need to encode those 1 million bytes (= 4 million bits) into a seed phrase. With a quick calculation it's 4,000,000 / 11 = 363,636 words.

I can't find this timesmart value you're saying when I open my wallet.dat. Where exactly is it? I can't read anything from my wallet file as it's not readable from text editors.


Title: Re: Is it possible to convert a Bitcoin Core "timesmart" into human-readable format?
Post by: ABCbits on January 15, 2022, 12:03:49 PM
According to https://github.com/bitcoin/bitcoin/blob/v22.0/src/wallet/transaction.h#L108-L117 (https://github.com/bitcoin/bitcoin/blob/v22.0/src/wallet/transaction.h#L108-L117), "timesmart" uses timestamp. So all you need to do is finding or create script which convert timestamp to human-readable format (such as Date/Time).

Code:
>>> # Simple example with Python 3
>>> from datetime import datetime
>>> datetime.fromtimestamp(1613256165).isoformat()
2021-02-13T17:42:45
>>> from time import ctime
>>> ctime(1613256165)
'Sat Feb 13 17:42:45 2021


Title: Re: Is it possible to convert a Bitcoin Core "timesmart" into human-readable format?
Post by: AdolfinWolf on January 15, 2022, 01:02:43 PM
For example, if you open "wallet.dat" file (for example Notepad++)
we will see "timesmart 1613256165" and my question Is it possible
to convert a Bitcoin Core "timesmart" into human-readable format?


seconds since epoch?

...


Title: Re: Is it possible to convert a Bitcoin Core "timesmart" into human-readable format?
Post by: walletrecovery on January 15, 2022, 03:44:58 PM
Why would you want to convert your wallet.dat into human-readable format? It contains information that makes it difficult to write down with no mistakes, such as your transactions etc., even if it was encoded into a seed phrase. For instance, if it's 1MB then you need to encode those 1 million bytes (= 4 million bits) into a seed phrase. With a quick calculation it's 4,000,000 / 11 = 363,636 words.

I can't find this timesmart value you're saying when I open my wallet.dat. Where exactly is it? I can't read anything from my wallet file as it's not readable from text editors.

Keyword search will help you (see screenshot)


Title: Re: Is it possible to convert a Bitcoin Core "timesmart" into human-readable format?
Post by: walletrecovery on January 15, 2022, 03:47:08 PM
For example, if you open "wallet.dat" file (for example Notepad++)
we will see "timesmart 1613256165" and my question Is it possible
to convert a Bitcoin Core "timesmart" into human-readable format?


seconds since epoch?

...

This value is probably somehow related to transactions and a converter is needed to analyze wallet files for their check genuine or not.


Title: Re: Is it possible to convert a Bitcoin Core "timesmart" into human-readable format?
Post by: walletrecovery on January 15, 2022, 03:50:54 PM
According to https://github.com/bitcoin/bitcoin/blob/v22.0/src/wallet/transaction.h#L108-L117 (https://github.com/bitcoin/bitcoin/blob/v22.0/src/wallet/transaction.h#L108-L117), "timesmart" uses timestamp. So all you need to do is finding or create script which convert timestamp to human-readable format (such as Date/Time).

Code:
>>> # Simple example with Python 3
>>> from datetime import datetime
>>> datetime.fromtimestamp(1613256165).isoformat()
2021-02-13T17:42:45
>>> from time import ctime
>>> ctime(1613256165)
'Sat Feb 13 17:42:45 2021

Thanks Sir! Could you teach me how to use this tool, i need a simple software that can convert a number into human-readable format?


Title: Re: Is it possible to convert a Bitcoin Core "timesmart" into human-readable format?
Post by: Quickseller on January 16, 2022, 05:33:22 AM
According to https://github.com/bitcoin/bitcoin/blob/v22.0/src/wallet/transaction.h#L108-L117 (https://github.com/bitcoin/bitcoin/blob/v22.0/src/wallet/transaction.h#L108-L117), "timesmart" uses timestamp. So all you need to do is finding or create script which convert timestamp to human-readable format (such as Date/Time).

Code:
>>> # Simple example with Python 3
>>> from datetime import datetime
>>> datetime.fromtimestamp(1613256165).isoformat()
2021-02-13T17:42:45
>>> from time import ctime
>>> ctime(1613256165)
'Sat Feb 13 17:42:45 2021

Thanks Sir! Could you teach me how to use this tool, i need a simple software that can convert a number into human-readable format?
It appears the "timesmart" entries are timestamps of your transactions.
Below is a simple function based on ETFbitcoin's code that you can insert into your program:
Code:
from time import ctime
def timesmart2humanReadable(timesmart)
    return ctime(timesmart)


Title: Re: Is it possible to convert a Bitcoin Core "timesmart" into human-readable format?
Post by: walletrecovery on January 16, 2022, 10:05:37 AM
Thanks Sir! Could you teach me how to use this tool, i need a simple software that can convert a number into human-readable format?
[/quote]

What i showed is only simple example of Python 3 (programming language) library. If you're looking for user-friendly/ready-to-use tool, you might want to use website such as https://timestamp.online/ (https://timestamp.online/).
[/quote]

Thank you, you are a genius. I wish you good luck, happiness and a lot of money!