Hey Thank you all for your kind answers. I just wanted to understand the concept.
Also, how does bitcoin "exist" in computers?
for example, someone with 1 BTC and 20 BTC their wallet must be different other than just number 1 and 20 right?
do they exist in a line of codes or...?
I'm familiar with computers and programmings so you can be much technical as you want explaining this.
Thanks in advance
the wallet does not contain a balance.
here is the easiest explanation of it.
having the bitcoin-core (and other main bitcoin wallet clients). downloads the whole blockchain.
the blockchain is a list of transactions (movements of funds).
the blockchain is not saved as 1Addressblahblahblah = 1btc
the blockchain is 1Addressblahblahblah recieves 0.5btc 1Addressblahblahblah receives 0.5btc from 1AnotherAddressblah
so again the blockchain is just a list of 'to' and 'from' and NOT 'contains'.
it is then the client or bitcoin explorer websites that read the blockchain do the maths to add and subtract th transactions involving certain addresses, to display a balance. but again this balance total is not saved. it is just for easy display purpose.
the wallet does not save the balance. the wallet just stores the private keys. (imagine it as password storage) that is purely used to know who owns the list of transactions to the corresponding public address.
each time you start up your wallet. it looks at the private key and finds the corresponding public key and then does all of the maths of adding and subtracting transaction values to get a 'balance'.
so to summerise.
if you were to manually read the blockchain you will not read anywhere that shows your total balance neatly wrote out, you would have to read all of the transactions that mention your address and see if its giving you a value or taking a value away. and you have to join it all together.
this is in accounting terms called a ledger. it is not a balance sheet (totalised numbers)
now to get technical
imagine it as a SQL database
from | to | amount to transfer
P1 | P2 | 5000000
P2 | P1 | 2500000
P1 | P2 | 2000000
to check balance of P2:
you would do a select where 'to' = P2 (500,000 + 200,000(700,000))
then do a select where from = P2 (250,000)
and minus the 'from' away from the 'to' = 450,000
you wont see 450,000 total wrote anywhere in the blockchain for address P2. its all worked out by calculating the ledger