User avatar
ladybugger
Posts: 3
Joined: Thu Dec 03, 2015 12:13 pm

How to generate Bitcoin-addressess with PHP?

Thu Dec 03, 2015 12:25 pm

Hello Everyone!

I'm a total newbie with Bitcoin so forgive me if I'm asking stupid things. All help needed!

My plan is to implement a way to pay with Bitcoins in my webshop.
My problem is to generate bitcoin-adresses with PHP. How should I do that?

I already managed to use addrgen.php (from https://github.com/prusnak/addrgen) but that needs a MPK in 64base. When I use Electrum on Bitcoin Core I do not have an 64base MPK, I have something else :?

Any ideas how to:
a) convert Electrum or Bitcoin Core private keys to 64base so that I can use this addrgen.php?
b) some other PHP sample that I can modify to produce limitless Bitcoin-adresses?
c) some other idea?

All hints and ideas are welcome!
BIG thanks in advance!

User avatar
BitcoinXio
Nickel Bitcoiner
Nickel Bitcoiner
Posts: 167
Joined: Mon Sep 21, 2015 4:12 pm
Contact: Website

Re: How to generate Bitcoin-addressess with PHP?

Thu Dec 03, 2015 4:29 pm

Hi, you may want to check out some of the tutorials by forum member coinableS. Here is one where he uses PHP to create a shopping cart using the Blockchain.info API, which will allow you to create bitcoin addresses on the fly.

1. project-development/shopping-cart-syste ... t3203.html
2. beginners-help/tutorials-diy-how-to-use ... -t520.html

User avatar
ladybugger
Posts: 3
Joined: Thu Dec 03, 2015 12:13 pm

Re: How to generate Bitcoin-addressess with PHP?

Thu Dec 03, 2015 4:53 pm

Thank you Sir,

I have to read thru those (I'm not really needing a cart system, only a way to generate addresses from MPK).

This is what I've found: https://github.com/Bit-Wasp/bitcoin-lib-php - super complicated for me :(
At least now I know where my "problem" is. It is this Electrum's freaking dark BIP32 codebase for the MPK :shock:

From my viewpoint this is really a pain in the neck when trying to put up a shop using Bitcoins, hah haa.
Thank you for the tip! All ideas welcome!

iFixBTCmemoryIssues
Gold Bitcoiner
Gold Bitcoiner
Posts: 2682
Joined: Tue Nov 24, 2015 9:03 pm

Re: How to generate Bitcoin-addressess with PHP?

Thu Dec 03, 2015 9:59 pm

Thank you Sir,

I have to read thru those (I'm not really needing a cart system, only a way to generate addresses from MPK).

This is what I've found: https://github.com/Bit-Wasp/bitcoin-lib-php - super complicated for me :(
At least now I know where my "problem" is. It is this Electrum's freaking dark BIP32 codebase for the MPK :shock:

From my viewpoint this is really a pain in the neck when trying to put up a shop using Bitcoins, hah haa.
Thank you for the tip! All ideas welcome!
Do not use any Bit-Wasp code, it is not safe.

Use this instead: https://github.com/mikegogulski/bitcoin-php

You can fork the functions and place them into your own code. If you can find something similar open-source as to what your end goal is, just copy that.

I may be able to have someone help you for free, just send me a PM and tell me what you want to do and where. I will see if it can be done and how easy (if it's a few hours work, no problem).
Image

If you are running a version of Bitcoin Core, stop using it. Upgrade to Bitcoin Unlimited or Classic immediately.

Fix Your Unconfirmed Transaction.

Vote for the future of our Bitcoin network!

iFixBTCmemoryIssues
Gold Bitcoiner
Gold Bitcoiner
Posts: 2682
Joined: Tue Nov 24, 2015 9:03 pm

Re: How to generate Bitcoin-addressess with PHP?

Thu Dec 03, 2015 10:04 pm

Hello Everyone!

I'm a total newbie with Bitcoin so forgive me if I'm asking stupid things. All help needed!

My plan is to implement a way to pay with Bitcoins in my webshop.
My problem is to generate bitcoin-adresses with PHP. How should I do that?

I already managed to use addrgen.php (from https://github.com/prusnak/addrgen) but that needs a MPK in 64base. When I use Electrum on Bitcoin Core I do not have an 64base MPK, I have something else :?

Any ideas how to:
a) convert Electrum or Bitcoin Core private keys to 64base so that I can use this addrgen.php?
b) some other PHP sample that I can modify to produce limitless Bitcoin-adresses?
c) some other idea?

All hints and ideas are welcome!
BIG thanks in advance!
/**
* Returns a new bitcoin address for receiving payments.
*
* If $account is specified (recommended), it is added to the address book so
* payments received with the address will be credited to $account.
*
* @param string $account Label to apply to the new address
* @return string Bitcoin address
* @throws BitcoinClientException
*/
public function getnewaddress($account = NULL) {
if (!$account || empty($account))
return $this->query("getnewaddress");
return $this->query("getnewaddress", $account);
}
Image

If you are running a version of Bitcoin Core, stop using it. Upgrade to Bitcoin Unlimited or Classic immediately.

Fix Your Unconfirmed Transaction.

Vote for the future of our Bitcoin network!

User avatar
coinableS
Nickel Bitcoiner
Nickel Bitcoiner
Posts: 65
Joined: Wed Sep 30, 2015 6:06 am

Donate BTC of your choice to 1J9ikqFuwrzPbczsDkquA9uVYeq6dEehsj

Contact: Website Twitter

Re: How to generate Bitcoin-addressess with PHP?

Sat Dec 05, 2015 6:05 am

Hello Everyone!

I'm a total newbie with Bitcoin so forgive me if I'm asking stupid things. All help needed!

My plan is to implement a way to pay with Bitcoins in my webshop.
My problem is to generate bitcoin-adresses with PHP. How should I do that?

I already managed to use addrgen.php (from https://github.com/prusnak/addrgen) but that needs a MPK in 64base. When I use Electrum on Bitcoin Core I do not have an 64base MPK, I have something else :?

Any ideas how to:
a) convert Electrum or Bitcoin Core private keys to 64base so that I can use this addrgen.php?
b) some other PHP sample that I can modify to produce limitless Bitcoin-adresses?
c) some other idea?

All hints and ideas are welcome!
BIG thanks in advance!
PHPcoinaddress is a PHP script that will work without any additional dependencies. No API, no bitcoind, or libraries.

https://github.com/zamgo/PHPCoinAddress

Save the PHPCoinAddress.php file, then include it, and then call it.

Code: Select all

<?php require_once('PHPCoinAddress'); //generate new public/private key pair $newKey = CoinAddress::bitcoin(); echo $newKey['public']; echo "<br>"; echo $newKey['private']; ?>


https://www.youtube.com/watch?v=5KK3wQRm1fo

User avatar
ladybugger
Posts: 3
Joined: Thu Dec 03, 2015 12:13 pm

Re: How to generate Bitcoin-addressess with PHP?

Sat Dec 05, 2015 6:32 pm

Super-big thanks for the good advice and answers.
Thank you all :D Great help!

As I mentioned, I am new with this Bitcoin and that is all okay. Bitcoin rules. But to build up this web page using Bitcoin is for me a real struggle. Or was. Now it looks like there's already some light at the end of the tunnel, hah haa. Thank you.

I'm not happy to use APIs so that's why I'm happy with the good example (thanks for the great video). I did not expect to go this deep into Bitcoin-stuff ... :shock:

Warning! I'll be soon back with more questions!

User avatar
BitcoinXio
Nickel Bitcoiner
Nickel Bitcoiner
Posts: 167
Joined: Mon Sep 21, 2015 4:12 pm
Contact: Website

Re: How to generate Bitcoin-addressess with PHP?

Sat Dec 05, 2015 6:35 pm

Super-big thanks for the good advice and answers.
Thank you all :D Great help!

As I mentioned, I am new with this Bitcoin and that is all okay. Bitcoin rules. But to build up this web page using Bitcoin is for me a real struggle. Or was. Now it looks like there's already some light at the end of the tunnel, hah haa. Thank you.

I'm not happy to use APIs so that's why I'm happy with the good example (thanks for the great video). I did not expect to go this deep into Bitcoin-stuff ... :shock:

Warning! I'll be soon back with more questions!
Well, you came to the right place for help! :)

User avatar
BitcoinNewsMagazine
Nickel Bitcoiner
Nickel Bitcoiner
Posts: 217
Joined: Thu Sep 24, 2015 5:03 pm
Contact: Website Facebook Twitter

Re: How to generate Bitcoin-addressess with PHP?

Sat Dec 05, 2015 6:54 pm

It is a good idea to use WordPress for ecommerce sites taking bitcoin as there are quite a few solutions ready available like CoinSimple.

Return to “Development & Technical Discussion”

Who is online

Users browsing this forum: No registered users and 0 guests