Hello,
What is technical difference between database and wallet.dat?
When one bitcoin is mined, this transaction is inside wallet our database files?
Thank you
A database is a computing concept for storing data in an organized fashion.
https://en.wikipedia.org/wiki/DatabaseThe
wallet.dat file stores your private keys.
It's pretty much all in this function:
https://github.com/bitcoin/bitcoin/blob/master/src/wallet/walletdb.cpp#L322The wallet.dat is either a BerkeleyDB database, or a SQLite database, depending on whether you have decided to make a descriptor wallet (SQLite if so).
The database is used as a key-value store, where every key always begins with a length prefixed ascii string indicating the type of the record. From there, the data stored depends on the record type and is just a bunch of different objects serialized. You will have to look at each object's serialization methods to figure that out.
BerkeleyDB is a key-value database so libraries for it provide access to that directly. For SQLite, the database is a single table with two columns, the first named "key" and the second "value".
There is no file that stores your Bitcoins.
Furthermore, when you mine a
block (you don't
mine a bitcoin), that block sits in your node's mempool (chainstate) and is broadcasted to other nodes. If it's not broadcasted, it doesn't exist on the blockchain and you got no block reward.