Bitcoin Forum
May 11, 2024, 12:42:48 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Help with BIP44 and blockchain.com API  (Read 205 times)
DoubleClickBTC (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
August 10, 2018, 11:05:02 AM
 #1

We are currently developing a OTC direct BTC exchange. Last week we launched after using Blockchain.com 's receive api v2. We used them to generated addresses for clients to send us bitcoin. The system worked flawlessly and all minor bugs were quickly fixed. Till this happened...

The API states due to BIP44...

As defined in BIP 44, wallet software will not scan past 20 unused addresses. Given enough requests from this API that don't have a matching payment, you could generate addresses past this horizon, which would make spending funds paid to those addresses quite difficult. For this reason, this API will return an error and refuse to generate new addresses if it detects it would create a gap of over 20 unused addresses. If you encounter this error, you will either need to switch to a new xPub (within the same wallet is fine), or receive a payment to one of the previous 20 created addresses

However, We got a trade for over 0.8 BTC. my API key and xPUB generated a address and presented it to the user as normal. The user paid and we credited the user with his fiat. I go onto the blockchain explorer and see the funds, confirmed in the address which i should own, but its not in my wallet and the funds are not accessable. After back and forth trying to send little amounts to the address to maybe get it to allocate I head back to the API docs and read what I quoted above.. It said it will not generate passed 20 unused addresses because if it does the BIP44 will not scan >21 and allocate funds. So i was not concerned at first. I then made a support query explaining what had happened and this was their response..

Hello,

Our Receive Payments API (RPv2) does not allow generating more than 20 unused addresses consecutively. This is to comply with the BIP44 spec, which states that addresses of an xpub after this limit should not be checked for funds.

To avoid this limit, we advise against generating a new address until necessary. For example, when accepting a user payment, do not request a new address to be generated until the very end of a checkout process, when the user is likely to complete the payment.

As a workaround, you could also send a small amount of bitcoin every 20 addresses, to ensure that the address limit requirements are met.

Best,

As I said I read the docs again and saw this but then it appeared to me this is what happened. The API generated more than 20 unused addresses and continued even though their docs said this would not happen as I am using rp V2. The addresses given to the user was number 21 and he sent funds to it that were not allocated to my account even though I own the address. I explained this to support after some tests and even paid out to every unpaid invoice as they suggested I do, still nothing showing in my blockchain wallet and the btc still sits in that address.

Support has not answered me in 2 days and they appear not to be interested in helping me.. what do I do?? Is there anyway I can recover my funds by manually scanning the address with my api key and xpub so it can allocate my funds to me. i

Any help or suggestions will be appreciated.. Im sure other users of their api have encountered this issue 
1715388168
Hero Member
*
Offline Offline

Posts: 1715388168

View Profile Personal Message (Offline)

Ignore
1715388168
Reply with quote  #2

1715388168
Report to moderator
1715388168
Hero Member
*
Offline Offline

Posts: 1715388168

View Profile Personal Message (Offline)

Ignore
1715388168
Reply with quote  #2

1715388168
Report to moderator
"The nature of Bitcoin is such that once version 0.1 was released, the core design was set in stone for the rest of its lifetime." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715388168
Hero Member
*
Offline Offline

Posts: 1715388168

View Profile Personal Message (Offline)

Ignore
1715388168
Reply with quote  #2

1715388168
Report to moderator
retprogramisto
Member
**
Offline Offline

Activity: 149
Merit: 34

💡 Websites, scripts for BTC web4crypto.xyz


View Profile WWW
August 10, 2018, 12:31:03 PM
 #2

Can you import your private key into a wallet e.g. Electrum or try https://coinb.in?

➡️  💡  𝗪𝗲𝗯𝟰𝗖𝗿𝘆𝗽𝘁𝗼  💡  ⬅️
Websites, scripts, crypto integration for BTC
✔️ Free consultation at Web4Crypto.xyz
DoubleClickBTC (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
August 10, 2018, 01:28:55 PM
 #3

Let me try that... Will update in a moment.
DoubleClickBTC (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
August 11, 2018, 09:15:33 AM
 #4

I tried with no success.  Any other ideas ?
AdolfinWolf
Legendary
*
Offline Offline

Activity: 1946
Merit: 1427


View Profile
August 11, 2018, 10:20:58 AM
Last edit: August 11, 2018, 05:38:34 PM by AdolfinWolf
 #5

I tried with no success.  Any other ideas ?

This seems really weird. I don't really understand how this could have happend, since the API is not supposed to go further than 20 unused adresses. ( This is also why i would never use a webbased wallet API  that doesn't give me complete control over my funds like blockchain.com,)

See https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#Address_gap_limit

Quote
Wallet software should warn when the user is trying to exceed the gap limit on an external chain by generating a new address.
It really does seem like blockchain.com is liable here.

I'm not entirely sure how blockchain.com api works, or what their derivation paths are, but do you have a seed (Backup phrase) from when you created your wallet on their platform?

retprogramisto
Member
**
Offline Offline

Activity: 149
Merit: 34

💡 Websites, scripts for BTC web4crypto.xyz


View Profile WWW
August 11, 2018, 11:23:53 AM
 #6

Try to import the xpriv key into electrum and change gap limit from 20 to e.g. 100.

With electrum GUI, click on console and enter:
Code:
wallet.change_gap_limit(100)
wallet.synchronize()
Then you should see your bitcoin address with 0.8 btc and be able to dump the private key.

With electrum CLI, edit your wallet file (generally found in .electrum/wallets/) and add:
Code:
"gap_limit": 100,
above
Code:
    "keystore": {
        "type": "bip32",
        "xprv": "....",
        "xpub": "...."
    },
Then list your addresses, locate the address with 0.8 btc and dump private key as normal.

➡️  💡  𝗪𝗲𝗯𝟰𝗖𝗿𝘆𝗽𝘁𝗼  💡  ⬅️
Websites, scripts, crypto integration for BTC
✔️ Free consultation at Web4Crypto.xyz
AdolfinWolf
Legendary
*
Offline Offline

Activity: 1946
Merit: 1427


View Profile
August 11, 2018, 12:18:49 PM
 #7

Try to import the xpriv key into electrum and change gap limit from 20 to e.g. 100.

How would one access the master private key on Blockchain.info directly? I don't think that that is possible.

Instead, OP should look for his backup phrase, and put that in a BIP39 compatible wallet to see if he can find his bitcoins, or in a script to then generate his xprv key.

I just tried it wit the seed of  a completely empty wallet from blockchain.info with https://iancoleman.io/bip39/, and it worked. ( Don't use this site when dealing with substantial amounts of money, as it could phish your coins, always use offline code that you verified yourself.)

DoubleClickBTC (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
August 12, 2018, 10:56:35 AM
 #8

Try to import the xpriv key into electrum and change gap limit from 20 to e.g. 100.

With electrum GUI, click on console and enter:
Code:
wallet.change_gap_limit(100)
wallet.synchronize()
Then you should see your bitcoin address with 0.8 btc and be able to dump the private key.

With electrum CLI, edit your wallet file (generally found in .electrum/wallets/) and add:
Code:
"gap_limit": 100,
above
Code:
    "keystore": {
        "type": "bip32",
        "xprv": "....",
        "xpub": "...."
    },
Then list your addresses, locate the address with 0.8 btc and dump private key as normal.

I have done this now and it does not seem to list the address
https://www.blockchain.com/btc/address/1Ar23WEvzW8obJWZfgtvQ5Z43AVtCUXoTe
retprogramisto
Member
**
Offline Offline

Activity: 149
Merit: 34

💡 Websites, scripts for BTC web4crypto.xyz


View Profile WWW
August 12, 2018, 03:37:59 PM
 #9

Sorry, after testing I found that electrum uses derivation path m/0/0. However blockchain.com uses derivation path m/44'/0'/0'/0'. Therefore electrum and blockchain.com generate different addresses.

I cant find how to change derivation path in electrum, but you can download this tool:
https://iancoleman.io/bip39/ (Download link: https://github.com/iancoleman/bip39/archive/master.zip)
1) Disconnect internet, unzip the file and open src/index.html in browser.
2) Input xpriv key
3) Scroll to Derivation Path
4) Click BIP32, client Blockchain.info
5) Scroll to derived addresses and check for your address (you can generate more addresses, edit the number after Show and click on More Rows button)
6) If it isnt there, click BIP44 then check for your address

➡️  💡  𝗪𝗲𝗯𝟰𝗖𝗿𝘆𝗽𝘁𝗼  💡  ⬅️
Websites, scripts, crypto integration for BTC
✔️ Free consultation at Web4Crypto.xyz
DoubleClickBTC (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
August 12, 2018, 04:43:29 PM
 #10

Giving it a shot. Thank you for your support! I really appreciate the effort.
DoubleClickBTC (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
August 12, 2018, 04:57:28 PM
 #11

Sorry, after testing I found that electrum uses derivation path m/0/0. However blockchain.com uses derivation path m/44'/0'/0'/0'. Therefore electrum and blockchain.com generate different addresses.

I cant find how to change derivation path in electrum, but you can download this tool:
https://iancoleman.io/bip39/ (Download link: https://github.com/iancoleman/bip39/archive/master.zip)
1) Disconnect internet, unzip the file and open src/index.html in browser.
2) Input xpriv key
3) Scroll to Derivation Path
4) Click BIP32, client Blockchain.info
5) Scroll to derived addresses and check for your address (you can generate more addresses, edit the number after Show and click on More Rows button)
6) If it isnt there, click BIP44 then check for your address

Ok I gave it a go and did not find the address in either bip32 or bip44. Any other ideas or am I out of luck? I searched up to 1500 addresses for both
retprogramisto
Member
**
Offline Offline

Activity: 149
Merit: 34

💡 Websites, scripts for BTC web4crypto.xyz


View Profile WWW
August 12, 2018, 05:09:47 PM
 #12

Did you select client blockchain.info in BIP 32?

Do you see your other blockchain.com addresses apart from 1Ar23WEvzW8obJWZfgtvQ5Z43AVtCUXoTe?

➡️  💡  𝗪𝗲𝗯𝟰𝗖𝗿𝘆𝗽𝘁𝗼  💡  ⬅️
Websites, scripts, crypto integration for BTC
✔️ Free consultation at Web4Crypto.xyz
DoubleClickBTC (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
August 13, 2018, 07:45:28 AM
 #13

Yes I see other addresses from my blockchain.com account.

I also generated a new address using their api and that addresses showed in electrum. Do you have a private channel I can contact you on?
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!