• Forum has been upgraded, all links, images, etc are as they were. Please see Official Announcements for more information

Android Wallet

HashEngineering

Well-known member
Hash Engineering Solutions is still working on a standalone Android Wallet that is forked from the Bitcoin Wallet by Andreas Schildbach.

Beta Program here for the Dash Wallet with some InstantX support (use at your own risk, with small amounts of coins):
https://play.google.com/apps/testing/hashengineering.darkcoin.wallet
https://github.com/HashEngineering/darkcoin-wallet/releases/tag/v4.0-beta2 (March 28)

If you have problems, send in a report.

This wallet has presented some new challenges (success in green):
1. The X11 hash algorithm - We have successfully implemented this in Java and Natively.
2. The Dark Gravity Wave difficulty adjustment - Tested until current block
3. DarkSend - We think this feature could be added to the Android Wallet. We intend to work on this.
4. InstantX - Work has begun on this feature.

Status:

Wallet currently syncs to the current block. Some users are reporting missing transactions that are fixable by a blockchain reset.

Source code:
https://github.com/HashEngineering/darkcoinj (Darkcoin Java Library)
https://github.com/HashEngineering/darkcoin-wallet (Darkcoin Wallet)
Change Log:
v4.0 - Beta - PIN code - Paper Wallet Sweep - some InstantX
v1.1 - Rebrand for Dash
v1.0.8 - Added bloom filter support
v1.0.7 - updated checkpoints
v1.0.0 - Added DNS Seeds (for more connections)
v0.1.2 - update for RC3 (added testnet as separate app)
v0.1.1 - update to latest icons (renamed to "Darkcoin (beta)")
v0.1.0 - first beta version

Downloads for Main Net
https://github.com/HashEngineering/darkcoin-wallet/releases - All Releases
https://play.google.com/store/apps/details?id=hashengineering.darkcoin.wallet
Downloads for Test Net
Not Available

Statistics (Google Play)
Current Installs: 427
Total Installs: 508
Reviews: 17
Score: 4.53
 
Last edited by a moderator:
I have encountered a strange problem when syncing the blockchain. After translating the C++ code (from 2 days ago) to Java, I was getting stuck at block 45,000. However, I was using DarkGravityWave (version 1) after block 34140 because I copied this function from another coin. When I fixed the DarkGravityWave to match the C++ source (then it was version 2) and it got stuck at block 34140.

After looking at the github, it seems that previously the fork at 34140 was using DGW v1, followed by DGW v2 at 45,000; although the current source says to use DGW v2 at 34140 and DGW v3 at 68589 as from the code below:

Code:
unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock)
{
        int DiffMode = 1;
        if (fTestNet) {
            if (pindexLast->nHeight+1 >= 16) { DiffMode = 4; }
        }
        else {
            if (pindexLast->nHeight+1 >= 68589) { DiffMode = 4; }
            else if (pindexLast->nHeight+1 >= 34140) { DiffMode = 3; }
            else if (pindexLast->nHeight+1 >= 15200) { DiffMode = 2; }
        }

        if (DiffMode == 1) { return GetNextWorkRequired_V1(pindexLast, pblock); }
        else if (DiffMode == 2) { return GetNextWorkRequired_V2(pindexLast, pblock); }  // KGW
        else if (DiffMode == 3) { return DarkGravityWave(pindexLast, pblock); }  //Version 2
        else if (DiffMode == 4) { return DarkGravityWave3(pindexLast, pblock); } // Version 3
        return DarkGravityWave3(pindexLast, pblock);
}

This method in the C++ code does refer to block 45000 as a fork, though it is not referenced above.
Code:
bool CBlock::AcceptBlock(CValidationState &state, CDiskBlockPos *dbp)

Can someone tell me what I am missing here?
 
I think you should ask Evan directly. He does look at his messages at bitcointalk, and probably here too (eduffield) The wallet compatibility source needed for the upcoming MasterNode payments is available on github, (see developer announcement) but DArkSend itself is not available open source yet (no problem for an interim wallet though)

Just something you need to be aware of since you're making an android wallet. The plan is to have the blockchain hosted by Masternodes, and now possibly any wallet who wants to host it, so that the default wallet will one day be a "lite" wallet, probably grabbing a section of the last part of the blockchain to function, if needed, from a parallel network of blockchain hosts, that are also decentralized. Not being a programmer, I don't know how this would impact your Android wallet, but just so you know it's probably coming.

Also, finally, yes, there is a pretty decent bounty for an android wallet, only I don't currently have the link (plus the amount has probably increased a bit since it's last posting) I hope you succeed with it, it would be awesome!
 
I have encountered a strange problem when syncing the blockchain. After translating the C++ code (from 2 days ago) to Java, I was getting stuck at block 45,000. However, I was using DarkGravityWave (version 1) after block 34140 because I copied this function from another coin. When I fixed the DarkGravityWave to match the C++ source (then it was version 2) and it got stuck at block 34140.

After looking at the github, it seems that previously the fork at 34140 was using DGW v1, followed by DGW v2 at 45,000; although the current source says to use DGW v2 at 34140 and DGW v3 at 68589 as from the code below:

Can someone tell me what I am missing here?

Very exciting!

DGW v1 and v2 have some weird issues with difference architectures syncing. These problems were finally fixed in V3, but it requires this code below to sync. It's too bad, during that period of time, some amount of fuzzy matching + checkpoints will be required. But it's fixed in the new version, so after that it'll return to the normal rules.

Looking forward to the wallet!

Code:
            #ifdef _WIN32
                // Check proof of work      
                if(nHeight >= 34140){
                    unsigned int nBitsNext = GetNextWorkRequired(pindexPrev, this);
                    double n1 = ConvertBitsToDouble(nBits);
                    double n2 = ConvertBitsToDouble(nBitsNext);

                    if (nHeight <= 45000) {
                        if (abs(n1-n2) > n1*0.2) 
                            return state.DoS(100, error("AcceptBlock() : incorrect proof of work (DGW pre-fork)"));
                    } else {
                        if (abs(n1-n2) > n1*0.005) 
                            return state.DoS(100, error("AcceptBlock() : incorrect proof of work (DGW2)"));
                    }
                } else {
                    if (nBits != GetNextWorkRequired(pindexPrev, this))
                        return state.DoS(100, error("AcceptBlock() : incorrect proof of work"));
                }
            #else
                // Check proof of work
                if(nHeight >= 34140 && nHeight <= 45000){
                    unsigned int nBitsNext = GetNextWorkRequired(pindexPrev, this);
                    double n1 = ConvertBitsToDouble(nBits);
                    double n2 = ConvertBitsToDouble(nBitsNext);
                    if (abs(n1-n2) > n1*0.2)
                        return state.DoS(100, error("AcceptBlock() : incorrect proof of work (DGW pre-fork)"));
                } else {
                    if (nBits != GetNextWorkRequired(pindexPrev, this))
                        return state.DoS(100, error("AcceptBlock() : incorrect proof of work"));
                }
            #endif
 
I'm looking forward to your wallet as well. It'll be installed on my Note II(And a few friend's phones) the moment I notice it being available. I will send you a donation as soon as this as wel. If you've a DRK address already, don't hesitate to post it as I'm sure there are a few whom wouldn't mind donating to ye for your work.

EDIT: Sorry, I didn't notice your sig with the DRK address, lol.
 
Last edited by a moderator:
Very exciting!

DGW v1 and v2 have some weird issues with difference architectures syncing. These problems were finally fixed in V3, but it requires this code below to sync. It's too bad, during that period of time, some amount of fuzzy matching + checkpoints will be required. But it's fixed in the new version, so after that it'll return to the normal rules.

Looking forward to the wallet!

Thanks for the code snippet. After adding what was contained in AcceptBlock, I was able to sync to block 46227. At this block I am getting a different difficulty that is 1.00005 times lower than the actual difficulty. This corresponds to a something like 1 second difference in the nActualTimespan. Maybe it is a rounding error or a translation mistake. Strangely, I was able to get the DarkGravityWave Version 2 to work in another coin. I will probably figure out the problem another day.
 
I have found the problem, but not a solution. The math for diff calculation fails because my code calculates nBlockTimeAverage as 125 instead of 136 based on adding some logging to the DarkCoin client and looking at the debug out put for 46227. More will need to be done to determine the root cause. All other numbers calculated by DarkGravityWave match up against the official version.

UPDATE: this is a rather challenging bug. The above statements turned out be wrong, so I am continuing to analyze how the darkcoin client handles block 46227 to see why the app fails to verify the difficulty.
 
Last edited by a moderator:
I got it working my using the _WIN32 code above (even though this is Java), but I am using a Windows machine. When the app is built and running on android, it may not work depending on which CPU is being used.

I assume that the differences between systems is due to floating point differences.
 
Last edited by a moderator:
Unfortunately with the TestNet, there was a bug found when downloading the headers. For some reason the 18th header is not null terminated. Either the incoming data is broken or there is a bug in the data parsing (probably the latter). I will use the testnet block explorer to see if the data is coming in correctly.
 
For some reason, when the app on the testnet receives the "headers" message, there is an extra byte or missing byte of data between the 16th block and 17th block. That ruins the data of the 17th block:

For instance this changes the prev hash value:
Code:
bad:   0000ab6ae22728c701e15a13dfa022c88f17a4e0fd71f073b0a720229de22b00
real:  000000ab6ae22728c701e15a13dfa022c88f17a4e0fd71f073b0a720229de22b
The version of the 17th block should be 2 (0x0002), but instead is 512 (0x0200), etc...

At this point I don't know how to fix it. Strangely, when connected to the mainnet, the app can sync all the way to the last block. To verify things, I also put the Darkcoin client in TestNet mode, but it has not yet been able to sync.
 
Just realized that there have been many changes to the code on the github account. That may be why the testnet doesn't work, need to update the android code and see what happens.
 
Back
Top