Class PostgresFullPrunedBlockStore

java.lang.Object
org.bitcoinj.store.DatabaseFullPrunedBlockStore
org.bitcoinj.store.PostgresFullPrunedBlockStore
All Implemented Interfaces:
UTXOProvider, BlockStore, FullPrunedBlockStore

public class PostgresFullPrunedBlockStore extends DatabaseFullPrunedBlockStore

A full pruned block store using the Postgres 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.

  • Constructor Details

    • PostgresFullPrunedBlockStore

      public PostgresFullPrunedBlockStore(NetworkParameters params, int fullStoreDepth, String hostname, String dbName, String username, String password) throws BlockStoreException
      Creates a new PostgresFullPrunedBlockStore.
      Parameters:
      params - A copy of the NetworkParameters used
      fullStoreDepth - The number of blocks of history stored in full (something like 1000 is pretty safe)
      hostname - The hostname of the database to connect to
      dbName - The database to connect to
      username - The database username
      password - The password to the database
      Throws:
      BlockStoreException - if the database fails to open for any reason
    • PostgresFullPrunedBlockStore

      public PostgresFullPrunedBlockStore(NetworkParameters params, int fullStoreDepth, String hostname, String dbName, String username, String password, @Nullable String schemaName) throws BlockStoreException

      Create a new PostgresFullPrunedBlockStore, storing the tables in the schema specified. You may want to specify a schema to avoid name collisions, or just to keep the database better organized. The schema is not required, and if one is not provided than the default schema for the username will be used. See the postgres schema docs for more on schemas.

      Parameters:
      params - A copy of the NetworkParameters used.
      fullStoreDepth - The number of blocks of history stored in full (something like 1000 is pretty safe).
      hostname - The hostname of the database to connect to.
      dbName - The database to connect to.
      username - The database username.
      password - The password to the database.
      schemaName - The name of the schema to put the tables in. May be null if no schema is being used.
      Throws:
      BlockStoreException - If the database fails to open for any reason.
  • Method Details