Bitcoin Forum
May 25, 2024, 04:03:43 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Combining addresses for space conservation on Mobile Phones  (Read 1335 times)
StephenMorse (OP)
Member
**
Offline Offline

Activity: 88
Merit: 12


View Profile
November 15, 2014, 07:24:12 PM
 #1

I'm part of a team making a mobile wallet for cryptocurrency. We have a database of addresses, and I was thinking about ways that we might be able to conserve space in this table.

So suppose the user has 5 priv/pub key pairs. Then I think we can actually get

(P2PKH):
    5 +
(P2SH):
    5  (1 of 1) + 20 (1 of 2) + 60 (1 of 3) + 120 (1 of 4) + 120 (1 of 5) +
                  20 (2 of 2) + 60 (2 of 3) + 120 (2 of 4) + 120 (2 of 5) +
                                60 (3 of 3) + 120 (3 of 4) + 120 (3 of 5) +
                                              120 (4 of 4) + 120 (4 of 5) +
                                                             120 (5 of 5)
    = 1310



Unique addresses from these 5 key pairs. We can do this because we can use different addresses in the redeemScript and we can rearrange the order of those addresses.

Is this a viable system? Is there some reason why it would not be a good idea to do this?

It probably wouldn't produce the greatest anonymity. And another problem is that using all these addresses might cause a bit of blockchain bloat, and it would make the transactions bigger and cause the user to need to pay larger fees. So while this is an interesting idea, I don't see us actually using this method in our wallet.
amaclin
Legendary
*
Offline Offline

Activity: 1260
Merit: 1019


View Profile
November 15, 2014, 10:17:35 PM
 #2

P2SH != m-of-n multisig
StephenMorse (OP)
Member
**
Offline Offline

Activity: 88
Merit: 12


View Profile
November 16, 2014, 01:55:02 AM
 #3

I know P2SH != m-of-n multisig, P2SH is much more general. But it can be used for m-of-n multisig, and that is what I was referring to here.
dabura667
Sr. Member
****
Offline Offline

Activity: 475
Merit: 252


View Profile
November 16, 2014, 02:15:21 PM
 #4

Why not just store an HD seed (or Master Public Key if you don't want to store private keys on your table) and just store indexes instead of addresses?

Then when you actually need the address, the local client just calculates the seed/MPK with the CKD function to the index you need.

My Tip Address:
1DXcHTJS2DJ3xDoxw22wCt11FeAsgfzdBU
StephenMorse (OP)
Member
**
Offline Offline

Activity: 88
Merit: 12


View Profile
November 17, 2014, 03:16:30 AM
 #5

That does sound like a better way to go... It's kind of interesting how many addresses you can get out of a few priv/pub key pairs, though.
spin
Sr. Member
****
Offline Offline

Activity: 362
Merit: 261


View Profile
November 18, 2014, 07:58:29 AM
 #6

You might want to take a look at this: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
Though I'd proceed with caution, as you are designing a wallet holding other peoples money. 

If you liked this post buy me a beer.  Beers are quite cheap where I live!
bc1q707guwp9pc73r08jw23lvecpywtazjjk399daa
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!