Bitcoin Forum
May 11, 2024, 08:18:54 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 2 [3] 4 5 »  All
  Print  
Author Topic: [BOUNTY] fix mobile WLCj wallet for android  (Read 7343 times)
hexafraction
Sr. Member
****
Offline Offline

Activity: 392
Merit: 259

Tips welcomed: 1CF4GhXX1RhCaGzWztgE1YZZUcSpoqTbsJ


View Profile
August 21, 2015, 01:15:16 PM
 #41

So it seems the merge mining information can not be found mmBlock == null returns true.

I dont know why but the c++ wallet somehow handles the newly generated blocks in another way than namecoin and devcoin.

Are you sure that the last block is specifically merge-mined? Having merge mined data isn't a requirement for a block to be valid.

I have recently become active again after a long period of inactivity. Cryptographic proof that my account has not been compromised is available.
1715458734
Hero Member
*
Offline Offline

Posts: 1715458734

View Profile Personal Message (Offline)

Ignore
1715458734
Reply with quote  #2

1715458734
Report to moderator
1715458734
Hero Member
*
Offline Offline

Posts: 1715458734

View Profile Personal Message (Offline)

Ignore
1715458734
Reply with quote  #2

1715458734
Report to moderator
The Bitcoin network protocol was designed to be extremely flexible. It can be used to create timed transactions, escrow transactions, multi-signature transactions, etc. The current features of the client only hint at what will be possible in the future.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
hexafraction
Sr. Member
****
Offline Offline

Activity: 392
Merit: 259

Tips welcomed: 1CF4GhXX1RhCaGzWztgE1YZZUcSpoqTbsJ


View Profile
August 21, 2015, 01:43:13 PM
Last edit: August 21, 2015, 01:54:45 PM by hexafraction
 #42

Nope, my previous reply was bogus. However, I also got the chain to sync 100% without errors using another fix.

Code:
09:37:39 15 DownloadListener.progress: Chain download 100% done with 0 blocks to go, block date Aug 21, 2015 9:12:56 AM

The issue was in the constructor of AbstractBlockChain$OrphanBlock:

Code:
 if (!shouldVerifyTransactions())
                this.block = block.cloneAsHeader();
            else
                this.block = block;

This optimization is invalid for merged mining since it will wipe out ALL of the merged mining data. A naive fix is to simply change it to this.block = block in ALL cases, but this will keep a bunch of payload data nobody cares around in many cases. There's a better solution that I'm testing right now.

Edit: I've tested my solution and it seems to work properly. To integrate it:

1) Don't change OrphanBlock from the original. Keep that if-statement.

2) Add the following to BlockMergeMined:

Code:
    public BlockMergeMined cloneAsHeader(Block mainBlock){
        BlockMergeMined bmm = new BlockMergeMined(this.params, null, 0, mainBlock);
        bmm.payload = this.payload;
        return bmm;
    }

3) Replace cloneAsHeader in Block with:

Code:
    public Block cloneAsHeader() {
        maybeParseHeader();
        Block block = new Block(params);
        block.nonce = nonce;
        block.prevBlockHash = prevBlockHash.duplicate();
        block.merkleRoot = getMerkleRoot().duplicate();
        block.version = version;
        block.time = time;
        block.difficultyTarget = difficultyTarget;
        block.transactions = null;
        block.hash = getHash().duplicate();
        if(mmBlock!=null)
            block.mmBlock = mmBlock.cloneAsHeader(block);
        return block;
    }

I've tested this with a successful sync up to 22397 (the latest block at the time).

Edit: I've synced up and am able to process new blocks successfully as they come in.

I have recently become active again after a long period of inactivity. Cryptographic proof that my account has not been compromised is available.
rik8119 (OP)
Full Member
***
Offline Offline

Activity: 217
Merit: 100

CEO WINC e. V.


View Profile
August 21, 2015, 02:06:30 PM
 #43

Awesome! I wish i had a portion of that skill of yours. The last step will be to get the wallet onto the phone. It is stll crashing at 10k, hmm..

Demurrage - the easiest way to a human society.
hexafraction
Sr. Member
****
Offline Offline

Activity: 392
Merit: 259

Tips welcomed: 1CF4GhXX1RhCaGzWztgE1YZZUcSpoqTbsJ


View Profile
August 21, 2015, 02:08:01 PM
 #44

Would you mind sharing the logcat and errors at the stage where it crashes? I'm going to try to get this to build and run on my phone soon.

I have recently become active again after a long period of inactivity. Cryptographic proof that my account has not been compromised is available.
rik8119 (OP)
Full Member
***
Offline Offline

Activity: 217
Merit: 100

CEO WINC e. V.


View Profile
August 21, 2015, 02:18:51 PM
 #45

Yes sure,
it is giving me a Java heap space error when running with that new code hm, did i set something wrong?

Code:
New block: 18539:2830f1d3fe790817ff4703373c2689eaa65470553ed254041e673904dfc1655d
04:14:34 13 AbstractBlockChain.add: 6 blocks per second
New block: 18540:c967137ed7a6affd2618b64ae23339e4b1281c5dbc82dac9bea00a3c0a972f86
Peer #1 disconnected: [127.0.0.1]:55889
04:14:36 13 PeerGroup.handlePeerDeath: [127.0.0.1]:55889: Peer died
04:14:36 11 PeerGroup.connectToAnyPeer: Waiting 1000 msec before next connect attempt
04:14:36 13 PeerGroup.handlePeerDeath: [127.0.0.1]:55889: Peer died
04:14:36 13 PeerGroup.handlePeerDeath: Download peer died. Picking a new one.
04:14:36 13 PeerGroup.setDownloadPeer: Unsetting download peer: [127.0.0.1]:55889
04:14:37 11 PeerGroup.connectToAnyPeer: Waiting 2250 msec before next connect attempt
Peer #0 disconnected: [127.0.0.1]:55889
Exception in thread "NioClientManager" java.lang.OutOfMemoryError: Java heap space
at org.bitcoinj.core.Utils.copyOf(Utils.java:457)

Demurrage - the easiest way to a human society.
hexafraction
Sr. Member
****
Offline Offline

Activity: 392
Merit: 259

Tips welcomed: 1CF4GhXX1RhCaGzWztgE1YZZUcSpoqTbsJ


View Profile
August 21, 2015, 02:24:33 PM
 #46

That means it ran out of memory. What device are you running it on?

I have a fairly high-end Android I can test it on, to see if it's just a need for resources, or an actual bug. Can you send me an APK file?

I have recently become active again after a long period of inactivity. Cryptographic proof that my account has not been compromised is available.
rik8119 (OP)
Full Member
***
Offline Offline

Activity: 217
Merit: 100

CEO WINC e. V.


View Profile
August 21, 2015, 02:29:44 PM
 #47

The error above is from intellij on my phone it is crashing at block 10k already.

Download is here: http://www.winc-ev.org/english/downloads-contact/

Demurrage - the easiest way to a human society.
hexafraction
Sr. Member
****
Offline Offline

Activity: 392
Merit: 259

Tips welcomed: 1CF4GhXX1RhCaGzWztgE1YZZUcSpoqTbsJ


View Profile
August 21, 2015, 02:42:59 PM
Last edit: August 21, 2015, 02:54:35 PM by hexafraction
 #48

My phone made it past 10k, and is around 17k and syncing right now. I'll continue testing with adb.

Edit: I've fetched up to the second to last block. Was this version built before my last change?

I have recently become active again after a long period of inactivity. Cryptographic proof that my account has not been compromised is available.
rik8119 (OP)
Full Member
***
Offline Offline

Activity: 217
Merit: 100

CEO WINC e. V.


View Profile
August 21, 2015, 05:22:09 PM
Last edit: August 21, 2015, 06:38:57 PM by rik8119
 #49

My phone made it past 10k, and is around 17k and syncing right now. I'll continue testing with adb.

Edit: I've fetched up to the second to last block. Was this version built before my last change?

Hmm this apk included the changes in Transaction.java in BlockMergedMining.java and in Block.java

EDIT: I put another .5 BTC and 400 WLC to the bounty

Demurrage - the easiest way to a human society.
achow101
Staff
Legendary
*
Offline Offline

Activity: 3388
Merit: 6635


Just writing some code


View Profile WWW
August 21, 2015, 08:31:33 PM
Last edit: August 21, 2015, 08:42:43 PM by knightdk
 #50

My phone made it past 10k, and is around 17k and syncing right now. I'll continue testing with adb.

Edit: I've fetched up to the second to last block. Was this version built before my last change?
you should just commit the changes to github and submit him a pull request to make sure that the changes are correct.

I will also test the app on my phone.

Edit: just ran the app and there were no errors.

hexafraction
Sr. Member
****
Offline Offline

Activity: 392
Merit: 259

Tips welcomed: 1CF4GhXX1RhCaGzWztgE1YZZUcSpoqTbsJ


View Profile
August 21, 2015, 08:43:50 PM
 #51

My phone made it past 10k, and is around 17k and syncing right now. I'll continue testing with adb.

Edit: I've fetched up to the second to last block. Was this version built before my last change?
you should just commit the changes to github and submit him a pull request to make sure that the changes are correct.

I will also test the app on my phone.

Edit: just ran the app and there were no errors.

My working copy is a mess due to debugging code. I'd need to redo many of the changes cleanly to make a PR.

I have recently become active again after a long period of inactivity. Cryptographic proof that my account has not been compromised is available.
achow101
Staff
Legendary
*
Offline Offline

Activity: 3388
Merit: 6635


Just writing some code


View Profile WWW
August 21, 2015, 08:51:38 PM
 #52

My phone made it past 10k, and is around 17k and syncing right now. I'll continue testing with adb.

Edit: I've fetched up to the second to last block. Was this version built before my last change?
you should just commit the changes to github and submit him a pull request to make sure that the changes are correct.

I will also test the app on my phone.

Edit: just ran the app and there were no errors.

My working copy is a mess due to debugging code. I'd need to redo many of the changes cleanly to make a PR.
When I get to my computer I can make all the changes she submit the PR. My code is relatively clean and I can do it quickly.

hexafraction
Sr. Member
****
Offline Offline

Activity: 392
Merit: 259

Tips welcomed: 1CF4GhXX1RhCaGzWztgE1YZZUcSpoqTbsJ


View Profile
August 21, 2015, 08:56:58 PM
 #53

My phone made it past 10k, and is around 17k and syncing right now. I'll continue testing with adb.

Edit: I've fetched up to the second to last block. Was this version built before my last change?
you should just commit the changes to github and submit him a pull request to make sure that the changes are correct.

I will also test the app on my phone.

Edit: just ran the app and there were no errors.

My working copy is a mess due to debugging code. I'd need to redo many of the changes cleanly to make a PR.
When I get to my computer I can make all the changes she submit the PR. My code is relatively clean and I can do it quickly.

Awesome, thanks! Just to confirm, with an up to date android build, you can sync to the last (not second to last) block? In that case, should we begin testing with real coins and various transaction patterns?

I have recently become active again after a long period of inactivity. Cryptographic proof that my account has not been compromised is available.
achow101
Staff
Legendary
*
Offline Offline

Activity: 3388
Merit: 6635


Just writing some code


View Profile WWW
August 21, 2015, 09:06:35 PM
 #54

My phone made it past 10k, and is around 17k and syncing right now. I'll continue testing with adb.

Edit: I've fetched up to the second to last block. Was this version built before my last change?
you should just commit the changes to github and submit him a pull request to make sure that the changes are correct.

I will also test the app on my phone.

Edit: just ran the app and there were no errors.

My working copy is a mess due to debugging code. I'd need to redo many of the changes cleanly to make a PR.
When I get to my computer I can make all the changes she submit the PR. My code is relatively clean and I can do it quickly.

Awesome, thanks! Just to confirm, with an up to date android build, you can sync to the last (not second to last) block? In that case, should we begin testing with real coins and various transaction patterns?
It loads all the way.

hexafraction
Sr. Member
****
Offline Offline

Activity: 392
Merit: 259

Tips welcomed: 1CF4GhXX1RhCaGzWztgE1YZZUcSpoqTbsJ


View Profile
August 21, 2015, 09:14:59 PM
 #55

Awesome, thanks. I'll try building on my own machine again soon. Are you building against API level 14, as per the pom.xml?

I have recently become active again after a long period of inactivity. Cryptographic proof that my account has not been compromised is available.
achow101
Staff
Legendary
*
Offline Offline

Activity: 3388
Merit: 6635


Just writing some code


View Profile WWW
August 21, 2015, 09:40:53 PM
 #56

Awesome, thanks. I'll try building on my own machine again soon. Are you building against API level 14, as per the pom.xml?
I just used the version on his site with a logcat app and I did not see any errors. The github for the app has not been updated for a few days. Doesn't the pom.xml need to be changed to use wlcj and not namecoinj?

He also already committed the changes to wlcj so I won't submit a PR.

rik8119 (OP)
Full Member
***
Offline Offline

Activity: 217
Merit: 100

CEO WINC e. V.


View Profile
August 21, 2015, 09:43:47 PM
 #57

I uploaded all changes on github -namecoinj. Is there a way to get the android build up to date on my s3 mini without rooting?

Demurrage - the easiest way to a human society.
achow101
Staff
Legendary
*
Offline Offline

Activity: 3388
Merit: 6635


Just writing some code


View Profile WWW
August 21, 2015, 09:44:55 PM
 #58

I uploaded all changes on github -namecoinj. Is there a way to get the android build up to date on my s3 mini without rooting?
Install the apk. How have you been testing it?

rik8119 (OP)
Full Member
***
Offline Offline

Activity: 217
Merit: 100

CEO WINC e. V.


View Profile
August 21, 2015, 09:50:42 PM
 #59

I uploaded all changes on github -namecoinj. Is there a way to get the android build up to date on my s3 mini without rooting?
Install the apk. How have you been testing it?

I just run it on my phone but the wallet stops syncing somewhere. At first it crashes at block 10k then it loads some more until it stops completely at some block (11964). Always producing ouOfMemoryError s. I will test installing the apk tomorrow see you then...

Demurrage - the easiest way to a human society.
achow101
Staff
Legendary
*
Offline Offline

Activity: 3388
Merit: 6635


Just writing some code


View Profile WWW
August 21, 2015, 09:52:52 PM
 #60

I uploaded all changes on github -namecoinj. Is there a way to get the android build up to date on my s3 mini without rooting?
Install the apk. How have you been testing it?

I just run it on my phone but the wallet stops syncing somewhere. At first it crashes at block 10k then it loads some more until it stops completely at some block (11964). Always producing ouOfMemoryError s. I will test installing the apk tomorrow see you then...
It is possible that your phone simply doesn't have enough RAM and thus can't run the app.

Pages: « 1 2 [3] 4 5 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!