<p>Those are quite some widespread questions.</p>
<h2>Tracking of account balances</h2>
<p>There are two parts that keep track of an accounts balance:</p>
<ol>
<li>each node keeps track of the transaction history</li>
<li>a node keeps track of the private keys for the accounts it owns</li>
</ol>
<p>Bitcoin at its core is a distributed ledger that keeps track of every transaction ever executed. Every node in the network stores a copy of the complete transaction history and can therefore reconstruct the balance for each account. Catching up with the rest of the network will take quite some time exactly because you need to download and verify the whole transaction history.</p>
<p>The private keys come into play when bitcoins are transferred from one account to another. To spend bitcoins you have to create a transaction and the owner of the sending account has to authorize the transaction by signing it with the private key associated with the account. So anybody that knows the private key to an account may spend the bitcoins that are in that account. Bitcoin-QT (the client you downloaded) creates a file on the harddisk called <code>wallet.dat</code>, which contains all the private keys for your accounts, so don't lose it. Other clients use different methods of storing the private keys.</p>
<h2>Mining (or &quot;free&quot; bitcoins)</h2>
<p>Mining is Bitcoin's way of minting new currency. There is no central bank that prints bitcoins, instead nodes are rewarded for their help in the network. They help the network by verifying and confirming the validity of transactions in the network.</p>
<p>As others have pointed out mining is not free: the initial investment in mining equipment has to be amortized and electricity has to be paid. While initially it was easy to mine, the fact that you compete with all the other miners about a limited supply of new bitcoins mined has quickly driven the cost of mining up.</p>
<p>Mining nowadays requires such a high investment that some miners never break even.</p>

CC BY-SA 3.0
2013-01-04T20:37:40.230Z
The reason I ask is because what happens if I get a new computer, do I lose all my bitcoins? Or is it as simple as copying wallet.dat to the new computer?
Celeritas
CC BY-SA 3.0
2013-01-04T20:53:48.883Z
That's absolutely right: the `wallet.dat` file has to be kept save. Do not lose it as it is the only way of accessing your bitcoins and under no circumstance share it with untrusted people as anyone who has it can transfer the bitcoins. If you get a new computer simply transfer the `wallet.dat` to the new computer.
cdecker
CC BY-SA 3.0
2013-01-05T11:52:22.393Z
@Celeritas notice you can also use an online wallet, such as https://blockchain.info/wallet/
o0'.
CC BY-SA 3.0
2013-01-04T19:07:37.020Z
2013-01-04T19:07:37.020Z
2020-06-16T11:10:03.350Z
cdecker
<p>I downloaded the <a href="http://bitcoin.org/releases/2012/12/14/v0.7.2.html" rel="noreferrer">latest bitcoin client</a> and am waiting for it to connect. How does it remember how much money a person has? Do I create an account and the balance is associated with the account each time I log in?</p>

<p>Another thing I don't get is how come there's ways to get free bitcoins, such as through mining or websites? Isn't it unfair that some have their money they worked for transferred to bitcoins where others depend on the strength of their computer to make them money? Is it that the free ways of getting bitcoins never give out that much it's not a problem?</p>

CC BY-SA 3.0
2013-01-04T18:12:17.983Z
Mining isn't free. Where I live electricity costs 13 cents a kilowatt hour. If a website wants to give you their bitcoins for nothing that's their right. As for how the bitcoin client figures out how much money everybody has, well, that's a bit complicated. See https://en.bitcoin.it/wiki/Block_chain
Nick ODell
CC BY-SA 3.0
2013-09-02T07:01:24.680Z
And how did the people who have strong computers obtain them, if not by working for them?
Meni Rosenfeld
CC BY-SA 4.0
2018-09-25T06:20:39.743Z
https://bitcoin.stackexchange.com/a/79563/87861 Here I tried to explain how balance is calculated in Bitcoin network, implementation wise.
Vishwas Bhushan
<client><bitcoin-core><bitcoin-core-accounts><balance>
How does Bitcoin keep track of account balances?
Celeritas
# How does Bitcoin keep track of account balances?

(Asked by: username_0 on 2013-01-04)

I downloaded the [latest bitcoin client](http://bitcoin.org/releases/2012/12/14/v0.7.2.html) and am waiting for it to connect. How does it remember how much money a person has? Do I create an account and the balance is associated with the account each time I log in?

Another thing I don't get is how come there's ways to get free bitcoins, such as through mining or websites? Isn't it unfair that some have their money they worked for transferred to bitcoins where others depend on the strength of their computer to make them money? Is it that the free ways of getting bitcoins never give out that much it's not a problem?

**Tags:** client, bitcoin-core, bitcoin-core-accounts, balance

> **Comments:**
> **username_1**: Mining isn't free. Where I live electricity costs 13 cents a kilowatt hour. If a website wants to give you their bitcoins for nothing that's their right. As for how the bitcoin client figures out how much money everybody has, well, that's a bit complicated. See https://en.bitcoin.it/wiki/Block_chain  
> **username_2**: And how did the people who have strong computers obtain them, if not by working for them?  
> **username_3**: https://bitcoin.stackexchange.com/a/79563/87861 Here I tried to explain how balance is calculated in Bitcoin network, implementation wise.  

---

## 1 answers

### Answer by username_4 on 2013-01-04. Score: 7 | Accepted answer

Those are quite some widespread questions.

## Tracking of account balances

There are two parts that keep track of an accounts balance:

1. each node keeps track of the transaction history
2. a node keeps track of the private keys for the accounts it owns

Bitcoin at its core is a distributed ledger that keeps track of every transaction ever executed. Every node in the network stores a copy of the complete transaction history and can therefore reconstruct the balance for each account. Catching up with the rest of the network will take quite some time exactly because you need to download and verify the whole transaction history.

The private keys come into play when bitcoins are transferred from one account to another. To spend bitcoins you have to create a transaction and the owner of the sending account has to authorize the transaction by signing it with the private key associated with the account. So anybody that knows the private key to an account may spend the bitcoins that are in that account. Bitcoin-QT (the client you downloaded) creates a file on the harddisk called `wallet.dat`, which contains all the private keys for your accounts, so don't lose it. Other clients use different methods of storing the private keys.

## Mining (or "free" bitcoins)

Mining is Bitcoin's way of minting new currency. There is no central bank that prints bitcoins, instead nodes are rewarded for their help in the network. They help the network by verifying and confirming the validity of transactions in the network.

As others have pointed out mining is not free: the initial investment in mining equipment has to be amortized and electricity has to be paid. While initially it was easy to mine, the fact that you compete with all the other miners about a limited supply of new bitcoins mined has quickly driven the cost of mining up.

Mining nowadays requires such a high investment that some miners never break even.

> **Comments:**
> **username_0**: The reason I ask is because what happens if I get a new computer, do I lose all my bitcoins? Or is it as simple as copying wallet.dat to the new computer?  
> **username_4**: That's absolutely right: the `wallet.dat` file has to be kept save. Do not lose it as it is the only way of accessing your bitcoins and under no circumstance share it with untrusted people as anyone who has it can transfer the bitcoins. If you get a new computer simply transfer the `wallet.dat` to the new computer.  
> **username_5**: @username_0 notice you can also use an online wallet, such as https://blockchain.info/wallet/  

---

