Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: darknetdeveloper on August 01, 2023, 11:08:40 AM



Title: How to create addresses with XPub
Post by: darknetdeveloper on August 01, 2023, 11:08:40 AM
Hello,

I want to create child bitcoin address. (for payment)
How to i create payment address with php -no javascript-


Title: Re: How to create addresses with XPub
Post by: BitMaxz on August 01, 2023, 05:12:22 PM
What exactly do you want to achieve?
Are you planning to create a payment gateway where you can accept payment directly to your wallet?

You can host this https://btcpayserver.org/ in your server and it is ready to use and it only requires xPub of your wallet.


Title: Re: How to create addresses with XPub
Post by: bitmover on August 01, 2023, 06:40:03 PM
Hello,

I want to create child bitcoin address. (for payment)
How to i create payment address with php -no javascript-


well, i just googled and found this

This blogs makes a step by step how to, using BitWasp PHP library
https://freedomnode.com/blog/generate-bitcoin-wallet-addresses-from-extended-public-key-with-php/




Title: Re: How to create addresses with XPub
Post by: tech30338 on August 02, 2023, 02:34:44 AM
Before I want to try to received payment using bitcoin, for example my website for my service payment, but i would have spend more time researching since I'm not a programmer, I also search google and find this they say you can just edit their codes,
https://www.tutorialswebsite.com/integrate-blockonomics-bitcoin-payment-gateway-in-php/, hope this can help you.


Title: Re: How to create addresses with XPub
Post by: pooya87 on August 03, 2023, 04:17:41 AM
No offense but if you have to ask something this basic, you can't call yourself a "developer" and you definitely should not attempt at creating something security critical unless you are just playing around in which case just visit github and search for a library written in PHP that supports BIP32.
Something like this search: https://github.com/search?q=bip32+language%3APHP&type=repositories&l=PHP
Then either use one of the ready to use tools or get the code from there to write a tool around that. But as I said if you don't know what you are doing, the result will not be secure.


Title: Re: How to create addresses with XPub
Post by: iBaba on August 03, 2023, 06:58:00 AM
Hello,

I want to create child bitcoin address. (for payment)
How to i create payment address with php -no javascript-


Bitcoin wallets are just pairs of private/public keys. Your "password" is your private key, and your "address" for receiving currency is your public key. So to protect my privacy and security, i will use distinct addresses for each transaction. Nonetheless, the number of keys we have to carry around would keep increasing to the point that it just wouldn’t be practical. Again, that's reason why the HD wallets were introduced.

Try something like this codes below, it will be your best of friend on this one.
https://gist.githubusercontent.com/gunar/86c05f67e2a862f148bda1fc4f0a82f3/raw/8456458b11f72289519ef581560f06c3caf7b798/p2pkhFromXpub.js (https://gist.githubusercontent.com/gunar/86c05f67e2a862f148bda1fc4f0a82f3/raw/8456458b11f72289519ef581560f06c3caf7b798/p2pkhFromXpub.js)


Title: Re: How to create addresses with XPub
Post by: NotATether on August 03, 2023, 07:14:36 AM
I think this is sort of the problem with Bitcoin (and crypto at large) libraries today, you have well-written implementations only in one or two languages, and the rest of the implementations in other languages are mediocre and/or do not work or are a security hazard. So you'd either have to settle with the mediocre implementation or try to port it yourself, which can also be hazardous.

But assuming you have those multi-language skills, the porting part shouldn't be too difficult. You only need native dependencies for secp256k1, SHA256 and HMAC-SHA512 (native is important, in order to avoid various timing and side-channel attacks).