I found an old wallet.dat but i dont know what is this. Is it a transaction that is not signed? If yes please help. I dont have a clue about cryptography. I have read and seen some tutorials but i dont get it.
1 Answers
I don't have a clue about cryptography.
That's OK, The Bitcoin protocol doesn't encrypt anything. Although implementations like Bitcoin core can use a wallet password to encrypt private keys stored in a wallet file. Anyway the text shown doesn't include any encrypted data.
So if the wallet isn't encrypted, you don't need to know anything about encryption.
Cryptography or crypto-graphy literally means secret writing. Cryptography is the study and use of methods of writing secret (encrypted) messages that can't be understood by an enemy. Many forms of encryption use an encryption key - a set of letters or a number that can be used with an encryption method to turn readable plain text into unreadable ciphertext. Or vice versa.
In the late 20th century, new forms of cryptography were invented that used mathematically related pairs of numbers as private and public keys such that the public key could be used to decrypt a ciphertext that had been encrypted using a private key (and usually, vice versa). At the same time, the idea of a digital signature was created. By checking the signature a general could be sure that the order to "nuke Baltimore" came from the president and not from the enemy.
The Bitcoin network doesn't use encryption but it does take from cryptography the idea and methods of digital signatures - and hence it uses the mathematical methods of creating and using public and private keys that are required for digital signatures.
Is this a transaction?
No.
Your image shows a data structure in JSON text format.
That JSON text isn't what I would expect to find in a wallet.dat
file produced by Bitcoin core. It might be something produced by a wallet reading tool of some sort.
That JSON appears to show data relating to an address. Some of that sort of address data can be found as part of a transaction but what you show isn't a description of a transaction.
(later comment by question author mentioned the use of decodescript
in Bitcoin-core)
Decodescript
decodescript
takes a hex-encoded script and produces a JSON "decoding" of it. Note that the "decoding" is not "decryption", it isn't anything to do with encryption. It is trying to make a more easily understood description of the Bitcoin script that you gave it in Hexadecimal form.
A Bitcoin script is the part of a transaction that specifies how someone can prove they are entitled to spend one of the output amounts of a transaction.
A script consists of operators (instructions) and data items. Things like OP_DUP are an operator that says to duplicate the top item on the stack. There are a small number of operators. There are standard scripts that use those operators in specific ways.
When you spend the bitcoin amount (the unspent transaction output or UTXO amount), you create an unconfirmed transaction that includes the input data needed by that script. Typically that input data includes a digital signature. Your wallet software will take care of this for you. See signrawtransactionwithkey
Wallet contents
A good source of information about the contents of a wallet.dat
produced by Bitcoin-core is an answer to dumpwallet output documentation & explanation?
I summarise that as
- Extended Master Private Key
- List of derived Private Keys
- List of Addresses
To fully understand wallet.dat, you'd also need to understand the storage format used - which is a kind of database structure. This Q&A website has answers to other questions that cover this.
Bitcoin Addresses
Bitcoin addresses are a presentation abstract of a bitcoin script. However the addresses themselves don't really appear in Bitcoin transactions as transmitted, only the bitcoin script they represent. So strictly speaking, we could say that addresses are not present in Bitcoin transactions. Saying that transactions contain addresses is a sort of convenient shorthand to try to make things easier for beginners to understand what they are doing.
For a particular type of Bitcoin script, popularly used over many years, such as P2SH, the Bitcoin address is formed from information including the public-key of a key-pair.
For some other types of Bitcoin script present in transactions in the blockchain, there is no standard way to form a Bitcoin address.
Since an HD wallet like Bitcoin core creates a large number of key-pairs in advance, its wallet.dat
will contain many unused key-pairs and hence contain many unused addresses.

- 26,841
- 3
- 25
- 51
-
Specifically, it's a JSON dump with information about an address, not a transaction. – Pieter Wuille Jun 20 '21 at 20:31
-
Well. I will explain a bit more. I ran bitcoin core, downloaded the blockchain, changed the wallet.dat and rescan. Found some receiving adresses. Validateadress of some of them and checked with decodescript. Actually this is one of the decoscript i have seen. Some of them shows op_dup op_hash160....op_equal op_checksig (reqsig:1) and some only op_hash160....op_equal (reqsig:1) What is that means? Do they need to be signed or something like that? Sorry if i ask too much but im really newbie and have 0 experience and 0 knowledge in cryptography – Kazuhiko Jun 20 '21 at 20:49
-
Apart of that. The wallet is not encrypted at all. It doesnt have a password – Kazuhiko Jun 20 '21 at 20:53
-
@Kazuhiko: see updated answer. – RedGrittyBrick Jun 20 '21 at 21:10
-
Just to reiterate: it is telling you information about an address your wallet has. It has nothing to do with transactions, or coins you might have. It's just information about an address which your wallet would be able to receive coins on. – Pieter Wuille Jun 20 '21 at 22:30
-
@PieterWuille: Thanks for the feedback (whether to me or OP) I have updated the answer in an attempt to incorporate the point made in your comments. My understanding of this area isn't as complete as I would like (obvs), so any edits or further helpful commentary would be appreciated. – RedGrittyBrick Jun 21 '21 at 09:48
-
Thank you for the help. One last question please. The first adress startin with 1 show ismine,the third address and 4th ( bc1...and psh2-segwit) also shows ismine. But the one in the middle p2sh 37tsb... its shows that its not mine. What it could be? I apreciate your comments – Kazuhiko Jun 21 '21 at 15:00
-
@Kazuhiko What are you trying to achieve? – Pieter Wuille Jun 21 '21 at 15:11
-
@Kazuhiko: The documentation I linked for decodescript says "address of P2SH script wrapping this redeem script (not returned if the script is already a P2SH)" -- reading Redeem script. script hash, witness script and witness program might clarify this further for you. – RedGrittyBrick Jun 21 '21 at 15:11