Bitcoin Forum
December 05, 2016, 04:45:07 PM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: coinsplit: generate, split, rejoin and import bitcoin addresses and keys offline  (Read 1953 times)
cecil w.
Newbie
*
Offline Offline

Activity: 23


View Profile
June 20, 2011, 11:14:10 PM
 #1

This is a simple commandline tool for playing with addresses and keys and wallets. I've been working on it for fun, just using ideas seen in other tools.

http://github.com/cecilw/coinsplit

This isn't for split-device generation of keys, as is discussed elsewhere in this forum, but simply a way of doing it with a one-time pad for now. I tried to keep it UNIXy, so you can append lists of keys together and pipe back and forth between the wallet and key backups.

Here's "coinsplit --help", just to give an idea.

Code:
coinsplit [wallet.dat] [--generate|--address XXX|--wallet|--import file1 file2] [--split] [keyfile1] [keyfile2]
Generates offline Bitcoin addresses and can split them into halves and import them into wallet.dat files.

** THIS BUILD GENERATES ONLY TESTNET ADDRESSES (which start with an 'm'). **

Examples:
        coinsplit --generate new.key
                Generates a new offline key and stores it in new.key.
        coinsplit --generate --split new.pt1 new.pt2
                Generates a new key and splits it into two halves.
        coinsplit wallet.dat --address 14Yots3PR3ygt12ksi5MZ36tBdaseQxN46 --split old.pt1 old.pt2
                Splits an address from the wallet into two halves.
        coinsplit wallet.dat --wallet --split old.pt1 old.pt2
                Splits all addresses from the wallet into two halves.
        coinsplit wallet.dat --import old.key
                Imports the addresses in old.key into the wallet.
        coinsplit wallet.dat --import old.pt1 old.pt2
                Imports the addresses in the split keys into the wallet.
        coinsplit wallet.dat --import old.pt1 old.pt2 old.key
                Rejoins two split keys into a single key.
        coinsplit --generate --split 1>mail 2>curl
                Generates a new key and sends the two halves off.
        coinsplit --generate | coinsplit --import
                Generate a new key and save the key in the wallet.

This is probably worthless and overlaps other tools, but I had fun making it. Take care.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1480956307
Hero Member
*
Offline Offline

Posts: 1480956307

View Profile Personal Message (Offline)

Ignore
1480956307
Reply with quote  #2

1480956307
Report to moderator
1480956307
Hero Member
*
Offline Offline

Posts: 1480956307

View Profile Personal Message (Offline)

Ignore
1480956307
Reply with quote  #2

1480956307
Report to moderator
netrin
Sr. Member
****
Offline Offline

Activity: 322


FirstBits: 168Bc


View Profile
June 21, 2011, 12:14:00 AM
 #2

From the help menu, this looks exactly like what I've been looking for. Maybe there's a better name, such as coinmanager - it looks like it splits AND merges (and generates). I'm reading coinsplit.c now. I've gotten paranoid in my old coin age!

Greenlandic tupilak. Hand carved, traditional cursed bone figures. Sorry, polar bear, walrus and human remains not available for export.
cecil w.
Newbie
*
Offline Offline

Activity: 23


View Profile
June 22, 2011, 02:31:30 PM
 #3

Definitely. It only works on the test net right now anyway, so please don't use it with a real wallet file.
SgtSpike
Legendary
*
Offline Offline

Activity: 1344



View Profile
June 22, 2011, 03:45:19 PM
 #4

So, the main purpose of this is for security for a savings wallet?

- Create an offline address/key.
- Split key into several parts.  Store each part in a different location.
- Send BTC to address.
- If need to access account, bring all key parts together and join them to the wallet file.
cecil w.
Newbie
*
Offline Offline

Activity: 23


View Profile
June 22, 2011, 04:18:52 PM
 #5

Well, I wrote it so someone could possibly do a semi-distributed exchange, with an escrow address along the lines of ClearCoin, but without storing any keys on the server.

I kind of imagine it going like this:

1. Seller lists a price on the exchange.
2. Buyer places an order.
3. Exchange gives each person the address and half of the key (deleting the original key and keeping only the buyer's half.)
4. Seller sends the BTC to the address.
5. Buyer sends the money to the seller using whatever the seller accepts.
6. Seller sends the other half of the key to the buyer.

If the money isn't claimed in like six months, then the seller gets it back.

I personally don't want to write an entire exchange, but I like the idea of having an exchange that keeps no funds and no keys for itself. It's not the completely distributed exchange that we all fantasize about, but it's better than what we have now.
loglow
Jr. Member
*
Offline Offline

Activity: 56


View Profile
July 01, 2011, 09:57:59 PM
 #6

Thanks very much for creating this program! I've been needing something very much like this, and was even considering writing something myself, although that would require a lot of research on my part since I haven't done any public/private key encryption programming before. That, and I'm not too great a programmer to begin with.

I was able to compile coinsplit on a Mac OS X 10.5 machine with GCC 4.2 (4.0 didn't work). I had to download and build the latest versions of GMP, Berkeley DB, and OpenSSL, which went mostly fine. OpenSSL needed some special love to build and work correctly on the Mac, but I was able to follow a simple guide and got it to work.

Unfortunately, the open_memstream() and fmemopen() functions aren't natively available on Macs, so I had to do some digging and was able to locate implementations of each using the available funopen() function. The app compiled fine and runs on both 10.5 and 10.6, however I couldn't create a working binary under 10.6; the resulting program segfaults when trying to generate an address. I tracked the fault to the base58_encode() function and its references to result_stream.

Just as a note, I noticed that the bitcoin source code includes its own base58 and bignum header files. Might these be easier and/or more portable to use? I realize they're C++ (not C).

Anyway, I have a few requests for the next version of coinsplit:

  • Easier build process / compatibility on Macs (see above)
  • Ability to specify bitcoin vs testnet address as a command line option
  • And most importantly: output of base58 encoded private key

The private key format is analoguous to the address format. It is a 51-character base58-encoded string, that includes a version number and a checksum.

If you're able to make these changes, I'd be happy to send you a donation in either BTC or USD.

Take care, and thanks again.
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!