Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Seal on February 24, 2013, 06:15:23 PM



Title: Create and send transactions in PHP
Post by: Seal on February 24, 2013, 06:15:23 PM
I'm looking for two things:

1. A way of creating transactions in PHP
2. Any supported API to broadcast the transactions mentioned above

Does a set of classes / api exist for this already?

Appreciate a link if this topic already exists (i couldnt find it though).

Edit: I should add, I do not want to use any daemons to do this or by piggybacking off other clients. This needs to be done within PHP in its entirety. The only external call would be the broadcast of the transaction.


Title: Re: Create and send transactions in PHP
Post by: deeplink on February 24, 2013, 06:43:41 PM
Not sure what you mean with 'piggybacking off other clients'

Maybe this suits your needs. It seems to be under active development, but it does need a daemon:

PHP Bitcoin Development Kit | Alpha Release candidate v0.0.43 | BitcoinDevKit.com
https://bitcointalk.org/index.php?topic=123586.0

You can also use the blockchain.info API for sending and receiving payments without running a local daemon:
https://blockchain.info/api


Title: Re: Create and send transactions in PHP
Post by: gweedo on February 24, 2013, 06:52:18 PM
I am pretty sure this isn't possible, just cause at some point you need to sign the inputs to prove they are owned by you, and that would require a wallet with the able to sign a raw tx.


Title: Re: Create and send transactions in PHP
Post by: Stephen Gornick on February 24, 2013, 07:18:59 PM
I am pretty sure this isn't possible, just cause at some point you need to sign the inputs to prove they are owned by you, and that would require a wallet with the able to sign a raw tx.

Braiinwallet does this in Javascript, but you need the transaction hash (and index) for each coin that you are spending -- that would be the service provided by the bitcoin.org clieint or other client that you would need to re-implement.

 - http://brainwallet.org/#tx

The only external call would be the broadcast of the transaction.

 - https://blockchain.info/pushtx
 - signrawtransaction and sendrawtransaction from http://en.bitcoin.it/wiki/Raw_Transactions


Title: Re: Create and send transactions in PHP
Post by: Seal on February 24, 2013, 07:38:21 PM
I am pretty sure this isn't possible, just cause at some point you need to sign the inputs to prove they are owned by you, and that would require a wallet with the able to sign a raw tx.

Braiinwallet does this in Javascript, but you need the transaction hash (and index) for each coin that you are spending -- that would be the service provided by the bitcoin.org clieint or other client that you would need to re-implement.

 - http://brainwallet.org/#tx

The only external call would be the broadcast of the transaction.

 - https://blockchain.info/pushtx
 - signrawtransaction and sendrawtransaction from http://en.bitcoin.it/wiki/Raw_Transactions

Seems like I've underestimated the complexity of the task. I assumed wrongly that if i had the private key it would be a simple task.

I was working on a online payment system that would take any coins paid into a certain address and redirect them straight to a more secure vault address (where the private key would not be on the server).

How do other sites accept payments and produce 'hot wallet' payments? Are they all running the daemon?


Title: Re: Create and send transactions in PHP
Post by: Sukrim on February 26, 2013, 12:31:57 PM
BIP32 (https://en.bitcoin.it/wiki/BIP_0032) sounds nice...

You'd generate new addresses on the fly and don't need to send the coins elsewhere.

If you want to _send_ payments though (to customers, not yourself) then you need something else, for _receiving_, BIP32 it is probably.