diff --git a/docs/allclasses-frame.html b/docs/allclasses-frame.html index 338026260..d05c733b2 100644 --- a/docs/allclasses-frame.html +++ b/docs/allclasses-frame.html @@ -31,8 +31,12 @@ All Classes
BlockChain
+BlockStore +
BlockStoreException
+DiskBlockStore +
ECKey
GetBlocksMessage @@ -45,6 +49,8 @@ All Classes
InventoryMessage
+MemoryBlockStore +
Message
NetworkConnection @@ -61,6 +67,10 @@ All Classes
ScriptException
+Sha256Hash +
+StoredBlock +
Transaction
Transaction.SigHash diff --git a/docs/allclasses-noframe.html b/docs/allclasses-noframe.html index 26bcc38c9..ad6644d7b 100644 --- a/docs/allclasses-noframe.html +++ b/docs/allclasses-noframe.html @@ -31,8 +31,12 @@ All Classes
BlockChain
+BlockStore +
BlockStoreException
+DiskBlockStore +
ECKey
GetBlocksMessage @@ -45,6 +49,8 @@ All Classes
InventoryMessage
+MemoryBlockStore +
Message
NetworkConnection @@ -61,6 +67,10 @@ All Classes
ScriptException
+Sha256Hash +
+StoredBlock +
Transaction
Transaction.SigHash diff --git a/docs/com/google/bitcoin/core/Block.html b/docs/com/google/bitcoin/core/Block.html index e8ed75c14..0a957d0d0 100644 --- a/docs/com/google/bitcoin/core/Block.html +++ b/docs/com/google/bitcoin/core/Block.html @@ -72,9 +72,9 @@ function windowTitle() - SUMMARY: NESTED | FIELD | CONSTR | METHOD + SUMMARY: NESTED | FIELD | CONSTR | METHOD -DETAIL: FIELD | CONSTR | METHOD +DETAIL: FIELD | CONSTR | METHOD @@ -123,6 +123,14 @@ A block is the foundation of the BitCoin system. It records a set of Field Summary + + +static int +HEADER_SIZE + +
+          How many bytes are required to represent a block header. +   @@ -303,6 +311,27 @@ A block is the foundation of the BitCoin system. It records a set of +
+ + + +
+Field Detail
+ +

+HEADER_SIZE

+
+public static final int HEADER_SIZE
+
+
How many bytes are required to represent a block header. +

+

+
See Also:
Constant Field Values
+
+ @@ -610,9 +639,9 @@ public long getNonce() - SUMMARY: NESTED | FIELD | CONSTR | METHOD + SUMMARY: NESTED | FIELD | CONSTR | METHOD -DETAIL: FIELD | CONSTR | METHOD +DETAIL: FIELD | CONSTR | METHOD diff --git a/docs/com/google/bitcoin/core/BlockChain.html b/docs/com/google/bitcoin/core/BlockChain.html index 11e74e3f6..905ddaa28 100644 --- a/docs/com/google/bitcoin/core/BlockChain.html +++ b/docs/com/google/bitcoin/core/BlockChain.html @@ -52,7 +52,7 @@ function windowTitle()  PREV CLASS  - NEXT CLASSNEXT CLASS FRAMES    NO FRAMES   @@ -135,7 +135,7 @@ A BlockChain holds a series of -protected  com.google.bitcoin.core.BlockStore +protected  BlockStore blockStore
@@ -143,7 +143,7 @@ A BlockChain holds a series of -protected  com.google.bitcoin.core.StoredBlock +protected  StoredBlock chainHead
@@ -176,11 +176,12 @@ A BlockChain holds a series of -BlockChain(NetworkParameters params, - Wallet wallet) +BlockChain(NetworkParameters params, + Wallet wallet, + BlockStore blockStore)
-            +          Constructs a BlockChain connected to the given wallet and store.   @@ -202,7 +203,7 @@ A BlockChain holds a series of - com.google.bitcoin.core.StoredBlock + StoredBlock getChainHead()
@@ -242,7 +243,7 @@ A BlockChain holds a series of

blockStore

-protected com.google.bitcoin.core.BlockStore blockStore
+protected BlockStore blockStore
Keeps a map of block hashes to StoredBlocks.

@@ -254,7 +255,7 @@ protected com.google.bitcoin.core.BlockStore blockStore

chainHead

-protected com.google.bitcoin.core.StoredBlock chainHead
+protected StoredBlock chainHead
Tracks the top of the best known chain.

@@ -297,12 +298,20 @@ protected final -

+

BlockChain

 public BlockChain(NetworkParameters params,
-                  Wallet wallet)
+ Wallet wallet, + BlockStore blockStore)
+
Constructs a BlockChain connected to the given wallet and store. To obtain a Wallet you can construct + one from scratch, or you can deserialize a saved wallet from disk using Wallet.loadFromFile(java.io.File) +

+ + For the store you can use a MemoryBlockStore if you don't care about saving the downloaded data, or a + DiskBlockStore if you'd like to ensure fast startup the next time you run the program. +

@@ -338,7 +347,7 @@ public boolean add(

getChainHead

-public com.google.bitcoin.core.StoredBlock getChainHead()
+public StoredBlock getChainHead()
Returns the block at the head of the current best chain. This is the block which represents the greatest amount of cumulative work done. @@ -390,7 +399,7 @@ public  PREV CLASS  - NEXT CLASSNEXT CLASS FRAMES    NO FRAMES   diff --git a/docs/com/google/bitcoin/core/BlockStoreException.html b/docs/com/google/bitcoin/core/BlockStoreException.html new file mode 100644 index 000000000..6a46e7d63 --- /dev/null +++ b/docs/com/google/bitcoin/core/BlockStoreException.html @@ -0,0 +1,252 @@ + + + + + +BlockStoreException + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.bitcoin.core +
+Class BlockStoreException

+
+java.lang.Object
+  extended by java.lang.Throwable
+      extended by java.lang.Exception
+          extended by com.google.bitcoin.core.BlockStoreException
+
+
+
All Implemented Interfaces:
java.io.Serializable
+
+
+
+
public class BlockStoreException
extends java.lang.Exception
+ + +

+Thrown when something goes wrong with storing a block. Examples: out of disk space. +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + + + + +
+Constructor Summary
BlockStoreException(java.lang.String message) + +
+           
BlockStoreException(java.lang.Throwable t) + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+BlockStoreException

+
+public BlockStoreException(java.lang.String message)
+
+
+
+ +

+BlockStoreException

+
+public BlockStoreException(java.lang.Throwable t)
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/com/google/bitcoin/core/ECKey.html b/docs/com/google/bitcoin/core/ECKey.html index 97f3c208d..b21e24f14 100644 --- a/docs/com/google/bitcoin/core/ECKey.html +++ b/docs/com/google/bitcoin/core/ECKey.html @@ -51,7 +51,7 @@ function windowTitle() PREV CLASS  + PREV CLASS   NEXT CLASS FRAMES   @@ -184,6 +184,15 @@ Represents an elliptic curve keypair that we own and can use for signing transac + byte[] +toASN1() + +
+          Output this ECKey as an ASN.1 encoded private key, as understood by OpenSSL or used by the BitCoin reference + implementation in its wallet storage format. + + +  java.lang.String toString() @@ -279,6 +288,23 @@ public static

+toASN1

+
+public byte[] toASN1()
+
+
Output this ECKey as an ASN.1 encoded private key, as understood by OpenSSL or used by the BitCoin reference + implementation in its wallet storage format. +

+

+
+
+
+
+
+
+
+

getPubKeyHash

@@ -422,7 +448,7 @@ public boolean verify(byte[] data,
 
 
 PREV CLASS 
+ PREV CLASS 
  NEXT CLASS
 
   FRAMES   
diff --git a/docs/com/google/bitcoin/core/InventoryMessage.html b/docs/com/google/bitcoin/core/InventoryMessage.html
index 8c0a25e20..f6515d0f7 100644
--- a/docs/com/google/bitcoin/core/InventoryMessage.html
+++ b/docs/com/google/bitcoin/core/InventoryMessage.html
@@ -52,7 +52,7 @@ function windowTitle()
 
 
  PREV CLASS 
- NEXT CLASSNEXT CLASS
 
   FRAMES   
  NO FRAMES   
@@ -327,7 +327,7 @@ public void bitcoinSerializeToStream(java.io.OutputStream stream)
 
 
  PREV CLASS 
- NEXT CLASSNEXT CLASS
 
   FRAMES   
  NO FRAMES   
diff --git a/docs/com/google/bitcoin/core/Message.html b/docs/com/google/bitcoin/core/Message.html
index 818505894..4040c9e02 100644
--- a/docs/com/google/bitcoin/core/Message.html
+++ b/docs/com/google/bitcoin/core/Message.html
@@ -51,7 +51,7 @@ function windowTitle()
 
 
 PREV CLASS 
+ PREV CLASS 
  NEXT CLASS
 
   FRAMES   
@@ -360,7 +360,7 @@ public byte[] bitcoinSerialize()
PREV CLASS  + PREV CLASS   NEXT CLASS FRAMES   diff --git a/docs/com/google/bitcoin/core/NetworkConnection.html b/docs/com/google/bitcoin/core/NetworkConnection.html index 21c8f3e2e..4ae69de42 100644 --- a/docs/com/google/bitcoin/core/NetworkConnection.html +++ b/docs/com/google/bitcoin/core/NetworkConnection.html @@ -119,8 +119,9 @@ A NetworkConnection handles talking to a remote BitCoin peer at a low level. It Constructor Summary -NetworkConnection(java.net.InetAddress remoteIp, - NetworkParameters params) +NetworkConnection(java.net.InetAddress remoteIp, + NetworkParameters params, + int bestHeight)
          Connect to the given IP address using the port specified as part of the network parameters. @@ -207,11 +208,12 @@ A NetworkConnection handles talking to a remote BitCoin peer at a low level. It -

+

NetworkConnection

 public NetworkConnection(java.net.InetAddress remoteIp,
-                         NetworkParameters params)
+                         NetworkParameters params,
+                         int bestHeight)
                   throws java.io.IOException,
                          ProtocolException
@@ -219,7 +221,7 @@ public NetworkConnection(java.net.InetAddress remoteIp, is complete a functioning network channel is set up and running.

-
Parameters:
remoteIp - IP address to connect to. IPv6 is not currently supported by BitCoin.
params - Defines which network to connect to and details of the protocol. +
Parameters:
remoteIp - IP address to connect to. IPv6 is not currently supported by BitCoin.
params - Defines which network to connect to and details of the protocol.
bestHeight - How many blocks are in our best chain
Throws:
java.io.IOException - if there is a network related failure.
ProtocolException - if the version negotiation failed.
diff --git a/docs/com/google/bitcoin/core/PeerAddress.html b/docs/com/google/bitcoin/core/PeerAddress.html index e18fc26f6..8e6171f69 100644 --- a/docs/com/google/bitcoin/core/PeerAddress.html +++ b/docs/com/google/bitcoin/core/PeerAddress.html @@ -139,8 +139,9 @@ A PeerAddress holds an IP address and port number representing the network locat Constructor Summary
-PeerAddress(java.net.InetAddress addr, - int port) +PeerAddress(java.net.InetAddress addr, + int port, + int protocolVersion)
            @@ -236,11 +237,12 @@ public PeerAddress(

+

PeerAddress

 public PeerAddress(java.net.InetAddress addr,
-                   int port)
+ int port, + int protocolVersion)
diff --git a/docs/com/google/bitcoin/core/ScriptException.html b/docs/com/google/bitcoin/core/ScriptException.html index e0870d70b..1beb900a9 100644 --- a/docs/com/google/bitcoin/core/ScriptException.html +++ b/docs/com/google/bitcoin/core/ScriptException.html @@ -52,7 +52,7 @@ function windowTitle()  PREV CLASS  - NEXT CLASSNEXT CLASS
FRAMES    NO FRAMES   @@ -216,7 +216,7 @@ public ScriptException(java.lang.String msg,  PREV CLASS  - NEXT CLASSNEXT CLASS FRAMES    NO FRAMES   diff --git a/docs/com/google/bitcoin/core/Transaction.SigHash.html b/docs/com/google/bitcoin/core/Transaction.SigHash.html index a6bd46eb9..e5f67a132 100644 --- a/docs/com/google/bitcoin/core/Transaction.SigHash.html +++ b/docs/com/google/bitcoin/core/Transaction.SigHash.html @@ -107,10 +107,9 @@ java.lang.Object These constants are a part of a scriptSig signature on the inputs. They define the details of how a transaction can be redeemed, specifically, they control how the hash of the transaction is calculated. - Note: in the official client, this enum also has another flag, SIGHASH_ANYONECANPAY. In this implementation, - that's kept separate. - - Also note: only SIGHASH_ALL is actually used in the official client today. + In the official client, this enum also has another flag, SIGHASH_ANYONECANPAY. In this implementation, + that's kept separate. Only SIGHASH_ALL is actually used in the official client today. The other flags + exist to allow for distributed contracts.

diff --git a/docs/com/google/bitcoin/core/Transaction.html b/docs/com/google/bitcoin/core/Transaction.html index dac039671..23c6daca2 100644 --- a/docs/com/google/bitcoin/core/Transaction.html +++ b/docs/com/google/bitcoin/core/Transaction.html @@ -51,7 +51,7 @@ function windowTitle() PREV CLASS  + PREV CLASS   NEXT CLASS FRAMES   @@ -219,7 +219,7 @@ A transaction represents the movement of coins from some addresses to some other - byte[] + Sha256Hash getHash()
@@ -393,7 +393,7 @@ public java.util.List<

getHash

-public byte[] getHash()
+public Sha256Hash getHash()
Returns the transaction hash as you see them in the block explorer.

@@ -431,8 +431,7 @@ public java.math.BigInteger getValueSentToMe(PREV CLASS  + PREV CLASS   NEXT CLASS FRAMES   diff --git a/docs/com/google/bitcoin/core/Utils.html b/docs/com/google/bitcoin/core/Utils.html index 79b0ba885..2fd74e859 100644 --- a/docs/com/google/bitcoin/core/Utils.html +++ b/docs/com/google/bitcoin/core/Utils.html @@ -119,7 +119,7 @@ A collection of various utility methods that are helpful for working with the Bi CENT
-          How many nanocoins there are in 0.01 BitCoins. +          How many "nanocoins" there are in 0.01 BitCoins. @@ -127,7 +127,7 @@ A collection of various utility methods that are helpful for working with the Bi COIN
-          How many nanocoins there are in a BitCoin. +          How many "nanocoins" there are in a BitCoin.   @@ -251,6 +251,14 @@ A collection of various utility methods that are helpful for working with the Bi toNanoCoins(int coins, int cents) +
+          Convert an amount expressed in the way humans are used to into nanocoins. + + + +static java.math.BigInteger +toNanoCoins(java.lang.String coins) +
          Convert an amount expressed in the way humans are used to into nanocoins. @@ -320,7 +328,11 @@ COIN

 public static final java.math.BigInteger COIN
-
How many nanocoins there are in a BitCoin. +
How many "nanocoins" there are in a BitCoin. + + A nanocoin is the smallest unit that can be transferred using BitCoin. + The term nanocoin is very misleading, though, because there are only 100 million + of them in a coin (whereas one would expect 1 billion.

@@ -332,7 +344,11 @@ CENT
 public static final java.math.BigInteger CENT
-
How many nanocoins there are in 0.01 BitCoins. +
How many "nanocoins" there are in 0.01 BitCoins. + + A nanocoin is the smallest unit that can be transferred using BitCoin. + The term nanocoin is very misleading, though, because there are only 100 million + of them in a coin (whereas one would expect 1 billion).

@@ -379,6 +395,24 @@ public static java.math.BigInteger toNanoCoins(int coins,

+

+toNanoCoins

+
+public static java.math.BigInteger toNanoCoins(java.lang.String coins)
+
+
Convert an amount expressed in the way humans are used to into nanocoins.

+ + This takes string in a format understood by BigDecimal.BigDecimal(String), + for example "0", "1", "0.10", "1.23E3", "1234.5E-5". +

+

+ +
Throws: +
java.lang.ArithmeticException - if you try to specify fractional nanocoins
+
+
+
+

uint32ToByteArrayBE

diff --git a/docs/com/google/bitcoin/core/VersionMessage.html b/docs/com/google/bitcoin/core/VersionMessage.html
index 2f0819ea6..54b5fd294 100644
--- a/docs/com/google/bitcoin/core/VersionMessage.html
+++ b/docs/com/google/bitcoin/core/VersionMessage.html
@@ -198,14 +198,15 @@ java.lang.Object
 Constructor Summary
 
 
-VersionMessage(NetworkParameters params)
+VersionMessage(NetworkParameters params,
+               byte[] msg)
 
 
            -VersionMessage(NetworkParameters params, - byte[] msg) +VersionMessage(NetworkParameters params, + int newBestHeight)
            @@ -397,10 +398,11 @@ public VersionMessage(

+

VersionMessage

-public VersionMessage(NetworkParameters params)
+public VersionMessage(NetworkParameters params, + int newBestHeight)
diff --git a/docs/com/google/bitcoin/core/Wallet.html b/docs/com/google/bitcoin/core/Wallet.html index dd1e0855c..e9f634775 100644 --- a/docs/com/google/bitcoin/core/Wallet.html +++ b/docs/com/google/bitcoin/core/Wallet.html @@ -131,14 +131,6 @@ A Wallet stores keys and a record of transactions that have not yet been spent.
          A list of public/private EC keys owned by this user. - - - java.util.ArrayList<Transaction> -unspent - -
-          A list of transactions with outputs we can spend. -   @@ -191,11 +183,43 @@ A Wallet stores keys and a record of transactions that have not yet been spent. + ECKey +findKeyFromPubKey(byte[] pubkey) + +
+          Locates a keypair from the keychain given the raw public key bytes. + + +  java.math.BigInteger getBalance()
-          Returns the balance of this wallet in nanocoins by summing up all unspent outputs that were sent to us. +          Returns the balance of this wallet by summing up all unspent outputs that were sent to us. + + + + java.util.Collection<Transaction> +getPendingTransactions() + +
+          Returns an immutable view of the transactions currently waiting for network confirmations. + + + + boolean +isPubKeyHashMine(byte[] pubkeyHash) + +
+          Returns true if this wallet contains a public key which hashes to the given hash. + + + + boolean +isPubKeyMine(byte[] pubkey) + +
+          Returns true if this wallet contains a keypair with the given public key. @@ -263,21 +287,6 @@ A Wallet stores keys and a record of transactions that have not yet been spent. -

-unspent

-
-public final java.util.ArrayList<Transaction> unspent
-
-
A list of transactions with outputs we can spend. Note that some of these transactions may be partially spent, - that is, they have outputs some of which are redeemed and others which aren't already. The spentness of each - output is tracked in the TransactionOutput object. The value of all unspent outputs is the balance of the - wallet. -

-

-
-
-
-

keychain

@@ -452,12 +461,61 @@ public 

+isPubKeyHashMine

+
+public boolean isPubKeyHashMine(byte[] pubkeyHash)
+
+
Returns true if this wallet contains a public key which hashes to the given hash. +

+

+
+
+
+
+
+
+
+ +

+findKeyFromPubKey

+
+public ECKey findKeyFromPubKey(byte[] pubkey)
+
+
Locates a keypair from the keychain given the raw public key bytes. +

+

+
+
+
+ +
Returns:
ECKey or null if no such key was found.
+
+
+
+ +

+isPubKeyMine

+
+public boolean isPubKeyMine(byte[] pubkey)
+
+
Returns true if this wallet contains a keypair with the given public key. +

+

+
+
+
+
+
+
+
+

getBalance

 public java.math.BigInteger getBalance()
-
Returns the balance of this wallet in nanocoins by summing up all unspent outputs that were sent to us. +
Returns the balance of this wallet by summing up all unspent outputs that were sent to us.

@@ -480,6 +538,22 @@ public java.lang.String toString()
+
+ +

+getPendingTransactions

+
+public java.util.Collection<Transaction> getPendingTransactions()
+
+
Returns an immutable view of the transactions currently waiting for network confirmations. +

+

+
+
+
+
+
+

diff --git a/docs/com/google/bitcoin/core/package-frame.html b/docs/com/google/bitcoin/core/package-frame.html index d81b79b13..2324f6d4c 100644 --- a/docs/com/google/bitcoin/core/package-frame.html +++ b/docs/com/google/bitcoin/core/package-frame.html @@ -15,6 +15,17 @@ com.google.bitcoin.core com.google.bitcoin.core + + + + +
+Interfaces  + +
+BlockStore
+ +
@@ -31,6 +42,8 @@ Classes 
BlockChain
+DiskBlockStore +
ECKey
GetBlocksMessage @@ -41,6 +54,8 @@ Classes 
InventoryMessage
+MemoryBlockStore +
Message
NetworkConnection @@ -53,6 +68,10 @@ Classes 
Script
+Sha256Hash +
+StoredBlock +
Transaction
TransactionInput diff --git a/docs/com/google/bitcoin/core/package-summary.html b/docs/com/google/bitcoin/core/package-summary.html index 93420b770..b0c37870b 100644 --- a/docs/com/google/bitcoin/core/package-summary.html +++ b/docs/com/google/bitcoin/core/package-summary.html @@ -79,6 +79,20 @@ function windowTitle() Package com.google.bitcoin.core + + + + + + + + +
+Interface Summary
BlockStoreAn implementor of BlockStore saves StoredBlock objects to disk.
+  + +

+ + + + + @@ -126,6 +144,10 @@ Package com.google.bitcoin.core + + + + @@ -152,6 +174,16 @@ Package com.google.bitcoin.core + + + + + + + + diff --git a/docs/com/google/bitcoin/core/package-tree.html b/docs/com/google/bitcoin/core/package-tree.html index be598659a..513415938 100644 --- a/docs/com/google/bitcoin/core/package-tree.html +++ b/docs/com/google/bitcoin/core/package-tree.html @@ -85,8 +85,10 @@ Class Hierarchy
@@ -106,6 +120,10 @@ Package com.google.bitcoin.core chain follows the rules of the NetworkParameters for this chain.
DiskBlockStoreStores the block chain to disk but still holds it in memory.
ECKey Represents an elliptic curve keypair that we own and can use for signing transactions.
 
MemoryBlockStoreKeeps StoredBlocks in memory.
Message A Message is a data structure that can be serialized/deserialized using both the BitCoin proprietary serialization format and built-in Java object serialization.BitCoin transactions don't specify what they do directly.
Sha256HashA Sha256Hash just wraps a byte[] so that equals and hashcode work correctly, allowing it to be used as keys in a + map.
StoredBlockWraps a Block object with extra data that can be derived from the block chain but is slow or inconvenient to + calculate.
Transaction A transaction represents the movement of coins from some addresses to some other addresses.
+ + + + + + + + + + +
com.google.bitcoin.core.Block
+public static final intHEADER_SIZE80
+ +

+ +

+ diff --git a/docs/index-all.html b/docs/index-all.html index 02948f79a..bd67f7cdf 100644 --- a/docs/index-all.html +++ b/docs/index-all.html @@ -156,15 +156,21 @@ Static method in class com.google.bitcoin.core.Block
Constructs a block object from the BitCoin wire format.
BlockChain - Class in com.google.bitcoin.core
A BlockChain holds a series of Block objects, links them together, and knows how to verify that the - chain follows the rules of the NetworkParameters for this chain.
BlockChain(NetworkParameters, Wallet) - + chain follows the rules of the NetworkParameters for this chain.
BlockChain(NetworkParameters, Wallet, BlockStore) - Constructor for class com.google.bitcoin.core.BlockChain -
  +
Constructs a BlockChain connected to the given wallet and store.
blockStore - Variable in class com.google.bitcoin.core.BlockChain
Keeps a map of block hashes to StoredBlocks. -
BlockStoreException - Exception in com.google.bitcoin.core
Thrown when something goes wrong with storing a block.
BlockStoreException() - +
BlockStore - Interface in com.google.bitcoin.core
An implementor of BlockStore saves StoredBlock objects to disk.
BlockStoreException - Exception in com.google.bitcoin.core
Thrown when something goes wrong with storing a block.
BlockStoreException(String) - Constructor for exception com.google.bitcoin.core.BlockStoreException
  +
BlockStoreException(Throwable) - +Constructor for exception com.google.bitcoin.core.BlockStoreException +
  +
build(Block) - +Method in class com.google.bitcoin.core.StoredBlock +
Creates a new StoredBlock, calculating the additional fields by adding to the values in this block.
bytes - Variable in class com.google.bitcoin.core.Message
  @@ -178,7 +184,7 @@ Static method in class com.google.bitcoin.core.CENT - Static variable in class com.google.bitcoin.core.Utils -
How many nanocoins there are in 0.01 BitCoins. +
How many "nanocoins" there are in 0.01 BitCoins.
chainHead - Variable in class com.google.bitcoin.core.BlockChain
Tracks the top of the best known chain. @@ -190,7 +196,7 @@ Method in class com.google.bitcoin.core.COIN - Static variable in class com.google.bitcoin.core.Utils -
How many nanocoins there are in a BitCoin. +
How many "nanocoins" there are in a BitCoin.
com.google.bitcoin.core - package com.google.bitcoin.core
 
cursor - Variable in class com.google.bitcoin.core.Message
  @@ -208,6 +214,9 @@ Static method in class com.google.bitcoin.core.disconnect() - Method in class com.google.bitcoin.core.Peer
Terminates the network connection and stops the background thread. +
DiskBlockStore - Class in com.google.bitcoin.core
Stores the block chain to disk but still holds it in memory.
DiskBlockStore(NetworkParameters, File) - +Constructor for class com.google.bitcoin.core.DiskBlockStore +
 
doubleDigest(byte[]) - Static method in class com.google.bitcoin.core.Utils
See Utils.doubleDigest(byte[],int,int). @@ -246,6 +255,12 @@ Method in class com.google.bitcoin.core.equals(Object) - Method in class com.google.bitcoin.core.Block
  +
equals(Object) - +Method in class com.google.bitcoin.core.Sha256Hash +
Returns true if the hashes are equal. +
equals(Object) - +Method in class com.google.bitcoin.core.StoredBlock +
 
equals(Object) - Method in class com.google.bitcoin.core.Transaction
  @@ -257,6 +272,9 @@ Method in class com.google.bitcoin.core.findKeyFromPubHash(byte[]) - Method in class com.google.bitcoin.core.Wallet
Locates a keypair from the keychain given the hash of the public key. +
findKeyFromPubKey(byte[]) - +Method in class com.google.bitcoin.core.Wallet +
Locates a keypair from the keychain given the raw public key bytes.
fromASN1(byte[]) - Static method in class com.google.bitcoin.core.ECKey
Construct an ECKey from an ASN.1 encoded private key. @@ -268,9 +286,18 @@ Static method in class com.google.bitcoin.core.genesisBlock - Variable in class com.google.bitcoin.core.NetworkParameters
Genesis block for this chain. +
get(byte[]) - +Method in interface com.google.bitcoin.core.BlockStore +
Returns the StoredBlock given a hash. +
get(byte[]) - +Method in class com.google.bitcoin.core.DiskBlockStore +
  +
get(byte[]) - +Method in class com.google.bitcoin.core.MemoryBlockStore +
 
getBalance() - Method in class com.google.bitcoin.core.Wallet -
Returns the balance of this wallet in nanocoins by summing up all unspent outputs that were sent to us. +
Returns the balance of this wallet by summing up all unspent outputs that were sent to us.
getBlock(byte[]) - Method in class com.google.bitcoin.core.Peer
Asks the connected peer for the block of the given hash, and returns a Future representing the answer. @@ -280,6 +307,18 @@ Constructor for class com.google.bitcoin.core.getChainHead() - Method in class com.google.bitcoin.core.BlockChain
Returns the block at the head of the current best chain. +
getChainHead() - +Method in interface com.google.bitcoin.core.BlockStore +
Returns the StoredBlock that represents the top of the chain of greatest total work. +
getChainHead() - +Method in class com.google.bitcoin.core.DiskBlockStore +
  +
getChainHead() - +Method in class com.google.bitcoin.core.MemoryBlockStore +
  +
getChainWork() - +Method in class com.google.bitcoin.core.StoredBlock +
The total sum of work done in this block, and all the blocks below it in the chain.
GetDataMessage - Class in com.google.bitcoin.core
 
GetDataMessage(NetworkParameters, byte[]) - Constructor for class com.google.bitcoin.core.GetDataMessage
  @@ -311,6 +350,12 @@ Method in class com.google.bitcoin.core.getHashAsString() - Method in class com.google.bitcoin.core.Transaction
  +
getHeader() - +Method in class com.google.bitcoin.core.StoredBlock +
The block header this object wraps. +
getHeight() - +Method in class com.google.bitcoin.core.StoredBlock +
Position in the chain for this block.
getInputs() - Method in class com.google.bitcoin.core.Transaction
Returns a read-only list of the inputs of this transaction. @@ -321,6 +366,12 @@ Method in class com.google.bitcoin.core.Block
Returns the nonce, an arbitrary value that exists only to make the hash of the block header fall below the difficulty target. +
getPendingTransactions() - +Method in class com.google.bitcoin.core.Wallet +
Returns an immutable view of the transactions currently waiting for network confirmations. +
getPrev(BlockStore) - +Method in class com.google.bitcoin.core.StoredBlock +
Given a block store, looks up the previous block in this chain.
getPrevBlockHash() - Method in class com.google.bitcoin.core.Block
Returns the hash of the previous block in the chain, as defined by the block header. @@ -388,15 +439,27 @@ Method in class com.google.bitcoin.core.hash - Variable in class com.google.bitcoin.core.InventoryItem
  +
hash - +Variable in class com.google.bitcoin.core.Sha256Hash +
 
hashCode() - Method in class com.google.bitcoin.core.Address
 
hashCode() - Method in class com.google.bitcoin.core.Block
  +
hashCode() - +Method in class com.google.bitcoin.core.Sha256Hash +
Hash code of the byte array as calculated by Object.hashCode(). +
hashCode() - +Method in class com.google.bitcoin.core.StoredBlock +
 
hashCode() - Method in class com.google.bitcoin.core.Transaction
  +
HEADER_SIZE - +Static variable in class com.google.bitcoin.core.Block +
How many bytes are required to represent a block header.

@@ -426,6 +489,12 @@ Static method in class com.google.bitcoin.core.isMine(Wallet) - Method in class com.google.bitcoin.core.TransactionOutput
Returns true if this output is to an address we have the keys for in the wallet. +
isPubKeyHashMine(byte[]) - +Method in class com.google.bitcoin.core.Wallet +
Returns true if this wallet contains a public key which hashes to the given hash. +
isPubKeyMine(byte[]) - +Method in class com.google.bitcoin.core.Wallet +
Returns true if this wallet contains a keypair with the given public key.
isSentToIP() - Method in class com.google.bitcoin.core.Script
Returns true if this transaction is of a format that means it was a direct IP to IP transaction. @@ -471,10 +540,16 @@ Variable in class com.google.bitcoin.core.MAX_SIZE - Static variable in class com.google.bitcoin.core.Message
  +
MemoryBlockStore - Class in com.google.bitcoin.core
Keeps StoredBlocks in memory.
MemoryBlockStore(NetworkParameters) - +Constructor for class com.google.bitcoin.core.MemoryBlockStore +
 
Message - Class in com.google.bitcoin.core
A Message is a data structure that can be serialized/deserialized using both the BitCoin proprietary serialization format and built-in Java object serialization.
Message() - Constructor for class com.google.bitcoin.core.Message
This exists for the Java serialization framework to use only. +
moreWorkThan(StoredBlock) - +Method in class com.google.bitcoin.core.StoredBlock +
Returns true if this objects chainWork is higher than the others.
myAddr - Variable in class com.google.bitcoin.core.VersionMessage
What the other side believes the address of this program is. @@ -483,7 +558,7 @@ Variable in class com.google.bitcoin.core.

N

-
NetworkConnection - Class in com.google.bitcoin.core
A NetworkConnection handles talking to a remote BitCoin peer at a low level.
NetworkConnection(InetAddress, NetworkParameters) - +
NetworkConnection - Class in com.google.bitcoin.core
A NetworkConnection handles talking to a remote BitCoin peer at a low level.
NetworkConnection(InetAddress, NetworkParameters, int) - Constructor for class com.google.bitcoin.core.NetworkConnection
Connect to the given IP address using the port specified as part of the network parameters.
NetworkParameters - Class in com.google.bitcoin.core
NetworkParameters contains the data needed for working with an instantiation of a BitCoin chain.
NetworkParameters() - @@ -566,7 +641,7 @@ Constructor for class com.google.bitcoin.core.PeerAddress(NetworkParameters, byte[], int, int) - Constructor for class com.google.bitcoin.core.PeerAddress
  -
PeerAddress(InetAddress, int) - +
PeerAddress(InetAddress, int, int) - Constructor for class com.google.bitcoin.core.PeerAddress
 
ping() - @@ -596,6 +671,15 @@ Constructor for exception com.google.bitcoin.core.protocolVersion - Variable in class com.google.bitcoin.core.Message
  +
put(StoredBlock) - +Method in interface com.google.bitcoin.core.BlockStore +
Saves the given block header+extra data. +
put(StoredBlock) - +Method in class com.google.bitcoin.core.DiskBlockStore +
  +
put(StoredBlock) - +Method in class com.google.bitcoin.core.MemoryBlockStore +
 

@@ -636,9 +720,22 @@ Constructor for exception com.google.bitcoin.core.sendCoins(Peer, Address, BigInteger) - Method in class com.google.bitcoin.core.Wallet
Sends coins to the given address, via the given Peer. +
setChainHead(StoredBlock) - +Method in interface com.google.bitcoin.core.BlockStore +
Sets the StoredBlock that represents the top of the chain of greatest total work. +
setChainHead(StoredBlock) - +Method in class com.google.bitcoin.core.DiskBlockStore +
  +
setChainHead(StoredBlock) - +Method in class com.google.bitcoin.core.MemoryBlockStore +
 
setTracing(boolean) - Method in class com.google.bitcoin.core.Script
If true, running a program will log its instructions. +
Sha256Hash - Class in com.google.bitcoin.core
A Sha256Hash just wraps a byte[] so that equals and hashcode work correctly, allowing it to be used as keys in a + map.
Sha256Hash(byte[]) - +Constructor for class com.google.bitcoin.core.Sha256Hash +
 
sha256hash160(byte[]) - Static method in class com.google.bitcoin.core.Utils
Calculates RIPEMD160(SHA256(input)). @@ -657,6 +754,10 @@ Method in class com.google.bitcoin.core.startBlockChainDownload() - Method in class com.google.bitcoin.core.Peer
Starts an asynchronous download of the block chain. +
StoredBlock - Class in com.google.bitcoin.core
Wraps a Block object with extra data that can be derived from the block chain but is slow or inconvenient to + calculate.
StoredBlock(Block, BigInteger, int) - +Constructor for class com.google.bitcoin.core.StoredBlock +
 
subVer - Variable in class com.google.bitcoin.core.VersionMessage
An additional string that today the official client sets to the empty string. @@ -680,9 +781,16 @@ Variable in class com.google.bitcoin.core.toAddress(NetworkParameters) - Method in class com.google.bitcoin.core.ECKey
Returns the address that corresponds to the public part of this ECKey. +
toASN1() - +Method in class com.google.bitcoin.core.ECKey +
Output this ECKey as an ASN.1 encoded private key, as understood by OpenSSL or used by the BitCoin reference + implementation in its wallet storage format.
toNanoCoins(int, int) - Static method in class com.google.bitcoin.core.Utils
Convert an amount expressed in the way humans are used to into nanocoins. +
toNanoCoins(String) - +Static method in class com.google.bitcoin.core.Utils +
Convert an amount expressed in the way humans are used to into nanocoins.
toString() - Method in class com.google.bitcoin.core.Address
  @@ -710,6 +818,12 @@ Method in class com.google.bitcoin.core.toString() - Method in class com.google.bitcoin.core.Script
Returns the program opcodes as a string, for example "[1234] DUP HAHS160" +
toString() - +Method in class com.google.bitcoin.core.Sha256Hash +
  +
toString() - +Method in class com.google.bitcoin.core.StoredBlock +
 
toString() - Method in class com.google.bitcoin.core.Transaction
  @@ -764,9 +878,6 @@ Static method in class com.google.bitcoin.core.UnknownMessage - Class in com.google.bitcoin.core
 
UnknownMessage(NetworkParameters, String, byte[]) - Constructor for class com.google.bitcoin.core.UnknownMessage
  -
unspent - -Variable in class com.google.bitcoin.core.Wallet -
A list of transactions with outputs we can spend.
Utils - Class in com.google.bitcoin.core
A collection of various utility methods that are helpful for working with the BitCoin protocol.
Utils() - Constructor for class com.google.bitcoin.core.Utils
  @@ -817,7 +928,7 @@ Method in class com.google.bitcoin.core.VersionMessage - Class in com.google.bitcoin.core
 
VersionMessage(NetworkParameters, byte[]) - Constructor for class com.google.bitcoin.core.VersionMessage
  -
VersionMessage(NetworkParameters) - +
VersionMessage(NetworkParameters, int) - Constructor for class com.google.bitcoin.core.VersionMessage
  diff --git a/docs/overview-tree.html b/docs/overview-tree.html index fe2596f51..a7e752602 100644 --- a/docs/overview-tree.html +++ b/docs/overview-tree.html @@ -87,8 +87,10 @@ Class Hierarchy

com.google.bitcoin.core.Message
+ + + +
+Class com.google.bitcoin.core.Sha256Hash extends java.lang.Object implements Serializable
+ +

+ + + + + +
+Serialized Fields
+ +

+hash

+
+byte[] hash
+
+
+
+
+ +

+ + + + + +
+Class com.google.bitcoin.core.StoredBlock extends java.lang.Object implements Serializable
+ +

+serialVersionUID: -6097565241243701771L + +

+ + + + + +
+Serialized Fields
+ +

+header

+
+Block header
+
+
+
+
+
+

+chainWork

+
+java.math.BigInteger chainWork
+
+
+
+
+
+

+height

+
+int height
+
+
+
+
+

@@ -621,6 +696,15 @@ long lockTime
+
+

+appearsIn

+
+java.util.Set<E> appearsIn
+
+
+
+

@@ -929,7 +1013,7 @@ long bestHeight

-serialVersionUID: -4501424466753895784L +serialVersionUID: 2L

@@ -964,26 +1048,65 @@ private void readObject(java.io.ObjectInputStream in)

-unspent

+pending
-java.util.ArrayList<E> unspent
+java.util.Map<K,V> pending
-
A list of transactions with outputs we can spend. Note that some of these transactions may be partially spent, - that is, they have outputs some of which are redeemed and others which aren't already. The spentness of each - output is tracked in the TransactionOutput object. The value of all unspent outputs is the balance of the - wallet. +
Map of txhash->Transactions that have not made it into the best chain yet. These transactions inputs count as + spent for the purposes of calculating our balance but their outputs are not available for spending yet. This + means after a spend, our balance can actually go down temporarily before going up again!


-fullySpent

+unspent
-java.util.LinkedList<E> fullySpent
+java.util.Map<K,V> unspent
-
When all the outputs of a transaction are spent, it gets put here. These transactions aren't useful for - anything except record keeping and presentation to the user. +
Map of txhash->Transactions where the Transaction has unspent outputs. These are transactions we can use + to pay other people and so count towards our balance. Transactions only appear in this map if they are part + of the best chain. Transactions we have broacast that are not confirmed yet appear in pending even though they + may have unspent "change" outputs.

+ + Note: for now we will not allow spends of transactions that did not make it into the block chain. The code + that handles this in BitCoin C++ is complicated. Satoshis code will not allow you to spend unconfirmed coins, + however, it does seem to support dependency resolution entirely within the context of the memory pool so + theoretically you could spend zero-conf coins and all of them would be included together. To simplify we'll + make people wait but it would be a good improvement to resolve this in future. +

+

+
+
+
+

+spent

+
+java.util.Map<K,V> spent
+
+
Map of txhash->Transactions where the Transactions outputs are all fully spent. They are kept separately so + the time to create a spend does not grow infinitely as wallets become more used. Some of these transactions + may not have appeared in a block yet if they were created by us to spend coins and that spend is still being + worked on by miners.

+ + Transactions only appear in this map if they are part of the best chain. +

+

+
+
+
+

+inactive

+
+java.util.Map<K,V> inactive
+
+
An inactive transaction is one that is seen only in a block that is not a part of the best chain. We keep it + around in case a re-org promotes a different chain to be the best. In this case some (not necessarily all) + inactive transactions will be moved out to unspent and spent, and some might be moved in.

+ + Note that in the case where a transaction appears in both the best chain and a side chain as well, it is not + placed in this map. It's an error for a transaction to be in both the inactive pool and unspent/spent.

diff --git a/src/com/google/bitcoin/core/Sha256Hash.java b/src/com/google/bitcoin/core/Sha256Hash.java index 70f03ffcf..243d529d9 100644 --- a/src/com/google/bitcoin/core/Sha256Hash.java +++ b/src/com/google/bitcoin/core/Sha256Hash.java @@ -41,7 +41,7 @@ public class Sha256Hash implements Serializable { } /** - * Hash code of the byte array as calculated by {@link Arrays.hashCode()}. Note the difference between a SHA256 + * Hash code of the byte array as calculated by {@link Arrays#hashCode()}. Note the difference between a SHA256 * secure hash and the type of quick/dirty hash used by the Java hashCode method which is designed for use in * hash tables. */