Giter Site home page Giter Site logo

horizontalsystems / bitcoin-kit-android Goto Github PK

View Code? Open in Web Editor NEW
154.0 12.0 68.0 3.88 MB

Comprehensive Bitcoin development library for Android, implemented on Kotlin. SPV wallet implementation for Bitcoin, Bitcoin Cash, Litecoin and Dash blockchains. Fully compliant with existing standards and BIPs.

Home Page: https://unstoppable.money

License: MIT License

Kotlin 81.66% Java 7.02% CMake 0.54% C 0.02% C++ 10.76%
bitcoin bitcoin-wallet kotlin spv bitcoin-cash decentralized btc bch hd-wallet blockchain-wallet

bitcoin-kit-android's Issues

Implement Storage that will wrap Realm

The Issue

Using Realm directly makes harder to write automated tests. The current solution with Realm in memory requires appContext to run tests. That is why we have to write unit test as android Instrumented test. I've came to that instrumented tests are good for UI testing, not for unit testing. We cannot use tools like Powermock there. In addition assertion blocks in tests look complicated.

Solution

Add a new class (singleton?) Storage. Realm clients will use this object instead of Realm. It will have concrete methods for retrieving and storing objects. As a result the current realm clients will dependent on Storage object. We can mock Storage without any problem in unit tests without appContext. So we will be able to write simple unit tests.

Infinite Syncing Loop BCH

There are some peers that responses w/o ordering for our requests. It results in infinite loop.

Here is the list of peers:

  • 198.74.99.168

Implement WalletKit methods

Methods to implement:

  • transactions
  • lastBlockHeight
  • send
  • validate
  • fee
  • receiveAddress
  • progress

See iOS code for reference

Handle internet disconnection

The following actions should be done only when internet connection is on:

  1. Connecting to peers
  2. Refreshing fee rate

Etherium on MainNet crashes app

EtheriumKit.start() on MainNet crashes with this log

java.lang.IllegalStateException: Exception thrown on Scheduler.Worker thread. Add `onError` handling.
        at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:57)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: rx.exceptions.OnErrorNotImplementedException: Invalid response received: okhttp3.internal.http.RealResponseBody@d010a5
        at rx.internal.util.InternalObservableUtils$ErrorNotImplementedAction.call(InternalObservableUtils.java:386)
        at rx.internal.util.InternalObservableUtils$ErrorNotImplementedAction.call(InternalObservableUtils.java:383)
        at rx.internal.util.ActionSubscriber.onError(ActionSubscriber.java:44)
        at rx.observers.SafeSubscriber._onError(SafeSubscriber.java:153)
        at rx.observers.SafeSubscriber.onError(SafeSubscriber.java:115)
        at rx.internal.operators.OnSubscribeMap$MapSubscriber.onError(OnSubscribeMap.java:88)
        at rx.internal.operators.OperatorSubscribeOn$SubscribeOnSubscriber.onError(OperatorSubscribeOn.java:80)
        at org.web3j.protocol.core.RemoteCall$2.call(RemoteCall.java:62)
        at org.web3j.protocol.core.RemoteCall$2.call(RemoteCall.java:55)
        at rx.Observable.unsafeSubscribe(Observable.java:10256)
        at rx.internal.operators.OperatorSubscribeOn$SubscribeOnSubscriber.call(OperatorSubscribeOn.java:100)
        at rx.internal.schedulers.CachedThreadScheduler$EventLoopWorker$1.call(CachedThreadScheduler.java:230)
        at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) 
        at java.lang.Thread.run(Thread.java:764) 
     Caused by: org.web3j.protocol.exceptions.ClientConnectionException: Invalid response received: okhttp3.internal.http.RealResponseBody@d010a5
        at org.web3j.protocol.http.HttpService.performIO(HttpService.java:119)
        at org.web3j.protocol.Service.send(Service.java:32)
        at org.web3j.protocol.core.Request.send(Request.java:72)
        at org.web3j.protocol.core.Request$1.call(Request.java:83)
        at org.web3j.protocol.core.Request$1.call(Request.java:80)
        at org.web3j.protocol.core.RemoteCall.send(RemoteCall.java:31)
        at org.web3j.protocol.core.RemoteCall$2.call(RemoteCall.java:59)
        at org.web3j.protocol.core.RemoteCall$2.call(RemoteCall.java:55) 
        at rx.Observable.unsafeSubscribe(Observable.java:10256) 
        at rx.internal.operators.OperatorSubscribeOn$SubscribeOnSubscriber.call(OperatorSubscribeOn.java:100) 
        at rx.internal.schedulers.CachedThreadScheduler$EventLoopWorker$1.call(CachedThreadScheduler.java:230) 
        at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55) 
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) 
        at java.lang.Thread.run(Thread.java:764) 


PeerGroup sends request to not ready Peer

PeerGroup sends request to Peer that has socket connection but is not ready yet. PeerGroup should wait for Peer to be ready before sending any request. Peer is ready when it triggers "connected" event.

Exception in ScriptParser

java.lang.Exception: Push of data element that is larger than remaining data
        at bitcoin.wallet.kit.scripts.ScriptParser.parseChunks(ScriptParser.kt:53)
        at bitcoin.wallet.kit.scripts.Script.<init>(Script.kt:19)
        at bitcoin.wallet.kit.transactions.TransactionExtractor.extract(TransactionExtractor.kt:13)
        at bitcoin.wallet.kit.transactions.TransactionProcessor$run$1.execute(TransactionProcessor.kt:33)

When processing Transaction 8257da2253e8b80292e17958797dd8e13797410f661345c54fdb35eac4d0c989:

byteArrayOf(2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 75, 3, 98, 49, 8, 4, -51, -117, 116, 91, 99, 47, 66, 84, 67, 46, 67, 79, 77, 47, -6, -66, 109, 109, 90, 52, -116, 104, -84, 33, -101, 69, -1, 94, -10, -1, 125, -25, -83, 107, -72, 31, -101, -106, 22, -75, -79, 42, -86, -125, -111, 84, 65, 122, 64, 0, 1, 0, 0, 0, 0, 0, 0, 0, 47, 17, 118, 48, 30, -86, 1, 0, 0, 0, 0, 0, -1, -1, -1, -1, 3, -12, -30, 66, 75, 0, 0, 0, 0, 22, 0, 20, -105, -49, -57, 100, 66, -2, 113, 127, 42, 63, 12, -55, -63, 117, -9, 86, 27, 102, 25, -105, 0, 0, 0, 0, 0, 0, 0, 0, 38, 106, 36, -86, 33, -87, -19, 73, 32, -22, 51, 120, 74, -67, 101, -50, -9, -87, 54, -30, -42, 83, 83, 89, -115, -8, 92, 102, 26, -125, -49, -70, 13, 25, 99, -94, 17, 41, 103, 0, 0, 0, 0, 0, 0, 0, 0, 41, 82, 83, 75, 66, 76, 79, 67, 75, 58, -37, 42, 118, 89, -18, -61, 97, 62, -26, -77, 54, -30, -73, -54, 9, -124, 104, 111, -75, 113, 77, -79, 49, -68, 54, 9, 75, -111, -10, -84, -50, -95, 0, 0, 0, 0)

Other transactions raise the same failure:


4171fd65246d17545365ea6b815342fd682260239b20a6d4e053e47af47ff270, [1, 0, 0, 0, 2, -6, -8, -13, -92, 111, 9, -20, 46, -114, -74, 113, 26, -4, -120, -109, 44, -85, -10, -99, 73, 51, -123, 95, 27, -20, 55, -111, -74, -113, 13, -73, -80, 0, 0, 0, 0, 73, 0, 71, 48, 68, 2, 32, 6, 70, -83, -72, -7, -37, -98, -43, 71, -6, -30, -70, 79, 122, -87, 51, 67, 94, 114, -91, -88, -17, 81, 78, 36, -50, 31, -87, -119, -2, -25, 21, 2, 32, 74, 92, -12, -102, 26, -122, -23, -35, -76, -43, 125, 18, -110, 71, -65, 48, 112, 81, -68, 113, 26, -107, 9, -104, -96, 125, -128, -18, 31, -95, 107, -111, 1, -1, -1, -1, -1, -6, -8, -13, -92, 111, 9, -20, 46, -114, -74, 113, 26, -4, -120, -109, 44, -85, -10, -99, 73, 51, -123, 95, 27, -20, 55, -111, -74, -113, 13, -73, -80, 2, 0, 0, 0, 107, 72, 48, 69, 2, 33, 0, -110, 87, -95, -63, 56, 51, 67, 59, 93, 74, -13, 104, -37, -113, -75, -31, 33, 13, -42, 98, 27, 79, -26, 41, -97, -93, -59, 10, 38, 65, 115, 11, 2, 32, 75, 8, -92, -51, 81, -51, 74, 121, 45, -50, -105, 16, 29, 4, -58, 101, -40, 2, -17, -54, -113, -74, 23, 53, 77, -16, 97, -54, -120, 112, 81, -75, 1, 33, 3, 33, 0, -122, -49, -33, 52, 88, 107, -74, -56, -119, -28, 63, -109, -1, -108, 117, 76, -115, 53, -75, -72, -19, 112, 126, 87, 106, 55, 81, -77, 47, 14, -1, -1, -1, -1, 3, -24, 3, 0, 0, 0, 0, 0, 0, 105, 81, 33, 3, 33, 0, -122, -49, -33, 52, 88, 107, -74, -56, -119, -28, 63, -109, -1, -108, 117, 76, -115, 53, -75, -72, -19, 112, 126, 87, 106, 55, 81, -77, 47, 14, 33, 3, 32, -96, -34, 54, 12, -62, -82, -122, 114, -37, 125, 85, 112, -122, -92, -25, -56, -20, -96, 98, -64, -91, -92, -70, -103, 34, -34, -32, -86, -49, 62, 18, 33, 3, 31, 82, 84, 35, 123, 34, 118, 101, 114, 34, 58, 49, 44, 34, 97, 117, 116, 104, 34, 58, 34, 48, 34, 44, 34, 116, 105, 116, 108, 101, 34, 58, 83, -82, 0, 0, 0, 0, 0, 0, 0, 0, 9, 106, 7, 34, 90, 101, 114, 111, 34, 125, -34, 60, 0, 0, 0, 0, 0, 0, 25, 118, -87, 20, 19, -43, 19, 90, -125, 29, 94, 106, -102, 22, 92, -110, -76, -52, -116, 77, 97, -86, 111, 113, -120, -84, 0, 0, 0, 0]
fd3f27ba599237ba739e5a799a5c317ea182addf2e4913b7322bd80c6adcfbd1, [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 98, 3, 126, 9, 8, 31, 47, 86, 105, 97, 66, 84, 67, 47, 77, 105, 110, 101, 100, 32, 98, 121, 32, 102, 98, 49, 56, 56, 54, 51, 50, 54, 54, 48, 54, 57, 47, 44, -6, -66, 109, 109, 55, -60, 91, -109, 106, 75, -59, -16, 3, 18, 76, 57, 24, 63, -111, -58, -17, -53, 5, 108, -5, -26, 99, -92, -96, -75, -89, -121, -73, 0, 126, -37, 4, 0, 0, 0, 0, 0, 0, 0, 16, -63, 15, -55, 0, 102, -50, 108, 120, 44, 101, 97, 9, -124, 115, 2, 0, -1, -1, -1, -1, 2, -59, -114, 122, 75, 0, 0, 0, 0, 25, 118, -87, 20, 83, 111, -6, -103, 36, -111, 80, -115, -54, 3, 84, -27, 47, 50, -93, -89, -90, 121, -91, 58, -120, -84, 0, 0, 0, 0, 0, 0, 0, 0, 38, 106, 36, -86, 33, -87, -19, 114, 71, 56, -83, 36, 61, -77, -33, -77, 101, 109, 46, 73, -117, 50, -69, 48, -29, -19, 92, -37, -111, -77, 115, -89, -51, -98, -83, 121, -87, 85, 36, 0, 0, 0, 0]
61a479a7c233baae740c0e5e416898cd62e71df8a543ec2e572a88cd06c5fdbf, [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 91, 3, -124, 9, 8, 24, 47, 86, 105, 97, 66, 84, 67, 47, 77, 105, 110, 101, 100, 32, 98, 121, 32, 98, 101, 114, 98, 101, 114, 47, 44, -6, -66, 109, 109, 118, 58, 51, 52, 10, 8, 103, 86, -8, -99, 12, 104, 10, 124, 71, -114, 36, 61, 45, -104, 61, 122, 102, 122, -79, 2, 13, 105, -11, 88, 29, 60, 4, 0, 0, 0, 0, 0, 0, 0, 16, 125, 15, -46, 7, -24, 32, 71, -53, 71, -37, 52, -37, 122, -28, 0, 0, -1, -1, -1, -1, 2, -9, -6, -125, 74, 0, 0, 0, 0, 25, 118, -87, 20, 83, 111, -6, -103, 36, -111, 80, -115, -54, 3, 84, -27, 47, 50, -93, -89, -90, 121, -91, 58, -120, -84, 0, 0, 0, 0, 0, 0, 0, 0, 38, 106, 36, -86, 33, -87, -19, -39, 80, 71, 32, 91, 11, 88, -98, 110, -106, -121, -106, -89, 62, -13, 117, -78, 28, -69, -3, -73, -128, 0, 41, 2, 23, -95, -21, -16, -85, -6, 44, 0, 0, 0, 0]
9d70a398b24cd07f79a8ac5e258c92b89d215d9ffb699e4d233588e3a95a70c0, [1, 0, 0, 0, 2, -81, 127, -112, 46, -10, 10, 68, 11, 86, -102, 1, 122, 46, -99, 102, -86, 4, -25, -116, 34, 40, 116, -56, -67, 52, 79, 109, -126, 122, -107, -80, -64, 0, 0, 0, 0, 73, 0, 71, 48, 68, 2, 32, 78, 43, 39, 64, -83, -44, 55, 60, -19, -72, 79, 64, 104, -107, 60, -76, -22, -8, 79, -32, 124, -64, 123, -100, -101, -28, 117, 97, -45, 110, 14, 2, 2, 32, 3, -48, -60, 19, 17, -8, 112, 44, 43, 111, 95, -81, -80, -33, -69, -81, 88, 125, 73, -103, 91, 85, -75, -62, 111, 39, -1, 19, -28, -32, 32, -91, 1, -1, -1, -1, -1, -81, 127, -112, 46, -10, 10, 68, 11, 86, -102, 1, 122, 46, -99, 102, -86, 4, -25, -116, 34, 40, 116, -56, -67, 52, 79, 109, -126, 122, -107, -80, -64, 2, 0, 0, 0, 107, 72, 48, 69, 2, 33, 0, -80, -91, 58, -63, 2, 67, -118, 56, -68, 27, 79, 99, -116, -104, 94, 18, -61, 75, -30, -54, -75, -30, 33, 92, 57, 14, 20, 103, 120, 64, -102, -18, 2, 32, 65, 28, 42, 32, -51, -42, 8, 22, 99, -24, 104, 90, -53, -125, 119, -81, 49, 12, -62, 116, 1, -34, -74, 86, -72, 50, 37, 61, -42, 81, 116, 117, 1, 33, 2, 43, -50, 71, -61, 48, 27, 91, -74, 49, 104, -36, -50, -112, -5, -124, -104, -96, -90, 43, 20, 42, -15, 73, -115, -31, 52, 109, 22, -107, -12, -22, 73, -1, -1, -1, -1, 3, -24, 3, 0, 0, 0, 0, 0, 0, 105, 81, 33, 2, 43, -50, 71, -61, 48, 27, 91, -74, 49, 104, -36, -50, -112, -5, -124, -104, -96, -90, 43, 20, 42, -15, 73, -115, -31, 52, 109, 22, -107, -12, -22, 73, 33, 3, 32, -96, -34, 54, 12, -62, -82, -122, 114, -37, 125, 85, 112, -122, -92, -25, -56, -20, -96, 98, -64, -91, -92, -70, -103, 34, -34, -32, -86, -49, 62, 18, 33, 3, 31, 82, 84, 37, 123, 34, 118, 101, 114, 34, 58, 49, 44, 34, 97, 117, 116, 104, 34, 58, 34, 48, 34, 44, 34, 116, 105, 116, 108, 101, 34, 58, 83, -82, 0, 0, 0, 0, 0, 0, 0, 0, 11, 106, 9, 34, -28, -70, -111, -27, -67, -87, 34, 125, -41, 89, 0, 0, 0, 0, 0, 0, 25, 118, -87, 20, -37, 44, -13, -27, -120, -26, -73, -117, -78, -66, 16, 126, -25, -60, 63, 116, -21, 110, 98, -5, -120, -84, 0, 0, 0, 0]
00f4dea07b3e6c022111890337bad38bdfe9f32cf49a88aa4ccdaf4663a93444, [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 73, 3, -66, 20, 8, 4, 5, -51, 52, 91, 47, 66, 84, 80, 79, 79, 76, 47, -6, -66, 109, 109, 81, -96, 46, 68, 80, -72, 106, 122, -89, -7, -92, 24, -119, 116, -69, 16, -59, 113, 47, -77, 19, -43, 51, -126, 108, -114, -11, 47, 53, 67, -47, 76, 1, 0, 0, 0, 0, 0, 0, 0, 2, -104, -74, -71, 34, -121, 30, 0, 0, 0, 0, 0, -1, -1, -1, -1, 2, 110, -27, 103, 75, 0, 0, 0, 0, 25, 118, -87, 20, 89, 88, -30, -89, 18, -99, -49, 42, -60, -111, 101, 7, 77, -94, -43, 30, -61, -72, 64, 127, -120, -84, 0, 0, 0, 0, 0, 0, 0, 0, 38, 106, 36, -86, 33, -87, -19, 60, 117, -11, -34, 24, 25, 9, -112, -60, 37, -94, 77, -21, 49, -5, 56, 71, -91, -90, 104, -127, -123, 48, 63, 72, -15, -3, 65, -46, 79, -31, -42, 0, 0, 0, 0]
8c10fcb553dd0cc29b3fb16afbc68b903a298ae4ce8856af688a94012c019af0, [2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 75, 3, -102, 13, 8, 4, 95, 87, 37, 91, 101, 47, 66, 84, 67, 46, 67, 79, 77, 47, -6, -66, 109, 109, -78, 68, 93, -116, 9, 48, 53, -66, -79, 125, -6, -118, -100, 53, 88, 85, 86, 32, 20, 76, 35, 46, -34, -19, -100, -80, 96, -98, -115, 37, 51, 23, 1, 0, 0, 0, 0, 0, 0, 0, 1, -45, 63, -119, -50, -64, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 2, -99, -40, -40, 74, 0, 0, 0, 0, 25, 118, -87, 20, 120, -50, 72, -8, -116, -108, -33, 55, 98, -38, -119, -36, -124, -104, 32, 83, 115, -88, -50, 111, -120, -84, 0, 0, 0, 0, 0, 0, 0, 0, 38, 106, 36, -86, 33, -87, -19, 22, 75, -49, 51, -28, -76, -120, -75, -64, 47, 103, -83, -40, 46, -38, 69, 113, -101, 59, 39, 36, -123, -89, -44, 28, -59, -106, -99, -40, 8, 115, 25, 0, 0, 0, 0]
d89c1b402c32b982a2f5b98ce60d8afca76453b635d40a9fc1d398d517b85565, [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 37, 3, -9, 18, 8, 24, 77, 105, 110, 101, 100, 32, 98, 121, 32, 65, 110, 116, 80, 111, 111, 108, 54, 49, 54, 32, 91, 48, -104, -126, 14, 0, 0, 0, 0, 12, 42, 31, -1, -1, -1, -1, 2, -31, 10, -63, 74, 0, 0, 0, 0, 25, 118, -87, 20, -19, -15, 10, 127, -84, 107, 50, -30, 77, -86, 83, 5, -57, 35, -13, -34, 88, -37, 27, -56, -120, -84, 0, 0, 0, 0, 0, 0, 0, 0, 38, 106, 36, -86, 33, -87, -19, 119, 9, -109, -80, 20, -110, -87, -99, 53, 42, -81, 19, -56, 70, -51, 46, -48, -103, -67, -76, 1, 28, 68, -107, -122, 46, -11, 126, -27, -63, 100, -102, 0, 0, 0, 0]
8ae378b353ea924ced7c773043c51e6055cb71ac96adc131eb59e8ad52509b5b, [2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 75, 3, 39, 19, 8, 4, 92, -6, 48, 91, 100, 47, 66, 84, 67, 46, 67, 79, 77, 47, -6, -66, 109, 109, -1, -16, 100, -13, -51, 86, 63, -81, -103, -85, -49, 98, 45, 68, 118, -69, 104, 83, -30, -69, 60, 69, 79, 2, -82, -97, -95, 120, 51, 50, 79, -65, 1, 0, 0, 0, 0, 0, 0, 0, 70, 1, -84, 85, -87, 1, 0, 96, 0, 0, 0, 0, -1, -1, -1, -1, 2, 118, -58, 11, 75, 0, 0, 0, 0, 25, 118, -87, 20, 120, -50, 72, -8, -116, -108, -33, 55, 98, -38, -119, -36, -124, -104, 32, 83, 115, -88, -50, 111, -120, -84, 0, 0, 0, 0, 0, 0, 0, 0, 38, 106, 36, -86, 33, -87, -19, -10, 54, -25, -64, 49, 90, -62, -59, -71, -91, -32, -9, 4, -30, -84, -63, 119, -23, 118, -89, 33, 112, -69, 14, 78, 19, 64, -59, 63, -72, 43, -77, 0, 0, 0, 0]
dbd146e8965ce07fb89c5b727e30dc835a16ab529f78888be5f0dd9bd538bfa2, [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 85, 3, 105, 20, 8, 65, -42, -51, 5, 2, -63, -63, -37, 65, -42, -51, 5, 2, -127, -96, -76, 47, 66, 84, 67, 46, 84, 79, 80, 47, -6, -66, 109, 109, 57, 106, -81, -32, 80, 11, 1, -102, -109, 107, -50, 57, 51, -98, -113, -114, -106, 78, -25, -65, -84, -4, 65, 19, -111, -29, 73, -128, -128, -21, -124, 109, -128, 0, 0, 0, 0, 0, 0, 0, -14, 0, 37, 11, -106, -123, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 2, -126, -99, -8, 75, 0, 0, 0, 0, 25, 118, -87, 20, -70, 80, 123, -82, -113, 22, 67, -46, 85, 96, 0, -54, 38, -71, 48, 27, -112, 105, -36, 107, -120, -84, 0, 0, 0, 0, 0, 0, 0, 0, 38, 106, 36, -86, 33, -87, -19, -49, -48, 21, -97, -27, -127, -29, -54, -96, -104, 8, 109, 71, -42, 100, 72, -95, 102, -64, 44, -56, 85, 101, 99, -106, -67, 105, -52, 118, 39, -91, -100, 0, 0, 0, 0]
ec8acb8c26c25b34cf06e5e084cd8d8ded51cdd4e5fb0755d90461170a706e37, [2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 75, 3, 122, 21, 8, 4, -118, -128, 54, 91, 98, 47, 66, 84, 67, 46, 67, 79, 77, 47, -6, -66, 109, 109, -45, -68, -120, 66, 9, -91, 22, 112, 125, 118, -105, 54, 49, -83, 23, -56, 73, 77, -16, -102, 41, 71, -58, 66, -121, -60, -27, 81, 73, -109, 79, 54, 1, 0, 0, 0, 0, 0, 0, 0, 41, 47, -19, -46, -81, 121, 1, 0, 0, 0, 0, 0, -1, -1, -1, -1, 3, 59, -58, 10, 77, 0, 0, 0, 0, 25, 118, -87, 20, 120, -50, 72, -8, -116, -108, -33, 55, 98, -38, -119, -36, -124, -104, 32, 83, 115, -88, -50, 111, -120, -84, 0, 0, 0, 0, 0, 0, 0, 0, 38, 106, 36, -86, 33, -87, -19, 57, 7, -5, 51, -123, -75, -95, 31, -17, 87, -64, -14, -83, -95, 88, -82, 45, 41, 79, 17, 93, -10, 85, 8, 42, 84, 110, -56, 36, 50, -100, 74, 0, 0, 0, 0, 0, 0, 0, 0, 41, 82, 83, 75, 66, 76, 79, 67, 75, 58, 109, -56, 11, -48, 41, -7, -77, 25, 30, -18, -105, 76, -74, -21, 81, 73, 109, -77, 50, 83, -33, -13, 126, -101, -71, 0, 84, 28, -35, 16, 34, -77, 0, 0, 0, 0]
955d4c70128f3bbf319bff79a2521c8ebde08644ae41d625098ba84e073fb3b0, [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 69, 3, 99, 16, 8, -6, -66, 109, 109, 17, 62, 101, -17, -85, 61, 68, -23, 30, 18, 11, -96, 54, 108, 39, 9, 70, -81, 111, -58, -36, -68, 104, -108, -62, 40, 32, -31, -111, -53, 126, 115, 1, 0, 0, 0, 0, 0, 0, 0, 6, 101, 5, 1, 109, 46, -36, -23, 54, 0, 0, -69, 102, 5, 47, 115, 108, 117, 115, 104, 47, 0, 0, 0, 0, 3, 73, -2, -112, 80, 0, 0, 0, 0, 25, 118, -87, 20, 124, 21, 78, -47, -36, 89, 96, -98, 61, 38, -85, -78, -33, 46, -93, -43, -121, -51, -116, 65, -120, -84, 0, 0, 0, 0, 0, 0, 0, 0, 44, 106, 76, 41, 82, 83, 75, 66, 76, 79, 67, 75, 58, -10, -119, -29, 105, 123, -111, -48, -72, -69, -92, -77, 20, -4, 61, -102, 79, 55, 21, -66, 71, 49, 45, 23, -70, 82, 28, 110, -16, 124, -110, -83, -10, 0, 0, 0, 0, 0, 0, 0, 0, 38, 106, 36, -86, 33, -87, -19, -7, 17, -39, 125, -30, -74, -38, -105, 95, 30, 77, 115, 27, -96, -99, 16, -84, -110, 55, -48, 117, -43, 4, 45, 117, 106, -11, 58, 9, -50, 34, 49, 0, 0, 0, 0]

Parse payload in *Message classes

There are objects like Transaction, MerkleBlock that can parse payload. This logic should be moved to the appropriate Message classes. See iOS code for reference.

PeerConnection: Peer connection exception

10-12 18:33:36.220 26877-30345/bitcoin.wallet.kit E/PeerConnection: Peer connection exception.
bitcoin.wallet.kit.blocks.validators.BlockValidatorException$NotEqualBits: Not Equal Bits
at bitcoin.wallet.kit.blocks.validators.BlockValidator.validateBits(BlockValidator.kt:75)
at bitcoin.wallet.kit.blocks.validators.BlockValidator.validate(BlockValidator.kt:15)
at bitcoin.wallet.kit.network.TestNet.validateBlock(TestNet.kt:41)
at bitcoin.wallet.kit.headers.HeaderHandler.handle(HeaderHandler.kt:25)
at bitcoin.wallet.kit.managers.Syncer.onReceiveHeaders(Syncer.kt:44)
at bitcoin.wallet.kit.network.PeerGroup.onReceiveHeaders(PeerGroup.kt:181)
at bitcoin.wallet.kit.network.Peer.onMessage(Peer.kt:78)
at bitcoin.wallet.kit.network.PeerConnection.run(PeerConnection.kt:66)

Peer Validations

Disconnect peer if:

  • It has expired blockchain
  • It doesn't respond with requested merkle block
  • Timeout

Large Realm file size

Realm db size is too large. There are 2 ways for solving this issue:

  1. Automatically compact realm db size on realm launch
  2. Manually compact realm db size

Manual compacting requires db file to be closed. We cannot use this method at this time, since we are holding open realm instance to listen for updates.

Automatic compacting increases app launch time. In addition it doesn't solve the issue when app is working.

Request for receive address crashes app

When initial syncer is not started requesting for receive address crashes app

Solution:

  1. Need to generate public keys once the BitcoinKit is created
  2. In InitialSyncer insert or update generated keys

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.