Bitcoin Forum
May 22, 2024, 03:51:18 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Deterministic address generating using watch-only address  (Read 747 times)
CoinSphere (OP)
Newbie
*
Offline Offline

Activity: 17
Merit: 0


View Profile
May 11, 2013, 05:06:59 PM
 #1

I use Armory client for home use. I keep most of my coins as offline paper and SD card backups (I built the client for my Raspberry pi and it seems to work well for this). I then use my watch-only addresses on my online computer. I know there is a bit of "magic" involving chain codes going on when I request my client to determine the next receiving address from my watch-only copy. My question is this: is there a version of this as a headless standalone program that would take a watch-only address, load it and have it generate receive address deterministically and on demand (say through JSON-RPC or similar protocol)? I've scanned over BIP 0032 and I'm sure I could hack something together myself, but I certainly don't want to reinvent the wheel.

Edit: please forgive me if I butchered any of the vernacular.
etotheipi
Legendary
*
expert
Offline Offline

Activity: 1428
Merit: 1093


Core Armory Developer


View Profile WWW
May 12, 2013, 12:28:54 AM
 #2

I use Armory client for home use. I keep most of my coins as offline paper and SD card backups (I built the client for my Raspberry pi and it seems to work well for this). I then use my watch-only addresses on my online computer. I know there is a bit of "magic" involving chain codes going on when I request my client to determine the next receiving address from my watch-only copy. My question is this: is there a version of this as a headless standalone program that would take a watch-only address, load it and have it generate receive address deterministically and on demand (say through JSON-RPC or similar protocol)? I've scanned over BIP 0032 and I'm sure I could hack something together myself, but I certainly don't want to reinvent the wheel.

Edit: please forgive me if I butchered any of the vernacular.

You can do this pretty simply as a python script.  Here's the entire script:

Code:
from armoryengine import *
from sys import argv
wlt = PyBtcWallet().readWalletFile(argv[1]);
print wlt.getNextUnusedAddress().getAddrStr()

Here's the output of that script:
Code:
$ python getNextAddress.py armory_2b1i32B43_.watchonly.wallet
13oH966qRBKy5s9a8Uszq1yHegoTvtbi37
$ python getNextAddress.py armory_2b1i32B43_.watchonly.wallet
1486e8pQ1Hd2Zmdc3JXQ1pmUrUohbirCQ9
$ python getNextAddress.py armory_2b1i32B43_.watchonly.wallet
1QFuMJwsHDiY9EthT8afJqjUtVLHs75Q6e


Wrap that in a socket server or just invoke it as a system command.  Each call accesses the wallet file, calculates the next address, then marks that address as used in the wallet file.  

This will be a pain in Windows.  But if you're in linux, either install it or build from source.  Then you only need:  _CppBlockUtils.so, CppBlockUtils.py, armoryengine.py.  If it complains about needing anything else, you can probably just comment out those portions of armoryengine, which are unrelated to this operation.  Or just bundle the whole directory with it.

EDIT: actually checking whether money has been received is another story.  Likewise, creating transactions to be signed like this is possible but not trivial.  Let me know if you are interested in doing any more with it.


Founder and CEO of Armory Technologies, Inc.
Armory Bitcoin Wallet: Bringing cold storage to the average user!
Only use Armory software signed by the Armory Offline Signing Key (0x98832223)

Please donate to the Armory project by clicking here!    (or donate directly via 1QBDLYTDFHHZAABYSKGKPWKLSXZWCCJQBX -- yes, it's a real address!)
CoinSphere (OP)
Newbie
*
Offline Offline

Activity: 17
Merit: 0


View Profile
May 12, 2013, 01:46:09 AM
 #3

That's exactly what I need. Thanks. I'm sure I'll be wanting to do more later on, but for now that is an excellent starting point.

And I really love Armory. Guess I need to bite the bullet and delve into the code more.
etotheipi
Legendary
*
expert
Offline Offline

Activity: 1428
Merit: 1093


Core Armory Developer


View Profile WWW
May 12, 2013, 01:52:16 AM
 #4

That's exactly what I need. Thanks. I'm sure I'll be wanting to do more later on, but for now that is an excellent starting point.

And I really love Armory. Guess I need to bite the bullet and delve into the code more.

Well, let me know when you do.  I am always happy to help people get into it (and maybe they'll eventually help out, too Smiley).

If you want to do some of your own exploration, download the repo and look at the "extras" directory.  Specifically:

sample_armory_code.py (lots of simple examples)
cli_sign_txdp.py  (for signing offline transactions from the command line)
createTxFromAddrList.py  (for creating an offline tx from online computer)
findpass.py  (for when you forget your wallet passphrase but remember enough to make brute-force feasible)
frag/unfrag_wallet.py (splitting your paper backup into M-of-N pieces)

Some of it was created a while ago before some major updates, so it may not all be 100%.  But I've tested most of it recently.

Founder and CEO of Armory Technologies, Inc.
Armory Bitcoin Wallet: Bringing cold storage to the average user!
Only use Armory software signed by the Armory Offline Signing Key (0x98832223)

Please donate to the Armory project by clicking here!    (or donate directly via 1QBDLYTDFHHZAABYSKGKPWKLSXZWCCJQBX -- yes, it's a real address!)
CoinSphere (OP)
Newbie
*
Offline Offline

Activity: 17
Merit: 0


View Profile
May 12, 2013, 02:15:38 AM
 #5

Sure thing. I'll look through the extras at the very least. Keep up the good work.
Pages: [1]
  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!