├── .gitattributes
├── .gitignore
├── .travis.yml
├── AUTHORS
├── COPYING
├── README.md
├── core
├── findbugs.xml
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── org
│ │ │ ├── bitcoin
│ │ │ ├── NativeSecp256k1.java
│ │ │ ├── NativeSecp256k1Util.java
│ │ │ ├── Secp256k1Context.java
│ │ │ ├── crawler
│ │ │ │ └── PeerSeedProtos.java
│ │ │ ├── paymentchannel
│ │ │ │ └── Protos.java
│ │ │ └── protocols
│ │ │ │ └── payments
│ │ │ │ └── Protos.java
│ │ │ └── bitcoinj
│ │ │ ├── core
│ │ │ ├── AbstractBlockChain.java
│ │ │ ├── Address.java
│ │ │ ├── AddressFactory.java
│ │ │ ├── AddressFormatException.java
│ │ │ ├── AddressMessage.java
│ │ │ ├── AlertMessage.java
│ │ │ ├── Base58.java
│ │ │ ├── BitcoinSerializer.java
│ │ │ ├── Block.java
│ │ │ ├── BlockChain.java
│ │ │ ├── BloomFilter.java
│ │ │ ├── CashAddress.java
│ │ │ ├── CashAddressFactory.java
│ │ │ ├── CashAddressHelper.java
│ │ │ ├── CashAddressValidator.java
│ │ │ ├── CheckpointManager.java
│ │ │ ├── ChildMessage.java
│ │ │ ├── Coin.java
│ │ │ ├── Context.java
│ │ │ ├── DummySerializer.java
│ │ │ ├── DumpedPrivateKey.java
│ │ │ ├── ECKey.java
│ │ │ ├── EmptyMessage.java
│ │ │ ├── FilteredBlock.java
│ │ │ ├── FullPrunedBlockChain.java
│ │ │ ├── GetAddrMessage.java
│ │ │ ├── GetBlocksMessage.java
│ │ │ ├── GetDataMessage.java
│ │ │ ├── GetHeadersMessage.java
│ │ │ ├── GetUTXOsMessage.java
│ │ │ ├── HeadersMessage.java
│ │ │ ├── InsufficientMoneyException.java
│ │ │ ├── InventoryItem.java
│ │ │ ├── InventoryMessage.java
│ │ │ ├── ListMessage.java
│ │ │ ├── MemoryPoolMessage.java
│ │ │ ├── Message.java
│ │ │ ├── MessageSerializer.java
│ │ │ ├── Monetary.java
│ │ │ ├── NetworkParameters.java
│ │ │ ├── NotFoundMessage.java
│ │ │ ├── PartialMerkleTree.java
│ │ │ ├── Peer.java
│ │ │ ├── PeerAddress.java
│ │ │ ├── PeerException.java
│ │ │ ├── PeerFilterProvider.java
│ │ │ ├── PeerGroup.java
│ │ │ ├── PeerSocketHandler.java
│ │ │ ├── Ping.java
│ │ │ ├── Pong.java
│ │ │ ├── ProtocolException.java
│ │ │ ├── PrunedException.java
│ │ │ ├── RejectMessage.java
│ │ │ ├── RejectedTransactionException.java
│ │ │ ├── ScriptException.java
│ │ │ ├── Sha256Hash.java
│ │ │ ├── StoredBlock.java
│ │ │ ├── StoredUndoableBlock.java
│ │ │ ├── Transaction.java
│ │ │ ├── TransactionBag.java
│ │ │ ├── TransactionBroadcast.java
│ │ │ ├── TransactionBroadcaster.java
│ │ │ ├── TransactionConfidence.java
│ │ │ ├── TransactionInput.java
│ │ │ ├── TransactionOutPoint.java
│ │ │ ├── TransactionOutput.java
│ │ │ ├── TransactionOutputChanges.java
│ │ │ ├── TxConfidenceTable.java
│ │ │ ├── UTXO.java
│ │ │ ├── UTXOProvider.java
│ │ │ ├── UTXOProviderException.java
│ │ │ ├── UTXOsMessage.java
│ │ │ ├── UnknownMessage.java
│ │ │ ├── UnsafeByteArrayOutputStream.java
│ │ │ ├── Utils.java
│ │ │ ├── VarInt.java
│ │ │ ├── VerificationException.java
│ │ │ ├── VersionAck.java
│ │ │ ├── VersionMessage.java
│ │ │ ├── VersionedChecksummedBytes.java
│ │ │ ├── WrongNetworkException.java
│ │ │ ├── listeners
│ │ │ │ ├── AbstractBlockChainListener.java
│ │ │ │ ├── AbstractPeerConnectionEventListener.java
│ │ │ │ ├── AbstractPeerDataEventListener.java
│ │ │ │ ├── AbstractPeerEventListener.java
│ │ │ │ ├── BlockChainListener.java
│ │ │ │ ├── BlocksDownloadedEventListener.java
│ │ │ │ ├── ChainDownloadStartedEventListener.java
│ │ │ │ ├── DownloadProgressTracker.java
│ │ │ │ ├── FeeFilterMessage.java
│ │ │ │ ├── GetDataEventListener.java
│ │ │ │ ├── NewBestBlockListener.java
│ │ │ │ ├── OnTransactionBroadcastListener.java
│ │ │ │ ├── PeerConnectedEventListener.java
│ │ │ │ ├── PeerConnectionEventListener.java
│ │ │ │ ├── PeerDataEventListener.java
│ │ │ │ ├── PeerDisconnectedEventListener.java
│ │ │ │ ├── PeerDiscoveredEventListener.java
│ │ │ │ ├── PreMessageReceivedEventListener.java
│ │ │ │ ├── ReorganizeListener.java
│ │ │ │ ├── SendHeadersMessage.java
│ │ │ │ ├── TransactionConfidenceEventListener.java
│ │ │ │ └── TransactionReceivedInBlockListener.java
│ │ │ └── package-info.java
│ │ │ ├── crypto
│ │ │ ├── BIP38PrivateKey.java
│ │ │ ├── ChildNumber.java
│ │ │ ├── DRMWorkaround.java
│ │ │ ├── DeterministicHierarchy.java
│ │ │ ├── DeterministicKey.java
│ │ │ ├── EncryptableItem.java
│ │ │ ├── EncryptedData.java
│ │ │ ├── HDDerivationException.java
│ │ │ ├── HDKeyDerivation.java
│ │ │ ├── HDUtils.java
│ │ │ ├── KeyCrypter.java
│ │ │ ├── KeyCrypterException.java
│ │ │ ├── KeyCrypterScrypt.java
│ │ │ ├── LazyECPoint.java
│ │ │ ├── LinuxSecureRandom.java
│ │ │ ├── MnemonicCode.java
│ │ │ ├── MnemonicException.java
│ │ │ ├── PBKDF2SHA512.java
│ │ │ ├── TransactionSignature.java
│ │ │ ├── TrustStoreLoader.java
│ │ │ ├── X509Utils.java
│ │ │ └── package-info.java
│ │ │ ├── jni
│ │ │ ├── NativeBlockChainListener.java
│ │ │ ├── NativeFutureCallback.java
│ │ │ ├── NativeKeyChainEventListener.java
│ │ │ ├── NativePaymentChannelHandlerFactory.java
│ │ │ ├── NativePaymentChannelServerConnectionEventHandler.java
│ │ │ ├── NativePeerEventListener.java
│ │ │ ├── NativeScriptsChangeEventListener.java
│ │ │ ├── NativeTransactionConfidenceEventListener.java
│ │ │ ├── NativeTransactionConfidenceListener.java
│ │ │ ├── NativeWalletChangeEventListener.java
│ │ │ ├── NativeWalletCoinsReceivedEventListener.java
│ │ │ ├── NativeWalletCoinsSentEventListener.java
│ │ │ ├── NativeWalletEventListener.java
│ │ │ └── NativeWalletReorganizeEventListener.java
│ │ │ ├── kits
│ │ │ ├── WalletAppKit.java
│ │ │ └── package-info.java
│ │ │ ├── net
│ │ │ ├── AbstractTimeoutHandler.java
│ │ │ ├── BlockingClient.java
│ │ │ ├── BlockingClientManager.java
│ │ │ ├── ClientConnectionManager.java
│ │ │ ├── ConnectionHandler.java
│ │ │ ├── FilterMerger.java
│ │ │ ├── MessageWriteTarget.java
│ │ │ ├── NioClient.java
│ │ │ ├── NioClientManager.java
│ │ │ ├── NioServer.java
│ │ │ ├── ProtobufConnection.java
│ │ │ ├── StreamConnection.java
│ │ │ ├── StreamConnectionFactory.java
│ │ │ ├── discovery
│ │ │ │ ├── DnsDiscovery.java
│ │ │ │ ├── HttpDiscovery.java
│ │ │ │ ├── MultiplexingDiscovery.java
│ │ │ │ ├── PeerDiscovery.java
│ │ │ │ ├── PeerDiscoveryException.java
│ │ │ │ ├── SeedPeers.java
│ │ │ │ ├── TorDiscovery.java
│ │ │ │ └── package-info.java
│ │ │ └── package-info.java
│ │ │ ├── params
│ │ │ ├── AbstractBitcoinNetParams.java
│ │ │ ├── MainNetParams.java
│ │ │ ├── Networks.java
│ │ │ ├── RegTestParams.java
│ │ │ ├── TestNet2Params.java
│ │ │ ├── TestNet3Params.java
│ │ │ ├── UnitTestParams.java
│ │ │ └── package-info.java
│ │ │ ├── pow
│ │ │ ├── AbstractPowRulesChecker.java
│ │ │ ├── AbstractRuleCheckerFactory.java
│ │ │ ├── RulesPoolChecker.java
│ │ │ ├── factory
│ │ │ │ ├── DAARuleCheckerFactory.java
│ │ │ │ ├── EDARuleCheckerFactory.java
│ │ │ │ └── RuleCheckerFactory.java
│ │ │ └── rule
│ │ │ │ ├── DifficultyTransitionPointRuleChecker.java
│ │ │ │ ├── EmergencyDifficultyAdjustmentRuleChecker.java
│ │ │ │ ├── LastNonMinimalDifficultyRuleChecker.java
│ │ │ │ ├── MinimalDifficultyNoChangedRuleChecker.java
│ │ │ │ ├── MinimalDifficultyRuleChecker.java
│ │ │ │ ├── NewDifficultyAdjustmentAlgorithmRulesChecker.java
│ │ │ │ └── RegTestRuleChecker.java
│ │ │ ├── protocols
│ │ │ ├── channels
│ │ │ │ ├── ClientState.java
│ │ │ │ ├── IPaymentChannelClient.java
│ │ │ │ ├── PaymentChannelClient.java
│ │ │ │ ├── PaymentChannelClientConnection.java
│ │ │ │ ├── PaymentChannelClientState.java
│ │ │ │ ├── PaymentChannelCloseException.java
│ │ │ │ ├── PaymentChannelServer.java
│ │ │ │ ├── PaymentChannelServerListener.java
│ │ │ │ ├── PaymentChannelServerState.java
│ │ │ │ ├── PaymentChannelV1ClientState.java
│ │ │ │ ├── PaymentChannelV1ServerState.java
│ │ │ │ ├── PaymentChannelV2ClientState.java
│ │ │ │ ├── PaymentChannelV2ServerState.java
│ │ │ │ ├── PaymentIncrementAck.java
│ │ │ │ ├── ServerConnectionEventHandler.java
│ │ │ │ ├── ServerState.java
│ │ │ │ ├── Simple channels protocol.txt
│ │ │ │ ├── StateMachine.java
│ │ │ │ ├── StoredPaymentChannelClientStates.java
│ │ │ │ ├── StoredPaymentChannelServerStates.java
│ │ │ │ ├── StoredServerChannel.java
│ │ │ │ ├── ValueOutOfRangeException.java
│ │ │ │ └── package-info.java
│ │ │ ├── package-info.java
│ │ │ └── payments
│ │ │ │ ├── PaymentProtocol.java
│ │ │ │ ├── PaymentProtocolException.java
│ │ │ │ ├── PaymentSession.java
│ │ │ │ └── package-info.java
│ │ │ ├── script
│ │ │ ├── Script.java
│ │ │ ├── ScriptBuilder.java
│ │ │ ├── ScriptChunk.java
│ │ │ ├── ScriptOpCodes.java
│ │ │ ├── ScriptStateListener.java
│ │ │ ├── TextScriptParser.java
│ │ │ └── package-info.java
│ │ │ ├── signers
│ │ │ ├── CustomTransactionSigner.java
│ │ │ ├── LocalTransactionSigner.java
│ │ │ ├── MissingSigResolutionSigner.java
│ │ │ ├── StatelessTransactionSigner.java
│ │ │ ├── TransactionSigner.java
│ │ │ └── package-info.java
│ │ │ ├── store
│ │ │ ├── BlockStore.java
│ │ │ ├── BlockStoreException.java
│ │ │ ├── ChainFileLockedException.java
│ │ │ ├── DatabaseFullPrunedBlockStore.java
│ │ │ ├── FullPrunedBlockStore.java
│ │ │ ├── H2FullPrunedBlockStore.java
│ │ │ ├── LevelDBBlockStore.java
│ │ │ ├── LevelDBFullPrunedBlockStore.java
│ │ │ ├── MemoryBlockStore.java
│ │ │ ├── MemoryFullPrunedBlockStore.java
│ │ │ ├── MySQLFullPrunedBlockStore.java
│ │ │ ├── PostgresFullPrunedBlockStore.java
│ │ │ ├── SPVBlockStore.java
│ │ │ ├── WindowsMMapHack.java
│ │ │ └── package-info.java
│ │ │ ├── uri
│ │ │ ├── BitcoinURI.java
│ │ │ ├── BitcoinURIParseException.java
│ │ │ ├── OptionalFieldValidationException.java
│ │ │ ├── RequiredFieldValidationException.java
│ │ │ └── package-info.java
│ │ │ ├── utils
│ │ │ ├── BaseTaggableObject.java
│ │ │ ├── BlockFileLoader.java
│ │ │ ├── BriefLogFormatter.java
│ │ │ ├── BtcAutoFormat.java
│ │ │ ├── BtcFixedFormat.java
│ │ │ ├── BtcFormat.java
│ │ │ ├── ContextPropagatingThreadFactory.java
│ │ │ ├── DaemonThreadFactory.java
│ │ │ ├── ExchangeRate.java
│ │ │ ├── ExponentialBackoff.java
│ │ │ ├── Fiat.java
│ │ │ ├── ListenerRegistration.java
│ │ │ ├── MonetaryFormat.java
│ │ │ ├── TaggableObject.java
│ │ │ ├── Threading.java
│ │ │ ├── VersionTally.java
│ │ │ └── package-info.java
│ │ │ └── wallet
│ │ │ ├── AllRandomKeysRotating.java
│ │ │ ├── AllowUnconfirmedCoinSelector.java
│ │ │ ├── BasicKeyChain.java
│ │ │ ├── CoinSelection.java
│ │ │ ├── CoinSelector.java
│ │ │ ├── DecryptingKeyBag.java
│ │ │ ├── DefaultCoinSelector.java
│ │ │ ├── DefaultKeyChainFactory.java
│ │ │ ├── DefaultRiskAnalysis.java
│ │ │ ├── DeterministicKeyChain.java
│ │ │ ├── DeterministicSeed.java
│ │ │ ├── DeterministicUpgradeRequiredException.java
│ │ │ ├── DeterministicUpgradeRequiresPassword.java
│ │ │ ├── EncryptableKeyChain.java
│ │ │ ├── FilteringCoinSelector.java
│ │ │ ├── KeyBag.java
│ │ │ ├── KeyChain.java
│ │ │ ├── KeyChainFactory.java
│ │ │ ├── KeyChainGroup.java
│ │ │ ├── KeyTimeCoinSelector.java
│ │ │ ├── MarriedKeyChain.java
│ │ │ ├── Protos.java
│ │ │ ├── RedeemData.java
│ │ │ ├── RiskAnalysis.java
│ │ │ ├── SendRequest.java
│ │ │ ├── UnreadableWalletException.java
│ │ │ ├── Wallet.java
│ │ │ ├── WalletExtension.java
│ │ │ ├── WalletFiles.java
│ │ │ ├── WalletProtobufSerializer.java
│ │ │ ├── WalletTransaction.java
│ │ │ ├── listeners
│ │ │ ├── AbstractKeyChainEventListener.java
│ │ │ ├── AbstractWalletEventListener.java
│ │ │ ├── KeyChainEventListener.java
│ │ │ ├── ScriptsChangeEventListener.java
│ │ │ ├── WalletChangeEventListener.java
│ │ │ ├── WalletCoinsReceivedEventListener.java
│ │ │ ├── WalletCoinsSentEventListener.java
│ │ │ ├── WalletEventListener.java
│ │ │ └── WalletReorganizeEventListener.java
│ │ │ └── package-info.java
│ └── resources
│ │ ├── org.bitcoin.production.checkpoints.txt
│ │ ├── org.bitcoin.test.checkpoints.txt
│ │ └── org
│ │ └── bitcoinj
│ │ └── crypto
│ │ ├── cacerts
│ │ └── mnemonic
│ │ └── wordlist
│ │ └── english.txt
│ ├── paymentchannel.proto
│ ├── paymentrequest.proto
│ ├── peerseeds.proto
│ ├── storedclientpaymentchannel.proto
│ ├── storedserverpaymentchannel.proto
│ ├── test
│ ├── java
│ │ └── org
│ │ │ └── bitcoinj
│ │ │ ├── core
│ │ │ ├── AbstractFullPrunedBlockChainIT.java
│ │ │ ├── AddressFactoryTest.java
│ │ │ ├── AddressTest.java
│ │ │ ├── AlertMessageTest.java
│ │ │ ├── Base58Test.java
│ │ │ ├── BitcoinSerializerTest.java
│ │ │ ├── BitcoindComparisonTool.java
│ │ │ ├── BlockChainTest.java
│ │ │ ├── BlockTest.java
│ │ │ ├── BloomFilterTest.java
│ │ │ ├── CashAddressTest.java
│ │ │ ├── ChainSplitTest.java
│ │ │ ├── CoinTest.java
│ │ │ ├── DumpedPrivateKeyTest.java
│ │ │ ├── ECKeyTest.java
│ │ │ ├── FilteredBlockAndPartialMerkleTreeTests.java
│ │ │ ├── FullBlockTestGenerator.java
│ │ │ ├── H2FullPrunedBlockChainIT.java
│ │ │ ├── LevelDBFullPrunedBlockChainIT.java
│ │ │ ├── MemoryFullPrunedBlockChainIT.java
│ │ │ ├── MessageTest.java
│ │ │ ├── MySQLFullPrunedBlockChainIT.java
│ │ │ ├── ParseByteCacheTest.java
│ │ │ ├── PeerAddressTest.java
│ │ │ ├── PeerGroupTest.java
│ │ │ ├── PeerTest.java
│ │ │ ├── PostgresFullPrunedBlockChainIT.java
│ │ │ ├── TransactionBroadcastTest.java
│ │ │ ├── TransactionOutputTest.java
│ │ │ ├── TransactionTest.java
│ │ │ ├── TxConfidenceTableTest.java
│ │ │ ├── UtilsTest.java
│ │ │ ├── VarIntTest.java
│ │ │ ├── VersionMessageTest.java
│ │ │ └── VersionedChecksummedBytesTest.java
│ │ │ ├── crypto
│ │ │ ├── BIP32Test.java
│ │ │ ├── BIP38PrivateKeyTest.java
│ │ │ ├── ChildKeyDerivationTest.java
│ │ │ ├── HDUtilsTest.java
│ │ │ ├── KeyCrypterScryptTest.java
│ │ │ ├── MnemonicCodeTest.java
│ │ │ └── X509UtilsTest.java
│ │ │ ├── net
│ │ │ ├── NetworkAbstractionTests.java
│ │ │ └── discovery
│ │ │ │ └── SeedPeersTest.java
│ │ │ ├── pow
│ │ │ └── POWRulesTest.java
│ │ │ ├── protocols
│ │ │ ├── channels
│ │ │ │ ├── ChannelConnectionTest.java
│ │ │ │ ├── ChannelTestUtils.java
│ │ │ │ ├── PaymentChannelClientTest.java
│ │ │ │ ├── PaymentChannelServerTest.java
│ │ │ │ └── PaymentChannelStateTest.java
│ │ │ └── payments
│ │ │ │ ├── PaymentProtocolTest.java
│ │ │ │ └── PaymentSessionTest.java
│ │ │ ├── script
│ │ │ ├── ScriptChunkTest.java
│ │ │ ├── ScriptTest.java
│ │ │ └── ScriptTestBitwiseData.java
│ │ │ ├── store
│ │ │ ├── LevelDBBlockStoreTest.java
│ │ │ ├── SPVBlockStoreTest.java
│ │ │ └── WalletProtobufSerializerTest.java
│ │ │ ├── testing
│ │ │ ├── FakeTxBuilder.java
│ │ │ ├── FooWalletExtension.java
│ │ │ ├── InboundMessageQueuer.java
│ │ │ ├── KeyChainTransactionSigner.java
│ │ │ ├── MockTransactionBroadcaster.java
│ │ │ ├── NopTransactionSigner.java
│ │ │ ├── TestWithNetworkConnections.java
│ │ │ ├── TestWithPeerGroup.java
│ │ │ ├── TestWithWallet.java
│ │ │ └── package-info.java
│ │ │ ├── uri
│ │ │ └── BitcoinURITest.java
│ │ │ ├── utils
│ │ │ ├── BaseTaggableObjectTest.java
│ │ │ ├── BtcFormatTest.java
│ │ │ ├── ExchangeRateTest.java
│ │ │ ├── ExponentialBackoffTest.java
│ │ │ ├── FiatTest.java
│ │ │ ├── MonetaryFormatTest.java
│ │ │ └── VersionTallyTest.java
│ │ │ └── wallet
│ │ │ ├── BasicKeyChainTest.java
│ │ │ ├── DefaultCoinSelectorTest.java
│ │ │ ├── DefaultRiskAnalysisTest.java
│ │ │ ├── DeterministicKeyChainTest.java
│ │ │ ├── KeyChainGroupTest.java
│ │ │ ├── WalletExtensionsTest.java
│ │ │ └── WalletTest.java
│ └── resources
│ │ ├── logback-test.xml
│ │ └── org
│ │ └── bitcoinj
│ │ ├── core
│ │ ├── bch_addresses.csv
│ │ ├── block169482.dat
│ │ ├── block227835.dat
│ │ ├── block227836.dat
│ │ ├── block363703.dat
│ │ ├── block370661.dat
│ │ ├── block383616.dat
│ │ ├── block_testnet21066.dat
│ │ ├── block_testnet32768.dat
│ │ ├── first-100k-blocks.dat
│ │ ├── sig_canonical.json
│ │ └── sig_noncanonical.json
│ │ ├── crypto
│ │ ├── comodo-smime.crt
│ │ ├── startssl-client.crt
│ │ └── startssl-smime.crt
│ │ ├── protocols
│ │ └── payments
│ │ │ ├── README
│ │ │ ├── pki_test.bitcoinpaymentrequest
│ │ │ ├── test-cacert.key
│ │ │ ├── test-cacerts
│ │ │ ├── test-expired-cert
│ │ │ └── test-valid-cert
│ │ ├── script
│ │ ├── script_invalid.json
│ │ ├── script_valid.json
│ │ ├── tx_invalid.json
│ │ └── tx_valid.json
│ │ └── wallet
│ │ ├── deterministic-wallet-serialization.txt
│ │ └── watching-wallet-serialization.txt
│ └── wallet.proto
├── docs
├── Releases.md
├── designdocs
│ ├── Contexts.md
│ ├── Deterministic wallets.txt
│ └── MavenBuildProcess.md
└── v0.14.md
├── examples
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── org
│ │ └── bitcoinj
│ │ └── examples
│ │ ├── BackupToMnemonicSeed.java
│ │ ├── DoubleSpend.java
│ │ ├── DumpWallet.java
│ │ ├── ExamplePaymentChannelClient.java
│ │ ├── ExamplePaymentChannelServer.java
│ │ ├── FetchBlock.java
│ │ ├── FetchTransactions.java
│ │ ├── ForwardingService.java
│ │ ├── GenerateLowSTests.java
│ │ ├── Kit.java
│ │ ├── LevelDB.java
│ │ ├── LevelDbSizes.java
│ │ ├── NetworkEnum.java
│ │ ├── PeerMonitor.java
│ │ ├── PrintPeers.java
│ │ ├── PrivateKeys.java
│ │ ├── RefreshWallet.java
│ │ ├── RestoreFromSeed.java
│ │ └── SendRequest.java
│ ├── javascript
│ ├── demo.js
│ ├── forwarding.js
│ ├── payprotocol.js
│ └── tor.js
│ └── python
│ └── forwarding.py
├── jenkins
├── Jenkinsfile
├── testlocal
└── tests
│ └── sync-chain
├── misc
├── bitcoinj.svg
├── bitcoinjlogo.png
└── bitcoinjlogo.svg
├── pom.xml
├── tools
├── build-checkpoints
├── build-checkpoints.cmd
├── pom.xml
├── src
│ └── main
│ │ ├── java
│ │ └── org
│ │ │ └── bitcoinj
│ │ │ └── tools
│ │ │ ├── BlockImporter.java
│ │ │ ├── BuildCheckpoints.java
│ │ │ ├── InteractiveScriptStateListener.java
│ │ │ ├── NetworkEnum.java
│ │ │ ├── PaymentProtocolTool.java
│ │ │ ├── TestFeeLevel.java
│ │ │ ├── WalletTool.java
│ │ │ └── WatchMempool.java
│ │ └── resources
│ │ └── org
│ │ └── bitcoinj
│ │ └── tools
│ │ ├── build-checkpoints-help.txt
│ │ └── wallet-tool-help.txt
├── wallet-tool
└── wallet-tool.cmd
└── wallettemplate
├── pom.xml
└── src
└── main
├── java
└── wallettemplate
│ ├── Main.java
│ ├── MainController.java
│ ├── SendMoneyController.java
│ ├── WalletPasswordController.java
│ ├── WalletSetPasswordController.java
│ ├── WalletSettingsController.java
│ ├── controls
│ ├── BitcoinAddressValidator.java
│ ├── ClickableBitcoinAddress.java
│ └── NotificationBarPane.java
│ └── utils
│ ├── AlertWindowController.java
│ ├── BitcoinUIModel.java
│ ├── GuiUtils.java
│ ├── KeyDerivationTasks.java
│ ├── TextFieldValidator.java
│ ├── ThrottledRunLater.java
│ ├── WTUtils.java
│ └── easing
│ ├── EasingInterpolator.java
│ ├── EasingMode.java
│ └── ElasticInterpolator.java
└── resources
└── wallettemplate
├── 200px-Padlock.svg.png
├── bitcoin_logo_plain.png
├── controls
└── bitcoin_address.fxml
├── main.fxml
├── send_money.fxml
├── utils
├── alert.fxml
└── text-validation.css
├── wallet.css
├── wallet_password.fxml
├── wallet_set_password.fxml
└── wallet_settings.fxml
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.ai -crlf -diff -merge
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | .project
3 | .classpath
4 | .settings
5 | .idea
6 | *.iml
7 | *.chain
8 | *.spvchain
9 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | # configuration for https://travis-ci.org/bitcoincash-wallet/bitcoincashj
2 | sudo: false
3 | dist: trusty
4 | language: java
5 | jdk: oraclejdk8
6 | addons:
7 | postgresql: "9.3" # min supported version
8 | cache:
9 | directories:
10 | - $HOME/.m2
11 |
12 | services:
13 | - mysql
14 |
15 | install: true # disable default because no need to do the mvn install before mvn verify
16 |
17 | before_script:
18 | - psql -c "create user bitcoinj with password 'password';" -U postgres
19 | - psql -c 'create database bitcoinj_test owner bitcoinj;' -U postgres
20 | - mysql -e 'CREATE DATABASE bitcoinj_test;'
21 | - mysql -e "grant all PRIVILEGES on bitcoinj_test.* to 'bitcoinj' identified by 'password';"
22 | - mysql -e 'SET GLOBAL max_allowed_packet=20971520;'
23 |
24 | script:
25 | - mvn verify -Ptravis -Dmaven.javadoc.skip=true
26 | # to run one specific test - in this case only testFirst100kBlocksWithCustomSchema test in PostgresFullPrunedBlockChainIT class
27 | # - mvn clean verify -Ptravis -Dmaven.javadoc.skip=true -Dit.test=PostgresFullPrunedBlockChainIT#testFirst100kBlocksWithCustomSchema -Dtest=nothing -DfailIfNoTests=false
28 | # run only mysql integration tests
29 | # - mvn clean verify -Ptravis -Dmaven.javadoc.skip=true -Dit.test=MySQLFullPrunedBlockChainIT -Dtest=nothing -DfailIfNoTests=false
30 |
31 | after_success:
32 | - cd core
33 | - mvn jacoco:report coveralls:report
34 |
--------------------------------------------------------------------------------
/AUTHORS:
--------------------------------------------------------------------------------
1 | $ git log --format='%aN' | sort -u
2 |
3 | Aaron Voisine
4 | Adam Mackler
5 | Alexander Lolis
6 | Alex Taylor
7 | Alon Muroch
8 | Amichai Rothman
9 | Andreas Schildbach
10 | andrewtoth
11 | Bennett Hoffman
12 | Carlos Lopez-Camey
13 | Carsten Otto
14 | Chris
15 | cyberzac
16 | Dave Collins
17 | dexX7
18 | Diego Basch
19 | elbandi
20 | eleetas
21 | En-Ran Zhou
22 | Erik Tierney
23 | Fireduck
24 | freak
25 | Gary Rowe
26 | Giannis Dzegoutanis
27 | Glenn Marien
28 | GreenAddress
29 | gubatron
30 | Harald Hoyer
31 | Jakob Stuber
32 | Jameson Lopp
33 | Jarl Fransson
34 | Jim Burton
35 | Jiri Peinlich
36 | Johnathan
37 | Jonny Heggheim
38 | Justas Dobiliauskas
39 | Kalpesh Parmar
40 | Ken Sedgwick
41 | Kevin Greene
42 | Kirill Vlasov
43 | Kosta Korenkov
44 | kushti
45 | langerhans
46 | Loco
47 | Manfred Karrer
48 | Marc-André Tremblay
49 | Martin Zachrison
50 | matija.mazi@gmail.com
51 | Matt Bogosian
52 | Matt Corallo
53 | Michael Bell
54 | Michael Bumann
55 | Mike Hearn
56 | Mike Rosseel
57 | Miron Cuperman
58 | monk
59 | Mora Zyx
60 | mruddy
61 | ollekullberg
62 | Oscar Guindzberg
63 | Pavol Rusnak
64 | peacekeeper
65 | Peter Dettman
66 | Peter Stockli
67 | Peter Todd
68 | Piotr Włodarek
69 | Richard Green
70 | Robin Owens
71 | Ross Nicoll
72 | Sean Gilligan
73 | Sebastian Ortega
74 | Simon de la Rouviere
75 | Simon Vermeersch
76 | Stephen Reed
77 | troggy
78 | Tyler Houlihan
79 | Willem Noort
80 | Will Shackleton
81 | Wojciech Langiewicz
82 | Xiaofeng Guo
83 | Ximo Guanter
84 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | ### NOTICE
3 | The bitcoinj.cash library has been retired, this repository will be put into archive mode soon.
4 |
5 | For the Bitcoin SV version of BitcoinJ, please see https://github.com/bitcoinj-sv/bitcoinj-sv.
6 |
7 |
--------------------------------------------------------------------------------
/core/findbugs.xml:
--------------------------------------------------------------------------------
1 |
16 |
Parent class for header only messages that don't have a payload. 25 | * Currently this includes getaddr, verack and special bitcoinj class UnknownMessage.
26 | * 27 | *Instances of this class are not safe for use by multiple threads.
28 | */ 29 | public abstract class EmptyMessage extends Message { 30 | 31 | public EmptyMessage() { 32 | length = 0; 33 | } 34 | 35 | public EmptyMessage(NetworkParameters params) { 36 | super(params); 37 | length = 0; 38 | } 39 | 40 | public EmptyMessage(NetworkParameters params, byte[] payload, int offset) throws ProtocolException { 41 | super(params, payload, offset); 42 | length = 0; 43 | } 44 | 45 | @Override 46 | protected final void bitcoinSerializeToStream(OutputStream stream) throws IOException { 47 | } 48 | 49 | @Override 50 | protected void parse() throws ProtocolException { 51 | } 52 | 53 | /* (non-Javadoc) 54 | * @see Message#bitcoinSerialize() 55 | */ 56 | @Override 57 | public byte[] bitcoinSerialize() { 58 | return new byte[0]; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /core/src/main/java/org/bitcoinj/core/GetAddrMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitcoinj.core; 18 | 19 | /** 20 | *Represents the "getaddr" P2P protocol message, which requests network {@link AddressMessage}s from a peer. Not to 21 | * be confused with {@link Address} which is sort of like an account number.
22 | * 23 | *Instances of this class are not safe for use by multiple threads.
24 | */ 25 | public class GetAddrMessage extends EmptyMessage { 26 | 27 | public GetAddrMessage(NetworkParameters params) { 28 | super(params); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /core/src/main/java/org/bitcoinj/core/InsufficientMoneyException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitcoinj.core; 18 | 19 | import javax.annotation.Nullable; 20 | 21 | import static com.google.common.base.Preconditions.checkNotNull; 22 | 23 | /** 24 | * Thrown to indicate that you don't have enough money available to perform the requested operation. 25 | */ 26 | public class InsufficientMoneyException extends Exception { 27 | /** Contains the number of satoshis that would have been required to complete the operation. */ 28 | @Nullable 29 | public final Coin missing; 30 | 31 | protected InsufficientMoneyException() { 32 | this.missing = null; 33 | } 34 | 35 | public InsufficientMoneyException(Coin missing) { 36 | this(missing, "Insufficient money, missing " + missing.toFriendlyString()); 37 | } 38 | 39 | public InsufficientMoneyException(Coin missing, String message) { 40 | super(message); 41 | this.missing = checkNotNull(missing); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /core/src/main/java/org/bitcoinj/core/InventoryItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitcoinj.core; 18 | 19 | import com.google.common.base.Objects; 20 | 21 | public class InventoryItem { 22 | 23 | /** 24 | * 4 byte uint32 type field + 32 byte hash 25 | */ 26 | static final int MESSAGE_LENGTH = 36; 27 | 28 | public enum Type { 29 | Error, 30 | Transaction, 31 | Block, 32 | FilteredBlock 33 | } 34 | 35 | public final Type type; 36 | public final Sha256Hash hash; 37 | 38 | public InventoryItem(Type type, Sha256Hash hash) { 39 | this.type = type; 40 | this.hash = hash; 41 | } 42 | 43 | @Override 44 | public String toString() { 45 | return type + ": " + hash; 46 | } 47 | 48 | @Override 49 | public boolean equals(Object o) { 50 | if (this == o) return true; 51 | if (o == null || getClass() != o.getClass()) return false; 52 | InventoryItem other = (InventoryItem) o; 53 | return type == other.type && hash.equals(other.hash); 54 | } 55 | 56 | @Override 57 | public int hashCode() { 58 | return Objects.hashCode(type, hash); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /core/src/main/java/org/bitcoinj/core/MemoryPoolMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * Copyright 2015 Andreas Schildbach 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package org.bitcoinj.core; 19 | 20 | import java.io.IOException; 21 | import java.io.OutputStream; 22 | 23 | /** 24 | *The "mempool" message asks a remote peer to announce all transactions in its memory pool, possibly restricted by 25 | * any Bloom filter set on the connection. The list of transaction hashes comes back in an inv message. Note that 26 | * this is different to the {@link TxConfidenceTable} object which doesn't try to keep track of all pending transactions, 27 | * it's just a holding area for transactions that a part of the app may find interesting. The mempool message has 28 | * no fields.
29 | * 30 | *Instances of this class are not safe for use by multiple threads.
31 | */ 32 | public class MemoryPoolMessage extends Message { 33 | @Override 34 | protected void parse() throws ProtocolException {} 35 | 36 | @Override 37 | protected void bitcoinSerializeToStream(OutputStream stream) throws IOException {} 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/org/bitcoinj/core/Monetary.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Andreas Schildbach 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitcoinj.core; 18 | 19 | import java.io.Serializable; 20 | 21 | /** 22 | * Classes implementing this interface represent a monetary value, such as a Bitcoin or fiat amount. 23 | */ 24 | public interface Monetary extends Serializable { 25 | 26 | /** 27 | * Returns the absolute value of exponent of the value of a "smallest unit" in scientific notation. For Bitcoin, a 28 | * satoshi is worth 1E-8 so this would be 8. 29 | */ 30 | int smallestUnitExponent(); 31 | 32 | /** 33 | * Returns the number of "smallest units" of this monetary value. For Bitcoin, this would be the number of satoshis. 34 | */ 35 | long getValue(); 36 | 37 | int signum(); 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/org/bitcoinj/core/NotFoundMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitcoinj.core; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | /** 23 | *Sent by a peer when a getdata request doesn't find the requested data in the mempool. It has the same format 24 | * as an inventory message and lists the hashes of the missing items.
25 | * 26 | *Instances of this class are not safe for use by multiple threads.
27 | */ 28 | public class NotFoundMessage extends InventoryMessage { 29 | public static int MIN_PROTOCOL_VERSION = 70001; 30 | 31 | public NotFoundMessage(NetworkParameters params) { 32 | super(params); 33 | } 34 | 35 | public NotFoundMessage(NetworkParameters params, byte[] payloadBytes) throws ProtocolException { 36 | super(params, payloadBytes); 37 | } 38 | 39 | public NotFoundMessage(NetworkParameters params, ListInstances of this class are not safe for use by multiple threads.
25 | */ 26 | public class Pong extends Message { 27 | private long nonce; 28 | 29 | public Pong(NetworkParameters params, byte[] payloadBytes) throws ProtocolException { 30 | super(params, payloadBytes, 0); 31 | } 32 | 33 | /** 34 | * Create a Pong with a nonce value. 35 | * Only use this if the remote node has a protocol version > 60000 36 | */ 37 | public Pong(long nonce) { 38 | this.nonce = nonce; 39 | } 40 | 41 | @Override 42 | protected void parse() throws ProtocolException { 43 | nonce = readInt64(); 44 | length = 8; 45 | } 46 | 47 | @Override 48 | public void bitcoinSerializeToStream(OutputStream stream) throws IOException { 49 | Utils.int64ToByteStreamLE(nonce, stream); 50 | } 51 | 52 | /** Returns the nonce sent by the remote peer. */ 53 | public long getNonce() { 54 | return nonce; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /core/src/main/java/org/bitcoinj/core/ProtocolException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitcoinj.core; 18 | 19 | @SuppressWarnings("serial") 20 | public class ProtocolException extends VerificationException { 21 | 22 | public ProtocolException(String msg) { 23 | super(msg); 24 | } 25 | 26 | public ProtocolException(Exception e) { 27 | super(e); 28 | } 29 | 30 | public ProtocolException(String msg, Exception e) { 31 | super(msg, e); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/org/bitcoinj/core/PrunedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitcoinj.core; 18 | 19 | // TODO: Rename PrunedException to something like RequiredDataWasPrunedException 20 | 21 | /** 22 | * PrunedException is thrown in cases where a fully verifying node has deleted (pruned) old block data that turned 23 | * out to be necessary for handling a re-org. Normally this should never happen unless you're playing with the testnet 24 | * as the pruning parameters should be set very conservatively, such that an absolutely enormous re-org would be 25 | * required to trigger it. 26 | */ 27 | @SuppressWarnings("serial") 28 | public class PrunedException extends Exception { 29 | private Sha256Hash hash; 30 | public PrunedException(Sha256Hash hash) { 31 | super(hash.toString()); 32 | this.hash = hash; 33 | } 34 | public Sha256Hash getHash() { 35 | return hash; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/org/bitcoinj/core/RejectedTransactionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Adam Mackler 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitcoinj.core; 18 | 19 | /** 20 | * This exception is used by the TransactionBroadcast class to indicate that a broadcast 21 | * Transaction has been rejected by the network, for example because it violates a 22 | * protocol rule. Note that not all invalid transactions generate a reject message, and 23 | * some peers may never do so. 24 | */ 25 | public class RejectedTransactionException extends Exception { 26 | private Transaction tx; 27 | private RejectMessage rejectMessage; 28 | 29 | public RejectedTransactionException(Transaction tx, RejectMessage rejectMessage) { 30 | super(rejectMessage.toString()); 31 | this.tx = tx; 32 | this.rejectMessage = rejectMessage; 33 | } 34 | 35 | /** Return the original Transaction object whose broadcast was rejected. */ 36 | public Transaction getTransaction() { return tx; } 37 | 38 | /** Return the RejectMessage object representing the broadcast rejection. */ 39 | public RejectMessage getRejectMessage() { return rejectMessage; } 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/org/bitcoinj/core/ScriptException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitcoinj.core; 18 | 19 | @SuppressWarnings("serial") 20 | public class ScriptException extends VerificationException { 21 | 22 | public ScriptException(String msg) { 23 | super(msg); 24 | } 25 | 26 | public ScriptException(String msg, Exception e) { 27 | super(msg, e); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/org/bitcoinj/core/TransactionBag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Giannis Dzegoutanis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitcoinj.core; 18 | 19 | import org.bitcoinj.script.Script; 20 | import org.bitcoinj.wallet.WalletTransaction; 21 | 22 | import java.util.Map; 23 | 24 | /** 25 | * This interface is used to abstract the {@link org.bitcoinj.wallet.Wallet} and the {@link org.bitcoinj.core.Transaction} 26 | */ 27 | public interface TransactionBag { 28 | /** Returns true if this wallet contains a public key which hashes to the given hash. */ 29 | boolean isPubKeyHashMine(byte[] pubkeyHash); 30 | 31 | /** Returns true if this wallet is watching transactions for outputs with the script. */ 32 | boolean isWatchedScript(Script script); 33 | 34 | /** Returns true if this wallet contains a keypair with the given public key. */ 35 | boolean isPubKeyMine(byte[] pubkey); 36 | 37 | /** Returns true if this wallet knows the script corresponding to the given hash. */ 38 | boolean isPayToScriptHashMine(byte[] payToScriptHash); 39 | 40 | /** Returns transactions from a specific pool. */ 41 | MapA {@link org.bitcoinj.store.FullPrunedBlockStore} is an internal implementation within bitcoinj.
26 | */ 27 | public interface UTXOProvider { 28 | 29 | // TODO currently the access to outputs is by address. Change to ECKey 30 | /** 31 | * Get the list of {@link UTXO}'s for a given address. 32 | * @param addresses List of address. 33 | * @return The list of transaction outputs. 34 | * @throws UTXOProviderException If there is an error. 35 | */ 36 | ListInstances of this class are not safe for use by multiple threads.
22 | */ 23 | public class UnknownMessage extends EmptyMessage { 24 | 25 | private String name; 26 | 27 | public UnknownMessage(NetworkParameters params, String name, byte[] payloadBytes) throws ProtocolException { 28 | super(params, payloadBytes, 0); 29 | this.name = name; 30 | } 31 | 32 | @Override 33 | public String toString() { 34 | return "Unknown message [" + name + "]: " + (payload == null ? "" : Utils.HEX.encode(payload)); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /core/src/main/java/org/bitcoinj/core/VersionAck.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Noa Resare. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitcoinj.core; 18 | 19 | /** 20 | *The verack message, sent by a client accepting the version message they 21 | * received from their peer.
22 | * 23 | *Instances of this class are not safe for use by multiple threads.
24 | */ 25 | public class VersionAck extends EmptyMessage { 26 | public VersionAck() { 27 | } 28 | 29 | // this is needed by the BitcoinSerializer 30 | public VersionAck(NetworkParameters params, byte[] payload) { 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/org/bitcoinj/core/WrongNetworkException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitcoinj.core; 18 | 19 | import java.util.Arrays; 20 | 21 | /** 22 | * This exception is thrown by the Address class when you try and decode an address with a version code that isn't 23 | * used by that network. You shouldn't allow the user to proceed in this case as they are trying to send money across 24 | * different chains, an operation that is guaranteed to destroy the money. 25 | */ 26 | public class WrongNetworkException extends AddressFormatException { 27 | /** The version code that was provided in the address. */ 28 | public int verCode; 29 | /** The list of acceptable versions that were expected given the addresses network parameters. */ 30 | public int[] acceptableVersions; 31 | 32 | public WrongNetworkException(int verCode, int[] acceptableVersions) { 33 | super("Version code of address did not match acceptable versions for network: " + verCode + " not in " + 34 | Arrays.toString(acceptableVersions)); 35 | this.verCode = verCode; 36 | this.acceptableVersions = acceptableVersions; 37 | } 38 | 39 | public WrongNetworkException(String prefix, String acceptablePrefix) 40 | { 41 | super("Prefix of address did not match acceptable prefix for network: " + prefix + " not " + 42 | acceptablePrefix); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /core/src/main/java/org/bitcoinj/core/listeners/AbstractBlockChainListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | 15 | package org.bitcoinj.core.listeners; 16 | 17 | import org.bitcoinj.core.*; 18 | 19 | import java.util.*; 20 | 21 | /** 22 | * For backwards compatibility only. Implements the block chain listener interfaces. Use the more specific interfaces 23 | * instead. 24 | */ 25 | @Deprecated 26 | public class AbstractBlockChainListener implements BlockChainListener { 27 | @Override 28 | public void notifyNewBestBlock(StoredBlock block) throws VerificationException { 29 | } 30 | 31 | @Override 32 | public void reorganize(StoredBlock splitPoint, ListImplementors can listen to events like blocks being downloaded/transactions being broadcast/connect/disconnects, 25 | * they can pre-filter messages before they are procesesed by a {@link Peer} or {@link PeerGroup}, and they can 26 | * provide transactions to remote peers when they ask for them.
27 | */ 28 | public interface BlocksDownloadedEventListener { 29 | 30 | // TODO: Fix the Block/FilteredBlock type hierarchy so we can avoid the stupid typeless API here. 31 | /** 32 | *Called on a Peer thread when a block is received.
33 | * 34 | *The block may be a Block object that contains transactions, a Block object that is only a header when 35 | * fast catchup is being used. If set, filteredBlock can be used to retrieve the list of associated transactions.
36 | * 37 | * @param peer the peer receiving the block 38 | * @param block the downloaded block 39 | * @param filteredBlock if non-null, the object that wraps the block header passed as the block param. 40 | * @param blocksLeft the number of blocks left to download 41 | */ 42 | void onBlocksDownloaded(Peer peer, Block block, @Nullable FilteredBlock filteredBlock, int blocksLeft); 43 | } 44 | -------------------------------------------------------------------------------- /core/src/main/java/org/bitcoinj/core/listeners/ChainDownloadStartedEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitcoinj.core.listeners; 18 | 19 | import org.bitcoinj.core.*; 20 | 21 | /** 22 | *Implementors can listen to events like blocks being downloaded/transactions being broadcast/connect/disconnects, 23 | * they can pre-filter messages before they are procesesed by a {@link Peer} or {@link PeerGroup}, and they can 24 | * provide transactions to remote peers when they ask for them.
25 | */ 26 | public interface ChainDownloadStartedEventListener { 27 | 28 | /** 29 | * Called when a download is started with the initial number of blocks to be downloaded. 30 | * 31 | * @param peer the peer receiving the block 32 | * @param blocksLeft the number of blocks left to download 33 | */ 34 | void onChainDownloadStarted(Peer peer, int blocksLeft); 35 | } 36 | -------------------------------------------------------------------------------- /core/src/main/java/org/bitcoinj/core/listeners/FeeFilterMessage.java: -------------------------------------------------------------------------------- 1 | package org.bitcoinj.core.listeners; 2 | 3 | import org.bitcoinj.core.EmptyMessage; 4 | import org.bitcoinj.core.NetworkParameters; 5 | 6 | /** 7 | * Created by HashEngineering on 8/11/2017. 8 | */ 9 | public class FeeFilterMessage extends EmptyMessage{ 10 | public FeeFilterMessage(NetworkParameters params){ 11 | super(params); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /core/src/main/java/org/bitcoinj/core/listeners/GetDataEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitcoinj.core.listeners; 18 | 19 | import org.bitcoinj.core.*; 20 | 21 | import javax.annotation.*; 22 | import java.util.*; 23 | 24 | /** 25 | *Implementors can listen to events like blocks being downloaded/transactions being broadcast/connect/disconnects, 26 | * they can pre-filter messages before they are procesesed by a {@link Peer} or {@link PeerGroup}, and they can 27 | * provide transactions to remote peers when they ask for them.
28 | */ 29 | public interface GetDataEventListener { 30 | 31 | /** 32 | *Called when a peer receives a getdata message, usually in response to an "inv" being broadcast. Return as many 33 | * items as possible which appear in the {@link GetDataMessage}, or null if you're not interested in responding.
34 | * 35 | *Note that this will never be called if registered with any executor other than 36 | * {@link org.bitcoinj.utils.Threading#SAME_THREAD}
37 | */ 38 | @Nullable 39 | ListImplementors can listen to events indicating a new peer connecting.
23 | */ 24 | public interface PeerConnectedEventListener { 25 | 26 | /** 27 | * Called when a peer is connected. If this listener is registered to a {@link Peer} instead of a {@link org.bitcoinj.core.PeerGroup}, 28 | * peerCount will always be 1. 29 | * 30 | * @param peer 31 | * @param peerCount the total number of connected peers 32 | */ 33 | void onPeerConnected(Peer peer, int peerCount); 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/org/bitcoinj/core/listeners/PeerConnectionEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitcoinj.core.listeners; 18 | 19 | import org.bitcoinj.core.Peer; 20 | 21 | /** 22 | *Implementors can listen to events like peer discovery, connect or disconnects.
23 | * 24 | * @deprecated Use the single event interfaces instead 25 | */ 26 | @Deprecated 27 | public interface PeerConnectionEventListener extends PeerConnectedEventListener, 28 | PeerDiscoveredEventListener, PeerDisconnectedEventListener { 29 | 30 | /** 31 | * Called when a peer is disconnected. Note that this won't be called if the listener is registered on a 32 | * {@link org.bitcoinj.core.PeerGroup} and the group is in the process of shutting down. If this listener is registered to a 33 | * {@link Peer} instead of a {@link org.bitcoinj.core.PeerGroup}, peerCount will always be 0. This handler can be called without 34 | * a corresponding invocation of onPeerConnected if the initial connection is never successful. 35 | * 36 | * @param peer 37 | * @param peerCount the total number of connected peers 38 | */ 39 | void onPeerDisconnected(Peer peer, int peerCount); 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/org/bitcoinj/core/listeners/PeerDataEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitcoinj.core.listeners; 18 | 19 | import org.bitcoinj.core.*; 20 | 21 | /** 22 | *Implementors can listen to events like blocks being downloaded/transactions being broadcast/connect/disconnects, 23 | * they can pre-filter messages before they are processed by a {@link Peer} or {@link PeerGroup}, and they can 24 | * provide transactions to remote peers when they ask for them.
25 | */ 26 | public interface PeerDataEventListener extends BlocksDownloadedEventListener, ChainDownloadStartedEventListener, 27 | GetDataEventListener, PreMessageReceivedEventListener { 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/org/bitcoinj/core/listeners/PeerDisconnectedEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitcoinj.core.listeners; 18 | 19 | import org.bitcoinj.core.Peer; 20 | 21 | /** 22 | *Implementors can listen to events indicating a peer disconnecting.
23 | */ 24 | public interface PeerDisconnectedEventListener { 25 | 26 | /** 27 | * Called when a peer is disconnected. Note that this won't be called if the listener is registered on a 28 | * {@link org.bitcoinj.core.PeerGroup} and the group is in the process of shutting down. If this listener is registered to a 29 | * {@link Peer} instead of a {@link org.bitcoinj.core.PeerGroup}, peerCount will always be 0. This handler can be called without 30 | * a corresponding invocation of onPeerConnected if the initial connection is never successful. 31 | * 32 | * @param peer 33 | * @param peerCount the total number of connected peers 34 | */ 35 | void onPeerDisconnected(Peer peer, int peerCount); 36 | } 37 | -------------------------------------------------------------------------------- /core/src/main/java/org/bitcoinj/core/listeners/PeerDiscoveredEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitcoinj.core.listeners; 18 | 19 | import org.bitcoinj.core.Peer; 20 | import org.bitcoinj.core.PeerAddress; 21 | import java.util.Set; 22 | 23 | /** 24 | *Implementors can listen to events for peers being discovered.
25 | */ 26 | public interface PeerDiscoveredEventListener { 27 | /** 28 | *Called when peers are discovered, this happens at startup of {@link org.bitcoinj.core.PeerGroup} or if we run out of 29 | * suitable {@link Peer}s to connect to.
30 | * 31 | * @param peerAddresses the set of discovered {@link PeerAddress}es 32 | */ 33 | void onPeersDiscovered(SetImplementors can listen to events like blocks being downloaded/transactions being broadcast/connect/disconnects, 23 | * they can pre-filter messages before they are procesesed by a {@link Peer} or {@link PeerGroup}, and they can 24 | * provide transactions to remote peers when they ask for them.
25 | */ 26 | public interface PreMessageReceivedEventListener { 27 | 28 | /** 29 | *Called when a message is received by a peer, before the message is processed. The returned message is 30 | * processed instead. Returning null will cause the message to be ignored by the Peer returning the same message 31 | * object allows you to see the messages received but not change them. The result from one event listeners 32 | * callback is passed as "m" to the next, forming a chain.
33 | * 34 | *Note that this will never be called if registered with any executor other than 35 | * {@link org.bitcoinj.utils.Threading#SAME_THREAD}
36 | */ 37 | Message onPreMessageReceived(Peer peer, Message m); 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/org/bitcoinj/core/listeners/ReorganizeListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Google Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitcoinj.core.listeners; 18 | 19 | import java.util.List; 20 | import org.bitcoinj.core.StoredBlock; 21 | import org.bitcoinj.core.VerificationException; 22 | 23 | /** 24 | * Listener interface for when the best chain has changed. 25 | */ 26 | public interface ReorganizeListener { 27 | 28 | /** 29 | * Called by the {@link org.bitcoinj.core.BlockChain} when the best chain 30 | * (representing total work done) has changed. In this case, 31 | * we need to go through our transactions and find out if any have become invalid. It's possible for our balance 32 | * to go down in this case: money we thought we had can suddenly vanish if the rest of the network agrees it 33 | * should be so.
34 | *
35 | * The oldBlocks/newBlocks lists are ordered height-wise from top first to bottom last (i.e. newest blocks first).
36 | */
37 | void reorganize(StoredBlock splitPoint, List Exception to provide the following: This base exception acts as a general failure mode not attributable to a specific cause (other than
23 | * that reported in the exception message). Since this is in English, it may not be worth reporting directly
24 | * to the user other than as part of a "general failure to parse" response.
20 | *
22 | *