Bitcoin Forum
May 07, 2024, 03:26:03 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Any PHP script that would do this ?  (Read 1229 times)
BitCoinDream (OP)
Legendary
*
Offline Offline

Activity: 2324
Merit: 1204

The revolution will be digital


View Profile
July 15, 2014, 03:23:45 PM
 #1

1. Generate a random bitcoin address.

2. Will check it's own address balance and confirmation at some of the existing block explorer service at a certain time interval using API call.

3. When a balance is found on the address with n+ confirmation, it pushes a Tx in network forwarding the balance to a certain address.

4. Make a call to a function amountSent with amount in satoshi and Tx ID as input, i.e. amountSent(amount, txid).

1715052363
Hero Member
*
Offline Offline

Posts: 1715052363

View Profile Personal Message (Offline)

Ignore
1715052363
Reply with quote  #2

1715052363
Report to moderator
I HATE TABLES I HATE TABLES I HA(╯°□°)╯︵ ┻━┻ TABLES I HATE TABLES I HATE TABLES
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
grue
Legendary
*
Offline Offline

Activity: 2058
Merit: 1431



View Profile
July 15, 2014, 03:46:04 PM
 #2

As in, a script that you can copy paste? probably not. but there's scripts for doing each of the steps you mentioned.

It is pitch black. You are likely to be eaten by a grue.

Adblock for annoying signature ads | Enhanced Merit UI
AuroraHF
Hero Member
*****
Offline Offline

Activity: 784
Merit: 500


View Profile
July 15, 2014, 03:48:44 PM
 #3

This would be really simple to create, I'm sure someone with a few months of coding can whip this up quickly using Blockchain's JSON-RPC API.

lmao
BitCoinDream (OP)
Legendary
*
Offline Offline

Activity: 2324
Merit: 1204

The revolution will be digital


View Profile
July 15, 2014, 04:10:17 PM
 #4

As in, a script that you can copy paste? probably not. but there's scripts for doing each of the steps you mentioned.

Can u please at least point me to the address generation and Tx creation PHP script ? For Tx creation function, the i/p will be address and private key.

BitCoinDream (OP)
Legendary
*
Offline Offline

Activity: 2324
Merit: 1204

The revolution will be digital


View Profile
July 15, 2014, 04:16:06 PM
 #5

This would be really simple to create, I'm sure someone with a few months of coding can whip this up quickly using Blockchain's JSON-RPC API.

The whole thing can be done using blockchain.info receive API in a single call. But, there are associated problems. Sometimes, when it takes more than 20 minutes to find a block, blockchain.info API takes looooooong time to forward the balance and does not make the callback at all !!! Hence, I'm trying to get rid of the blockchain.info dependency for receival purpose. If the code can be found or I can make it up by adding multiple snippets, it would probably help the community in general to partly move out of blockchain.info dependency for payment receival.

ThomasCrowne
Full Member
***
Offline Offline

Activity: 210
Merit: 100

★☆★ 777Coin - The Exciting Bitco


View Profile
July 16, 2014, 06:21:41 AM
 #6

As in, a script that you can copy paste? probably not. but there's scripts for doing each of the steps you mentioned.

Can u please at least point me to the address generation and Tx creation PHP script ? For Tx creation function, the i/p will be address and private key.
Here ya go Smiley

https://github.com/mikegogulski/bitcoin-php/blob/master/src/bitcoin.inc#L567

deathmare
Newbie
*
Offline Offline

Activity: 14
Merit: 0


View Profile
July 16, 2014, 06:32:35 AM
 #7

Yeah, this can be done quickly by daemon's JSON-RPC API nor with command-line interface. Also I prepared something like you want with nodejs and blockchain.info before, not so hard to do in my opinion.
BitCoinDream (OP)
Legendary
*
Offline Offline

Activity: 2324
Merit: 1204

The revolution will be digital


View Profile
July 16, 2014, 02:19:53 PM
 #8

As in, a script that you can copy paste? probably not. but there's scripts for doing each of the steps you mentioned.

Can u please at least point me to the address generation and Tx creation PHP script ? For Tx creation function, the i/p will be address and private key.
Here ya go Smiley

https://github.com/mikegogulski/bitcoin-php/blob/master/src/bitcoin.inc#L567

Thank u for the link. From a quick look, what I understand that it relies on JSON-RPC call to a BitcoinD to generate a new address. I'm not looking for that. I am looking for a PHP code that can generate a Bitcoin address & Private key combination without relying on any external call.

deathmare
Newbie
*
Offline Offline

Activity: 14
Merit: 0


View Profile
July 17, 2014, 07:40:22 AM
 #9

I'm not sure about that, but it looks PHP can not generate BTC addresses itself:
https://github.com/bitcoin/bitcoin/blob/d3165ed35adde59bdfbe72928b51a039202fa21e/src/rpcwallet.cpp#L79
fbueller
Sr. Member
****
Offline Offline

Activity: 412
Merit: 266


View Profile
July 17, 2014, 08:01:02 AM
 #10

My library borrows some stuff from Mikes (Or else Mikes borrows from an upstream one).

https://github.com/Bit-Wasp/bitcoin-lib-php/blob/master/src/BitcoinLib.php#313-328 This function generates a key pair + address.

The library doesn't use RPC calls, it's up to you to know what to use it for! You'd need either blockchains API or else some sort of transaction scraper to identify payments your addresses. A scraper gets complicated, since you need to be prepared for reorgs.

Bitwasp Developer.
BitCoinDream (OP)
Legendary
*
Offline Offline

Activity: 2324
Merit: 1204

The revolution will be digital


View Profile
July 17, 2014, 10:23:48 AM
 #11

I'm not sure about that, but it looks PHP can not generate BTC addresses itself:
https://github.com/bitcoin/bitcoin/blob/d3165ed35adde59bdfbe72928b51a039202fa21e/src/rpcwallet.cpp#L79

Before, I have seen a code by Theymos in Python that can independently generate an address. Moreover, given the fact that Bitcoin-QT is written in C++ and generating address independently, PHP should also be able to do the same. It is about taking a big random no. and doing some cryptographic transformation on it to generate private key and address.

BitCoinDream (OP)
Legendary
*
Offline Offline

Activity: 2324
Merit: 1204

The revolution will be digital


View Profile
July 17, 2014, 10:24:27 AM
 #12


My library borrows some stuff from Mikes (Or else Mikes borrows from an upstream one).

https://github.com/Bit-Wasp/bitcoin-lib-php/blob/master/src/BitcoinLib.php#313-328 This function generates a key pair + address.

The library doesn't use RPC calls, it's up to you to know what to use it for! You'd need either blockchains API or else some sort of transaction scraper to identify payments your addresses. A scraper gets complicated, since you need to be prepared for reorgs.

In your code, as I can see, to get new private key, the following are being used...

Code:
\SECcurve::generator_secp256k1()
openssl_random_pseudo_bytes(32)

The second is in PHP lib, but is the first one ? If not, then how the first one is invoked ? I'm a little confused !!!

And, I'm not relying on a scraper to identify payment. Now, we have, multiple block explorers for bitcoin. We can check any address balance using their API and verify from multiple explorers.

Eyepawd
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
July 17, 2014, 01:46:33 PM
 #13

Can't you just use RPC with Bitcoind
https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list

Bitcoind also has a function that will run a command when a transaction has been made.
https://en.bitcoin.it/wiki/Running_Bitcoin
fbueller
Sr. Member
****
Offline Offline

Activity: 412
Merit: 266


View Profile
July 17, 2014, 02:05:28 PM
 #14


My library borrows some stuff from Mikes (Or else Mikes borrows from an upstream one).

https://github.com/Bit-Wasp/bitcoin-lib-php/blob/master/src/BitcoinLib.php#313-328 This function generates a key pair + address.

The library doesn't use RPC calls, it's up to you to know what to use it for! You'd need either blockchains API or else some sort of transaction scraper to identify payments your addresses. A scraper gets complicated, since you need to be prepared for reorgs.

In your code, as I can see, to get new private key, the following are being used...

Code:
\SECcurve::generator_secp256k1()
openssl_random_pseudo_bytes(32)

The second is in PHP lib, but is the first one ? If not, then how the first one is invoked ? I'm a little confused !!!

And, I'm not relying on a scraper to identify payment. Now, we have, multiple block explorers for bitcoin. We can check any address balance using their API and verify from multiple explorers.

Clone the project from Github, or download the zip file: https://github.com/Bit-Wasp/bitcoin-lib-php

You can use composer (https://github.com/Bit-Wasp/bitcoin-lib-php/blob/master/README.md#installation) to manage all this. Install, and then include "./vendor/autoload.php"

Check the examples folder on how to use it then!

Bitwasp Developer.
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!