Developer API
Available API endpoints
Stats
URL: https://0xbtc.info/api/stats.json
Rate limit: 10 calls per 10 seconds per IP address. It's fine to call this from your website's JavaScript since each of your visitors has a different IP address, even if you have millions of users.
This endpoint gives fundamental stats about 0xBitcoin. The format is compatible with the stats produced by 0xbtc-api by Infernal_Toast, except these two differences:
- It calculates
totalSupplyexactly - It adds
usdPrice
To use:
Simply do a normal HTTP GET to
https://0xbtc.info/api/stats.json, and you will receive JSON
like the following:
{
"apiVersion": "1.01",
"name": "0xBitcoin Token",
"symbol": "0xBTC",
"contractUrl": "https://etherscan.io/address/0xb6ed7644c69416d67b522e20bc294a9a9b405b31",
"contractAddress": "0xb6ed7644c69416d67b522e20bc294a9a9b405b31",
"decimals": 100000000,
"difficulty": 1297837503,
"minimumTarget": "65536",
"maximumTarget": "27606985387162255149739023449108101809804435888681546220650096895197184",
"miningTarget": "21271526910302486050457981358149075005488413517817103191680580",
"challengeNumber": "0xd6e77bd8d0c876b4f4f64fae5de2a19a7ed491d4a3ef6dcd7175e4c2d8044f7e",
"epochCount": 94367,
"rewardEra": "0",
"maxSupplyForEra": 1050000000000000,
"blocksPerReadjustment": 1024,
"latestDifficultyPeriodStarted": 8166386,
"circulatingSupply": 4718300,
"totalSupply": 20999983.69,
"lastRewardTo": "0x15d3a2c45746f5f827bf2dea55a4e1d1529bafa2",
"lastRewardAmount": 5000000000,
"lastRewardEthBlockNumber": 8171003,
"currentEthBlock": 8171022,
"ethBlocksSinceLastDifficultyPeriod": 4636,
"secondsPerReward": 437.35849056603774,
"hashrateEstimate": 12446368713385.96,
"hashrateEstimateDescription": "12446.37 GH/s",
"rewardsSinceReadjustment": 159,
"usdPrice": "0.21570"
}
Description of keys
apiVersion1.01name0xBitcoin Token- ERC-20 token name.
symbol0xBTC- ERC-20 token symbol.
contractUrlhttps://etherscan.io/address/0xb6ed7644c69416d67b522e20bc294a9a9b405b31- View contract
- The Etherscan URL for viewing the contract is not expected to change. (This URL is for humans only; computers don't need this value.)
contractAddress0xb6ed7644c69416d67b522e20bc294a9a9b405b31- Ethereum address of the 0xBitcoin smart contract.
decimals100000000-
1 0xBTC can be subdivided 100,000,000 times (eight decimal places), so the
smallest possible transfer would be —
- 0.00000001 0xBTC
- aka 1/100,000,000th of 1 0xBTC
- aka 1 Satoasti (named after Infernal_Toast).
difficulty1297837503-
How hard mining is now, relative to how hard it was at the start of
0xBitcoin. If
difficultyis currently1297837503, that means it is ~1.3 billion times as hard to mine 0xBTC now as it was on Feb-06-2018 04:03:46 AM +UTC when the contract was created. (Initially,difficultywas1.) minimumTarget65536-
Mining the next 0xBitcoin block requires finding a 256-bit SHA3-Keccack
hash such that
keccak256(challengeNumber, msg.sender, nonce) ≤ miningTarget. The smallerminingTargetis, the harder mining 0xBitcoin is. (Given as a string for compatability with 0xbtc-api.) maximumTarget27606985387162255149739023449108101809804435888681546220650096895197184-
This was the initial value of
miningTargetwhen mining was easiest. It is equal to 2234. Finding a hash less than this number is not hard; it only takes 4,194,304 guesses on average (222 guesses). (Given as a string because JavaScript can't natively handle large numbers.) miningTarget21271526910302486050457981358149075005488413517817103191680580-
The current
miningTarget. The 0xBitcoin smart contract adjusts the difficulty of mining by lowering/raisingminingTargetover time, in order to control the emission rate of 0xBTC. If mining is happening too fast, it decreasesminingTargetand vice versa. The target rate is one block mined every 10 minutes. Readjustment happens every 1,024 0xBitcoin blocks. (Given as a string because JavaScript can't natively handle large numbers.) challengeNumber0xd6e77bd8d0c876b4f4f64fae5de2a19a7ed491d4a3ef6dcd7175e4c2d8044f7e- This changes every time a 0xBitcoin block is mined. It is set to the block hash of the immediately preceding Ethereum block. Having this value change on every 0xBitcoin block is critical since it prevents any kind of premining attack.
epochCount94367- The total number of 0xBitcoin blocks that have been mined so far.
rewardEra0-
The current era. There will be 40 in total (
0...39). The mining reward, which started at 50 in the first era (number0), halves at the start of every new era. maxSupplyForEra1050000000000000- The total number of 0xBTC that will be mined in the current era.
blocksPerReadjustment1024- The smart contract readjusts the difficulty of mining every 1,024 0xBitcoin blocks. (More info above.)
latestDifficultyPeriodStarted8166386- The Ethereum block number at the time the difficulty was last readjusted.
circulatingSupply4718300- The total number of 0xBTC that have been mined so far.
totalSupply20999983.69- The maximum number number of 0xBTC that can ever exist. The total supply decreases when 0xBTC are burned (that is, transfered to the Ethereum address 0x0000000000000000000000000000000000000000, from which they can never be recovered). This value can only decrease with time.
lastRewardTo0x15d3a2c45746f5f827bf2dea55a4e1d1529bafa2- The Ethereum address of the miner who mined the last block.
lastRewardAmount5000000000-
How many 0xBitcoin (in Satoastis) were awarded in the last block. This decreases by half
every era. The
5000000000example shown here means 50.00000000 0xBTC. lastRewardEthBlockNumber8171003- The number of the most recent Ethereum block where 0xBitcoin was successfully mined.
currentEthBlock8171022- The current Ethereum block number. Ethereum miners are always trying to mine the next block in a process similar to 0xBitcoin mining, but with a completely different algorithm. Ethereum adjusts its own mining difficulty to try to have one block every 15 seconds.
ethBlocksSinceLastDifficultyPeriod4636- How many Ethereum blocks have been mined since the 0xBitcoin smart contract last adjusted the mining difficulty of 0xBitcoin. This value is used by the smart contract to figure out how much to readjust difficulty by, when it readjusts difficulty every 1,024 blocks.
secondsPerReward437.35849056603774- In the current difficulty period, how long it has taken each 0xBitcoin block to be mined, on average. This will normally be about 600 seconds, but it could be lower if total 0xBitcoin mining power (hashrate) has recently ramped up a lot.
hashrateEstimate12446368713385.96-
Given the current mining difficulty (which is directly related to
miningTarget), this is the number of hash guesses that are being done per second by all 0xBitcoin miners. hashrateEstimateDescription12446.37 GH/s-
The
hashrateEstimateexpressed in gigahashes per second. 1 GH/s is 1 billion hashes per second. rewardsSinceReadjustment159-
The number of 0xBitcoin blocks that have been mined in the current
difficulty period. This value is computed (but not stored) by the smart
contract on every solved block to figure out when to do a readjustment of
difficulty (actually
miningTarget), which happens every 1,024 0xBitcoin blocks. usdPrice0.21570- The weighted price of 0xBitcoin on exchanges. Right now this is collected from Live Coin Watch.