Author

Topic: retrieve blockchain.info network propagation percentage programmatically (Read 491 times)

newbie
Activity: 11
Merit: 0
Thanks for the reply & thanks for the explanation! Any chance you can give me an example?

Basically im following a tutorial online where first we generate a fresh bitcoin address that users can send btc to on page load using the wallet api. (code example below)  
That said i was trying to get the network propagation percentage for the "latest transaction" on the new address that just got generated.. ( $parseAddy )

Code:
// Generate new address
$newAddy = json_decode(file_get_contents("https://blockchain.info/merchant/$ID/new_address?password=$PW"), true);

$parseAddy = $newAddy[address];

 

What i really want to do is determine if the network propagation percentage for the latest transaction on that address is low or high!


I was told when waiting for a confirmation, if the network propagation percentage for that transaction is high like 99%  then the chance of a double spend is really low and so it would be ok to accept the payment with a low confirmation number even 0 confirmations. ( items worth $20-$100)


That said im trying to put something together that checks the balance of the freshly created address and then checks the network propagation percentage of the latest transaction on that address and if it has a high percentage say greater than 97% than i want the transaction to immediately complete and forward the user to the product.

If the network propagation percentage for the latest transaction in that address is low, like 10% then i want the script to keep waiting for 2-3 confirmations instead of completing the transaction and forwarding the user.

 
hero member
Activity: 672
Merit: 508
LOTEO
Network propagation is the number of nodes (computers running a bitcoin client) that have heard about your transaction.
Not only transactions propagate in a network. Routing messages propagate too  Smiley

Propagation needs to happen before a confirmation can occur, if no miner knows about the transaction it cannot be confirmed.

To get the unconfirmed transactions:  https://blockchain.info/en/unconfirmed-transactions?format=json
Use a HTTP get to put the data into a variable ($data).  Then parse it with a JSON parser. Count the number of elements ($unconfirmedTotal). You can then calculate the percentage.
 
Do you want the percentage of uncofirmed transactions relative to all transactions or compared to recently confirmed?
newbie
Activity: 11
Merit: 0
Hello im learning php here and i have a question about blockchain.info's wallet api.

so from my understanding network propagation is the amount of nodes a transaction hits before being confirmed.


Im using blockchain.info's wallet api and when a transaction has not had a confirmation yet, blockchain.info shows network propagation in the form of a percentage for any given unconfirmed transaction on their website.


How can i programmatically get this percentage for an unconfirmed transaction using php?..
 
Thanks in advance,
Time_Dj
Jump to: