Hot answers tagged

8 votes
Accepted

How to generate addresses in PHP

Use BitWasp Bitcoin-php library https://github.com/Bit-Wasp/bitcoin-php <?php use BitWasp\Bitcoin\Bitcoin; use BitWasp\Bitcoin\Key\PrivateKeyFactory; $network = Bitcoin::getNetwork(); $privateKey ...
user avatar
  • 863
7 votes

How can I convert a bitcoin public key to a bitcoin address?

There is a step-by-step tutorial on the Bitcoin Wiki for converting Keys. For testing there is a very good website, where you can put in a private or public key and its show you the result of any ...
user avatar
7 votes
Accepted

JSON-RPC call to bitcoind error, 403 failed to open stream

I just read through the code that handles rpcallowip, and I can tell you that rpcallowip=0.0.0.0 won't work. If you want to allow from all addresses, you should use rpcallowip=0.0.0.0/0 (Weirdly, ...
user avatar
  • 28.7k
6 votes

Using PHP with RPC and cookie

Not sure if you're still looking for an answer, but I just stumbled upon this myself and for the benefit of anyone running into this. Even though it's called cookie based authentication, you still ...
user avatar
  • 61
5 votes

How to accept payments with Blockchain in PHP

Since you say "sort of a BitPay system", I assume you don't want to use BitPay. You can start with dissecting some of the work people have done in the space on repositories such as bitwasp or bitcoin-...
user avatar
  • 161
5 votes
Accepted

How would one monitor an address for a transaction and 1 confirmation in PHP?

Cron Jobs and 3rd Party API: You could try with cron jobs, but I wouldn't run it every second, that's rather exhaustive. Maybe every 5 or 10 minutes, and then have it check the current total ...
user avatar
  • 5,233
5 votes
Accepted

Is there a way to generate new addresses for someone else's wallet?

Bob can provide Alice with an extended public key (xpub). This will allow Alice to generate as many addresses as required, all of which will be accessible to Bob via the corresponding extended private ...
user avatar
  • 16.5k
4 votes
Accepted

How to use BlockChain API?

Your code is close to what you need: <?php $guid="xxxxxxxxx"; $main_password="xxxxxxxxx"; $json_url = "https://blockchain.info/merchant/$guid/balance?password=$main_password"; $json_data = ...
user avatar
4 votes
Accepted

Can I use curl to call getInfo from a the Bitcoin server?

You can use the command-line curl or any of the various JSON-RPC examples listed here. In particular, you can use curl like this: $ curl --user <username>:<password> --data-binary '{"...
user avatar
  • 7,639
4 votes
Accepted

Raw Transaction Fee - 256: absurdly-high-fee error

The fee is calculated from the difference between vin and vout. Here you are sending a very small amount to an addresses but you have not specified an output to receive the change. The client sees ...
user avatar
4 votes

How can I accept Bitcoin as a payment without a 3rd party gateway

There are several solutions out there and currently the most hyped one is probably BTC-Pay. It also supports lightning, so you should be pretty future-ready.
user avatar
  • 274
4 votes

Actively display wallet funds on web page - how?

I already have bitcoind running with a 4GB pruned database, and I'm hoping that will be enough. It is! By running bitcoin-core, you can pull this data in an easy, trustless way. I would recommend ...
user avatar
  • 17.4k
3 votes
Accepted

EasyBitcoin-PHP very slow

This is likely implementation specific. Bitcoind is an intensive application to run on a basic server, especially if the webapp lives on the same machine. You should never directly connect a page's ...
user avatar
3 votes
Accepted

How to integrate Blockchain Wallet API V2 to php

You need to run a local nodejs service. From there you can then integrate with php. As of January 2016 Blockchain.info made changes to the wallet API service that now require you to run a local ...
user avatar
  • 5,233
3 votes

How To Calculate Merkle Root?

This is the correct way to double hash two tx's. First you need to convert them into little endian, and then convert into raw binary data before hashing. <?php function le_raw ($str) { return ...
user avatar
  • 131
3 votes

How to send bitcoins with commission extracted from payment in PHP or bitcoind

Here is the algorythm without the code: createrawtransaction with amount that you want to send assuming that fees are 0 fundrawtransaction to let your bitcoind construct final transaction, put your ...
user avatar
3 votes
Accepted

Why a flip a bin before hashing in this script?

Hashes are big endian by standard, and most computers use little endian, so it's probably just for convenience. See Why does the Bitcoin protocol use the little-endian notation?
user avatar
  • 7,090
3 votes

convert private key to bitcoin address using python or php

I think this video will explain it in details (python): https://youtu.be/tX-XokHf_nI Using the code from video, pip packages ecdsa , hashlib and base58: import ecdsa import hashlib import base58 # ...
user avatar
  • 1,584
2 votes

How to create bitcoin wallet by PHP

. You can use Bitcoin-PHP Payment library - https://github.com/cryptoapi/Payment-Gateway <? require_once( "cryptobox.class.php" ); $options = array( "private_key" =&...
user avatar
  • 21
2 votes

How can I use bitcoin testnet in coinbase php

Yes, Coinbase now supports using the Testnet.
user avatar
  • 121
2 votes

JSON RPC library unable to connect to bitcoind?

As @Bittylicious mentioned the JSON-RPC is a little bit buggy https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)#PHP Note: The jsonRPCClient library uses fopen() and will throw an exception saying "...
user avatar
  • 131
2 votes

jsonRPC calling createrawtransaction in PHP

you should pass parameters as an array. try like that: $bitcoin->createrawtransaction( array( array( "txid"=>"...
user avatar
  • 3,569
2 votes

API for converting currency such as Euro/USD to BTC

See bitcoin-prices.js library for JavaScript (front end, no server-side components needed) that uses free bitcoinaverage.com API.
user avatar
2 votes
Accepted

Bitcoin.conf not being read by Bitcoin Core

The answer was to simply move bitcoin.conf in the correct directory, as described here: Where is the data folder for Bitcoin-Qt? Also, don't forget to set the correct file permissions as well; bitcoin....
user avatar
2 votes

Broadcasting an OP_RETURN transaction

blockchain.info's pushtx feature will reject transactions with OP_RETURN in it. You might want to try my tool https://github.com/kaykurokawa/pushtx
user avatar
  • 2,052
2 votes

Generating Bitcoin Public and Private Keys

Bitcoin uses point multiplication on the Elliptic Curve secp256k1 to generate a public key from a private key. Basically, this curve has a defined Generator point G, and a method for 'adding' two ...
user avatar
  • 11.4k
2 votes
Accepted

Is there a way to get the memory pool in order of newest first?

I think you have two options: 1) Patch bitcoin-core and make getrawmempoolentry return the mempool transaction sorted after entry_date. There is boost multi index that would be capable to fast sort ...
user avatar
2 votes

Bitcoin Transaction Detection With PHP

Im guessing your on ubuntu because of your username ;) Step 1 add the bitcoin ppa sudo apt-add-repository ppa:bitcoin/bitcoin Step 2 install bitcoind sudo apt install bitcoind Step 3 set bitcoind ...
user avatar
  • 399
2 votes

How to generate addresses in PHP

Full instruction based on response of @Farghaly: Ubuntu 16 Install dependencies sudo apt-get install php-bcmath php-gmp composer require bitwasp/bitcoin And then in fiel app.php <?php require '...
user avatar
  • 133
2 votes

With JSON how do I know the amount that was LAST sent to a given address?

You can also use the filter GET parameter to ensure that the first transaction is one where the address receives bitcoins and not one where the address spent bitcoins and the limit parameter to only ...
user avatar
  • 81

Only top scored, non community-wiki answers of a minimum length are eligible