Bitcoin Forum
December 12, 2024, 06:32:06 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: blockchain.com api | How generate "Legacy" & "Nested SegWit" & "Native SegWit"?  (Read 150 times)
Vort3x.Layers (OP)
Jr. Member
*
Offline Offline

Activity: 47
Merit: 11


View Profile
December 01, 2021, 05:01:34 PM
Merited by Welsh (2), Quickseller (2), Halab (2)
 #1

Please check out this link :
https://www.blockchain.com/api/api_receive
As you see we can generate receiving addresses for our customers using this api.

My first question is : what is the type of that generated address?
"Legacy" or "Nested SegWit" or "Native SegWit"?

My other question is : is there a way to generate "Legacy" & "Nested SegWit" & "Native SegWit" addresses for receive separately?
n0nce
Hero Member
*****
Offline Offline

Activity: 910
Merit: 5935


not your keys, not your coins!


View Profile WWW
December 01, 2021, 06:44:51 PM
 #2

It seems they generate PKPKH addresses.

Have your customer send bitcoin to the address contained in the response:
Response:200 OK, application/json

{
  "address": "19jJyiC6DnKyKvPg38eBE8R6yCSXLLEjqw",
  "index": 23,
  "callback": "https://mystore.com?invoice_id=058921123"
}

But to be honest, I wouldn't send peoples' xPubs over the internet. You can easily calculate any kind of public key (and any number) locally if you already have their xPub. Should be possible with any Bitcoin- or more generic cryptography library.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
BlackHatCoiner
Legendary
*
Offline Offline

Activity: 1736
Merit: 8448


Fiatheist


View Profile WWW
December 01, 2021, 07:16:27 PM
Merited by Welsh (4), Quickseller (3), pooya87 (2), ABCbits (2)
 #3

Would you mind telling us what you are trying to accomplish? You may get yourself satisfied with a response that doesn't have to do with this API.

For instance, are you a merchant who wants to receive bitcoin payments in their site? You don't need to trust a third party for deriving you the correct addresses of your xpub key, you can do it yourself. Check btcpayserver.

"Legacy" or "Nested SegWit" or "Native SegWit"?
Legacy starts with 1.
Nested SegWit starts with 3.
Native SegWit starts with bc1.

My other question is : is there a way to generate "Legacy" & "Nested SegWit" & "Native SegWit" addresses for receive separately?
For nested segwit you'd need a ypub key and for native segwit a zpub key.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Vort3x.Layers (OP)
Jr. Member
*
Offline Offline

Activity: 47
Merit: 11


View Profile
December 01, 2021, 07:46:53 PM
 #4

Quote
Would you mind telling us what you are trying to accomplish? You may get yourself satisfied with a response that doesn't have to do with this API.
I have a web site and i want create a unique "Legacy" & "Nested SegWit" & "Native SegWit" address for every customer to send & receive bitcoin.
So i need a free api to handle this!
Unlimited addresses!
No Expiration of those addresses!
I do n't want use some third party sites like https://www.coinpayments.net for payment method because i need unique address for every customer for another purpose than payment.
BlackHatCoiner
Legendary
*
Offline Offline

Activity: 1736
Merit: 8448


Fiatheist


View Profile WWW
December 01, 2021, 08:00:41 PM
 #5

I do n't want use some third party sites like https://www.coinpayments.net for payment method because i need unique address for every customer for another purpose than payment.
Yes, but this way you still have a third party called blockchain dot com which is responsible for serving you the correct addresses. They may not have access to your money, but they are part of your business one way or another.

Anyway, you can't achieve having all three types of addresses from that API, which brings me the next question. I understand that you may want to have a different address for each client as you should, but why to serve them three addresses? That makes things more difficult and less practical.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
n0nce
Hero Member
*****
Offline Offline

Activity: 910
Merit: 5935


not your keys, not your coins!


View Profile WWW
December 01, 2021, 11:29:33 PM
Merited by Welsh (2), ABCbits (1)
 #6

So i need a free api to handle this!
You do not; you do this locally on your own machine / server using the xpub. You will have one xpub per customer and derive as many addresses as you want fro that.

Unlimited addresses!
You can do that directly with the xpub.

No Expiration of those addresses!
Bitcoin addresses don't expire.

I don't want use some third party sites
Then don't use an API to derive addresses from xpub; just do it locally yourself, as I and BlackHatCoiner suggested.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
pooya87
Legendary
*
Offline Offline

Activity: 3668
Merit: 11103


Crypto Swap Exchange


View Profile
December 02, 2021, 03:55:37 AM
Merited by Welsh (3)
 #7

I have a web site and i want create a unique "Legacy" & "Nested SegWit" & "Native SegWit" address for every customer to send & receive bitcoin.
So i need a free api to handle this!
Using a third party like this is very risky specially when you are using one that is known to have many bugs. They could end up creating an invalid address for you and any coins sent to that address would be lost.

It is best that you handle everything on your own. Generating an address from a public key is a pretty easy task too (it is a matter of computing a hash and doing a simple encoding).
You can also watch those addresses using the Electrum protocol (https://electrumx-spesmilo.readthedocs.io/en/latest/protocol.html). You can hire someone to code this all for you.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Vort3x.Layers (OP)
Jr. Member
*
Offline Offline

Activity: 47
Merit: 11


View Profile
December 03, 2021, 03:18:42 AM
 #8

https://bitcointalk.org is the best & people around here are really pro.
Thanks for the answers.
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!