Bitcoin Forum
May 09, 2024, 12:18:44 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin Databases for Large Websites  (Read 2608 times)
BTC_Junkie (OP)
Member
**
Offline Offline

Activity: 97
Merit: 10


View Profile
June 04, 2013, 04:00:34 PM
 #1

I'm building a bitcoin website, and have been using bitcoind for database requests which has been fairly slow. We'll only really be looking at history, and not managing any wallet based functions. I'm considering switching to either SQL or Mongo for longer-term use, does anyone have experience using either for bitcoin sites? What database structure do some of the larger sites like blockchain.info use?

Thanks for your help.

12jAZVfnCjKmPUXTszwmoji9S4NmY26Qvu
1715257124
Hero Member
*
Offline Offline

Posts: 1715257124

View Profile Personal Message (Offline)

Ignore
1715257124
Reply with quote  #2

1715257124
Report to moderator
1715257124
Hero Member
*
Offline Offline

Posts: 1715257124

View Profile Personal Message (Offline)

Ignore
1715257124
Reply with quote  #2

1715257124
Report to moderator
"You Asked For Change, We Gave You Coins" -- casascius
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715257124
Hero Member
*
Offline Offline

Posts: 1715257124

View Profile Personal Message (Offline)

Ignore
1715257124
Reply with quote  #2

1715257124
Report to moderator
1715257124
Hero Member
*
Offline Offline

Posts: 1715257124

View Profile Personal Message (Offline)

Ignore
1715257124
Reply with quote  #2

1715257124
Report to moderator
Aldur1
Member
**
Offline Offline

Activity: 73
Merit: 10


www.bitex.co.uk - A new begining in cryptotech


View Profile WWW
June 04, 2013, 04:04:34 PM
 #2

Wouldnt it make sense to keep all you transaction records in a database?  I use MySQL and then can reference TX ID's if I make qt calls.

Donations: 1PX1uRHtWzYLBdbbRm2nbhqS3H4QcxqDkD
Bitcoin OTC WoT: http://bitcoin-otc.com/viewratingdetail.php?nick=aldur1
https://www.facebook.com/BitEx.Cryptocurrency.Solutions
https://twitter.com/bitEX_Ltd
http://instagram.com/bitex_ltd
http://www.linkedin.com/company/bitex-ltd
<html>
<a href="http://bitcoin.stackexchange.com/users/13963/hafnero">
<img src="http://bitcoin.stackexchange.com/users/flair/13963.png" width="208" height="58" alt="profile for hafnero at Bitcoin Stack Exchange, Q&amp;A for Bitcoin crypto-currency enthusiasts" title="profile for hafnero at Bitcoin Stack Exchange, Q&amp;A for Bitcoin crypto-currency enthusiasts">
</a>
</html>
BTC_Junkie (OP)
Member
**
Offline Offline

Activity: 97
Merit: 10


View Profile
June 04, 2013, 05:16:40 PM
 #3

I mean, if I want to store the whole block chain to do data analysis on a web site, what is the best database to use for that?

12jAZVfnCjKmPUXTszwmoji9S4NmY26Qvu
jgarzik
Legendary
*
qt
Offline Offline

Activity: 1596
Merit: 1091


View Profile
June 04, 2013, 06:56:32 PM
 #4

I mean, if I want to store the whole block chain to do data analysis on a web site, what is the best database to use for that?

People generally wind up creating custom databases, or at least highly custom setups of standard database software.

You are talking about indices containing many millions of records.  It isn't as easy as just telling your SQL db to index a column.  People often turn to tools like redis for such huge datasets.


Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
BTC_Junkie (OP)
Member
**
Offline Offline

Activity: 97
Merit: 10


View Profile
June 04, 2013, 07:26:34 PM
 #5

I mean, if I want to store the whole block chain to do data analysis on a web site, what is the best database to use for that?

People generally wind up creating custom databases, or at least highly custom setups of standard database software.

You are talking about indices containing many millions of records.  It isn't as easy as just telling your SQL db to index a column.  People often turn to tools like redis for such huge datasets.



Thanks Jeff. Why would you recommend redis over mongo?

12jAZVfnCjKmPUXTszwmoji9S4NmY26Qvu
jgarzik
Legendary
*
qt
Offline Offline

Activity: 1596
Merit: 1091


View Profile
June 05, 2013, 02:03:31 PM
 #6

I mean, if I want to store the whole block chain to do data analysis on a web site, what is the best database to use for that?

People generally wind up creating custom databases, or at least highly custom setups of standard database software.

You are talking about indices containing many millions of records.  It isn't as easy as just telling your SQL db to index a column.  People often turn to tools like redis for such huge datasets.



Thanks Jeff. Why would you recommend redis over mongo?

Mongo works just fine, too.

Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
loudog40
Newbie
*
Offline Offline

Activity: 11
Merit: 0



View Profile
June 06, 2013, 07:22:49 PM
 #7

Maybe take a peek at the Bits of Proof Enterprise Server.  Stores the blockchain in the JPA compliant database of your choice.
grau
Hero Member
*****
Offline Offline

Activity: 836
Merit: 1021


bits of proof


View Profile WWW
June 06, 2013, 07:46:20 PM
 #8

Maybe take a peek at the Bits of Proof Enterprise Server.  Stores the blockchain in the JPA compliant database of your choice.
+1

You may run it with an SQL Configuration to get the block chain into a fully normalized relational database or with LevelDB and use its API to retrieve blocks or transactions.

I build, host and support servers running the configuration of your choice if you like.
maco
Sr. Member
****
Offline Offline

Activity: 294
Merit: 250



View Profile
June 07, 2013, 08:45:26 PM
 #9

PHP Sites = MYSQL
I haven't touched Mongo as of yet.

Anything with MYSQL should be fine as a stable database for a bitcoin website.

I'm building a bitcoin website, and have been using bitcoind for database requests which has been fairly slow. We'll only really be looking at history, and not managing any wallet based functions. I'm considering switching to either SQL or Mongo for longer-term use, does anyone have experience using either for bitcoin sites? What database structure do some of the larger sites like blockchain.info use?

Thanks for your help.
phantomcircuit
Sr. Member
****
Offline Offline

Activity: 463
Merit: 252


View Profile
June 08, 2013, 08:05:22 PM
 #10

I mean, if I want to store the whole block chain to do data analysis on a web site, what is the best database to use for that?

People generally wind up creating custom databases, or at least highly custom setups of standard database software.

You are talking about indices containing many millions of records.  It isn't as easy as just telling your SQL db to index a column.  People often turn to tools like redis for such huge datasets.

PostgreSQL has no problem indexing the entire blockchain.

Example: select * from transaction_outputs where ARRAY['18ese9gmJ5zYePvLQiFoC5bVNzVicgDZWz'::character varying] && addresses;
Total runtime: 0.066 ms

The issue is the time to insert/update columns, in general indexed select queries are fast.
kwilliams
Member
**
Offline Offline

Activity: 70
Merit: 10


View Profile
June 09, 2013, 08:05:08 AM
 #11

I have used Mongo for other projects and it's a bitch to maintain. It makes most sense if
a) You know how to maintain it
b) The R/W ratio is skewed to 90% reads or more
c) You have lots of RAM.
d) You don't care about transactions and can live with less than 100% data integrity

Note to NSA: please note in my personal file that the above comment, as well as any and all communications dating back to AOL/1993, are wholly fictitious, and are to be regarded as such. The later statement is to remain in effect until reversed by me personally in a waterboard-free questioning.
dashingriddler
Legendary
*
Offline Offline

Activity: 1258
Merit: 1001



View Profile
June 11, 2013, 01:46:11 PM
 #12

I have used mySQL for the same purpose of analysing and searching for info in block chain.
All are INNODB tables with baraccuda compression with key-block-size being 2kb
I am recording all the data available over the block chain and it is effectively taking twice the amount of data (17gb) it takes for normal bitcoind block chain(8.5gb).

CENTRA

            ▄▄▄██████████▄▄▄
        ▄▄████████████████████▄▄
      ▄███████▀▀         ▀▀███████▄
    ▄█████▀                  ▀██████
   █████▀      ▄▄▄█████▄▄      ▀█████▄
  █████     ▄██████████████▄     ▀████▄
 █████     ██████▀▀  ▀▀██████▄    ▀████
▐████     █████          █████     █████
█████    ▐████                     ▐████
█████    █████                     ▐████
█████     █████          ▄████▌    █████
 ████▌    ▀█████▄▄    ▄▄█████▀    ▄████▌
 ▀████▄     ▀██████████████▀     ▄████▀
  ▀█████▄     `▀████████▀▀     ▄█████▀
   `██████▄                  ▄██████
     ▀███████▄▄          ▄▄███████▀
       ▀██████████████████████▀
           ▀▀▀█████████████▀▀

.
.
.
.
phantomcircuit
Sr. Member
****
Offline Offline

Activity: 463
Merit: 252


View Profile
June 11, 2013, 09:37:14 PM
 #13

I have used mySQL for the same purpose of analysing and searching for info in block chain.
All are INNODB tables with baraccuda compression with key-block-size being 2kb
I am recording all the data available over the block chain and it is effectively taking twice the amount of data (17gb) it takes for normal bitcoind block chain(8.5gb).

Are you storing things as their hex representation or binary representation?

The nearly exact doubling in size makes me suspect hex.
grau
Hero Member
*****
Offline Offline

Activity: 836
Merit: 1021


bits of proof


View Profile WWW
June 12, 2013, 06:49:38 AM
 #14

I have used mySQL for the same purpose of analysing and searching for info in block chain.
All are INNODB tables with baraccuda compression with key-block-size being 2kb
I am recording all the data available over the block chain and it is effectively taking twice the amount of data (17gb) it takes for normal bitcoind block chain(8.5gb).

Are you storing things as their hex representation or binary representation?

The nearly exact doubling in size makes me suspect hex.
May I offer an other play: LevelDB is a persistent key-value map. I use transaction and block hashes as keys and the value is protobuf serialization. Blocks are stored as serialized header + list of tx hashes + bloom filter. The persistent bloom filter is populated with all data elements of scripts and outpoints. I read the bloom filter set into memory to query. For blocks where filter is positive I retrieve and parse the transactions.

The result is 11.8 GB disk use (at block 241061) and it takes 3 seconds to scan the entire blockchain for addresses generated from a BIP32 public key and transactions spending them with 10 keys lookahead. (LevelDB is native, rest is Java).
dashingriddler
Legendary
*
Offline Offline

Activity: 1258
Merit: 1001



View Profile
July 13, 2013, 09:27:33 AM
 #15

I have used mySQL for the same purpose of analysing and searching for info in block chain.
All are INNODB tables with baraccuda compression with key-block-size being 2kb
I am recording all the data available over the block chain and it is effectively taking twice the amount of data (17gb) it takes for normal bitcoind block chain(8.5gb).

Are you storing things as their hex representation or binary representation?

The nearly exact doubling in size makes me suspect hex.
Yes i am storing it as hex at this point of time.

CENTRA

            ▄▄▄██████████▄▄▄
        ▄▄████████████████████▄▄
      ▄███████▀▀         ▀▀███████▄
    ▄█████▀                  ▀██████
   █████▀      ▄▄▄█████▄▄      ▀█████▄
  █████     ▄██████████████▄     ▀████▄
 █████     ██████▀▀  ▀▀██████▄    ▀████
▐████     █████          █████     █████
█████    ▐████                     ▐████
█████    █████                     ▐████
█████     █████          ▄████▌    █████
 ████▌    ▀█████▄▄    ▄▄█████▀    ▄████▌
 ▀████▄     ▀██████████████▀     ▄████▀
  ▀█████▄     `▀████████▀▀     ▄█████▀
   `██████▄                  ▄██████
     ▀███████▄▄          ▄▄███████▀
       ▀██████████████████████▀
           ▀▀▀█████████████▀▀

.
.
.
.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!