Pubkey only wallet - naive implementation

merged into glv2 branch

Current implementation supports

pubgetaddressesbyaccount <account> pubgettransaction <txid> pubimportkey <ppcoinpubkey> [label] [rescan] publistaccounts [minconf=1] publisttransactions [account] [count=10] [from=0] publistunspent [minconf=1] [maxconf=9999999] ["address",...] pubsetaccount <ppcoinaddress> <account>
Why? To use Peercoin/unity client directly as mobile wallet backend.

f.e. 256MB RAM $4/Year!

We can have the most secure mobile wallet and support the network for less than $1/mo.

[ul][li]Upload synced blockchain - even Peercoin syncing can cause VPS account suspension[/li]
[li]Rename ppcoind binary - automatic filters can catch *coind processes and block account due to “VPS mining abuse”[/li][/ul]

Discussion welcome

Lowendspirit Dallas 256MB with Peercoin(~70MB) and Camlistore(

Blockchain 2014-04-23 (195MB)

Neat. +1

Thanks to glv2 now I have also

publistunspent [minconf=1] [maxconf=9999999] ["address",...] getrawtransaction <txid> [verbose=0]
Practically ready for trivial mobile wallet.


Some VPS w/ NAT providers(f.e. lowendspirit) use different routes for inbound and outbound connections, causing faulty result of GetMyExternalIP() and hence faulty external IP propagation. This options solves the problem.

Sample app:


XClient xclient = createClient(prodNet);

// create new address (main wallet)
String newAddr = xclient.newKey().toAddress(params).toString();
System.out.println("send coins to " + newAddr);
// wait for coins
Rpc.Unspent[] unspent;
while ((unspent = xclient.listUnpsent(newAddr)).length == 0) {
BigInteger receivedAmount = XClient.toMicroCoins(unspent[0].amount);
// send half back to the sender and half to out cold storage
BigInteger sendToEach = receivedAmount.subtract(Utils.CENT).subtract(Utils.CENT)
// get and parse raw transaction
Transaction tx = new Transaction(params, xclient.getRpcClient().getRawTransactionBytes(
// extract sender's address
String fromAddress = tx.getInput(0).getFromAddress().toString();
// send to the sender
xclient.sendToAddress(new Address(params, fromAddress), sendToEach);
// send to new cold storage key
xclient.sendToAddress(xclient.newRKey().toAddress(params), sendToEach);
  • create client with two hd wallets - public and private
  • create new spendable(private wallet) address and wait for coins
  • split received coins by two
  • send one half to the sender
  • send second half to newly created hd cold storage key (public wallet)

ppcoind site

You need
Running sample app creates three accounts on public-wallet

$ ppcoind -testnet publistaccounts { "" : -13.66000000, "xprv_kuoBmn3nYhyf6XSXwAfSpToPowJ" : 10.00000000, "xprv_kuoBmn3nYhyf6XSXwAfSpToPowJ_change" : 2.24000000, "xpub_3TvkeEFFGaEbPiEGgYL7TpBcNven" : 1.96000000 }
xprv_kuoBmn3nYhyf6XSXwAfSpToPowJ: main(private) wallet
xprv_kuoBmn3nYhyf6XSXwAfSpToPowJ_change: main sub-wallet for change
xpub_3TvkeEFFGaEbPiEGgYL7TpBcNven: hd cold wallet (public)

Slightly modified client is currently waiting for coins on mwLnfUo6KH2fVN1padsB5epud8t72Wxyok (testnet), send some to check testnet tx propagation :slight_smile: [let me know if you don’t have testnet peercoins]

It’s a base for mobile client:

  • scan hd privkey
  • [option] scan hd pubkey
  • have fun
    No backups creation, spending paper wallets[ahh… maybe], etc - those aren’t tasks for mobile clients (device with camera and internet connection near paper wallet with life savings isn’t good idea).

Next step is to make it possible to share full node backend with family members and friends and let verify chosen txs with different sources (f.e. with other friend’s node). Due to the nature of Peercoin network we’ll probably be able to host full node backends on R-Pi-like devices and cheap VPSs for next years.

  • decentralized (VS mycelium,, even electrum)
  • fast
  • always compatible with core implementation
  • friend (backend admin) knows your txs

Please share your thoughts and ideas

Cross-compile environment for R-Pi on Amazon EC2 done, fast Peercoin/Peerunity/Peershares/custom compilation, my R-Pi is syncing and soon will become fully functional server for mobile wallet :slight_smile:
AMI and environment build script later.

Whoooa - PeerunityR-Pi(ppcoind) compiled in 90 seconds!!!
Script to reproduce

sudo dpkg --add-architecture i386
sudo apt-get -y update ; sudo apt-get -y upgrade ; sudo apt-get -y install build-essential libssl-dev libdb-dev libdb++-dev  libboost-all-dev git curl ia32-libs
sudo mkdir -p /opt/rpi
sudo chown admin:admin /opt/rpi
cd /opt/rpi
curl | tar xz
mkdir -p /opt/rpi/var/lib/dpkg /opt/rpi/var/cache/apt /opt/rpi/var/lib/dpkg /opt/rpi/var/log/apt
touch /opt/rpi/var/lib/dpkg/status
apt-get -c apt.conf.ec2 update
apt-get -c apt.conf.ec2 -y -d install libqt4-dev libboost-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-thread-dev libssl-dev libdb++-dev libminiupnpc-dev
for x in /opt/rpi/var/cache/apt/archives/*.deb ; do dpkg -x $x /opt/rpi ; done
echo -e 'OUTPUT_FORMAT(elf32-littlearm)\nGROUP ( libpthread_nonshared.a )' > /opt/rpi/usr/lib/arm-linux-gnueabihf/
echo -e 'OUTPUT_FORMAT(elf32-littlearm)\nGROUP ( libc_nonshared.a  AS_NEEDED ( ) )' >/opt/rpi/usr/lib/arm-linux-gnueabihf/

git clone --depth=1
echo 'export PATH=$PATH:/opt/rpi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin' >>~/.profile
. ~/.profile

Still contains curl | tar xz, I’ll try to get rid of that one.

Latest blockchain

Nice! I thought that ideally every Peercoin household should have a minting node running at home (Raspberry Pi or other low end machine) and connect to it with their smartphones to actually spend it. I did not like the Bitcoin mobile wallet, it consumed too much battery and it was a bit weird keeping money on my phone. This looks like the way forward.

I’m not quite sure of what this thing is. :pearcoin:

Yeah, but things aren’t so bright here, mobile back-end should run on DMZ of home network and second device for secure minting is needed. There are still private keys on the phone( in a form of one extended private key), so you still have to protect it’s data( together with contacts/SMSs/notes) and keep reasonable amount in mobile wallet. For emergency situations when you need more coins it’s easier with externally accessible device to implement f.e. multisig with wife but it isn’t covered right now.

It’s ppcoind with RPC via HTTPS and pubkey-only wallet, R-Pi does whole p2p networking and blocks/addresses/tx tracking thing, mobile client enjoy payments w/o leaking your ip/addresses/txs to external services.

Good question, I struggled to understand what this actually is. Thanks Kac- for the answer. I think I’m now starting to understand what this is. It is still very geeky, but quiet cool what you achieved. I think this is the way forward to safer mobile clients instead of having full clients with private keys on your phone. It looks similar as what bkchain is doing with his bkchain daemon here: I believe.

Hope when things get a bit less experimental and proven you are able to post some step-by-step instructions and scripts as Tea42 did for setting up a Rpi fullnode. I would love to have safe access to my coins and still being in control myself on the Rpi and at the same time having access to it on my mobile device.

For brave ones [unstable, not signed, etc.] :

deb wheezy main

to /etc/apt/sources.list, then

apt-get update
apt-get install ppcoind

Ok, I’m starting to see the point, except in my mind, if I have my cold wallet in a hardware disconnected from internet. I grab public keys from it and put it online with pubkey-only wallet which syncs the blockchain. When I want to spend, I would just create an unsigned raw transaction from it, generate QR code. Then the cold machine read it with camera, sign it, gen qr code, send it back to the online wallet to broadcast. Bitcoin should benefit more from something like this, as the blockchain size forcing ppl to put it online rather than syncing it with their local machine every time.