+
+ 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().
+
+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.
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.
+
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,
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.
+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.
+
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
+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.
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.
+
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.
+
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
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
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 class
+
Wallet.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.
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.
+
+
+
+ java.math.BigInteger
+
getBalance(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).
+
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.
+
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
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
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.
+
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
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
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.
+
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.
+
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.
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!
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.
+