mastercoin-MSC / mastercore

mastercore info
mastercoin.org
MIT License
24 stars 11 forks source link

Mastercored takes 5 days (!) to reindex the blockchain #216

Open kostaz opened 9 years ago

kostaz commented 9 years ago

Issue

The daemon is run with the below command: './mastercored -daemon -datadir=/home/mastercore/.bitcoin -reindex'

Reindexing of 330,000 blocks takes 5 (!!) days

Reindexing of 1018 blocks takes 23 minutes (as see from 'getinfo' snapshot), => reindexing of 330,000 blocks takes 5 days! What is wrong here? How to fix it? Can it help to use better PC?

root@ubuntu:/home/mastercore/.bitcoin# ~/msc_0.0.8.2/mastercore/src/mastercored getinfo ; date
{
    "mastercoreversion" : 12008,
    "version" : 90200,
    "protocolversion" : 70002,
    "walletversion" : 60000,
    "balance" : 0.00000000,
    "blocks" : 318790,
    "timeoffset" : 0,
    "connections" : 31,
    "proxy" : "",
    "difficulty" : 27428630902.25787354,
    "testnet" : false,
    "keypoololdest" : 1417119409,
    "keypoolsize" : 101,
    "paytxfee" : 0.00010000,
    "relayfee" : 0.00001001,
    "errors" : ""
}
Fri Nov 28 11:43:38 IST 2014
root@ubuntu:/home/mastercore/.bitcoin# 
root@ubuntu:/home/mastercore/.bitcoin# 
root@ubuntu:/home/mastercore/.bitcoin# 
root@ubuntu:/home/mastercore/.bitcoin# 
root@ubuntu:/home/mastercore/.bitcoin# 
root@ubuntu:/home/mastercore/.bitcoin# 
root@ubuntu:/home/mastercore/.bitcoin# 
root@ubuntu:/home/mastercore/.bitcoin# ~/msc_0.0.8.2/mastercore/src/mastercored getinfo ; date
{
    "mastercoreversion" : 12008,
    "version" : 90200,
    "protocolversion" : 70002,
    "walletversion" : 60000,
    "balance" : 0.00000000,
    "blocks" : 319808,
    "timeoffset" : 0,
    "connections" : 30,
    "proxy" : "",
    "difficulty" : 27428630902.25787354,
    "testnet" : false,
    "keypoololdest" : 1417119409,
    "keypoolsize" : 101,
    "paytxfee" : 0.00010000,
    "relayfee" : 0.00001001,
    "errors" : ""
}
Fri Nov 28 12:06:45 IST 2014

Thanks, --- Kosta

kostaz commented 9 years ago

This issue seems related to the issue #215.

dexX7 commented 9 years ago

The v0.0.8 branch (and release) is based on Bitcoin Core 0.9.2~ and the Master Core related logic doesn't have much relevance in this context, so I tend to say: yes, that's to expect.

But it's extreme nevertheless. Did you wait 5 days or extrapolated based on the first few thousand blocks?

There are basically four mechanisms in place (based on the other thread from you):

  1. block download
  2. script verification
  3. transaction indexing
  4. (later) Mastercoin transaction processing

In my experience step 3, transaction indexing, with a fully synchronized client, takes about 3-8 hours on a $ 20 Digital Ocean VPS. Assuming step 1-3 are done or you delete all Mastercoin related files (the MP_ folders), the actual Mastercoin related processing is done in 2-5 minutes.

I once noticed step 1 (and as consequence 2) at the very beginning are quite slow, but it speeds up later: http://sourceforge.net/p/bitcoin/mailman/message/32701295/

zathras-crypto commented 9 years ago

Hi,

The extrapolation of 5 days I don't think is quite accurate.

FYI for re-indexing, the time it takes to index a block is dependent on the size and number of transactions within the block. Recent blocks around 300,000 are large and carry many transactions as the popularity of Bitcoin increases, vs the first Bitcoin blocks that carried few transactions and low difficulty.

TL:DR; during a re-index, the first 150,000 to 200,000 blocks are processed within a couple of hours, then blocks start to take longer and longer to reindex the more difficult and populated the block. It's absolutely hardware dependent (a good SSD and CPU will help things along greatly).

Also FYI MasterCore takes no additional action during a re-index (starts parsing when re-index is complete) so time to re-index should be identical to Bitcoin Core.

Thanks Zathras