org.bitcoinj.store.FullPrunedBlockStore Java Examples

The following examples show how to use org.bitcoinj.store.FullPrunedBlockStore. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LevelDB.java    From green_android with GNU General Public License v3.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    /*
     * This is just a test runner that will download blockchain till block
     * 390000 then exit.
     */
    FullPrunedBlockStore store = new LevelDBFullPrunedBlockStore(
            MainNetParams.get(), args[0], 1000, 100 * 1024 * 1024l,
            10 * 1024 * 1024, 100000, true, 390000);

    FullPrunedBlockChain vChain = new FullPrunedBlockChain(
            MainNetParams.get(), store);
    vChain.setRunScripts(false);

    PeerGroup vPeerGroup = new PeerGroup(MainNetParams.get(), vChain);
    vPeerGroup.setUseLocalhostPeerWhenPossible(true);
    vPeerGroup.addAddress(InetAddress.getLocalHost());

    vPeerGroup.start();
    vPeerGroup.downloadBlockChain();
}
 
Example #2
Source File: LevelDB.java    From GreenBits with GNU General Public License v3.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    /*
     * This is just a test runner that will download blockchain till block
     * 390000 then exit.
     */
    FullPrunedBlockStore store = new LevelDBFullPrunedBlockStore(
            MainNetParams.get(), args[0], 1000, 100 * 1024 * 1024l,
            10 * 1024 * 1024, 100000, true, 390000);

    FullPrunedBlockChain vChain = new FullPrunedBlockChain(
            MainNetParams.get(), store);
    vChain.setRunScripts(false);

    PeerGroup vPeerGroup = new PeerGroup(MainNetParams.get(), vChain);
    vPeerGroup.setUseLocalhostPeerWhenPossible(true);
    vPeerGroup.addAddress(InetAddress.getLocalHost());

    vPeerGroup.start();
    vPeerGroup.downloadBlockChain();
}
 
Example #3
Source File: LevelDBFullPrunedBlockChainTest.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public FullPrunedBlockStore createStore(NetworkParameters params,
        int blockCount) throws BlockStoreException {
    deleteFiles();
    return new LevelDBFullPrunedBlockStore(params, "test-leveldb",
            blockCount);
}
 
Example #4
Source File: FullPrunedBlockChain.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructs a block chain connected to the given list of wallets and a store.
 */
public FullPrunedBlockChain(Context context, List<Wallet> listeners, FullPrunedBlockStore blockStore) throws BlockStoreException {
    super(context, listeners, blockStore);
    this.blockStore = blockStore;
    // Ignore upgrading for now
    this.chainHead = blockStore.getVerifiedChainHead();
}
 
Example #5
Source File: FullPrunedBlockChain.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructs a block chain connected to the given list of wallets and a store.
 */
public FullPrunedBlockChain(Context context, List<Wallet> listeners, FullPrunedBlockStore blockStore) throws BlockStoreException {
    super(context, listeners, blockStore);
    this.blockStore = blockStore;
    // Ignore upgrading for now
    this.chainHead = blockStore.getVerifiedChainHead();
}
 
Example #6
Source File: PostgresFullPrunedBlockChainTest.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public FullPrunedBlockStore createStore(NetworkParameters params, int blockCount)
        throws BlockStoreException {
    if (useSchema) {
        return new PostgresFullPrunedBlockStore(params, blockCount, DB_HOSTNAME, DB_NAME, DB_USERNAME, DB_PASSWORD, DB_SCHEMA);
    } else {
        return new PostgresFullPrunedBlockStore(params, blockCount, DB_HOSTNAME, DB_NAME, DB_USERNAME, DB_PASSWORD);
    }
}
 
Example #7
Source File: PostgresFullPrunedBlockChainTest.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public FullPrunedBlockStore createStore(NetworkParameters params, int blockCount)
        throws BlockStoreException {
    if(useSchema) {
        return new PostgresFullPrunedBlockStore(params, blockCount, DB_HOSTNAME, DB_NAME, DB_USERNAME, DB_PASSWORD, DB_SCHEMA);
    }
    else {
        return new PostgresFullPrunedBlockStore(params, blockCount, DB_HOSTNAME, DB_NAME, DB_USERNAME, DB_PASSWORD);
    }
}
 
Example #8
Source File: LevelDBFullPrunedBlockChainTest.java    From bcm-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public FullPrunedBlockStore createStore(NetworkParameters params,
                                        int blockCount) throws BlockStoreException {
    deleteFiles();
    return new LevelDBFullPrunedBlockStore(params, "test-leveldb",
            blockCount);
}
 
Example #9
Source File: FullPrunedBlockChain.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Constructs a block chain connected to the given list of wallets and a store.
 */
public FullPrunedBlockChain(Context context, List<Wallet> listeners, FullPrunedBlockStore blockStore) throws BlockStoreException {
    super(context, listeners, blockStore);
    this.blockStore = blockStore;
    // Ignore upgrading for now
    this.chainHead = blockStore.getVerifiedChainHead();
}
 
Example #10
Source File: PostgresFullPrunedBlockChainTest.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
@Override
public FullPrunedBlockStore createStore(NetworkParameters params, int blockCount)
        throws BlockStoreException {
    if(useSchema) {
        return new PostgresFullPrunedBlockStore(params, blockCount, DB_HOSTNAME, DB_NAME, DB_USERNAME, DB_PASSWORD, DB_SCHEMA);
    }
    else {
        return new PostgresFullPrunedBlockStore(params, blockCount, DB_HOSTNAME, DB_NAME, DB_USERNAME, DB_PASSWORD);
    }
}
 
Example #11
Source File: LevelDBFullPrunedBlockChainTest.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
@Override
public FullPrunedBlockStore createStore(NetworkParameters params,
        int blockCount) throws BlockStoreException {
    deleteFiles();
    return new LevelDBFullPrunedBlockStore(params, "test-leveldb",
            blockCount);
}
 
Example #12
Source File: MySQLFullPrunedBlockChainTest.java    From green_android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void resetStore(FullPrunedBlockStore store) throws BlockStoreException {
    ((MySQLFullPrunedBlockStore)store).resetStore();
}
 
Example #13
Source File: FullPrunedBlockChain.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Constructs a block chain connected to the given store.
 */
public FullPrunedBlockChain(Context context, FullPrunedBlockStore blockStore) throws BlockStoreException {
    this(context, new ArrayList<Wallet>(), blockStore);
}
 
Example #14
Source File: MemoryFullPrunedBlockChainTest.java    From green_android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void resetStore(FullPrunedBlockStore store) throws BlockStoreException
{
    //No-op for memory store, because it's not persistent
}
 
Example #15
Source File: MemoryFullPrunedBlockChainTest.java    From green_android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public FullPrunedBlockStore createStore(NetworkParameters params, int blockCount) throws BlockStoreException
{
    return new MemoryFullPrunedBlockStore(params, blockCount);
}
 
Example #16
Source File: FullPrunedBlockChain.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
/**
 * See {@link #FullPrunedBlockChain(Context, List, FullPrunedBlockStore)}
 */
public FullPrunedBlockChain(NetworkParameters params, List<Wallet> listeners,
                            FullPrunedBlockStore blockStore) throws BlockStoreException {
    this(Context.getOrCreate(params), listeners, blockStore);
}
 
Example #17
Source File: MySQLFullPrunedBlockChainTest.java    From green_android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public FullPrunedBlockStore createStore(NetworkParameters params, int blockCount)
        throws BlockStoreException {
    return new MySQLFullPrunedBlockStore(params, blockCount, DB_HOSTNAME, DB_NAME, DB_USERNAME, DB_PASSWORD);
}
 
Example #18
Source File: AbstractFullPrunedBlockChainTest.java    From green_android with GNU General Public License v3.0 4 votes vote down vote up
public abstract FullPrunedBlockStore createStore(NetworkParameters params, int blockCount)
throws BlockStoreException;
 
Example #19
Source File: H2FullPrunedBlockChainTest.java    From green_android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void resetStore(FullPrunedBlockStore store) throws BlockStoreException {
    ((H2FullPrunedBlockStore)store).resetStore();
}
 
Example #20
Source File: FullPrunedBlockChain.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
/**
 * See {@link #FullPrunedBlockChain(Context, Wallet, FullPrunedBlockStore)}
 */
public FullPrunedBlockChain(NetworkParameters params, FullPrunedBlockStore blockStore) throws BlockStoreException {
    this(Context.getOrCreate(params), blockStore);
}
 
Example #21
Source File: LevelDBFullPrunedBlockChainTest.java    From green_android with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void resetStore(FullPrunedBlockStore store)
        throws BlockStoreException {
    ((LevelDBFullPrunedBlockStore) store).resetStore();
}
 
Example #22
Source File: PostgresFullPrunedBlockChainTest.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void resetStore(FullPrunedBlockStore store) throws BlockStoreException {
    ((PostgresFullPrunedBlockStore)store).resetStore();
}
 
Example #23
Source File: LevelDBFullPrunedBlockChainTest.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void resetStore(FullPrunedBlockStore store)
        throws BlockStoreException {
    ((LevelDBFullPrunedBlockStore) store).resetStore();
}
 
Example #24
Source File: H2FullPrunedBlockChainTest.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
@Override
public FullPrunedBlockStore createStore(NetworkParameters params, int blockCount) throws BlockStoreException {
    deleteFiles();
    return new H2FullPrunedBlockStore(params, "test", "sa", "sa", blockCount);
}
 
Example #25
Source File: H2FullPrunedBlockChainTest.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void resetStore(FullPrunedBlockStore store) throws BlockStoreException {
    ((H2FullPrunedBlockStore)store).resetStore();
}
 
Example #26
Source File: AbstractFullPrunedBlockChainTest.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
public abstract FullPrunedBlockStore createStore(NetworkParameters params, int blockCount)
throws BlockStoreException;
 
Example #27
Source File: MySQLFullPrunedBlockChainTest.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
@Override
public FullPrunedBlockStore createStore(NetworkParameters params, int blockCount)
        throws BlockStoreException {
    return new MySQLFullPrunedBlockStore(params, blockCount, DB_HOSTNAME, DB_NAME, DB_USERNAME, DB_PASSWORD);
}
 
Example #28
Source File: MySQLFullPrunedBlockChainTest.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void resetStore(FullPrunedBlockStore store) throws BlockStoreException {
    ((MySQLFullPrunedBlockStore)store).resetStore();
}
 
Example #29
Source File: MemoryFullPrunedBlockChainTest.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
@Override
public FullPrunedBlockStore createStore(NetworkParameters params, int blockCount) throws BlockStoreException
{
    return new MemoryFullPrunedBlockStore(params, blockCount);
}
 
Example #30
Source File: MemoryFullPrunedBlockChainTest.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void resetStore(FullPrunedBlockStore store) throws BlockStoreException
{
    //No-op for memory store, because it's not persistent
}