Simple back end api for developers

I have started work on an api to help do some calculations for developers to save time and help the less technical minded play with their own creations without dealing without the need for complex coding.

It is currently hosted on free hosting so don’t expect it to be lightning fast or able to handle millions of requests a minute.

http://stevenbrown.uphero.com/api.php?lookup= Address

Its very basic at the moment but allows you to get the following information for a given address

  • Balance
  • Coin Weight
  • Btc value
  • Usd Value
  • Estimated time to stake in minutes

There is also http://stevenbrown.uphero.com/api.php?lookup=info that gives certain generic information like network weight, current price, difficulty etc.

Here is an example
http://stevenbrown.uphero.com/api.php?lookup=RvmwBpHbwQgLZcTvkcpdhGqt17FA11U1it
and this is an example of it being used to create a basic web based RddCompanion
http://rddcompanion.tk

The api might go down or things might alter slightly so while you can use it to build anything you want, I would not rely on it for a major service.

I have no idea how far I shall take this as I am short on ideas, but if you feel there is something I should add or do differently please let me know.

Just in case any of you want to see how easy it is to use you can test or adapt the code below

<?php
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "http://stevenbrown.uphero.com/api.php?lookup=RvmwBpHbwQgLZcTvkcpdhGqt17FA11U1it");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$rawData = curl_exec($curl);
curl_close($curl);
$data = json_decode($rawData);
$address = $data->address;
$bal = $data->balance;
$value = $data->value;
$usdvalue = $data->usdvalue;
$minstostake = $data->minstostake / 60;

echo "<b>Wallet Address:</b><br> $address<br>";
echo "<b>Balance:</b><br> $bal<br>";
echo "<b>Bitcoin Value:</b><br>$value<br>";
echo "<b>USD Value:</b><br>$ $usdvalue<br>";
echo "<b>Estimated Time until stake:</b><br>$minstostake<br>";
?>

I have a second api to add bits to and use for testing until I know it works it can be accessed using api2.php

Thank you for the tips and up votes, please feel free to send tips to “test” the speed of the api updating :stuck_out_tongue:

Any features you may want adding will be considered and let me know of any faults/errors

My current to do list is pretty small and shouldn’t take long
~To Do~

  • Multi address lookup - not sure which approach I shall take to this
  • Add market cap to “info”
  • Add wallet Stake history total

Doopee :smiley: Sent you a tip. Great job and hopefully you can find the time to keep this up! It would be cool if a website was to monitor the blockchain such as checking the time between blocks, checking for forks(idk if this is even possible), and other features

Thanks

Naro said:
It would be cool if a website was to monitor the blockchain such as checking for forks(idk if this is even possible)

you can’t check for forks as a fork has to exist before you can monitor it as far as I know

BrownSlaughter said:

~To Do~

  • Multi address lookup - not sure which approach I shall take to this
  • Add market cap to “info”

multi address lookup (upto 5 addresses) has been added to test api and in testing phase (separate each address with a comma. e.g. api2.php?lookup=address1,address2 )
marketcap added to test api

2 Likes

BrownSlaughter Is this using reddcore or just reddsight-api? hopefully I don’t end up breaking it as part of the upgrades to reddcore that are in the pipeline :-/

bigreddmachine it uses redsight, I have not looked into reddcore yet

BrownSlaughter okay then i don’t think anything should break!

BrownSlaughter What a perfect API you’ve made !

Where do you get current prices from?

Let me know if you need any help, or think we could do something together with Reddex and this API

Convertor I currently use a site that averages the price from cryptsy, bitrex and poloniex. I was going to use your price api but the other site did btc price as well so it made my life a little easier to do both at the same time.

BrownSlaughter Is that BTC to fiat, or which pair are you talking about? :slight_smile:

Convertor yes btc usd

BrownSlaughter How are you calculating Coin Weight for a giving address?

Working on a new Reddcoin projects for staking, which will be open source today or tomorrow, just adding some last things.

Are you getting both Coin Weight and stake time for current address by the reddsight API?

Convertor weight is a fairly complex thing to work out
you do it by getting the information of unspent transactions from reddsight http://live.reddcoin.com/api/addr/RvmwBpHbwQgLZcTvkcpdhGqt17FA11U1it/utxo
and then use the calculations in the source code for the qt wallet for calculating weight for each transaction and add it all up for the wallet total.

If you need any more info just shoot me a pm.

2 Likes

BrownSlaughter Thanks a lot!.

Will shoot you a PM in a few :slight_smile: