[Project] Android Mobile Wallet

I store full pruned blockchain so I store block with unspent transactions… (in H2 database)

How do you compute this number
if it is an offset of txPrev inside block?

txindex.pos.nTxPos - txindex.pos.nBlockPos

Can you show me on an example maybe that would be better

Add offsetInBlock member to Transaction.class and modify constructor to take offsetInBlock as additional param and set member.
https://github.com/bitcoinj/bitcoinj/blob/master/core/src/main/java/com/google/bitcoin/core/Transaction.java#L191

    public Transaction(NetworkParameters params, byte[] payload, int offset, @Nullable Message parent, boolean parseLazy, boolean parseRetain, int length, int offsetInBlock)
            throws ProtocolException {
        super(params, payload, offset, parent, parseLazy, parseRetain, length);
        this.offsetInBlock = offsetInBlock
    }

Use it here
https://github.com/bitcoinj/bitcoinj/blob/master/core/src/main/java/com/google/bitcoin/core/Block.java#L216

            Transaction tx = new Transaction(params, payload, cursor, this, parseLazy, parseRetain, UNKNOWN_LENGTH, cursor - offset);

More to code w/ database, good luck.

Edit: setter after super()

will do captain :wink:

Thank you

I will post what I figured out to see if I am correct

txPrev is a previous transaction which can be found by prevout hash

Transaction has hash in bitcoinj here
https://github.com/bitcoinj/bitcoinj/blob/master/core/src/main/java/com/google/bitcoin/core/Transaction.java#L116

and prevout hash is here
https://github.com/bitcoinj/bitcoinj/blob/master/core/src/main/java/com/google/bitcoin/core/TransactionOutPoint.java#L40

what is this?
int64 nValueIn = txPrev.vout[prevout.n].nValue;
https://github.com/ppcoin/ppcoin/blob/master/src/kernel.cpp#L324

this
https://github.com/bitcoinj/bitcoinj/blob/master/core/src/main/java/com/google/bitcoin/core/TransactionOutput.java#L166

https://github.com/ppcoin/ppcoin/blob/master/src/kernel.cpp#L346
ss << nTimeBlockFrom << nTxPrevOffset << txPrev.nTime << prevout.n << nTimeTx;
hashProofOfStake = Hash(ss.begin(), ss.end());

this is

can I just use this from comment
hash(nStakeModifier + txPrev.block.nTime + txPrev.offset + txPrev.nTime + txPrev.vout.n + nTime)

and that should be it :slight_smile:

nEntropyBit = ((GetHash().Get64()) & 1llu);

long lastBit = newBlock.getHeader().getScryptHash().toBigInteger().and(BigInteger.ONE).longValue();
newBlock.setEntropyBit(lastBit);

[quote=“janko33, post:25, topic:2104”]nEntropyBit = ((GetHash().Get64()) & 1llu);

long lastBit = newBlock.getHeader().getScryptHash().toBigInteger().and(BigInteger.ONE).longValue();
newBlock.setEntropyBit(lastBit);[/quote]
It’s nice of you to post this, but we don’t all speak C++, haha. Is this meant to be a question? How is development going, overall?

Also, will the app have the ability to import a private key QR code? This is a feature that’s currently lacking in Peercoin, as far as I know, and it would make paper wallets much more compelling (especially with cold-lock minting coming in PPC v0.5).

Thanks!

how is the android peercoin wallet app project going can we expect to see this on the google play store soon for downloads?
It is hard to do trades face to face with people without a mobile app. I only have a desktop PC not a laptop so I cant just bring it to a location where there is wifi to trade with people face to face and i do not really want to invite random people over to my place. I am selling clothing and other items on craigslist and kijiji for peercoin.

We the peercoin community really need this mobile app in order to help peercoin grow. Who ever has the skills to help out please jump on in and help. Thank you. :slight_smile:

Icemine, it looks like Janko33 hasn’t been around for a little while, but you might be interested in the Android Wallet with Centralised Validation conversation!

[quote=“janko33, post:15, topic:2104”]I don’t use SPV it’s useless for blackcoin too.
I had to rewrite bitcoinj, so i can commit to peercoin mycelium github too…
and I am not the author of the running Blackcoin android.

Mine will be released in comming weeks, I have full time job,
so I mostly work on weekends and Fridays…

I have tested it on android emulator and it runs
https://i.imgur.com/W2TgoNG.png[/quote]

I thought bitcoinj had already been rewritten for Peercoin: https://github.com/kac-/peercoinj

Or am I missing something?

@icemine, we are all eagerly awaiting a Android app. There are a few initiatives going on, but nothing has been completed yet unfortunately. Not sure if there is a funding or a technical issue with the app @Janko is working on. Would be great if he could let us know.

You could use bkchain.org electrum style web wallet to do trades. It does also display QR codes. Only the interface is a bit rudimentary, but to me it appears as very stable in the last 2 months.

time is an issue for me…had some issues in my work(almost got fired, while working on bitcoinj…) I am in the middle of CheckKernelStake. All needed variables are written to DB… now the check has to be implemented. I don’t want to write when I will finish cause of time… but I am progressing…

Hooray I can compute stake :)))
and the number is right too

[quote=“janko33, post:32, topic:2104”]Hooray I can compute stake :)))
and the number is right too[/quote]
! lol Grats lol !

[quote=“kac-, post:33, topic:2104”][quote=“janko33, post:32, topic:2104”]Hooray I can compute stake :)))
and the number is right too[/quote]
! lol Grats lol ![/quote]

Instant classic quote ;D

Given how complex POS is and how little document there is, this is no small feat!

This is so great! Congratulations!

[quote=“janko33, post:32, topic:2104”]Hooray I can compute stake :)))
and the number is right too[/quote]

You mean successful PoS minting on testnet?
It would be wonderful to see some screenshot.

I don’t know about minting…

I meant this function
https://github.com/ppcoin/ppcoin/blob/master/src/kernel.cpp#L142

now I can use it in
https://github.com/ppcoin/ppcoin/blob/master/src/kernel.cpp#L313

I hope this offset is right
I have used long because java doesn’t have unsigned int
http://www.peercointalk.org/index.php?topic=2547.msg28425#msg28425

you know that cursor changes on line
https://github.com/bitcoinj/bitcoinj/blob/master/core/src/main/java/com/google/bitcoin/core/Block.java#L220

I hope this is OK? is it?

[quote=“janko33, post:37, topic:2104”]you know that cursor changes on line
https://github.com/bitcoinj/bitcoinj/blob/master/core/src/main/java/com/google/bitcoin/core/Block.java#L220

I hope this is OK? is it?[/quote]

FYI bitcoinj has already been rewritten for Peercoin, you can get check the Block.java file here:
https://github.com/kac-/peercoinj/blob/master/core/src/main/java/com/google/bitcoin/core/Block.java

Are you rewriting a Peercoin java library from scratch?

checked
it’s identical to bitcoinj none peercoin changes
Did you check?

I appreciate every help that is given to me
sorry if I look rude

I don’t know if the peercoinj java library is feature complete but I’m using it successfully to collect a few information about the Peercoin network.

You can check the results here: http://cryptocities.appspot.com/