Bitcoin Forum
May 26, 2024, 05:28:47 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Can RawTx be created using PHP ?  (Read 827 times)
BitCoinDream (OP)
Legendary
*
Offline Offline

Activity: 2324
Merit: 1204

The revolution will be digital


View Profile
July 25, 2014, 05:58:28 PM
 #1

If I have the bitcoin address, private key, amount to be sent & the destination address, can i create the raw tx code to be used in https://blockchain.info/pushtx or similar services using PHP ?

If yes, can someone plz point to any sample code ?

DannyHamilton
Legendary
*
Offline Offline

Activity: 3402
Merit: 4656



View Profile
July 25, 2014, 10:07:24 PM
 #2

If I have the bitcoin address,

This is not useful.  Bitcoin transactions do not spend from addresses, they spend specific previously unspent outputs.  To identify the previously unspent outputs, you need the transaction ID and the offset (vout) of the particular outputs you are trying to spend. To provide the necessary information to authorize spending the output, you also need to know what the scriptPubKey is for each output.

private key, amount to be sent & the destination address, can i create the raw tx code to be used in https://blockchain.info/pushtx or similar services using PHP ?

If yes, can someone plz point to any sample code ?

Once you have the list of specific outputs and the scriptPubKey of each, then you should be able to use the private keys to generate an appropriate scriptSig for each input.  With the amount sent, and destination address, you should be able to create the necessary outputs.

I'm not sure how to go about this in PHP, but for an example of how it can be accomplished with javascript you can take a look at this page:

https://brainwallet.github.io/#tx
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!