diff --git a/build.xml b/build.xml index e2058b5b..4953fb46 100644 --- a/build.xml +++ b/build.xml @@ -20,7 +20,8 @@ + additionalparam="-notimestamp" + classpath="lib/slf4j-api-1.6.1.jar"/> diff --git a/docs/allclasses-frame.html b/docs/allclasses-frame.html index d05c733b..d694a3f0 100644 --- a/docs/allclasses-frame.html +++ b/docs/allclasses-frame.html @@ -37,6 +37,8 @@ All Classes
DiskBlockStore
+DnsDiscovery +
ECKey
GetBlocksMessage @@ -49,6 +51,8 @@ All Classes
InventoryMessage
+IrcDiscovery +
MemoryBlockStore
Message @@ -61,6 +65,10 @@ All Classes
PeerAddress
+PeerDiscovery +
+PeerDiscoveryException +
ProtocolException
Script @@ -93,6 +101,8 @@ All Classes
Wallet
+Wallet.BalanceType +
WalletEventListener
diff --git a/docs/allclasses-noframe.html b/docs/allclasses-noframe.html index ad6644d7..322a70c7 100644 --- a/docs/allclasses-noframe.html +++ b/docs/allclasses-noframe.html @@ -37,6 +37,8 @@ All Classes
DiskBlockStore
+DnsDiscovery +
ECKey
GetBlocksMessage @@ -49,6 +51,8 @@ All Classes
InventoryMessage
+IrcDiscovery +
MemoryBlockStore
Message @@ -61,6 +65,10 @@ All Classes
PeerAddress
+PeerDiscovery +
+PeerDiscoveryException +
ProtocolException
Script @@ -93,6 +101,8 @@ All Classes
Wallet
+Wallet.BalanceType +
WalletEventListener
diff --git a/docs/com/google/bitcoin/core/Base58.html b/docs/com/google/bitcoin/core/Base58.html index 841b6672..5efbd261 100644 --- a/docs/com/google/bitcoin/core/Base58.html +++ b/docs/com/google/bitcoin/core/Base58.html @@ -150,6 +150,14 @@ A custom form of base58 is used to encode BitCoin addresses. Note that this is n +static byte[] +decodeChecked(java.lang.String input) + +
+          Uses the checksum in the last 4 bytes of the decoded data to verify the rest are correct. + + + static java.math.BigInteger decodeToBigInteger(java.lang.String input) @@ -218,10 +226,13 @@ public static java.lang.String encode(byte[] input)

decode

-public static byte[] decode(java.lang.String input)
+public static byte[] decode(java.lang.String input) + throws AddressFormatException
-
+ +
Throws: +
AddressFormatException

@@ -229,10 +240,30 @@ public static byte[] decode(java.lang.String input)

decodeToBigInteger

-public static java.math.BigInteger decodeToBigInteger(java.lang.String input)
+public static java.math.BigInteger decodeToBigInteger(java.lang.String input) + throws AddressFormatException
+ +
Throws: +
AddressFormatException
+
+
+ +

+decodeChecked

+
+public static byte[] decodeChecked(java.lang.String input)
+                            throws AddressFormatException
+
+
Uses the checksum in the last 4 bytes of the decoded data to verify the rest are correct. The checksum is + removed from the returned data. +

+

+ +
Throws: +
AddressFormatException - if the input is not base 58 or the checksum does not validate.
diff --git a/docs/com/google/bitcoin/core/DiskBlockStore.html b/docs/com/google/bitcoin/core/DiskBlockStore.html index f6191ab1..259b9527 100644 --- a/docs/com/google/bitcoin/core/DiskBlockStore.html +++ b/docs/com/google/bitcoin/core/DiskBlockStore.html @@ -52,7 +52,7 @@ function windowTitle()  PREV CLASS  - NEXT CLASSNEXT CLASS FRAMES    NO FRAMES   @@ -323,7 +323,7 @@ public void setChainHead(  PREV CLASS  - NEXT CLASSNEXT CLASS FRAMES    NO FRAMES   diff --git a/docs/com/google/bitcoin/core/DnsDiscovery.html b/docs/com/google/bitcoin/core/DnsDiscovery.html new file mode 100644 index 00000000..2b9c6ef7 --- /dev/null +++ b/docs/com/google/bitcoin/core/DnsDiscovery.html @@ -0,0 +1,316 @@ + + + + + +DnsDiscovery + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.bitcoin.core +
+Class DnsDiscovery

+
+java.lang.Object
+  extended by com.google.bitcoin.core.DnsDiscovery
+
+
+
All Implemented Interfaces:
PeerDiscovery
+
+
+
+
public class DnsDiscovery
extends java.lang.Object
implements PeerDiscovery
+ + +

+Supports peer discovery through DNS.

+ + This class does not support the testnet as currently there are no DNS servers providing testnet hosts. + If this class is being used for testnet you must specify the hostnames to use.

+ + Failure to resolve individual host names will not cause an Exception to be thrown. + However, if all hosts passed fail to resolve a PeerDiscoveryException will be thrown during getPeers(). +

+ +

+


+ +

+ + + + + + + + + + + + + + +
+Constructor Summary
DnsDiscovery(NetworkParameters netParams) + +
+          Supports finding peers through DNS A records.
DnsDiscovery(java.lang.String[] hostNames, + NetworkParameters netParams) + +
+          Supports finding peers through DNS A records.
+  + + + + + + + + + + + + + + + +
+Method Summary
+static java.lang.String[]getDefaultHostNames() + +
+          Returns the well known discovery host names on the production network.
+ java.net.InetSocketAddress[]getPeers() + +
+          Returns an array of addresses.
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

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

+DnsDiscovery

+
+public DnsDiscovery(NetworkParameters netParams)
+
+
Supports finding peers through DNS A records. Community run DNS entry points will be used. +

+

+
Parameters:
netParams - Network parameters to be used for port information.
+
+
+ +

+DnsDiscovery

+
+public DnsDiscovery(java.lang.String[] hostNames,
+                    NetworkParameters netParams)
+
+
Supports finding peers through DNS A records. +

+

+
Parameters:
hostNames - Host names to be examined for seed addresses.
netParams - Network parameters to be used for port information.
+
+ + + + + + + + +
+Method Detail
+ +

+getPeers

+
+public java.net.InetSocketAddress[] getPeers()
+                                      throws PeerDiscoveryException
+
+
Description copied from interface: PeerDiscovery
+
Returns an array of addresses. This method may block. +

+

+
Specified by:
getPeers in interface PeerDiscovery
+
+
+ +
Throws: +
PeerDiscoveryException
+
+
+
+ +

+getDefaultHostNames

+
+public static java.lang.String[] getDefaultHostNames()
+
+
Returns the well known discovery host names on the production network. +

+

+
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/com/google/bitcoin/core/ECKey.html b/docs/com/google/bitcoin/core/ECKey.html index b21e24f1..87bbd9ed 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   @@ -448,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 f6515d0f..e2038ac1 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/IrcDiscovery.html b/docs/com/google/bitcoin/core/IrcDiscovery.html new file mode 100644 index 00000000..ceffa9fc --- /dev/null +++ b/docs/com/google/bitcoin/core/IrcDiscovery.html @@ -0,0 +1,337 @@ + + + + + +IrcDiscovery + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.bitcoin.core +
+Class IrcDiscovery

+
+java.lang.Object
+  extended by com.google.bitcoin.core.IrcDiscovery
+
+
+
All Implemented Interfaces:
PeerDiscovery
+
+
+
+
public class IrcDiscovery
extends java.lang.Object
implements PeerDiscovery
+ + +

+IrcDiscovery provides a way to find network peers by joining a pre-agreed rendevouz point on the LFnet IRC network. +

+ +

+


+ +

+ + + + + + + + + + + + + + +
+Constructor Summary
IrcDiscovery(java.lang.String channel) + +
+          Finds a list of peers by connecting to an IRC network, joining a channel, decoding the nicks and then + disconnecting.
IrcDiscovery(java.lang.String channel, + java.lang.String server, + int port) + +
+          Finds a list of peers by connecting to an IRC network, joining a channel, decoding the nicks and then + disconnecting.
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ java.net.InetSocketAddress[]getPeers() + +
+          Returns a list of peers that were found in the IRC channel.
+protected  voidonIRCReceive(java.lang.String message) + +
+           
+protected  voidonIRCSend(java.lang.String message) + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

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

+IrcDiscovery

+
+public IrcDiscovery(java.lang.String channel)
+
+
Finds a list of peers by connecting to an IRC network, joining a channel, decoding the nicks and then + disconnecting. +

+

+
Parameters:
channel - The IRC channel to join, either "#bitcoin" or "#bitcoinTEST" for the production and test networks + respectively.
+
+
+ +

+IrcDiscovery

+
+public IrcDiscovery(java.lang.String channel,
+                    java.lang.String server,
+                    int port)
+
+
Finds a list of peers by connecting to an IRC network, joining a channel, decoding the nicks and then + disconnecting. +

+

+
Parameters:
server - Name or textual IP address of the IRC server to join.
channel - The IRC channel to join, either "#bitcoin" or "#bitcoinTEST" for the production and test networks
+
+ + + + + + + + +
+Method Detail
+ +

+onIRCSend

+
+protected void onIRCSend(java.lang.String message)
+
+
+
+
+
+
+
+
+
+ +

+onIRCReceive

+
+protected void onIRCReceive(java.lang.String message)
+
+
+
+
+
+
+
+
+
+ +

+getPeers

+
+public java.net.InetSocketAddress[] getPeers()
+                                      throws PeerDiscoveryException
+
+
Returns a list of peers that were found in the IRC channel. Note that just because a peer appears in the list + does not mean it is accepting connections. +

+

+
Specified by:
getPeers in interface PeerDiscovery
+
+
+ +
Throws: +
PeerDiscoveryException
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/com/google/bitcoin/core/MemoryBlockStore.html b/docs/com/google/bitcoin/core/MemoryBlockStore.html index a046ec0a..56d52e06 100644 --- a/docs/com/google/bitcoin/core/MemoryBlockStore.html +++ b/docs/com/google/bitcoin/core/MemoryBlockStore.html @@ -51,7 +51,7 @@ function windowTitle() PREV CLASS  + PREV CLASS   NEXT CLASS FRAMES   @@ -311,7 +311,7 @@ public void setChainHead(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 4ae69de4..77e3b914 100644 --- a/docs/com/google/bitcoin/core/NetworkConnection.html +++ b/docs/com/google/bitcoin/core/NetworkConnection.html @@ -119,9 +119,10 @@ A NetworkConnection handles talking to a remote BitCoin peer at a low level. It Constructor Summary -NetworkConnection(java.net.InetAddress remoteIp, +NetworkConnection(java.net.InetAddress remoteIp, NetworkParameters params, - int bestHeight) + int bestHeight, + int connectTimeout)
          Connect to the given IP address using the port specified as part of the network parameters. @@ -208,12 +209,13 @@ A NetworkConnection handles talking to a remote BitCoin peer at a low level. It -

+

NetworkConnection

 public NetworkConnection(java.net.InetAddress remoteIp,
                          NetworkParameters params,
-                         int bestHeight)
+                         int bestHeight,
+                         int connectTimeout)
                   throws java.io.IOException,
                          ProtocolException
@@ -221,7 +223,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.
bestHeight - How many blocks are in our best chain +
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
connectTimeout - Timeout in milliseconds when initially connecting to peer
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 8e6171f6..715210cd 100644 --- a/docs/com/google/bitcoin/core/PeerAddress.html +++ b/docs/com/google/bitcoin/core/PeerAddress.html @@ -52,7 +52,7 @@ function windowTitle()  PREV CLASS  - NEXT CLASSNEXT CLASS
FRAMES    NO FRAMES   @@ -335,7 +335,7 @@ public java.lang.String toString()  PREV CLASS  - NEXT CLASSNEXT CLASS FRAMES    NO FRAMES   diff --git a/docs/com/google/bitcoin/core/PeerDiscovery.html b/docs/com/google/bitcoin/core/PeerDiscovery.html new file mode 100644 index 00000000..65d31d18 --- /dev/null +++ b/docs/com/google/bitcoin/core/PeerDiscovery.html @@ -0,0 +1,213 @@ + + + + + +PeerDiscovery + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.bitcoin.core +
+Interface PeerDiscovery

+
+
All Known Implementing Classes:
DnsDiscovery, IrcDiscovery
+
+
+
+
public interface PeerDiscovery
+ + +

+A PeerDiscovery object is responsible for finding addresses of other nodes in the BitCoin P2P network. Note that + the addresses returned may or may not be accepting connections. +

+ +

+


+ +

+ + + + + + + + + + + + +
+Method Summary
+ java.net.InetSocketAddress[]getPeers() + +
+          Returns an array of addresses.
+  +

+ + + + + + + + +
+Method Detail
+ +

+getPeers

+
+java.net.InetSocketAddress[] getPeers()
+                                      throws PeerDiscoveryException
+
+
Returns an array of addresses. This method may block. +

+

+ +
Throws: +
PeerDiscoveryException
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/com/google/bitcoin/core/PeerDiscoveryException.html b/docs/com/google/bitcoin/core/PeerDiscoveryException.html new file mode 100644 index 00000000..702cbdde --- /dev/null +++ b/docs/com/google/bitcoin/core/PeerDiscoveryException.html @@ -0,0 +1,278 @@ + + + + + +PeerDiscoveryException + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.bitcoin.core +
+Class PeerDiscoveryException

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

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + + + + + + + + + + +
+Constructor Summary
PeerDiscoveryException() + +
+           
PeerDiscoveryException(java.lang.String message) + +
+           
PeerDiscoveryException(java.lang.String message, + java.lang.Throwable arg0) + +
+           
PeerDiscoveryException(java.lang.Throwable arg0) + +
+           
+  + + + + + + + +
+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
+ +

+PeerDiscoveryException

+
+public PeerDiscoveryException()
+
+
+
+ +

+PeerDiscoveryException

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

+PeerDiscoveryException

+
+public PeerDiscoveryException(java.lang.Throwable arg0)
+
+
+
+ +

+PeerDiscoveryException

+
+public PeerDiscoveryException(java.lang.String message,
+                              java.lang.Throwable arg0)
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/com/google/bitcoin/core/ProtocolException.html b/docs/com/google/bitcoin/core/ProtocolException.html index c87c6166..ba0d0a93 100644 --- a/docs/com/google/bitcoin/core/ProtocolException.html +++ b/docs/com/google/bitcoin/core/ProtocolException.html @@ -51,7 +51,7 @@ function windowTitle() PREV CLASS  + PREV CLASS   NEXT CLASS FRAMES   @@ -229,7 +229,7 @@ public ProtocolException(java.lang.String msg, 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 2fd74e85..5fc27df6 100644 --- a/docs/com/google/bitcoin/core/Utils.html +++ b/docs/com/google/bitcoin/core/Utils.html @@ -213,6 +213,15 @@ A collection of various utility methods that are helpful for working with the Bi +static int +readUint16BE(byte[] bytes, + int offset) + +
+            + + + static long readUint32(byte[] bytes, int offset) @@ -580,6 +589,18 @@ public static long readUint32BE(byte[] bytes,

+

+readUint16BE

+
+public static int readUint16BE(byte[] bytes,
+                               int offset)
+
+
+
+
+
+
+

sha256hash160

diff --git a/docs/com/google/bitcoin/core/Wallet.BalanceType.html b/docs/com/google/bitcoin/core/Wallet.BalanceType.html
new file mode 100644
index 00000000..c92f65eb
--- /dev/null
+++ b/docs/com/google/bitcoin/core/Wallet.BalanceType.html
@@ -0,0 +1,335 @@
+
+
+
+
+
+Wallet.BalanceType
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.bitcoin.core +
+Enum Wallet.BalanceType

+
+java.lang.Object
+  extended by java.lang.Enum<Wallet.BalanceType>
+      extended by com.google.bitcoin.core.Wallet.BalanceType
+
+
+
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Wallet.BalanceType>
+
+
+
Enclosing class:
Wallet
+
+
+
+
public static enum Wallet.BalanceType
extends java.lang.Enum<Wallet.BalanceType>
+
+ +

+It's possible to calculate a wallets balance from multiple points of view. This enum selects which + getBalance() should use.

+ + Consider a real-world example: you buy a snack costing $5 but you only have a $10 bill. At the start you have + $10 viewed from every possible angle. After you order the snack you hand over your $10 bill. From the + perspective of your wallet you have zero dollars (AVAILABLE). But you know in a few seconds the shopkeeper + will give you back $5 change so most people in practice would say they have $5 (ESTIMATED).

+

+ +

+


+ +

+ + + + + + + + + + + + + +
+Enum Constant Summary
AVAILABLE + +
+          Balance that can be safely used to create new spends.
ESTIMATED + +
+          Balance calculated assuming all pending transactions are in fact included into the best chain by miners.
+  + + + + + + + + + + + + + + + +
+Method Summary
+static Wallet.BalanceTypevalueOf(java.lang.String name) + +
+          Returns the enum constant of this type with the specified name.
+static Wallet.BalanceType[]values() + +
+          Returns an array containing the constants of this enum type, in +the order they are declared.
+ + + + + + + +
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
+ + + + + + + +
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Enum Constant Detail
+ +

+ESTIMATED

+
+public static final Wallet.BalanceType ESTIMATED
+
+
Balance calculated assuming all pending transactions are in fact included into the best chain by miners. + This is the right balance to show in user interfaces. +

+

+
+
+
+ +

+AVAILABLE

+
+public static final Wallet.BalanceType AVAILABLE
+
+
Balance that can be safely used to create new spends. This is all confirmed unspent outputs minus the ones + spent by pending transactions, but not including the outputs of those pending transactions. +

+

+
+
+ + + + + + + + +
+Method Detail
+ +

+values

+
+public static Wallet.BalanceType[] values()
+
+
Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
+for (Wallet.BalanceType c : Wallet.BalanceType.values())
+    System.out.println(c);
+
+

+

+ +
Returns:
an array containing the constants of this enum type, in +the order they are declared
+
+
+
+ +

+valueOf

+
+public static Wallet.BalanceType valueOf(java.lang.String name)
+
+
Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.) +

+

+
Parameters:
name - the name of the enum constant to be returned. +
Returns:
the enum constant with the specified name +
Throws: +
java.lang.IllegalArgumentException - if this enum type has no constant +with the specified name +
java.lang.NullPointerException - if the argument is null
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/docs/com/google/bitcoin/core/Wallet.html b/docs/com/google/bitcoin/core/Wallet.html index e9f63477..3338680b 100644 --- a/docs/com/google/bitcoin/core/Wallet.html +++ b/docs/com/google/bitcoin/core/Wallet.html @@ -52,7 +52,7 @@ function windowTitle()  PREV CLASS  - NEXT CLASSNEXT CLASS
FRAMES    NO FRAMES   @@ -72,7 +72,7 @@ function windowTitle() - SUMMARY: NESTED | FIELD | CONSTR | METHOD + SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD @@ -101,12 +101,11 @@ java.lang.Object

A Wallet stores keys and a record of transactions that have not yet been spent. Thus, it is capable of - providing transactions on demand that meet a given combined value. Once a transaction - output is used, it is removed from the wallet as it is no longer available for spending.

+ providing transactions on demand that meet a given combined value.

- The Wallet is read and written from disk, so be sure to follow the Java serialization - versioning rules here. We use the built in Java serialization to avoid the need to - pull in a potentially large (code-size) third party serialization library.

+ The Wallet is read and written from disk, so be sure to follow the Java serialization versioning rules here. We + use the built in Java serialization to avoid the need to pull in a potentially large (code-size) third party + serialization library.

@@ -115,7 +114,24 @@ A Wallet stores keys and a record of transactions that have not yet been spent.


- + + + + + + + + + + + +
+Nested Class Summary
+static classWallet.BalanceType + +
+          It's possible to calculate a wallets balance from multiple points of view.
@@ -195,7 +211,15 @@ A Wallet stores keys and a record of transactions that have not yet been spent. +          Returns the AVAILABLE balance of this wallet. + + + + + NEXT CLASS + SUMMARY: NESTED | FIELD | CONSTR | METHOD diff --git a/docs/com/google/bitcoin/core/WalletEventListener.html b/docs/com/google/bitcoin/core/WalletEventListener.html index b1c2408e..bd29da15 100644 --- a/docs/com/google/bitcoin/core/WalletEventListener.html +++ b/docs/com/google/bitcoin/core/WalletEventListener.html @@ -51,7 +51,7 @@ function windowTitle() + + + + +BlockStore +
+PeerDiscovery
getBalance()
-          Returns the balance of this wallet by summing up all unspent outputs that were sent to us.
+ java.math.BigIntegergetBalance(Wallet.BalanceType balanceType) + +
+          Returns the balance of this wallet as calculated by the provided balanceType.
@@ -515,7 +539,28 @@ getBalance
 public java.math.BigInteger getBalance()
-
Returns the balance of this wallet by summing up all unspent outputs that were sent to us. +
Returns the AVAILABLE balance of this wallet. See Wallet.BalanceType.AVAILABLE for details on what this + means.

+ + Note: the estimated balance is usually the one you want to show to the end user - however attempting to + actually spend these coins may result in temporary failure. This method returns how much you can safely + provide to createSend(Address, java.math.BigInteger). +

+

+
+
+
+
+
+
+
+ +

+getBalance

+
+public java.math.BigInteger getBalance(Wallet.BalanceType balanceType)
+
+
Returns the balance of this wallet as calculated by the provided balanceType.

@@ -584,7 +629,7 @@ public java.util.Collection<  PREV CLASS  - NEXT CLASS
 voidonDeadTransaction(Transaction deadTx, + Transaction replacementTx) + +
+          This is called on a Peer thread when a transaction becomes dead.
+ void onReorganize()
@@ -229,6 +238,26 @@ public void onReorganize() +
+ +

+onDeadTransaction

+
+public void onDeadTransaction(Transaction deadTx,
+                              Transaction replacementTx)
+
+
This is called on a Peer thread when a transaction becomes dead. A dead transaction is one that has + been overridden by a double spend from the network and so will never confirm no matter how long you wait.

+ + A dead transaction can occur if somebody is attacking the network, or by accident if keys are being shared. + You can use this event handler to inform the user of the situation. A dead spend will show up in the BitCoin + C++ client of the recipient as 0/unconfirmed forever, so if it was used to purchase something, + the user needs to know their goods will never arrive. +

+

+
Parameters:
deadTx - The transaction that is newly dead.
replacementTx - The transaction that killed it.
+
+

@@ -258,7 +287,7 @@ public void onReorganize()
@@ -44,6 +46,8 @@ Classes
 
DiskBlockStore
+DnsDiscovery +
ECKey
GetBlocksMessage @@ -54,6 +58,8 @@ Classes 
InventoryMessage
+IrcDiscovery +
MemoryBlockStore
Message @@ -103,7 +109,9 @@ Enums 
InventoryItem.Type
-Transaction.SigHash +Transaction.SigHash +
+Wallet.BalanceType @@ -118,6 +126,8 @@ Exceptions 
BlockStoreException
+PeerDiscoveryException +
ProtocolException
ScriptException diff --git a/docs/com/google/bitcoin/core/package-summary.html b/docs/com/google/bitcoin/core/package-summary.html index b0c37870..ffcb4773 100644 --- a/docs/com/google/bitcoin/core/package-summary.html +++ b/docs/com/google/bitcoin/core/package-summary.html @@ -88,6 +88,10 @@ Package com.google.bitcoin.core BlockStore An implementor of BlockStore saves StoredBlock objects to disk. + +PeerDiscovery +A PeerDiscovery object is responsible for finding addresses of other nodes in the BitCoin P2P network. +   @@ -124,6 +128,10 @@ Package com.google.bitcoin.core Stores the block chain to disk but still holds it in memory. +DnsDiscovery +Supports peer discovery through DNS. + + ECKey Represents an elliptic curve keypair that we own and can use for signing transactions. @@ -144,6 +152,10 @@ Package com.google.bitcoin.core   +IrcDiscovery +IrcDiscovery provides a way to find network peers by joining a pre-agreed rendevouz point on the LFnet IRC network. + + MemoryBlockStore Keeps StoredBlocks in memory. @@ -243,6 +255,10 @@ Package com.google.bitcoin.core Transaction.SigHash These constants are a part of a scriptSig signature on the inputs. + +Wallet.BalanceType +It's possible to calculate a wallets balance from multiple points of view. +   @@ -262,6 +278,10 @@ Package com.google.bitcoin.core Thrown when something goes wrong with storing a block. +PeerDiscoveryException +  + + ProtocolException   diff --git a/docs/com/google/bitcoin/core/package-tree.html b/docs/com/google/bitcoin/core/package-tree.html index 51341593..a1580859 100644 --- a/docs/com/google/bitcoin/core/package-tree.html +++ b/docs/com/google/bitcoin/core/package-tree.html @@ -86,8 +86,10 @@ Class Hierarchy

Enum Hierarchy

@@ -118,7 +120,7 @@ Enum Hierarchy
  • java.lang.Object
    diff --git a/docs/index-all.html b/docs/index-all.html index bd67f7cd..48a163fa 100644 --- a/docs/index-all.html +++ b/docs/index-all.html @@ -208,6 +208,9 @@ Variable in class com.google.bitcoin.core.decode(String) - Static method in class com.google.bitcoin.core.Base58
      +
    decodeChecked(String) - +Static method in class com.google.bitcoin.core.Base58 +
    Uses the checksum in the last 4 bytes of the decoded data to verify the rest are correct.
    decodeToBigInteger(String) - Static method in class com.google.bitcoin.core.Base58
      @@ -217,6 +220,12 @@ Method in class com.google.bitcoin.core.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
      +
    DnsDiscovery - Class in com.google.bitcoin.core
    Supports peer discovery through DNS.
    DnsDiscovery(NetworkParameters) - +Constructor for class com.google.bitcoin.core.DnsDiscovery +
    Supports finding peers through DNS A records. +
    DnsDiscovery(String[], NetworkParameters) - +Constructor for class com.google.bitcoin.core.DnsDiscovery +
    Supports finding peers through DNS A records.
    doubleDigest(byte[]) - Static method in class com.google.bitcoin.core.Utils
    See Utils.doubleDigest(byte[],int,int). @@ -297,7 +306,10 @@ Method in class com.google.bitcoin.core.getBalance() - Method in class com.google.bitcoin.core.Wallet -
    Returns the balance of this wallet by summing up all unspent outputs that were sent to us. +
    Returns the AVAILABLE balance of this wallet. +
    getBalance(Wallet.BalanceType) - +Method in class com.google.bitcoin.core.Wallet +
    Returns the balance of this wallet as calculated by the provided balanceType.
    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. @@ -322,6 +334,9 @@ Method in class com.google.bitcoin.core.GetDataMessage - Class in com.google.bitcoin.core
     
    GetDataMessage(NetworkParameters, byte[]) - Constructor for class com.google.bitcoin.core.GetDataMessage
      +
    getDefaultHostNames() - +Static method in class com.google.bitcoin.core.DnsDiscovery +
    Returns the well known discovery host names on the production network.
    getDifficultyTarget() - Method in class com.google.bitcoin.core.Block
    Returns the difficulty of the proof of work that this block should meet encoded in compact form. @@ -366,6 +381,15 @@ 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. +
    getPeers() - +Method in class com.google.bitcoin.core.DnsDiscovery +
      +
    getPeers() - +Method in class com.google.bitcoin.core.IrcDiscovery +
    Returns a list of peers that were found in the IRC channel. +
    getPeers() - +Method in interface com.google.bitcoin.core.PeerDiscovery +
    Returns an array of addresses.
    getPendingTransactions() - Method in class com.google.bitcoin.core.Wallet
    Returns an immutable view of the transactions currently waiting for network confirmations. @@ -477,6 +501,14 @@ Constructor for class com.google.bitcoin.core.InventoryMessage(NetworkParameters) - Constructor for class com.google.bitcoin.core.InventoryMessage
      +
    IrcDiscovery - Class in com.google.bitcoin.core
    IrcDiscovery provides a way to find network peers by joining a pre-agreed rendevouz point on the LFnet IRC network.
    IrcDiscovery(String) - +Constructor for class com.google.bitcoin.core.IrcDiscovery +
    Finds a list of peers by connecting to an IRC network, joining a channel, decoding the nicks and then + disconnecting. +
    IrcDiscovery(String, String, int) - +Constructor for class com.google.bitcoin.core.IrcDiscovery +
    Finds a list of peers by connecting to an IRC network, joining a channel, decoding the nicks and then + disconnecting.
    isCoinBase() - Method in class com.google.bitcoin.core.Transaction
    A coinbase transaction is one that creates a new coin. @@ -558,7 +590,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, int) - +
    NetworkConnection - Class in com.google.bitcoin.core
    A NetworkConnection handles talking to a remote BitCoin peer at a low level.
    NetworkConnection(InetAddress, NetworkParameters, int, 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() - @@ -578,6 +610,15 @@ Variable in class com.google.bitcoin.core.onCoinsReceived(Wallet, Transaction, BigInteger, BigInteger) - Method in class com.google.bitcoin.core.WalletEventListener
    This is called on a Peer thread when a block is received that sends some coins to you. +
    onDeadTransaction(Transaction, Transaction) - +Method in class com.google.bitcoin.core.WalletEventListener +
    This is called on a Peer thread when a transaction becomes dead. +
    onIRCReceive(String) - +Method in class com.google.bitcoin.core.IrcDiscovery +
      +
    onIRCSend(String) - +Method in class com.google.bitcoin.core.IrcDiscovery +
     
    onReorganize() - Method in class com.google.bitcoin.core.WalletEventListener
    This is called on a Peer thread when a block is received that triggers a block chain re-organization. @@ -644,6 +685,18 @@ Constructor for class com.google.bitcoin.core.PeerAddress(InetAddress, int, int) - Constructor for class com.google.bitcoin.core.PeerAddress
      +
    PeerDiscovery - Interface in com.google.bitcoin.core
    A PeerDiscovery object is responsible for finding addresses of other nodes in the BitCoin P2P network.
    PeerDiscoveryException - Exception in com.google.bitcoin.core
     
    PeerDiscoveryException() - +Constructor for exception com.google.bitcoin.core.PeerDiscoveryException +
      +
    PeerDiscoveryException(String) - +Constructor for exception com.google.bitcoin.core.PeerDiscoveryException +
      +
    PeerDiscoveryException(Throwable) - +Constructor for exception com.google.bitcoin.core.PeerDiscoveryException +
      +
    PeerDiscoveryException(String, Throwable) - +Constructor for exception com.google.bitcoin.core.PeerDiscoveryException +
     
    ping() - Method in class com.google.bitcoin.core.NetworkConnection
    Sends a "ping" message to the remote node. @@ -688,6 +741,9 @@ Method in class com.google.bitcoin.core.readMessage() - Method in class com.google.bitcoin.core.NetworkConnection
    Reads a network message from the wire, blocking until the message is fully received. +
    readUint16BE(byte[], int) - +Static method in class com.google.bitcoin.core.Utils +
     
    readUint32(byte[], int) - Static method in class com.google.bitcoin.core.Utils
      @@ -895,6 +951,9 @@ Static method in enum com.google.bitcoin.core.valueOf(String) - Static method in enum com.google.bitcoin.core.Transaction.SigHash
    Returns the enum constant of this type with the specified name. +
    valueOf(String) - +Static method in enum com.google.bitcoin.core.Wallet.BalanceType +
    Returns the enum constant of this type with the specified name.
    values() - Static method in enum com.google.bitcoin.core.InventoryItem.Type
    Returns an array containing the constants of this enum type, in @@ -903,6 +962,10 @@ the order they are declared. Static method in enum com.google.bitcoin.core.Transaction.SigHash
    Returns an array containing the constants of this enum type, in the order they are declared. +
    values() - +Static method in enum com.google.bitcoin.core.Wallet.BalanceType +
    Returns an array containing the constants of this enum type, in +the order they are declared.
    VarInt - Class in com.google.bitcoin.core
     
    VarInt(long) - Constructor for class com.google.bitcoin.core.VarInt
      @@ -942,7 +1005,7 @@ Variable in class com.google.bitcoin.core.Wallet - Class in com.google.bitcoin.core
    A Wallet stores keys and a record of transactions that have not yet been spent.
    Wallet(NetworkParameters) - Constructor for class com.google.bitcoin.core.Wallet
    Creates a new, empty wallet with no keys and no transactions. -
    WalletEventListener - Class in com.google.bitcoin.core
    Implementing a subclass WalletEventListener allows you to learn when the contents of the wallet changes due to +
    Wallet.BalanceType - Enum in com.google.bitcoin.core
    It's possible to calculate a wallets balance from multiple points of view.
    WalletEventListener - Class in com.google.bitcoin.core
    Implementing a subclass WalletEventListener allows you to learn when the contents of the wallet changes due to receiving money or a block chain re-organize.
    WalletEventListener() - Constructor for class com.google.bitcoin.core.WalletEventListener
      diff --git a/docs/overview-tree.html b/docs/overview-tree.html index a7e75260..4a1a0291 100644 --- a/docs/overview-tree.html +++ b/docs/overview-tree.html @@ -88,8 +88,10 @@ Class Hierarchy

    Enum Hierarchy

    @@ -120,7 +122,7 @@ Enum Hierarchy
  • java.lang.Object
    diff --git a/docs/serialized-form.html b/docs/serialized-form.html index 9433319c..061dc27e 100644 --- a/docs/serialized-form.html +++ b/docs/serialized-form.html @@ -543,6 +543,20 @@ long time
  • +

    + + + + + +
    +Class com.google.bitcoin.core.PeerDiscoveryException extends java.lang.Exception implements Serializable
    + +

    +serialVersionUID: -2863411151549391392L + +

    +

    @@ -716,7 +730,7 @@ java.util.Set<E> appearsIn

    -serialVersionUID: -7687665228438202968L +serialVersionUID: 2L

    @@ -846,9 +860,18 @@ byte[] scriptBytes


    -isSpent

    +availableForSpending
    -boolean isSpent
    +boolean availableForSpending +
    +
    +
    +
    +
    +

    +spentBy

    +
    +TransactionInput spentBy
    @@ -1052,7 +1075,8 @@ pending
     java.util.Map<K,V> pending
    -
    Map of txhash->Transactions that have not made it into the best chain yet. These transactions inputs count as +
    Map of txhash->Transactions that have not made it into the best chain yet. They are eligible to move there but + are waiting for a miner to send a block on the best chain including them. 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!

    @@ -1113,6 +1137,20 @@ java.util.Map<K,V> inactive


    +dead

    +
    +java.util.Map<K,V> dead
    +
    +
    A dead transaction is one that's been overridden by a double spend. Such a transaction is pending except it + will never confirm and so should be presented to the user in some unique way - flashing red for example. This + should nearly never happen in normal usage. Dead transactions can be "resurrected" by re-orgs just like any + other. Dead transactions are not in the pending pool. +

    +

    +
    +
    +
    +

    keychain

     java.util.ArrayList<E> keychain