Package org.bitcoinj.store
Class MySQLFullPrunedBlockStore
- java.lang.Object
-
- org.bitcoinj.store.DatabaseFullPrunedBlockStore
-
- org.bitcoinj.store.MySQLFullPrunedBlockStore
-
- All Implemented Interfaces:
UTXOProvider,BlockStore,FullPrunedBlockStore
public class MySQLFullPrunedBlockStore extends DatabaseFullPrunedBlockStore
A full pruned block store using the MySQL database engine. As an added bonus an address index is calculated, so you can use
DatabaseFullPrunedBlockStore.calculateBalanceForAddress(Address)to quickly look up the quantity of bitcoins controlled by that address.
-
-
Field Summary
-
Fields inherited from class org.bitcoinj.store.DatabaseFullPrunedBlockStore
allConnections, chainHeadBlock, chainHeadHash, conn, connectionURL, fullStoreDepth, params, password, schemaName, username, verifiedChainHeadBlock, verifiedChainHeadHash
-
-
Constructor Summary
Constructors Constructor Description MySQLFullPrunedBlockStore(NetworkParameters params, int fullStoreDepth, java.lang.String hostname, java.lang.String dbName, java.lang.String username, java.lang.String password)Creates a new MySQLFullPrunedBlockStore.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.List<java.lang.String>getCreateIndexesSQL()Get the SQL statements that create the indexes (DDL).protected java.util.List<java.lang.String>getCreateSchemeSQL()Get the SQL statements that create the schema (DDL).protected java.util.List<java.lang.String>getCreateTablesSQL()Get the SQL statements that create the tables (DDL).protected java.lang.StringgetDatabaseDriverClass()Get the database driver class,protected java.lang.StringgetDeleteOpenoutputsSQL()Get the SQL to delete a openoutputs record.protected java.lang.StringgetDuplicateKeyErrorCode()Get the database specific error code that indicated a duplicate key error when inserting a record.protected java.lang.StringgetInsertOpenoutputsSQL()Get the SQL to insert a openoutputs record.protected java.lang.StringgetSelectOpenoutputsSQL()Get the SQL to select a openoutputs record.protected java.lang.StringgetTransactionOutputSelectSQL()Get the SQL to select the transaction outputs for a given address.-
Methods inherited from class org.bitcoinj.store.DatabaseFullPrunedBlockStore
abortDatabaseBatchWrite, addUnspentTransactionOutput, beginDatabaseBatchWrite, calculateBalanceForAddress, close, commitDatabaseBatchWrite, deleteStore, dumpSizes, get, get, getBalanceSelectSQL, getChainHead, getChainHeadHeight, getCompatibilitySQL, getDeleteUndoableBlocksSQL, getDropTablesSQL, getInsertHeadersSQL, getInsertSettingsSQL, getInsertUndoableBlocksSQL, getOnceUndoableStoredBlock, getOpenTransactionOutputs, getParams, getSelectHeadersDumpSQL, getSelectHeadersSQL, getSelectOpenoutputsCountSQL, getSelectopenoutputsDumpSQL, getSelectSettingsDumpSQL, getSelectSettingsSQL, getSelectUndoableblocksDumpSQL, getSelectUndoableBlocksSQL, getTablesExistSQL, getTransactionOutput, getUndoBlock, getUpdateHeadersSQL, getUpdateSettingsSLQ, getUpdateUndoableBlocksSQL, getVerifiedChainHead, hasUnspentOutputs, maybeConnect, put, put, putUpdateStoredBlock, removeUnspentTransactionOutput, resetStore, setChainHead, setVerifiedChainHead
-
-
-
-
Constructor Detail
-
MySQLFullPrunedBlockStore
public MySQLFullPrunedBlockStore(NetworkParameters params, int fullStoreDepth, java.lang.String hostname, java.lang.String dbName, java.lang.String username, java.lang.String password) throws BlockStoreException
Creates a new MySQLFullPrunedBlockStore.- Parameters:
params- A copy of the NetworkParameters usedfullStoreDepth- The number of blocks of history stored in full (something like 1000 is pretty safe)hostname- The hostname of the database to connect todbName- The database to connect tousername- The database usernamepassword- The password to the database- Throws:
BlockStoreException- if the database fails to open for any reason
-
-
Method Detail
-
getDuplicateKeyErrorCode
protected java.lang.String getDuplicateKeyErrorCode()
Description copied from class:DatabaseFullPrunedBlockStoreGet the database specific error code that indicated a duplicate key error when inserting a record.This is the code returned by
SQLException.getSQLState()- Specified by:
getDuplicateKeyErrorCodein classDatabaseFullPrunedBlockStore- Returns:
- The database duplicate error code.
-
getSelectOpenoutputsSQL
protected java.lang.String getSelectOpenoutputsSQL()
Description copied from class:DatabaseFullPrunedBlockStoreGet the SQL to select a openoutputs record.- Overrides:
getSelectOpenoutputsSQLin classDatabaseFullPrunedBlockStore- Returns:
- The SQL select statement.
-
getInsertOpenoutputsSQL
protected java.lang.String getInsertOpenoutputsSQL()
Description copied from class:DatabaseFullPrunedBlockStoreGet the SQL to insert a openoutputs record.- Overrides:
getInsertOpenoutputsSQLin classDatabaseFullPrunedBlockStore- Returns:
- The SQL insert statement.
-
getDeleteOpenoutputsSQL
protected java.lang.String getDeleteOpenoutputsSQL()
Description copied from class:DatabaseFullPrunedBlockStoreGet the SQL to delete a openoutputs record.- Overrides:
getDeleteOpenoutputsSQLin classDatabaseFullPrunedBlockStore- Returns:
- The SQL delete statement.
-
getTransactionOutputSelectSQL
protected java.lang.String getTransactionOutputSelectSQL()
Description copied from class:DatabaseFullPrunedBlockStoreGet the SQL to select the transaction outputs for a given address.- Overrides:
getTransactionOutputSelectSQLin classDatabaseFullPrunedBlockStore- Returns:
- The SQL prepared statement.
-
getCreateTablesSQL
protected java.util.List<java.lang.String> getCreateTablesSQL()
Description copied from class:DatabaseFullPrunedBlockStoreGet the SQL statements that create the tables (DDL).- Specified by:
getCreateTablesSQLin classDatabaseFullPrunedBlockStore- Returns:
- The list of SQL statements.
-
getCreateIndexesSQL
protected java.util.List<java.lang.String> getCreateIndexesSQL()
Description copied from class:DatabaseFullPrunedBlockStoreGet the SQL statements that create the indexes (DDL).- Specified by:
getCreateIndexesSQLin classDatabaseFullPrunedBlockStore- Returns:
- The list of SQL statements.
-
getCreateSchemeSQL
protected java.util.List<java.lang.String> getCreateSchemeSQL()
Description copied from class:DatabaseFullPrunedBlockStoreGet the SQL statements that create the schema (DDL).- Specified by:
getCreateSchemeSQLin classDatabaseFullPrunedBlockStore- Returns:
- The list of SQL statements.
-
getDatabaseDriverClass
protected java.lang.String getDatabaseDriverClass()
Description copied from class:DatabaseFullPrunedBlockStoreGet the database driver class,i.e org.postgresql.Driver.
- Specified by:
getDatabaseDriverClassin classDatabaseFullPrunedBlockStore- Returns:
- The fully qualified database driver class.
-
-