Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: bondcoder on June 19, 2019, 11:12:11 AM



Title: Where does blockchain store adresses of wallets?
Post by: bondcoder on June 19, 2019, 11:12:11 AM
Hello! I am new person in blockchain technology and I want to fasten my knowledges by writing own primitive version of blockchain. I can not understand where will be my blockchain store wallets public addresses for transactions between users. Should I use helpful database like a MongoDB or MySQL for these purposes? 


Title: Re: Where does blockchain store adresses of wallets?
Post by: bitmover on June 19, 2019, 11:26:33 AM
Hello! I am new person in blockchain technology and I want to fasten my knowledges by writing own primitive version of blockchain. I can not understand where will be my blockchain store wallets public addresses for transactions between users.

Your wallet is able to create almost unlimited public addresses. Your wallet is basically a seed, which is a mathematical function that canl generate many addresses mathematically related (from that seed).

Those addresses have UTXO (unspent transaction outputs) registered to them, if they have any balance available for them to spent.
Those UTXO are stored in every node in the network (the blockchain), not the addresses or the seed or the wallet, but the UTXO.


from mastering bitcoin by Antonopoulos
Quote
There are no accounts or balances in bitcoin; there are only unspent transaction outputs (UTXO) scattered in the blockchain. Users cannot cut a UTXO in half any more than they can cut a dollar bill in half and use it as currency.
Sending someone bitcoin is creating an unspent transaction output (UTXO) registered to their address and available for them to spend.
https://github.com/bitcoinbook/bitcoinbook



Title: Re: Where does blockchain store adresses of wallets?
Post by: bondcoder on June 19, 2019, 11:55:50 AM
Thank you for your answer!)


Title: Re: Where does blockchain store adresses of wallets?
Post by: GMAIL RM008 on June 19, 2019, 02:22:05 PM
Hello! I am new person in blockchain technology and I want to fasten my knowledges by writing own primitive version of blockchain. I can not understand where will be my blockchain store wallets public addresses for transactions between users. Should I use helpful database like a MongoDB or MySQL for these purposes? 


I think you can Read this article. It will help you a lot to understand the storing sytem.

https://www.bitcoinofamerica.org/blog/where-is-blockchain-stored/


Title: Re: Where does blockchain store adresses of wallets?
Post by: bondcoder on June 19, 2019, 02:41:59 PM
Thank you for the reference. I understand from this article that it doesn't matter how transaction info stored in the node. The main idea in distributed storage system on different nodes. Type of database on one node touch internal realization and can be various from project to project.
Because it question create a big problem in storing process blockchain data like adresses, transaction lists. Thanks evebody for answer. You  helped me in my problem :)


Title: Re: Where does blockchain store adresses of wallets?
Post by: ABCbits on June 19, 2019, 03:24:35 PM
For reference, Bitcoin Core use LevelDB and have 3 separate database which are :
1. blocks, which store all blocks
2. chainstate, which store all UTXO
3. txindex, which index of all transaction. It's turned off by default

If you wonder why LevelDB is used, you might want to check https://en.bitcoin.it/wiki/Bitcoin_Core_0.11_(ch_2):_Data_Storage#Use_of_LevelDB (https://en.bitcoin.it/wiki/Bitcoin_Core_0.11_(ch_2):_Data_Storage#Use_of_LevelDB)


Title: Re: Where does blockchain store adresses of wallets?
Post by: Thirdspace on June 19, 2019, 10:58:58 PM
I can not understand where will be my blockchain store wallets public addresses for transactions between users. Should I use helpful database like a MongoDB or MySQL for these purposes? 
if you're talking about the blockchain of bitcoin, it doesn't actually store public addresses
all nodes use the same standard of LevelDB to store all transaction data, built from raw blocks

if you're talking about the blockchain explorer, you can use the 3 database mentioned by ETFbitcoin
then create your own database for easier implementation for displaying on the web
so web user can search an address and you can easily list all transactions of that address


Title: Re: Where does blockchain store adresses of wallets?
Post by: bondcoder on June 20, 2019, 08:05:48 AM
Wow, it is really mean that all parameters like adresses, balances, tokens I can calculate from this distributed ledger. Thank you. I started to deep learn creating of keys and it fallen in my mind that address exist only when it appeared in the transaction list (block of blockchain). I read in previous answers about storing transaction in special database LevelDB. Can I change it on MongoDB in my implementation? MongoDB use key-value structure too.


Title: Re: Where does blockchain store adresses of wallets?
Post by: bondcoder on June 21, 2019, 05:41:39 PM
Yes, you are right, thank you!