Bitcoin Forum
November 02, 2024, 09:35:20 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to import bitcoin addresses generated using Master Public Key?  (Read 8274 times)
Tungsten (OP)
Member
**
Offline Offline

Activity: 73
Merit: 10



View Profile WWW
April 05, 2013, 01:38:21 AM
 #1

I've generated bitcoin address using mpk, using index with high value =  184926
How do i import it into my wallet?

• 188888888qZ5Mv4u5C2Bve6eyVJBFR5EEj • Get personalized bitcoin address like that at http://vanitycoin.com/
ThomasV
Moderator
Legendary
*
Offline Offline

Activity: 1896
Merit: 1353



View Profile WWW
April 05, 2013, 07:54:43 AM
 #2

there is no special way to import them; you don't want to set your gap limit to such a high value.
just import them as if they were exogeneous

Electrum: the convenience of a web wallet, without the risks
Tungsten (OP)
Member
**
Offline Offline

Activity: 73
Merit: 10



View Profile WWW
April 05, 2013, 11:01:25 AM
 #3

there is no special way to import them; you don't want to set your gap limit to such a high value.
just import them as if they were exogeneous


Thank you.

My scenario is - online merchant uses accepbit.com model to generate addresses from MPK for each order.

How does merchant gets hold of the funds after making few thousand sales?

What are the steps?

• 188888888qZ5Mv4u5C2Bve6eyVJBFR5EEj • Get personalized bitcoin address like that at http://vanitycoin.com/
kangasbros
Hero Member
*****
Offline Offline

Activity: 812
Merit: 1006



View Profile
April 05, 2013, 03:25:17 PM
 #4

there is no special way to import them; you don't want to set your gap limit to such a high value.
just import them as if they were exogeneous


Thank you.

My scenario is - online merchant uses accepbit.com model to generate addresses from MPK for each order.

How does merchant gets hold of the funds after making few thousand sales?

What are the steps?


I guess you have to program that yourself, electrum doesn't do that kind of thing by default (AFAIK).

Tungsten (OP)
Member
**
Offline Offline

Activity: 73
Merit: 10



View Profile WWW
April 05, 2013, 03:33:01 PM
 #5

...

I guess you have to program that yourself, electrum doesn't do that kind of thing by default (AFAIK).

So if someone used acceptbit.com to make a sales - he than has to write a special program to get hold of funds???

• 188888888qZ5Mv4u5C2Bve6eyVJBFR5EEj • Get personalized bitcoin address like that at http://vanitycoin.com/
kangasbros
Hero Member
*****
Offline Offline

Activity: 812
Merit: 1006



View Profile
April 05, 2013, 04:41:08 PM
 #6

...

I guess you have to program that yourself, electrum doesn't do that kind of thing by default (AFAIK).

So if someone used acceptbit.com to make a sales - he than has to write a special program to get hold of funds???


acceptbit.com is just a proof-of-concept sone in a weekend hackatohon. I should probably state this more clearly on the frontpage.

Tungsten (OP)
Member
**
Offline Offline

Activity: 73
Merit: 10



View Profile WWW
April 05, 2013, 04:46:28 PM
 #7

acceptbit.com is just a proof-of-concept sone in a weekend hackatohon. I should probably state this more clearly on the frontpage.

The only thing the front page is missing is "Step 4" to describe in details how people can get hold of Bitcoins received.
Otherwise it looks like deposit-only solution.

• 188888888qZ5Mv4u5C2Bve6eyVJBFR5EEj • Get personalized bitcoin address like that at http://vanitycoin.com/
Tachikoma
Hero Member
*****
Offline Offline

Activity: 938
Merit: 1000



View Profile WWW
April 06, 2013, 08:57:35 AM
 #8

People supply their MPK. The funds end up directly in their Electrum wallet. There is no step 4.

Electrum: the convenience of a web wallet, without the risks | Bytesized Seedboxes BTC/LTC supported
Tungsten (OP)
Member
**
Offline Offline

Activity: 73
Merit: 10



View Profile WWW
April 06, 2013, 10:51:09 AM
 #9

People supply their MPK. The funds end up directly in their Electrum wallet. There is no step 4.

Step 4: Adjust "Gap Limit" of your Electrum wallet to be equal or higher than number of payments addresses generated at your acceptbit.com merchant URL.
Otherwise you'll never see the payments beyond the 5-th address.

Gleb

• 188888888qZ5Mv4u5C2Bve6eyVJBFR5EEj • Get personalized bitcoin address like that at http://vanitycoin.com/
Tachikoma
Hero Member
*****
Offline Offline

Activity: 938
Merit: 1000



View Profile WWW
April 07, 2013, 01:47:53 PM
 #10

This is not the case. This is only the case if you give out 5 sequencial addresses which all five go unused for some reason.

Electrum: the convenience of a web wallet, without the risks | Bytesized Seedboxes BTC/LTC supported
Tungsten (OP)
Member
**
Offline Offline

Activity: 73
Merit: 10



View Profile WWW
April 07, 2013, 02:01:36 PM
 #11

This is not the case. This is only the case if you give out 5 sequencial addresses which all five go unused for some reason.

This is actually real scenario.
1. Visitor comes to online store and clicks "buy product X for bitcoins" out of curiocity.
2. Temporary bitcoin address is generated, as no one knows if that a real buyer or just clicker.
3. Above process happen few times before real buyer comes. He got address with, say, index #7 before unused addresses expires for reuse.
4. Merchant never sees money coming unless he adjusts gap limit according to missing Step 4 instructions.

Gleb

• 188888888qZ5Mv4u5C2Bve6eyVJBFR5EEj • Get personalized bitcoin address like that at http://vanitycoin.com/
BkkCoins
Hero Member
*****
Offline Offline

Activity: 784
Merit: 1009


firstbits:1MinerQ


View Profile WWW
April 09, 2013, 02:34:13 AM
 #12

If you store the index number (instead of, or in addition to the address), then it is fairly easy to generate a private key to match the address. I could whip up a little utility to do that if you want or a function. Once you have the key you can import it as normal.

Or maybe better write a script to sweep the balances to a given address so that you don't end up with a wallet containing thousands of addresses. If I recall correctly you can use cmd line mode to create a transaction with a private key and not have to import it.

ThomasV
Moderator
Legendary
*
Offline Offline

Activity: 1896
Merit: 1353



View Profile WWW
April 09, 2013, 08:28:30 AM
 #13

I wrote a merchant script for Electrum some time ago.
it writes IDs in a database.

I think we should improve the client, so that it takes a list of IDs from a database in order to generate a sequence of addresses

Electrum: the convenience of a web wallet, without the risks
ThomasV
Moderator
Legendary
*
Offline Offline

Activity: 1896
Merit: 1353



View Profile WWW
April 09, 2013, 09:25:41 AM
 #14

I wrote a merchant script for Electrum some time ago.
it writes IDs in a database.

I think we should improve the client, so that it takes a list of IDs from a database in order to generate a sequence of addresses


maybe a new plugin could do that.
it could connect to a service like acceptbit.com, and get a list of IDs that have been used to generate addresses

Electrum: the convenience of a web wallet, without the risks
Tungsten (OP)
Member
**
Offline Offline

Activity: 73
Merit: 10



View Profile WWW
April 09, 2013, 02:05:10 PM
 #15

I wrote a merchant script for Electrum some time ago.
it writes IDs in a database.

I think we should improve the client, so that it takes a list of IDs from a database in order to generate a sequence of addresses


maybe a new plugin could do that.
it could connect to a service like acceptbit.com, and get a list of IDs that have been used to generate addresses

I think this would violate beautiful "deterministicability" principle (what a term!) of Electrum. Deterministic wallets are very resilient to being lost. Once we start promoting importation of foreign keys - this will open can of worms about backups and will hurt wallet owners in the long run.
In case of acceptbit and similar services - I'd just pull the "last used index" and make sure wallet used that to sync all addresses up to this index.

Gleb

• 188888888qZ5Mv4u5C2Bve6eyVJBFR5EEj • Get personalized bitcoin address like that at http://vanitycoin.com/
BkkCoins
Hero Member
*****
Offline Offline

Activity: 784
Merit: 1009


firstbits:1MinerQ


View Profile WWW
April 09, 2013, 02:37:53 PM
 #16

I wrote a merchant script for Electrum some time ago.
it writes IDs in a database.

I think we should improve the client, so that it takes a list of IDs from a database in order to generate a sequence of addresses


maybe a new plugin could do that.
it could connect to a service like acceptbit.com, and get a list of IDs that have been used to generate addresses

I think this would violate beautiful "deterministicability" principle (what a term!) of Electrum. Deterministic wallets are very resilient to being lost. Once we start promoting importation of foreign keys - this will open can of worms about backups and will hurt wallet owners in the long run.
In case of acceptbit and similar services - I'd just pull the "last used index" and make sure wallet used that to sync all addresses up to this index.

Gleb

Regarding very high gap values - I'm not sure of performance ramifications but if you have thousands of addresses in a wallet I suspect the server end could be severely impeded by such a large subscribe cmd.

One way would be to add a new list of addresses besides just change and normal ones. We already have an imported list but we could add a "sparse" list. These ones show up and act as normal addresses in the interface but actually store the index with the address and use the index instead of ordinal position to generate keys. The import cmd line could accept a list of index values to add to this list. It could potentially also use a different hash base, eg. 2 instead of 1 so that it cannot collide with normal addresses.

Upon restoring a lost wallet you could restore sparse addresses automatically with a scan of a range (scan 0-250 or whatever), or it could be a cmd used any time to scan for sparsely used addresses beyond the last one known. This way you likely don't even need to import index values, just trigger a scan cmd (periodically much less work than subscribing always).

@ThomasV if this sounds like a good idea I'd be happy to code it and offer a pull request. It should be transparent to users with wallets missing the list. (Gee, I have to sync up to date first as I'm still using 1.6.1 right now)

Tungsten (OP)
Member
**
Offline Offline

Activity: 73
Merit: 10



View Profile WWW
April 09, 2013, 03:21:32 PM
 #17

...
Regarding very high gap values - I'm not sure of performance ramifications but if you have thousands of addresses in a wallet I suspect the server end could be severely impeded by such a large subscribe cmd
...

I tested gap limit = 500 with Electrum and it only takes a ~15 seconds to sync after initial set of addresses is created.
I am sure this process could be further optimized to support few K's addresses.
Beyond that person/merchant should create new wallet and aggregate all funds from old wallet into single address of the new one.
At least I would do it this way.

Gleb

• 188888888qZ5Mv4u5C2Bve6eyVJBFR5EEj • Get personalized bitcoin address like that at http://vanitycoin.com/
BkkCoins
Hero Member
*****
Offline Offline

Activity: 784
Merit: 1009


firstbits:1MinerQ


View Profile WWW
April 09, 2013, 03:37:56 PM
 #18

...
Regarding very high gap values - I'm not sure of performance ramifications but if you have thousands of addresses in a wallet I suspect the server end could be severely impeded by such a large subscribe cmd
...

I tested gap limit = 500 with Electrum and it only takes a ~15 seconds to sync after initial set of addresses is created.
I am sure this process could be further optimized to support few K's addresses.
Beyond that person/merchant should create new wallet and aggregate all funds from old wallet into single address of the new one.
At least I would do it this way.

Gleb
Yes, it's possible to make a merchant wallet that checks addresses in reverse. It gets each new block and instead of looking up each address in the wallet it looks up each output in the block. This would allow for millions of addresses in a database and only checking a few hundred outputs every block. I could see using either Sqlite3/MySql for addresses and payment history. I don't think Electrum server can provide block data so you'd either use blockchain.info or run bitcoind.

My coinwatch script in my misc repo does this but it doesn't use MPK generation yet. I should update it to use the mpkgen script.

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!