diff --git a/API b/API new file mode 100644 index 00000000..e1f0db4a --- /dev/null +++ b/API @@ -0,0 +1,545 @@ +## [Blockchair.com](https://blockchair.com/) API + +Logo + +### API v.2 documentation +* English: [https://blockchair.com/api/docs](https://blockchair.com/api/docs) (up to v.2.0.80) + +### Please apply for an API key first + +tl;dr: +* If you use our API occasionally a key is not required +* Non-commercial and academic projects constantly using our API should apply for a free Public API key +* Commercial projects should apply for a key to Premium API + +Since the introduction of our API more than two years ago it has been free to use in both non-commercial and commercial cases with a limit of 30 requests per minute. Obtaining an API key has been required only for those who were hitting this limit. + +**Beginning July 19th, 2019 we require all applications using our API to obtain an API key.** + +If you develop a non-commercial project (e.g. a website showing some stats) or conducting academic research, please apply for a free key to our Public API (). + +If you develop a commercial project (e.g. a web wallet showing ads), please apply for a key to our Premium API (). + +While we still allow making requests without a key, services which make too many resource-consuming requests may automatically be banned (the API will return HTTP Error 430 in this case). + +The key is applied to the end of the request string like this: `api.blockchair.com/bitcoin/blocks?key=MYSECRETKEY`. Please remember that your key is a secret -- don't disclose it to client-side applications as unauthorized users may start to use your key. + +### Changelog + +* v.2.0.95 - December 23rd, 2021 + * Added Solana support in beta mode. We're not running a full history Solana node at the moment, so only the most recent blocks and transactions are available. The available block range can be obtained using `https://api.blockchair.com/range`. New endpoints: + * `https://api.blockchair.com/solana/stats` + * `https://api.blockchair.com/solana/raw/slot/{:id}` + * `https://api.blockchair.com/solana/raw/transaction/{:signature}` + * `https://api.blockchair.com/solana/raw/address/{:address}`. Possible options: `?tokens=true` (costs `1` additional request point to use). + * `https://api.blockchair.com/solana/raw/validators`. Available options: `?offset={:offset}`. + * `https://api.blockchair.com/solana/raw/slots`. Available options: `?offset={:offset}`. +* v.2.0.94 - December 1st, 2021 + * Added Kusama support in beta mode. The endpoints are compatible with Polkadot (we'll refer to Polkadot and Kusama as "Polkadot-like blockchains"): + * `https://api.blockchair.com/kusama/stats` (+ `https://api.blockchair.com/stats` now also features Kusama) + * `https://api.blockchair.com/kusama/raw/block/{:id}` + * `https://api.blockchair.com/kusama/raw/block/{:hash}` + * `https://api.blockchair.com/kusama/raw/extrinsic/{:id}` + * `https://api.blockchair.com/kusama/raw/extrinsic/{:hash}` + * `https://api.blockchair.com/kusama/raw/address/{:address}` (with `?offset={:offset} option to iterate through the latest extrinsics and transfers) + * `https://api.blockchair.com/kusama/raw/blocks` (an infinitable with `?offset={:offset} option) + * `https://api.blockchair.com/kusama/raw/extrinsics` (an infinitable with `?offset={:offset} option) + * `https://api.blockchair.com/kusama/raw/events` (an infinitable with `?offset={:offset} option) +* v.2.0.93 - November 17th, 2021 + * Added support for almost 200 fiat currencies and precious metals with exchange rates going back to 2009. + * All API endpoints now support the `?rates={:code}` option. If enabled, it adds extra data for the chosen currency code on top of where USD data is already available. Example: `https://api.blockchair.com/bitcoin/stats?rates=kzt` adds `average_transaction_fee_kzt_24h`. For historical data (example: `https://api.blockchair.com/bitcoin/dashboards/block/500000?rates=kzt`) it honors historical exchange rates. + * The supported fiat currencies are: `AED` (United Arab Emirates Dirham), `AFN` (Afghan Afghani), `ALL` (Albanian Lek), `AMD` (Armenian Dram), `ANG` (Netherlands Antillean Guilder), `AOA` (Angolan Kwanza), `ARS` (Argentine Peso), `AUD` (Australian Dollar), `AWG` (Aruban Florin), `AZN` (Azerbaijani Manat), `BAM` (Bosnia-Herzegovina Convertible Mark), `BBD` (Barbadian Dollar), `BDT` (Bangladeshi Taka), `BGN` (Bulgarian Lev), `BHD` (Bahraini Dinar), `BIF` (Burundian Franc), `BMD` (Bermudan Dollar), `BND` (Brunei Dollar), `BOB` (Bolivian Boliviano), `BRL` (Brazilian Real), `BSD` (Bahamian Dollar), `BTN` (Bhutanese Ngultrum), `BWP` (Botswanan Pula), `BYN` (Belarusian Ruble), `BZD` (Belize Dollar), `CAD` (Canadian Dollar), `CDF` (Congolese Franc), `CHF` (Swiss Franc), `CLF` (Chilean Unit of Account (UF)), `CLP` (Chilean Peso), `CNH` (Chinese Yuan (Offshore)), `CNY` (Chinese Yuan), `COP` (Colombian Peso), `CRC` (Costa Rican Colón), `CUC` (Cuban Convertible Peso), `CUP` (Cuban Peso), `CVE` (Cape Verdean Escudo), `CZK` (Czech Republic Koruna), `DJF` (Djiboutian Franc), `DKK` (Danish Krone), `DOP` (Dominican Peso), `DZD` (Algerian Dinar), `EGP` (Egyptian Pound), `ERN` (Eritrean Nakfa), `ETB` (Ethiopian Birr), `EUR` (Euro), `FJD` (Fijian Dollar), `FKP` (Falkland Islands Pound), `GBP` (British Pound Sterling), `GEL` (Georgian Lari), `GGP` (Guernsey Pound), `GHS` (Ghanaian Cedi), `GIP` (Gibraltar Pound), `GMD` (Gambian Dalasi), `GNF` (Guinean Franc), `GTQ` (Guatemalan Quetzal), `GYD` (Guyanaese Dollar), `HKD` (Hong Kong Dollar), `HNL` (Honduran Lempira), `HRK` (Croatian Kuna), `HTG` (Haitian Gourde), `HUF` (Hungarian Forint), `IDR` (Indonesian Rupiah), `ILS` (Israeli New Sheqel), `IMP` (Manx pound), `INR` (Indian Rupee), `IQD` (Iraqi Dinar), `IRR` (Iranian Rial), `ISK` (Icelandic Króna), `JEP` (Jersey Pound), `JMD` (Jamaican Dollar), `JOD` (Jordanian Dinar), `JPY` (Japanese Yen), `KES` (Kenyan Shilling), `KGS` (Kyrgystani Som), `KHR` (Cambodian Riel), `KMF` (Comorian Franc), `KPW` (North Korean Won), `KRW` (South Korean Won), `KWD` (Kuwaiti Dinar), `KYD` (Cayman Islands Dollar), `KZT` (Kazakhstani Tenge), `LAK` (Laotian Kip), `LBP` (Lebanese Pound), `LKR` (Sri Lankan Rupee), `LRD` (Liberian Dollar), `LSL` (Lesotho Loti), `LYD` (Libyan Dinar), `MAD` (Moroccan Dirham), `MDL` (Moldovan Leu), `MGA` (Malagasy Ariary), `MKD` (Macedonian Denar), `MMK` (Myanma Kyat), `MNT` (Mongolian Tugrik), `MOP` (Macanese Pataca), `MRO` (Mauritanian Ouguiya (pre-2018)), `MRU` (Mauritanian Ouguiya), `MUR` (Mauritian Rupee), `MVR` (Maldivian Rufiyaa), `MWK` (Malawian Kwacha), `MXN` (Mexican Peso), `MYR` (Malaysian Ringgit), `MZN` (Mozambican Metical), `NAD` (Namibian Dollar), `NGN` (Nigerian Naira), `NIO` (Nicaraguan Córdoba), `NOK` (Norwegian Krone), `NPR` (Nepalese Rupee), `NZD` (New Zealand Dollar), `OMR` (Omani Rial), `PAB` (Panamanian Balboa), `PEN` (Peruvian Nuevo Sol), `PGK` (Papua New Guinean Kina), `PHP` (Philippine Peso), `PKR` (Pakistani Rupee), `PLN` (Polish Zloty), `PYG` (Paraguayan Guarani), `QAR` (Qatari Rial), `RON` (Romanian Leu), `RSD` (Serbian Dinar), `RUB` (Russian Ruble), `RWF` (Rwandan Franc), `SAR` (Saudi Riyal), `SBD` (Solomon Islands Dollar), `SCR` (Seychellois Rupee), `SDG` (Sudanese Pound), `SEK` (Swedish Krona), `SGD` (Singapore Dollar), `SHP` (Saint Helena Pound), `SLL` (Sierra Leonean Leone), `SOS` (Somali Shilling), `SRD` (Surinamese Dollar), `SSP` (South Sudanese Pound), `STD` (São Tomé and Príncipe Dobra (pre-2018)), `STN` (São Tomé and Príncipe Dobra), `SVC` (Salvadoran Colón), `SYP` (Syrian Pound), `SZL` (Swazi Lilangeni), `THB` (Thai Baht), `TJS` (Tajikistani Somoni), `TMT` (Turkmenistani Manat), `TND` (Tunisian Dinar), `TOP` (Tongan Pa'anga), `TRY` (Turkish Lira), `TTD` (Trinidad and Tobago Dollar), `TWD` (New Taiwan Dollar), `TZS` (Tanzanian Shilling), `UAH` (Ukrainian Hryvnia), `UGX` (Ugandan Shilling), `UYU` (Uruguayan Peso), `UZS` (Uzbekistan Som), `VEF` (Venezuelan Bolívar Fuerte (Old)), `VES` (Venezuelan Bolívar Soberano), `VND` (Vietnamese Dong), `VUV` (Vanuatu Vatu), `WST` (Samoan Tala), `XCD` (East Caribbean Dollar), `XPF` (CFP Franc), `YER` (Yemeni Rial), `ZAR` (South African Rand), `ZMW` (Zambian Kwacha), `ZWL` (Zimbabwean Dollar) + * The precious metals are: `XAG` (Silver Ounce), `XAU` (Gold Ounce), `XPD` (Palladium Ounce) `XPT` (Platinum Ounce) + * The cryptocurrencies are: `BTC` (Bitcoin), `ETH` (Ethereum) + * Note that `?rates=USD` is not supported and will result in an error. When the `?rates={:code}` option is used, it only adds new data, and doesn't remove any `*usd*` fields from the output. +* v.2.0.92 - November 11th, 2021 + * Added Taproot support for Bitcoin, Groestlcoin, and Bitcoin Testnet: + * Taproot scripts now convert to P2TR addresses (some older outputs that came before according activation dates may be reindexed a bit later) + * `outputs.type` column can now yield and accept `witness_v1_taproot` type. Example: `https://api.blockchair.com/bitcoin/testnet/outputs?q=type(witness_v1_taproot)` +* v.2.0.91 - November 10th, 2021 + * Added Polkadot support in beta mode. New endpoints: + * `https://api.blockchair.com/polkadot/stats` (+ `https://api.blockchair.com/stats` now also features Polkadot) + * `https://api.blockchair.com/polkadot/raw/block/{:id}` + * `https://api.blockchair.com/polkadot/raw/block/{:hash}` + * `https://api.blockchair.com/polkadot/raw/extrinsic/{:id}` + * `https://api.blockchair.com/polkadot/raw/extrinsic/{:hash}` + * `https://api.blockchair.com/polkadot/raw/address/{:address}` (with `?offset={:offset} option to iterate through the latest extrinsics and transfers) + * `https://api.blockchair.com/polkadot/raw/blocks` (an infinitable with `?offset={:offset} option) + * `https://api.blockchair.com/polkadot/raw/extrinsics` (an infinitable with `?offset={:offset} option) + * `https://api.blockchair.com/polkadot/raw/events` (an infinitable with `?offset={:offset} option) +* v.2.0.90 - October 24th, 2021 + * ERC-20 and ERC-721 transfers are now ordered within transactions as they were executed + * Added `?offset={:offset}` option to the Cardano address endpoint (`https://api.blockchair.com/{:ada_chain}/raw/address/{:address}₀`) that allows to paginate the list of latest transactions +* v.2.0.89 - October 18th, 2021 + * Added ERC-721 support for Ethereum. New endpoints and options: + * `https://api.blockchair.com/ethereum/erc-721/tokens` infinitable (the output is the same as for ERC-20 except for there's no `decimals`). + * `https://api.blockchair.com/ethereum/erc-721/transactions` infinitable (also no `token_decimals`, and `token_id` is used instead of `value` Examples: + * Find most used contracts over the last month: `https://api.blockchair.com/ethereum/erc-721/transactions?q=time(~P1M)&a=token_address,token_name,count()&s=count()(desc)&limit=10` + * Owner change history by token id: `https://api.blockchair.com/ethereum/erc-721/transactions?q=token_address(0xbd3531da5cf5857e7cfaa92426877b022e612cf8),token_id(5177)` + * Find tokens that changed hands many times: `https://api.blockchair.com/ethereum/erc-721/transactions?a=token_address,token_id,count()&s=count()(desc)&limit=10` + * `https://api.blockchair.com/ethereum/stats` now yields statistical data on ERC-721s in the `layer_2.erc_721` array: `tokens` is the total number of NFTs, `transactions` - the total number of transfers, `tokens_24h` - new NFTs over the last 24 hours, `transactions_24h` - token transfers over the last 24 hours + * Find ERC-721 transfers inside of a transaction: `https://api.blockchair.com/ethereum/dashboards/transaction/{:hash}?erc_721=true`. Example: `https://api.blockchair.com/ethereum/dashboards/transaction/0x6e7dbd3e3835f5c08ac8a0e26216df17e9aa9d1b6956fc9f0c56c19a085ad888?erc_721=true` + * List ERC-721 tokens for an address: `https://api.blockchair.com/ethereum/dashboards/address/{:address}?erc_721=true`. Example: `https://api.blockchair.com/ethereum/dashboards/address/0x943a48498c9d622273e214c1757e436f76a113ce?erc_721=true&limit=0`. This option lists token ids + * ERC-721 contract dashboard: `https://api.blockchair.com/ethereum/erc-721/{:address}/stats`. Example: `https://api.blockchair.com/ethereum/erc-721/0x1dfe7ca09e99d10835bf73044a23b73fc20623df/stats` + * ERC-721 contract inventory (token list): `https://api.blockchair.com/ethereum/erc-721/{:address}/inventory`. Available params: `?limit={:limit}` and `?offset={:offset}`. Example: `https://api.blockchair.com/ethereum/erc-721/0x2E956Ed3D7337F4Ed4316A6e8F2EdF74BF84bb54/inventory?limit=100&offset=100`. The list returns `transaction_count`, `first_time` (creation time), `last_time` (last ownership change time), `first_owner`, and `last_owner` (current owner). + * Please note that some of popular NFTs may either not follow the ERC-721 standard at all or follow the ERC-20 standard instead. In the first case, our API won't return any data for such NFTs. In the second case, such contracts will be treated as ERC-20s. ERC-721 functionality is launched in beta mode, it's possible there will be compatibility-breaking changes. This functionality is available for the Goerli Testnet as well. +* v.2.0.88 - August 23rd, 2021 + * Added basic SLP support for Bitcoin Cash. New endpoints and options: + * `https://api.blockchair.com/bitcoin-cash/stats` now yields statistical data on SLP in the `layer_2.slp` array: `tokens` is the total number of SLP tokens, `transactions` - the total number of SLP transfers, `tokens_24h` - new SLP tokens over the last 24 hours, `transactions_24h` - token transfers over the last 24 hours + * Find SLP transfers inside of a transaction: `https://api.blockchair.com/bitcoin-cash/dashboards/transaction/{:hash}?slp=true`. Example: `https://api.blockchair.com/bitcoin-cash/dashboards/transaction/ca851afc516f6d1488924f4a064abdd8b82b45bc8a5890bee8aba58a1314f498?slp=true` (valid `SEND` transaction), `https://api.blockchair.com/bitcoin-cash/dashboards/transaction/71b31ecaf916fe2da690a61c45978542a654185caba643c3eda2a87f38f88d31?slp=true` (invalid `MINT` transaction`) +* v.2.0.87 - August 20th, 2021 + * For all API requests, the `context` array now yields `market_price_usd` value. It contains the current USD price of the blockchain's main token in request. E.g. all `https://api.blockchair.com/zcash/...` requests show ZEC price in `context.market_price_usd`. For Ethereum, it's always the ETH price, even if some token data is requested. This change also deprecates `context.price_usd` for EOS and Tezos in favour of `context.market_price_usd`. + * New `number({:n})` function for aggregations that returns a number. It may be useful when you are too lazy to divide some values on your side, for example, when you're calculating the average interval between blocks in seconds: `https://api.blockchair.com/bitcoin/blocks?a=date,f(number(86400)/count())`. Our API can now also serve as your calculator for any needs: `https://api.blockchair.com/bitcoin/blocks?a=f(number(2)*number(2))&limit=1` returns `4`. + * Tweaked `suggested_transaction_fee_per_byte_sat` for Dogecoin (in `https://api.blockchair.com/dogecoin/stats`) to honour the minimum fee of 1 DOGE per transaction + * The following Ethereum endpoints are now also available for Ethereum Goerli Testnet: + * `https://api.blockchair.com/ethereum/testnet/raw/block/{:id|hash}` + * `https://api.blockchair.com/ethereum/testnet/raw/transaction/{:hash}` + * `https://api.blockchair.com/ethereum/testnet/push/transaction` + * `https://api.blockchair.com/ethereum/testnet/addresses` + * `https://api.blockchair.com/ethereum/testnet/state/changes/block/{:id}` +* v.2.0.86 - August 19th, 2021 + * Error code `435` is now returned if you're using an API key and going over the maximum requests in parallel limit. By default, the limit is `daily_request_limit / 10000` request points. Also, by default, it is not enforced: it only comes into effect if our security system notices that your requests significantly overload our servers on a constant basis. This limit **supersedes** the 5 requests per second limit for premium API plans (which was also not enforced automatically). Example: if you're on a 5000 requests per day plan and do some daily calculations like fetching xpub balances right after the midnight, please try doing this in 2-3 app instances in parallel instead of spawning 1000 instances trying to complete the process in 10 seconds. +* v.2.0.85 - August 18th, 2021 + * New hashrate dashboard for all Bitcoin-like and Ethereum-like chains: `https://api.blockchair.com/{:chain}/dashboards/hashrate` that outputs the estimated hashrate by day. Example: `https://api.blockchair.com/bitcoin/dashboards/hashrate`. + * New difficulty dashboard for Bitcoin: `https://api.blockchair.com/bitcoin/dashboards/difficulty`. It outputs: + * All completed difficulty "periods" (2016 blocks each). `status` is `completed`, `hashrate` is the estimated average hashrate within the period, `avg_block_time` is the average time between blocks in seconds + * The current difficulty period. `status` is `ongoing` + * The next difficulty period. `status` is `planned`, `start_time` is the estimated time when the period will start based on the current hashrate and the number of blocks left in the current period, `difficulty` is the estimated difficulty for the next period, `hashrate` is the same as for the current period, `avg_block_time` is always `600` (10 minutes) as it's the target time between blocks +* v.2.0.84 - August 9th, 2021 + * Enhancements to the Ethereum transaction dashboard (`https://api.blockchair.com/{:eth_chain}/dashboards/transaction/{:hash}`) for unconfirmed transactions. Please note that these values are not final and may change as transactions get confirmed: tracing unconfirmed transactions doesn't take possible changes to the state into account. + * If the `?events=true` option is used, API returns values for `gas_used`, `fee`, `fee_usd` instead of `null`s + * If the `?trace_mempool=true` option is used, API returns values for `internal_value` and `internal_value_usd` instead of `null`s + * API still always returns `null` for `failed` + * There's a new option for the Ethereum address dashboard (`https://api.blockchair.com/{:eth_chain}/dashboards/address/{:address}`): `?transactions_instead_of_calls=true`. If applied, it returns the list of latest transaction hashes in the `transactions` array instead of returning the `calls` array. An important difference is that ERC-20 transfers that weren't previously included in the `calls` array will be among `transactions`. This option also affects `transaction_count` behaviour: if enabled, it returns the transaction count for an address which takes ERC-20 transfers into account. Using this option costs `2`. The option has no effect on contracts (i.e. for contracts the `calls` array will be returned even if the option is enabled). + * The Ethereum stats dashboard (`https://api.blockchair.com/{:eth_chain}/stats`) now also outputs `addresses` yielding the total number of addresses (including both accounts and contracts) ever seen on chain. +* v.2.0.83 - August 6th, 2021 + * Added support for the Ethereum London hard fork. New table fields (for Ethereum and Ethereum Goerli Testnet): + * Blocks: + * `base_fee_per_gas` (queryable, sortable, aggregatable). Average base fee per day example: `https://api.blockchair.com/ethereum/blocks?a=date,avg(base_fee_per_gas)&q=id(12965000..)` + * `burned_total` (queryable, sortable, aggregatable). Examples: + * Total ETH burned: `https://api.blockchair.com/ethereum/blocks?a=date,sum(burned_total)&q=id(12965000..)` + * Burned to minted ratio by day: `https://api.blockchair.com/ethereum/blocks?a=date,f(sum(burned_total)/sum(generation))&q=id(12965000..)` + * Uncles: + * `base_fee_per_gas` (queryable, sortable, aggregatable) + * Transactions: + * `effective_gas_price` (queryable, sortable, aggregatable) + * `max_fee_per_gas` (`null` for legacy transactions; queryable, sortable, aggregatable) + * `max_priority_fee_per_gas` (`null` for legacy transactions; queryable, sortable, aggregatable) + * `base_fee_per_gas` (base fee of the block; queryable, sortable, aggregatable) + * `burned` (calculated as `gas_used * base_fee_per_gas`; queryable, sortable, aggregatable) + * Added `burned` and `burned_24h` to the `https://api.blockchair.com/{:eth_chain}/stats` dashboard + * Added `version` field (queryable, aggregatable) to Ethereum transactions. `0` represents legacy transactions, `1` is for EIP-2718 transactions, `2` is for London transactions. In Ethereum terminology this is "type" instead of "version", but as we're already using "type" for another column, we decided to go with "version". Example: `https://api.blockchair.com/ethereum/transactions?a=version,count()&q=block_id(12965000..)`. Please note that for all transactions before block #12965000 it always returns `0`, even for EIP-2718 transactions: this will be fixed in one of the next updates. + * Added support for the Ethereum Berlin hard fork. Transactions now have an additional field called `type_2718` (queryable) that represents transaction type as outlined in [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718) +* v.2.0.82 - July 30th, 2021 + * Now it's possible to broadcast Cardano transactions using the `https://api.blockchair.com/cardano/push/transaction` endpoint + * Despite the request cost formulas for infinitables have been set in the documentation since July 19th, 2020, they haven't been effective, and every request to inifintables always cost 1 point. Now the formulas are respected. + * Fixed a bug with the `https://api.blockchair.com/{:btc_chain}/addresses` infinitable where some balances weren't returned correctly + * Fixed a bug with the `https://api.blockchair.com/{:btc_chain}/addresses/balances?addresses={:list}` endpoint where some balances weren't calculated correctly + * Fixed some bugs with eCash +* v.2.0.81 - July 12th, 2021 + * Infinitable enhancements: + * Intervals are now available for querying time columns. Example usage: `https://api.blockchair.com/bitcoin/blocks?q=time(~P1D)&a=count()` counts the number of blocks over the last 24 hours, `https://api.blockchair.com/ethereum/mempool/transactions?q=time(~PT30S)` lists transactions that were included to the Ethereum mempool for the last 30 seconds. Previously users were required to set the interval manually (e.g. `?q=time(2021-07-11 07:58:58..2021-07-12 07:58:58)`). The format is an ISO 8601 Duration. + * New aggregation functions to calculate running totals: `runningcount()`, `runningsum({:column})`, `runningavg({:column})`, `runningmedian({:column})`, `runningmin({:column})`, `runningmax({:column})`. Example usage: `https://api.blockchair.com/bitcoin/blocks?a=month,sum(size),runningsum(size)` calculates the blockchain size, `https://api.blockchair.com/bitcoin/blocks?a=date,avg(size),runningavg(size)` calculates the running average for block size, `https://api.blockchair.com/bitcoin/blocks?a=year,count(),runningcount()` calculates the number of blocks by the end of each year since 2009. +* v.2.0.80 - July 8th, 2021 + * Database dumps now feature Ethereum addresses, ERC-20 tokens, ERC-20 transfers, Zcash blocks, Zcash transactions, Zcash outputs, Zcash inputs, and Zcash addresses (transparent): https://gz.blockchair.com + * There's a new `addresses` infinitable for Ethereum: `https://api.blockchair.com/ethereum/addresses`. The columns are: `address`, `balance`, `nonce`, `is_contract`. The default sort is by balance descending. Unlike with Bitocin-like `addresses` infinitables which are updated once every 5 minutes, this infinitable is only updated once a day. The documentation is available here: https://blockchair.com/api/docs#link_310. Some cool examples: + * `https://api.blockchair.com/ethereum/addresses?a=is_contract,count()` - count accounts and contracts + * `https://api.blockchair.com/ethereum/addresses?q=balance(1000000..)&a=count()` - count the number of addresses hodling more than 1 million ethers + * Full dump is available here: https://gz.blockchair.com/ethereum/addresses/ (updated daily) + * Stats endpoint for Bitcoin-like chains (`https://api.blockchair.com/{:btc_chain}/stats`) now includes `mempool_outputs`. + * **BREAKING CHANGE**: Bitcoin ABC (which is still in beta status on our platform) is now renamed to eCash and starting from July 19th, 2021 00:00:00 UTC: + * All API paths will be renamed from `bitcoin-abc` to `ecash` (right now both work) + * All array keys that previously were named `bitcoin-abc` will be renamed to `ecash` + * The prefix for the address format will be changed from `bitcoincash:` to `ecash:` +* v.2.0.79 - April 23rd, 2021 + * Added a new `?events=true` option to the `https://api.blockchair.com/ethereum/dashboards/transaction/{:hash}` endpoint (works with the `transactions` endpoint as well). This option costs `1` additional request point to use. When enabled, it adds an array of event logs to the output. Every log contains `topics`, `data`, `contract`, `log_index`, and `decoded_event`. Depending on how much our API knows about the event signature, there are 3 detalization levels for `decoded_event` (example transaction with all 3: `https://api.blockchair.com/ethereum/dashboards/transaction/0x7d52cf58fe78403e8816dae6e900baff92b35760b4ed81cecd2590eafcde3dad?events=true`): + * Full data: `decoded_event` contains both the full event name with its argument names (`name_full`, example: `Approval(address owner, address spender, uint256 value)`), and the argument values in the `arguments` array; + * Partial data: only `name_with_types` is known (example: `Withdrawal(address, uint256)`), `arguments` yields `null`; + * No data: `decoded_event` yields `null`. + * Added `eta_seconds` to the `https://api.blockchair.com/{:btc_chain}/dashboards/transaction/{:hash}/priority` and `https://api.blockchair.com/{:eth_chain}/dashboards/transaction/{:hash}/priority` endpoints returning an approximate time for the transaction to confirm (in seconds). Please note it's an experimental function and may be unreliable. + * Upgraded Dogecoin infrastructure for better transaction broadcasting +* v.2.0.78 - April 17th, 2021 + * The `?state=latest` option can now also be applied to the Ethereum address dashboard endpoint. If this option is enabled, `balance` will yield the confirmed balance, and the `calls` array won't include unconfirmed data. Example: `https://api.blockchair.com/{:eth_chain}/dashboards/address/{:address}?state=latest`. + * Added a new `?contract_details=true` option to the `https://api.blockchair.com/ethereum/dashboards/address/{:address}₀` endpoint. If applied, it adds additional data on the address if it's a contract. At the moment, it works with ERC-20 contracts only yielding `token_name`, `token_symbol`, and `token_decimals`. It also yields some additional fields for all contracts: `creating_transaction_hash`, `creating_address`, and `creating_transaction_time`. The additional cost of using this option is `0.5`. + * Added `hodling_addresses` to the `https://api.blockchair.com/{:btc_chain}/stats` endpoint (stats on Bitcoin-like blockchains) yielding the total number of addresses with positive balance. + * Added `market_price_usd`, `market_price_btc`, `market_cap_usd` to the `https://api.blockchair.com/ethereum/erc-20/{:token_address}/stats` endpoint. `null`s are returned if there's no market data for the specified token. +* v.2.0.77 - March 15th, 2021 + * Added special statistical endpoints for USDT, USDC, and BUSD. Please note this feature is currently in test mode, there may be compatibility-breaking changes. These endpoints show the distribution of tokens amongst blockchain platforms they are issued on: + * `https://api.blockchair.com/cross-chain/tether/stats` for Tether (USDT) + * `https://api.blockchair.com/cross-chain/usd-coin/stats` for USD Coin (USDC) + * `https://api.blockchair.com/cross-chain/binance-usd/stats` for Binance USD (BUSD) + * `https://api.blockchair.com/stats` was also updated to show these stats +* v.2.0.76 - March 12th, 2021 + * Added a new `?assets_in_usd=true` option to the `https://api.blockchair.com/ethereum/dashboards/transaction/{:hash}` endpoint (works with the `transactions` endpoint as well). When applied, it adds `value_usd_now` to all `layer_2.erc_20` items yielding the current (not at the moment of the transaction!) USD value of tokens (`null` if the price is unknown). Example: `https://api.blockchair.com/ethereum/dashboards/transaction/0x77025c5c7ff5eeb4bb164a4be84dd49192e12086cc321199f73888830c3ecd9e?erc_20=true&assets_in_usd=true` + * Added `{:hash}.layer_2.erc_20.{:index}.value_approximate` to the `https://api.blockchair.com/{:eth_chain}/dashboards/transaction/{:hash}` endpoint when using `?erc_20=true` option +* v.2.0.75 - March 11th, 2021 + * Added `suggested_transaction_fee_gwei_options` to the `https://api.blockchair.com/{:eth_chain}/stats` endpoint yielding an array of suggested gas prices (`sloth` if you can take the risk and wait; `slow`, `normal`, and `fast` if you want to get the transaction confirmed within 2-10 minutes; `cheetah` if you'd like to try to get into the next block). + * The `https://api.blockchair.com/{:eth_chain}/dashboards/transaction/{:hash}₀/priority` endpoint now supports Ethereum Testnet +* v.2.0.74 - March 4th, 2021 + * `address.nonce` now yields `0` instead of `null` when using the `?nonce=true` option with the `https://api.blockchair.com/ethereum/dashboards/address/{:address}` dashboard for addresses that have made no transactions + * The `https://api.blockchair.com/{:eth_chain}/dashboards/address/{:address}` endpoint now correctly returns token details when the `?erc_20={:list}` option is fed with non-lowered token addresses + * Cardano API enhancements + * Mixin API enhancements +* v.2.0.73 - February 26th, 2021 + * Added a new `?assets_in_usd=true` option to the `https://api.blockchair.com/ethereum/dashboards/address/{:address}` endpoint. When applied, it adds `asset_balance_usd` to the output yielding the total USD value of all account assets (currently it's most popular ERC-20 tokens only), as well as `balance_usd` to all `layer_2.erc_20` items. + * Fixed wrong nonce values for some Ethereum transactions + * The `https://api.blockchair.com/premium/stats?key={:api_key}` now yields request points instead of raw requests in `requests_today` + * The `https://api.blockchair.com/{:eth_chain}/push/transaction` endpoint now yields a more detailed error description (`context.error`) in case the broadcast fails (e.g. `nonce too low`, `insufficient funds for gas * price + value` or `already known`) +* v.2.0.72 - December 18th, 2020 + * Added an ability to retrieve internal calls for unconfirmed Ethereum transactions. Usage: `https://api.blockchair.com/{:eth_chain}/dashboards/transaction/{:hash}?trace_mempool=true`. It's also possible to retrieve the list of ERC-20 transfers for mempool transactions: `https://api.blockchair.com/{:eth_chain}/dashboards/transaction/{:hash}?trace_mempool=true&erc_20=true`. This is an experimental feature. Please note that internal transfers may get invalidated when transaction gets confirmed. + * The `https://api.blockchair.com/{:eth_chain}/dashboards/transaction/{:hash}` dashboard is now more efficient at handling recently (1-30 seconds ago) confirmed transactions + * Updated list of Bitcoin mining pools + * Fixed some issues with Bitcoin ABC +* v.2.0.71 - December 14th, 2020 + * Improved Dogecoin transaction broadcasting + * Added `?output=type` option to the `https://api.blockchair.com/{:eth_chain}/dashboards/address/{:address}` dashboard. When this option is enabled, only address type (`account` or `contract`) is returned. This may be a very fast handy way instead of requesting full address data. Example: `https://api.blockchair.com/ethereum/dashboards/address/0x00000000219ab540356cbb839cbe05303d7705fa?output=type`. + * Fixed a bug where the `https://api.blockchair.com/{:btc_chain}/raw/transaction/{:hash}` endpoint returned code `200` even if there was a back end error + * Fixed GitHub issue #320 ("No data returned for address balance mass check for some bitcoin-cash addresses", https://github.com/Blockchair/Blockchair.Support/issues/320) + * Added new nodes to the Release monitor: `Bitcoin Cash Node` for Bitcoin Cash, `Cardano Node` for Cardano +* v.2.0.70 - November 17th, 2020 + * We're introducing News aggregator API! Starting today not only Blockchair API provides you with blockchain data, but also with some crypto news to integrate into your app. We're aggregating data from more than 60 news outlets in 14 languages, populating over 35,000 headlines into our database a month. Documentation: https://blockchair.com/api/docs#link_M7. Want your media outlet to be included to the aggregator? Please contact us at [info@blockchair.com](mailto:info@blockchair.com)! +* v.2.0.69 - November 16th, 2020 + * ERC-20 tokens in the `https://api.blockchair.com/{:eth_chain}/dashboards/address/{:address}?erc_20={approximate|precise|{:list}}` endpoint are now sorted by their market capitalization descending (so the most popular ones are on top now) + * It's now possible to aggregate the Ethereum transactions infinitable (`https://api.blockchair.com/ethereum/transactions`) and the Ethereum calls infinitable (`https://api.blockchair.com/ethereum/calls`) by `sender` and `recipient` (the same applies for the Ethereum testnet). Example: show top 100 stakers of the eth2 contract (by number of deposits): `https://api.blockchair.com/ethereum/calls?q=recipient(0x00000000219ab540356cbb839cbe05303d7705fa),failed(false)&limit=100&a=sender,count()&s=count()(desc)` +* v.2.0.68 - November 10th, 2020 + * Added an experimental `?effects=true` option to the `https://api.blockchair.com/ethereum/dashboards/transaction/{:hash}` dashboard. Example: `https://api.blockchair.com/ethereum/dashboards/transaction/0xd9a24f57c713207c39c58e8ef3cb44e115fcc8bd0f85eb4ea82c78bc065a723f?effects=true&erc_20=true`. `effects` array yields the list of all changes to ETH and ERC-20 token balances. + * Added an experimental endpoint to retrieve allowance for ERC-20 contracts: `https://api.blockchair.com/ethereum/erc-20/{:token_address}/utils/allowance?owner={:owner_address}&spender={:spender_address}`. Example: `https://api.blockchair.com/ethereum/erc-20/0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2/utils/allowance?owner=0x448bb00f370da5af5d33d3e7fca686379fc782ea&spender=0xe0e6b25b22173849668c85e06bc2ce1f69baff8c` + * The `https://api.blockchair.com/{:eth_chain}/dashboards/address/{:address}` dashboard now has 3 options to retrieve ERC-20 balances: + * `?erc_20=approximate` (or `?erc_20=true`, default) - yields all token balances from our database. These values may miss some non-standard transfers in tokens that don't follow the ERC-20 standard in full. Please double-check if this option returns correct values for the tokens you'd want to get information about. Using this option costs `1`. + * `?erc_20=precise` - yields all token balances from our node. The process is the following: we gather information from our database about potential ERC-20 tokens the address may hold, and then for each token we call `getBalance` function using our node to get precise balances. Please note that if for some reason some contract doesn't follow the ERC-20 standard, our database may still miss records about the address holding this token, and there will be no request to the node about this token. So while balances yielded with this option are precise, some non-standard tokens may still be missed. Using this option costs `2`. + * `?erc_20={:token_address}₀,...,{:token_address}ᵩ` (recommended) - yields balances for the enlisted ERC-20 tokens from our node. That's the recommended way if you have an exact list of tokens you'd like to check. Even if some token doesn't follow the ERC-20 standard, but still has `getBalance` function implemented, the correct balance will be returned. Using this option costs `0.75` + `0.01` for each contract checked (the cheapest option!) + * Improved efficiency of the `https://api.blockchair.com/ethereum/erc-20/{:token_address}/stats` endpoint + * Fixed a bug with cUSDT Ethereum contract + * Fixed some missing ERC-20 transfers +* v.2.0.67 - November 6th, 2020 + * Added Bitcoin ABC (Bitcoin Cash ABC) support. Please read our statement on the upcoming Bitcoin Cash split: https://twitter.com/Blockchair/status/1324424632179576832. Also please note that it is expected that Bitcoin ABC's hashrate will be very low so 51% attacks are possible. We'll be running Bitcoin ABC in beta mode and we don't guarantee neither its stability, nor that we'll run it if the chain won't be used by businesses. +* v.2.0.66 - September 23rd, 2020 + * We've upgraded our Ethereum engine - blocks, transactions, and ERC-20 transfers are now processed more than 10 times faster. + * Added Ethereum Goerli testnet: https://blockchair.com/ethereum/testnet (API endpoints are the same as for Ethereum, just use `ethereum/testnet` instead of `ethereum`; ERC-20's are also supported for the testnet). +* v.2.0.65 - August 27th, 2020 + * Fixed wrong `nonce` values for Ethereum transactions. `nonce` field now yields correct integers (thanks to Linmin Li for noticing this bug). +* v.2.0.64 - July 19th, 2020 + * Added `?transaction_details=true` option to `https://api.blockchair.com/{:btc_chain}/dashboards/addresses/{:address}₀,...,{:address}ᵩ` and `https://api.blockchair.com/{:btc_chain}/dashboards/xpub/{:extended_key}` endpoints. The additional cost for using this option is `1`. See its description in the v.2.0.37 changelog or in the documentation. Usage example: `https://api.blockchair.com/bitcoin/dashboards/xpub/xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKrhko4egpiMZbpiaQL2jkwSB1icqYh2cfDfVxdx4df189oLKnC5fSwqPfgyP3hooxujYzAu3fDVmz?transaction_details=true` + * New `https://api.blockchair.com/multi/dashboards/addresses/{:address}₀,...,{:address}ᵩ` endpoint to check addresses from multiple blockchains at once. Supported blockchains: all Bitcoin-like blockchains and Ethereum. The maximum number of addresses is 100. See the documentation: https://blockchair.com/api/docs#link_391 + * Previously announced request cost formulas now come into full effect. +* v.2.0.63 - July 8th, 2020 + * Added `is_rbf` field to `https://api.blockchair.com/bitcoin/dashboards/transaction/{:hash}` and `https://api.blockchair.com/bitcoin/dashboards/transactions/{:hash}₀,...,{:hash}ᵩ` endpoints. It yields `true` if the transaction can be replaced with a transaction with a higher fee (replace-by-fee), and `false` otherwise. For blockchain transactions it shows whether the transaction could've been replaced before it has been included into the block. Available for Bitcoin Testnet as well. + * Fixed a bug with Tezos when API returned error `500` for blocks with no transactions +* v.2.0.62 - July 2nd, 2020 + * We're happy to announce that Groestlcoin support has been extended up to at least January 1st, 2021. + * `https://api.blockchair.com/{:eos_chain}/raw/account/{:address}` endpoint now has `?actions=true` option showing the last 10 actions for account + * All EOS endpoints now have `context.price_usd` showing the USD price of EOS. + * Fixed a bug where it wasn't possible to submit a transaction that is larger than 32 kB in size for broadcast (thanks to Koval for noticing that). Just a reminder, the transaction size still shouldn't be more than ~100 kB as it makes it non-standard and it won't be relayed by nodes. + * The `https://api.blockchair.com/{:btc_chain}/addresses/balances` endpoint now works more stable. +* v.2.0.61 - Jun 24th, 2020 + * We're launching Privacy-o-meter - a tool to highlight transactions privacy issues. See the most detailed documentation: https://blockchair.com/api/docs#link_M6 + * `https://api.blockchair.com/{:btc_chain}/dashboards/transaction/{:hash}₀` and `https://api.blockchair.com/{:btc_chain}/dashboards/transactions/{:hash}₀,...,{:hash}ᵩ` now yield `coinbase_data_hex` for coinbase transactions if `?privacy-o-meter=true` option is set. +* v.2.0.60 - Jun 19th, 2020 + * New way to fetch balances for multiple addresses: `https://api.blockchair.com/{:btc_chain}/addresses/balances` (`POST` or `GET`) with `addresses` key in a `POST` request (or `?addresses={:list}` in a `GET` request) as a comma-separated list of addresses (up to 25.000 at once). This endpoint returns confirmed balances only. If address hasn't been recorded on the blockchain or has a balance of zero, it won't be displayed in the results. This endpoint is extremely fast (under 1 second for 25.000 addresses) and cheap (it costs only 26 request points to fetch 25.000 addresses). See documentation here: https://blockchair.com/api/docs#link_390 (supported chains: Bitcoin, Bitcoin Cash, Bitcoin SV, Litecoin, Dash, Zcash, Dogecoin, Groestlcoin) + * On Oct 26th, 2019 with v.2.0.38 we announced the "request cost" concept by which some requests cost more than others (i.e. requesting the data on 10 transactions costs more than requesting it for just 1 transaction, but since the request is done in bulk, it is cheaper for the API user in the end). Up until now we didn't enforce that policy counting each request as 1. + * Starting July 19th, 2020 at 00:00 UTC we'll start enforcing this rule + * As this is a somewhat compatibility-breaking change, we activate `context.api.next_major_update` and set it to `2020-07-19 00:00:00` (see [General Provisions](https://blockchair.com/api/docs#link_M06) for our policy on compatibility-breaking changes) + * `context` array for all requests now has the `request_cost` field yielding the request cost + * Premium API clients can track thier usage using [the control panel](https://api.blockchair.com/premium). If you have any questions, you can always reach us at <`info@blockchair.com`> +* v.2.0.59 - Jun 18th, 2020 + * Enhancements for Tezos: + * New `blocks` infinitable: `https://api.blockchair.com/tezos/raw/blocks` + * `context` array for every API call to the Tezos blockchain now has `price_usd` element returning the current USD price of Tezos +* v.2.0.58 - Jun 13th, 2020 + * Added EOS support. Please note we're not running a full history EOS node at the moment, so our API shows the most recent blocks and transactions only. New endpoints: + * `https://api.blockchair.com/eos/stats` + * `https://api.blockchair.com/eos/raw/block/{:id}` + * `https://api.blockchair.com/eos/raw/transaction/{:hash}` + * `https://api.blockchair.com/eos/raw/account/{:address}` +* v.2.0.57 - Jun 5th, 2020 + * We now show multisig types for P2SH and P2WSH addresses. The type has the following format: `multisig_{:m}_of_{:n}`. If the script is not P2SH or P2WSH multisig, the type is `null`. Affected endpoints: + * `https://api.blockchair.com/{:btc_chain}/dashboards/address/{:address}` now has the `scripthash_type` field (example: `https://api.blockchair.com/bitcoin/dashboards/address/37cmSuMp7CuLDhjYkNJiTSewmbPuv8RBt1`). If address hasn't been seen spending, it's not possible to derive the multisig type, and `scripthash_type` will be `null`. + * `https://api.blockchair.com/{:btc_chain}/dashboards/transaction/{:hash}₀` and `https://api.blockchair.com/{:btc_chain}/dashboards/transactions/{:hash}₀,...,{:hash}ᵩ` now have `scripthash_type` field for inputs and outputs (example: `https://api.blockchair.com/bitcoin/dashboards/transaction/4d41241148a7cb8f4e2820d4393415ccd3d0793053a3855b44c33e5053c231ff`). Please note that if output is unspent, `scripthash_type` will always be `null`, even if the associated address multisig type can be derived from some other spent output. + * Fixed bug in the `https://api.blockchair.com/{:btc_chain}/mempool/outputs` infinitable where `spending_witness` returned values in an incorrect format for SegWit-enabled chains (this closes Issue #157) +* v.2.0.56 - Jun 4th, 2020 + * Improved the `https://api.blockchair.com/{:btc_chain}/dashboards/xpub/{:extended_key}` endpoint response time when requesting the same xpub for the second and subsequent times -- we now cache the minimum number of needed derivation cycles (e.g. now if an xpub contains 59 addresses on the first request API goes through 3 cycles -- 20 addresses each -- and then remembers that there are at least 60 addresses should be checked -- and on subsequent requests these 60 addresses will be checked using 1 database request instead of 3. + * Fixed API returning error `500` for very large xpubs + * Improved Cardano explorer stability + * Improved `https://api.blockchair.com/{:chain}/stats` and `https://api.blockchair.com/stats` endpoints response time +* v.2.0.55 - May 28th, 2020 + * Added `circulation` and `circulation_approximate` fields to the `https://api.blockchair.com/ethereum/erc-20/{:token}/stats` endpoint output. These values yield total circulating supply of the token (`null` if the contract doesn't have the `totalSuply` function). + * Fixed a precision issue in the `https://api.blockchair.com/ethereum/erc-20/{:contract}/dashboards/address/{:address}` endpoint, now `balance` returns precise value. + * Added `?nonce=true` option to the `https://api.blockchair.com/ethereum/dashboards/address/{:address}` endpoint. If enabled, `nonce` will yield account's current transaction nonce. +* v.2.0.54 - May 27th, 2020 + * The limit on xpub discovery is raised to 20.000 (10.000 main addresses and 10.000 change addresses) for Premium API customers. Please note that according to the request cost formula for `xpub` endpoints, the cost of fetching an xpub consisting of 10.000 addresses is `1 + 2 * (10000 / 20) - 0.1 = 1000.9` + * Fixed a bug with complex aggregation queries. Now instead throwing a `500` error, the following example works: `https://api.blockchair.com/bitcoin/transactions?q=has_witness(true),has_witness(false),time(2020-05),input_count(1),output_count(1),is_coinbase(false)&a=date,f(avg(fee)/avg(fee))&aq=0:0;1:1` (this particular example returns data on how many times more SegWit transactions with a single input and a single outputs pay in fees on average). + * `https://api.blockchair.com/{:chain}/push/transaction` endpoint now returns a detailed error description in the `context.error` field in case you're trying to submit a malformed transaction. This is not yet available for Ethereum. + * In addition to `POST`, `https://api.blockchair.com/{:chain}/push/transaction` endpoint now works using `GET` as well. Example usage: `https://api.blockchair.com/{:chain}/push/transaction?data={:raw_transaction}`. Available for all cryptos we support. +* v.2.0.53 - May 26th, 2020 + * Improved stability of our Omni Layer explorer + * The `https://api.blockchair.com/bitcoin/dashboads/transaction/{:hash}?omni=true` endpoint now returns info for unconfirmed Omni Layer transfers. In case there are any, the `valid` field will yield `null`. Please note that it's not possible to know if an Omni Layer transfer is valid before it has at least 1 confirmation. +* v.2.0.52 - May 22th, 2020 + * Fixed a bug where it wasn't possible to filter Ethereum mempool tables by sender and recipient (thanks @emilianobonassi for noticing) + * `https://api.blockchair.com/{:btc_chain}/dashboards/transaction/{:hash}/priority` endpoint now yields `confirmed` in the `position` field for confirmed transactions. Previously it wasn't possible to differ confirmed transactions from transactions that have completely fallen out of the mempool. +* v.2.0.51 - May 14th, 2020 + * Added Tezos support. New endpoints: + * `https://api.blockchair.com/tezos/stats` + * `https://api.blockchair.com/tezos/raw/block/{:id|hash}` + * `https://api.blockchair.com/tezos/raw/operation/{:hash}` + * `https://api.blockchair.com/tezos/raw/account/{:account|contract}` +* v.2.0.50 - May 13th, 2020 + * Removed support for Telegram Open Network (TON) as the project has been shut down (see https://telegra.ph/What-Was-TON-And-Why-It-Is-Over-05-12). All the relevant endpoints will now return a `404` error. +* v.2.0.49 - April 26th, 2020 + * It's now possible to discard unconfirmed transactions from the address dashboard by applying `?state=latest` option. If this option is applied, `balance` will show only confirmed balance, and `transactions` and `utxo` arrays won't include unconfirmed data. Affected endpoints (`{:btc_chain}` can be one of these: `bitcoin`, `bitcoin-cash`, `litecoin`, `bitcoin-sv`, `dogecoin`, `dash`, `groestlcoin`, `zcash`, `bitcoin/testnet`): + * `https://api.blockchair.com/{:btc_chain}/dashboards/address/{:address}₀?state=latest` + * `https://api.blockchair.com/{:btc_chain}/dashboards/addresses/{:address}₀,...,{:address}ᵩ?state=latest` + * `https://api.blockchair.com/{:btc_chain}/dashboards/xpub/{:extended_key}?state=latest` +* v.2.0.48 - April 22nd, 2020 (Lenin turns 150 today!) + * Added Mixin support. The list of new endpoints (see the documentation for details): + * `https://api.blockchair.com/mixin/stats` + * `https://api.blockchair.com/mixin/raw/snapshots` + * `https://api.blockchair.com/mixin/raw/mintings` + * `https://api.blockchair.com/mixin/raw/nodes` + * `https://api.blockchair.com/mixin/raw/graph` + * `https://api.blockchair.com/mixin/raw/snapshot/{:hash}` + * `https://api.blockchair.com/mixin/raw/snapshot/{:id}` + * `https://api.blockchair.com/mixin/raw/transaction/{:hash}` + * `https://api.blockchair.com/mixin/raw/round/{:hash}` + * `https://api.blockchair.com/mixin/raw/round/({:id},{:node_hash})` + * `https://api.blockchair.com/mixin/raw/node/{:node_hash}` + * `https://api.blockchair.com/mixin/push/transaction` +* v.2.0.47 - March 12th, 2020 + * Added Zcash support. Features: dashboard endpoints, raw endpoints, infinitables (allowing to filter and sort blockchain data), node explorer, and many more. +* v.2.0.46 - March 3rd, 2020 + * There's a new interface for our Premium API users available at `https://api.blockchair.com/premium`. It's now possible to buy and extend a subscription using this interface as well as to track some basic stats. Subscription extending is not available for existing customers with custom plans, please contact us at if you'd like to have an automated interface. +* v.2.0.45 - February 6th, 2020 + * New endpoint to track halvening events: `https://api.blockchair.com/tools/halvening`. Documentation: https://blockchair.com/api/docs#link_511 +* v.2.0.44 - January 28th, 2020 + * New endpoint to track new reference node software releases: `https://api.blockchair.com/tools/releases`. This endpoint returns the list of latest software (core clients) releases for blockchains we support. This may be useful for those who want to track blockchain development, new features, and hard forks (especially this is useful for multi-currency blockchain software — wallets or exchanges — developers). Never miss a BSV hard fork anymore! Documentation: https://blockchair.com/api/docs#link_510 +* v.2.0.43 - January 23rd, 2020 + * Added alpha support for Cardano (ADA). Here's the list of new endpoints (please refer to our documentation for more info: https://blockchair.com/api/docs): + * `https://api.blockchair.com/cardano/stats` + * `https://api.blockchair.com/cardano/raw/block/{:id|hash}` + * `https://api.blockchair.com/cardano/raw/transaction/{:hash}` + * `https://api.blockchair.com/cardano/raw/address/{:address}` +* v.2.0.42 - January 20th, 2020 + * New endpoint to query the range of available blocks in blockchains we support: `https://api.blockchair.com/range`. Note that at this moment we don't store full historical data for Ripple and Stellar, so this endpoint is useful when you need to know which blocks can be queried. +* v.2.0.41 - January 18th, 2020 + * Added alpha support for Monero. Here's the list of new endpoints (please refer to our documentation for more info: https://blockchair.com/api/docs): + * `https://api.blockchair.com/monero/stats` + * `https://api.blockchair.com/monero/raw/block/{:id|hash}` + * `https://api.blockchair.com/monero/raw/transaction/{:hash}` + * `https://api.blockchair.com/monero/raw/outputs?{:query}` +* v.2.0.40 - December 3rd, 2019 + * Added alpha support for Telegram Open Network (TON). Here's the list of new endpoints (please refer to our documentation for more info: https://blockchair.com/api/docs): + * `https://api.blockchair.com/ton/testnet/stats` + * `https://api.blockchair.com/ton/testnet/raw/ledger/{:tuple}` + * `https://api.blockchair.com/ton/testnet/raw/transaction/{:tuple}` + * `https://api.blockchair.com/ton/testnet/raw/account/{:address}` +* v.2.0.39 - Nov 1st, 2019 + * Added alpha support for Stellar (XLM). Here's the list of new endpoints (please refer to our documentation for more info: https://blockchair.com/api/docs): + * `https://api.blockchair.com/stellar/stats` + * `https://api.blockchair.com/stellar/raw/ledger/{:id}` + * `https://api.blockchair.com/stellar/raw/transaction/{:hash}` + * `https://api.blockchair.com/stellar/raw/account/{:address}` +* v.2.0.38 - Oct 26th, 2019 + * We've published new documentation for our API which is lots more clear and describes all the functions we have, it's now available here: https://blockchair.com/api/docs + * Changes to the Omni Layer and Wormhole support (as they're in Alpha test mode these are compatibility-breaking changes; we'll be bringing Omni to Stable the next year): + * As Wormhole as a protocol isn't used anymore, we'll shut it down on our platform on January 1st, 2020 + * Retrieving infomation about Omni Layer transfers within a Bitcoin transaction now requires a `?omni=true` parameter + * Retrieving infomation about Wormhole transfers within a Bitcoin Cash transaction now requires a `?wormhole=true` parameter + * Retrieving infomation about Omni Layer token balances of a Bitcoin address now requires a `?omni=true` parameter + * Retrieving infomation about Wormhole token balances of a Bitcoin Cash transaction now requires a `?wormhole=true` parameter + * Data is now yielded in `layer_2.omni` and `layer_2.wormhole` arrays instead of `_omni` and `_wormhole` + * Changes to Ripple endpoints (they're in Alpha test mode as well): + * `https://api.blockchair.com/{:xrp_chain}/dashboards/ledger/{:hash|id}₀` is now `https://api.blockchair.com/{:xrp_chain}/raw/ledger/{:hash|id}₀` + * `https://api.blockchair.com/{:xrp_chain}/dashboards/transaction/{:hash}₀` is now `https://api.blockchair.com/{:xrp_chain}/raw/transaction/{:hash}₀` + * `https://api.blockchair.com/{:xrp_chain}/dashboards/account/{:address}₀` is now `https://api.blockchair.com/{:xrp_chain}/raw/account/{:address}₀` + * Added `block_id` property to the output of the `?transaction_details=true` param introduced in v.2.0.37 - it's now easier to count the number of confirmations. Also a small bug has been fixed with the timestamps (thanks to Maxim Chistov for noticing) + * We're introducing the "request cost" concept (full description is available in our new documentation; basically, the idea is that some of API requests will cost more than others). We'll not be forcing this rule at the moment, the launch date will be announced later. That won't affect our existing API customers until the end of their subscription periods. +* v.2.0.37 - Oct 9th, 2019 + * `{:chain}/dashboards/address/{:address}` endpoint now has an optional parameter `?transaction_details=true` which allows you to retrieve transaction details in the `transactions` array instead of just transaction hashes. Each `transactions` array element contains the following values: + * `hash` - transaction hash + * `time` - transaction timestamp (UTC) + * `balance_change` - how the transaction affected the balance of `{:address}` + + Appending a request with `?transaction_details=true` makes it count as 2 separate requests in the matter of API limits (including Premium API). + + Usage example: `https://api.blockchair.com/bitcoin/dashboards/address/12cbQLTFMXRnSzktFkuoG3eHoMeFtpTu3S?transaction_details=true` + + This option is supported for Bitcoin, Bitcoin Cash, Litecoin, Dash, Bitcoin SV, Dogecoin, and Groestlcoin only. +* v.2.0.36 - Sep 17th, 2019 + * We begin a public beta test of ERC-20 support on our platform. Over 100.000 tokens are available to explore! + * New ERC-20 endpoints: + * ERC-20 tokens infinitable: `https://api.blockchair.com/ethereum/erc-20/tokens` + * ERC-20 transactions infinitable: `https://api.blockchair.com/ethereum/erc-20/transactions` (example: `https://api.blockchair.com/ethereum/erc-20/transactions?q=token_address({:token_address})` - filter transactions by a specific token). These two infinitables act as other infinitables in our API, i.e. it's possible to sort and filter by many params, to paginate, etc. + * ERC-20 token stats dashboard: `https://api.blockchair.com/ethereum/erc-20/{:token_address}/stats` - returns some basic stats about a token + * ERC-20 token holder dashboard: `https://api.blockchair.com/ethereum/erc-20/{:token_address}/dashboards/address/{:address}` - returns info about a token holder (the balance, list of latest transactions, etc.) + * New options and changes to the existing Ethereum dashboards: + * Ethereum transaction dashboard: `https://api.blockchair.com/ethereum/dashboards/transaction/{:transaction_hash}?erc_20=true` - returns info about a transaction including ERC-20 transfers + * Ethereum address dashboard: `https://api.blockchair.com/ethereum/dashboards/address/{:address}?erc_20=true` - returns info about an address including its ERC-20 token balances (tip: addresses and hashes should start with `0x`) + * Ethereum stats dashboards (`https://api.blockchair.com/ethereum/stats`) now have `data.layer_2.erc_20` key yielding basic stats on ERC-20's: the total number of tokens, the total number of transactions, and the number of new tokens and transactions over the last 24 hours. + * For all Ethereum endpoints there's a new key `context.state_layer_2` which yields the latest processed block number. It can be different from `context.state` as it takes some time to process second layer transactions. + + Please note these endpoints are in beta, so there may be some unannounced compatibility-breaking changes. More detailed documentation will come later this month. Appending `?erc_20=true` to requests makes it counted as 2 separate requests in the matter of API limits (including Premium API). +* v.2.0.35 - Sep 11th, 2019 + * `api.blockchair.com/{:chain}/nodes` endpoint now also returns the `heights` array showing distribution of the latest block numbers among nodes. See a visualisation on our web interface as an example: https://blockchair.com/bitcoin/nodes + * There's a new endpoint `api.blockchair.com/nodes` showing some aggregated node stats across 7 networks (Bitcoin, Bitcoin Cash, Bitcoin SV, Litecoin, Dash, Dogecoin, and Groestlcoin). + * Our database dumps now also feature daily balances snapshot, see Bitcoin for example: https://gz.blockchair.com/bitcoin/addresses/ (please note that the download speed is limited for non-premium users). The format is `addressbalance`. +* v.2.0.34 - Aug 7th, 2019 + * It's now possible to retrieve raw block data directly from our nodes. The endpoint is `api.blockchair.com/{:chain}/raw/block/{:hash}|{:id}`. This endpoint supports all chains except for `ripple`. + * For Bitcoin-like chains the `data` array returns two elements: + * `raw_block` - contains hex representation of the block + * `decoded_raw_block` - contains json representation of the block that is generated by our node + * For Ethereum only `decoded_raw_block` is available + + Please note that these endpoints are for development usage only. The result is returned directly from our nodes, so we can't guarantee backward compatibility in case we upgrade our nodes. For production, please use the `api.blockchair.com/{:chain}/dashboards/block/{:hash}|{:id}` endpoint - it pulls data from our databases. + * Ethereum uncles now have an `id` property (previously they only had `parent_block_id`, `index`, and `hash` properties as identifiers). This affects `api.blockchair.com/ethereum/dashboards/uncle/{:hash}` and `api.blockchair.com/ethereum/uncles?{:params}` endpoints. Please note that `id` is not a unique identifier for an uncle (use `hash` or `parent_block_id:index` instead). + * Fixed a bug where `api.blockchair.com/{:chain}/dashboards/addresses/{:address},{:address},...` endpoint returned `500` if `?limit=0` was applied + * `context.state` doesn't return the latest block number anymore in case API returns an error (`400`, `402`, `404`, etc.) +* v.2.0.33 - Jul 23rd, 2019 + * According to the Bitcoin SV roadmap we've upgraded our nodes to support the Quasar upgrade + * **BREAKING CHANGE**: Upon popular request (#161, #162, #193, #196, #211, and others), starting **July 29th 00:00:00+0000** we're switching to the legacy address format for Bitcoin SV. This will affect the output of the following endpoints: + * `api.blockchair.com/bitcoin-sv/dashboards/transaction/{:hash}` + * `api.blockchair.com/bitcoin-sv/dashboards/transactions/{:hash},{:hash},...` + * `api.blockchair.com/bitcoin-sv/dashboards/address/{:address}` (it will be still possible to use CashAddr in the query string) + * `api.blockchair.com/bitcoin-sv/dashboards/addresses/{:address},{:address},...` (the same) + * `api.blockchair.com/bitcoin-sv/dashboards/xpub/{:[xyz]pub}` + * `api.blockchair.com/bitcoin-sv/outputs?{:params}` + * `api.blockchair.com/bitcoin-sv/mempool/outputs?{:params}` + * `api.blockchair.com/bitcoin-sv/addresses?{:params}` + * `api.blockchair.com/bitcoin-sv/state/changes/block/{:block_id)` + * `api.blockchair.com/bitcoin-sv/state/changes/mempool` +* v.2.0.32 - Jul 15th, 2019 + * We're launching Bitcoin Testnet support for developers! All the functions available for Bitcoin are now available for Bitcoin Testnet as well, including: + * Filtering and sorting blockchain data using infinitables (`api.blockchair.com/bitcoin/testnet/blocks`, `api.blockchair.com/bitcoin/testnet/transactions`, `api.blockchair.com/bitcoin/testnet/outputs`, `api.blockchair.com/bitcoin/testnet/mempool/transactions`, `api.blockchair.com/bitcoin/testnet/mempool/outputs`, and `api.blockchair.com/bitcoin/testnet/addresses`), including aggregation capabilities + * Dashboards (`api.blockchair.com/bitcoin/testnet/dashboards/block/{:id|hash}`, `api.blockchair.com/bitcoin/testnet/dashboards/blocks/{:id|hash},{:id|hash},...`, `api.blockchair.com/bitcoin/testnet/dashboards/transaction/{:hash}`, `api.blockchair.com/bitcoin/testnet/dashboards/transactions/{:hash},{:hash},...`), `api.blockchair.com/bitcoin/testnet/dashboards/address/{:address}`, `api.blockchair.com/bitcoin/testnet/dashboards/addresses/{:address},{:address},...`, `api.blockchair.com/bitcoin/testnet/dashboards/xpub/{:[xyz]pub}` + * Broadcasting transactions (`api.blockchair.com/bitcoin/testnet/push/transaction`) + * State changes (`api.blockchair.com/bitcoin/testnet/state/changes/block/{:block_id)` and `api.blockchair.com/bitcoin/testnet/state/changes/mempool`) + * Stats (`api.blockchair.com/bitcoin/testnet/stats`) + + See documentation for Bitcoin for more details. Please note that USD countervalue for testnet coins is always 0. In the future we also plan to launch support for Bitcoin Cash and Ethereum testnets. + * `outputs.type` column for SegWit-coins can now yield `witness_unknown` type + * `blocks.generation` column for Bitcoin-like coins can now yield negative values in case there are transaction fees, but the output for the coinbase transaction is less than the sum of the fees + * The `utxo` array in the `{:chain}/dashboards/xpub/{[xyz]pub}` dashboard now shows which utxo belongs to which addresses (now it's identical to `{:address1}[,{:address2}…]`) +* v.2.0.31 - Jul 5th, 2019 + * Added two new keys to `bitcoin/stats` and `litecoin/stats` calls: + * `next_retarget_time_estimate` yields an estimated timestamp of the next difficulty retarget + * `next_difficulty_estimate` yeilds an estimated next difficulty value + + These keys are available for Bitcoin and Litecoin as other cryptos we support recalculate difficulty every block. +* v.2.0.30 - Jul 4th, 2019 + * We're adding a new table called `addresses` containing the list of all addresses and their confirmed balances to all Bitcoin-like coins (Bitcoin, Bitcoin Cash, Litecoin, Dash, Bitcoin SV, Dogecoin, Groestlcoin). Unlike other "infinitables" (`blocks`, `transactions`, `outputs`) this table isn't live, it's automatically updated every 5 minutes, thus we're classifying it as an "infiniview", meaning it's not really a table, but a view over the `outputs` table. See [the documentation](#link_bitcoinaddresses) for this table. Here are some examples of how it can be used: + * `api.blockchair.com/bitcoin/addresses` - show Bitcoin addresses with biggest balances (i.e. the rich list) + * `api.blockchair.com/bitcoin/addresses?q=balance(100000000)` - show Bitcoin addresses having exactly 1 BTC on their balance + * `api.blockchair.com/bitcoin/addresses?a=count()` - count the number of addresses with a non-zero balance + * `api.blockchair.com/bitcoin/addresses?a=count()&q=balance(100000000..)` - count the number of addresses holding at least 1 BTC + * `api.blockchair.com/bitcoin/addresses?a=sum(balance)&q=balance(100000000..)` - calculate how many bitcoins do the addresses from the previous example hold + * `api.blockchair.com/bitcoin/addresses?a=median(balance)` - calculate the median balance + + Using this table makes it trivial to build various sorts of rich lists. It's now also possible to retrieve a full list of addresses and balances in one file (available only in our Private API solution). Please note that this table shouldn't be used for retrieving balances for a particular set of addresses, please use the `api.blockchair.com/{:chain}/dashboards/addresses/{:addr1}[,{:addr2}...]` dashboard endpoint instead. +* v.2.0.29 - Jun 30th, 2019 + * The [State changes](API_DOCUMENTATION_EN.md#link_state) feature now supports requesting potential state changes caused by mempool transactions. The endpoint is `https://api.blockchair.com/{:chain}/state/changes/mempool`. It's now possible to easily build an app watching for transactions incoming/outgoing to/from millions of addresses, see [an example](API_DOCUMENTATION_EN.md#link_state). +* v.2.0.28 - Jun 28th, 2019 + * Added support for Groestlcoin nodes. The endpoint is `https://api.blockchair.com/groestlcoin/nodes`. The `stats` endpoint (`https://api.blockchair.com/groestlcoin/stats`) now also shows the node count. +* v.2.0.27 - Jun 27th, 2019 + * Effective July 19th, there will be a new policy on using our Public API for both non-commercial and commercial projects. Please see [Applying for an API key first](API_DOCUMENTATION_EN.md#link_apikey) and apply for an API key before July 19th! Since this is a major compatibility-breaking change, `context.api.next_major_update` is set to `2019-07-19 18:07:19` (see [General Provisions](API_DOCUMENTATION_EN.md#link_generalprovisions)) + * Removed `ethereum.uncles.total_difficulty` column according to https://github.com/ethereum/go-ethereum/issues/19024 +* v.2.0.26 - Jun 20th, 2019 + * Added `utxo` array showing available unspent transaction outputs for Bitcoin-like coins to the following endpoints: + * `api.blockchair.com/{:chain}/dashboards/address/{:address}` + * `api.blockchair.com/{:chain}/dashboards/addresses/{:address1}[,{:address2}…]` + * `api.blockchair.com/{:chain}/dashboards/xpub/{:[xyz]pub}` + + Each array element has the following structure: + * `block_id` - block number (`-1` for unconfirmed outputs) + * `transaction_hash` - transaction hash + * `index` - output index in the transaction (also known as the `vout` number) + * `value` - output value in satoshi + * `address` (only for `addresses` and `xpub` dashboards) - showing the output owner + + This new functionality **DEPRECATES** usage of an old method to retrieve the UTXO set for an address, namely `api.blockchair.com/{:chain}/outputs?q=recipient({:address}),is_spent(false)`. See the discussion with some examples here: https://github.com/Blockchair/Blockchair.Support/issues/192 + * The 3 above listed endpoints now also have a new way to iterate through the transaction list and the UTXO set. It's now possible to use `?limit=A,B` and `?offset=C,D` sections in the query. The first number affects the transaction list, the second number affects the UTXO set. If only one number is set, it affects both. The default `limit` is `100`. The maximum `limit` is `10000`. The default offset is `0`. The maximum offset is `1000000`. Here are some examples: + * `api.blockchair.com/{:chain}/dashboards/address/{:address}` - shows address data with an array of 100 latest transactions and 100 latest UTXOs + * `api.blockchair.com/{:chain}/dashboards/address/{:address}?limit=0` - if you require just some general stats like the address balance + * `api.blockchair.com/{:chain}/dashboards/address/{:address}?limit=0,100` - if you need just the general stats and the UTXO set + * `api.blockchair.com/{:chain}/dashboards/address/{:address}?limit=100,0` - if you need just the general stats and the transaction list + * `api.blockchair.com/{:chain}/dashboards/address/{:address}?limit=100,0&offset=100,0` - ... and to iterate it + * The `api.blockchair.com/{:chain}/dashboards/block/{:hash}|{:id}` endpoint now also has an iterable set of transaction hashes included in the block. The default `limit` is `100`. The maximum `limit` is `10000`. The default offset is `0`. The maximum offset is `1000000`. This feature implements https://github.com/Blockchair/Blockchair.Support/issues/189 +* v.2.0.25 - Jun 19th, 2019 + * Added Groestlcoin support (it has SegWit support, so all API functionality available for Bitcoin and Litecoin is available for Groestlcoin as well). + * Added `suggested_transaction_fee_per_byte_sat` key to `{:chain}/stats` calls. This value shows a good enough approximation of an optimal fee value suggested by our engine based on the current mempool state (in satoshi per byte) to get into the next block. Please note that for transactions less important for you this fee suggestion may be too high, while for very important transactions it may not be enough if you'll get unlucky because of the lack of new blocks. Supported for all coins except for Ripple and Ethereum for which we'll have a separate value suggesting an appropriate gas price value. + * Updated xpub support to v.b5 (see `xpub support` in the docs: two bugs have been fixed); +* v.2.0.24 - Jun 6th, 2019 + * Added an optional `countdowns` array to `{:chain}/stats` calls. If present, this array contains information about various upcoming events such as hard forks or reward halvings. There are two keys for each event: `event` which contains event description, and `time_left` showing how many seconds are left until the event occurs. Please note that the number of seconds is an approximate value because most events are triggered after a block at a specific height is mined, and since it's not possible to know for sure when a block becomes mined, we can only approximate that. +* v.2.0.23 - May 24th, 2019 + * Added support for Dash nodes. The endpoint is `https://api.blockchair.com/dash/nodes`. The `stats` endpoint (`https://api.blockchair.com/dash/stats`) now also shows the node count. + * It's now possible to query Dash xpubs (see `xpub support` in the docs) + * Dash is now out of beta on our platform +* v.2.0.22 - May 23rd, 2019 + * The state changes feature introduced in v.2.0.20 is now available for Ethereum. The endpoint is `https://api.blockchair.com/ethereum/state/changes/block/{:block_id}`. Please note that it shows only the balance changes caused by a block. Values are returned as strings because some wei values don't fit into int64. + * Some optimizations to the Ethereum mempool processing - we now show a lot more unconfirmed transactions +* v.2.0.21 - Apr 22nd, 2019 + * We've added an ability to query multiple addresses at once. The endpoint is `https://api.blockchair.com/{:chain}/dashboards/addresses/{:addr1},{:addr2},...` (supported for BTC, BCH, LTC, DASH, BSV, and DOGE). E.g., now, if you need to retrieve information about 3 different addresses, you wouldn't need to make 3 separate queries, you'd need to query just `https://api.blockchair.com/bitcoin/dashboards/addresses/1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa,12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX,1HLoD9E4SDFFPDiYfNYnkBLQ85Y51J3Zb1`. The response contains information on the set of addresses (total balance, total transaction count, etc.), information about each address, and the list of the latest 100 transactions for this set (iterable with `&offset=N`). The maximum number of addresses in one query is 100 (higher limits are available for our premium users). Querying multiple addresses at once works much faster (e.g. it's almost 95 times faster to query 100 addresses via the new endpoint compared to making separate requests). +* v.2.0.20 - Apr 19th, 2019 + * Now it's possible to query state changes caused by a block for all chains we support except for ETH. The endpoint is `https://api.blockchair.com/{:chain}/state/changes/block/{:block_id}`. The response contains an array where the keys are addresses which were affected by the block, and the values are balance changes. Example: `https://api.blockchair.com/bitcoin/state/changes/block/1` returns `12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX => 5000000000` which means that the only state change caused by this block was rewarding the miner with 50 bitcoins. This is useful if you need to track balance changes for a lot of addresses - you can now simply track state changes and find the needed addresses there instead of constantly retrieving information about the balances. +* v.2.0.19 - Apr 17th, 2019 + * Added alpha support for Ripple (see `Ripple support` in the docs) + * Introducing Graph API for Ethereum (a possibility to find connections between two Ethereum addresses), see `Ethereum graph` in the docs) - it's in private alpha test mode + * If you're constantly hitting Error 402 (i.e. by making too many requests per minute to our free API), you'll now receive Error 429 which means that your IP is banned for an hour. Not honoring our limits may result in a permanent ban + * Fixed a couple of minor bugs in our Ethereum engine. We'll be rolling out an updated engine the next week, there shouldn't be any compatibility breaking changes +* v.2.0.18 - Apr 2nd, 2019 + * Added biggest transactions over the last 24h to `https://api.blockchair.com/{chain}/stats` calls (`largest_transaction_24h` key); + * Updated xpub support to v.b3 (see `xpub support` in the docs, there are some breaking changes); + * Updated aggregation support to v.b4 (see `Data aggregation support` in the docs) + * We're **DEPRECATING** usage of unsupported parameters in GET and POST requests to our API endpoints (e.g. `https://api.blockchair.com/stats?myarbitrarykey=1234` might result in a `400 Bad Request` error); + * Previously DEPRECATED API v.1 has been shut down + * Previously DEPRECATED undocumented `?export=` functionality now requires an API key (apply at <`info@blockchair.com`>) for everything except: + * Aggregated results + * `blocks` tables across all blockchains we support +* v.2.0.17 - Mar 14th, 2019 + * Added support for Bitcoin SV nodes, they are now separate from Bitcoin Cash nodes. Endpoint: `https://api.blockchair.com/bitcoin-sv/nodes`. +* v.2.0.16 - Mar 13th, 2019 + * Added support for ypub and zpub for Bitcoin and Litecoin in test mode. See `xpub support` in the docs. +* v.2.0.15 - Mar 12th, 2019 + * Added Dash support in test mode. We're supporting all the features for DASH as we support for other Satoshi-like coins. Additional columns: `blocks.cbtx`, `transactions.type` (possible types: `simple`, `proregtx`, `proupservtx`, `proupregtx`, `prouprevtx`, `cbtx`, `qctx`, `subtxregister`, `subtxtopup`, `subtxresetkey`, `subtxcloseaccount`), `transactions.is_instant_lock`, `transactions.is_special` (`true` for all transaction types except `simple`), `transactions.special_json` (contains special transaction data encoded in json). E.g.: `https://api.blockchair.com/dash/blocks` +* v.2.0.14 - Mar 6th, 2019 + * Added xpub support in test mode. There's now support for retrieving info about multiple addresses using xpub keys. Use `https://api.blockchair.com/{chain}/dashboards/xpub/{xpub}`. See `xpub support` in the docs. + * Extended data aggregation abilities (still in test mode), see `Data aggregation support` in the docs. Now it's possbile to find correlations with price, and use special functions (e.g. to calculate SegWit adoption). + * We're DEPRECATING API v.1 and will be shutting it down on April 1st, 2019. + * We're DEPRECATING undocumented `?export=` functionality when exporting large datasets without an API key. This feature will be documented in one of the next updates. + * Full support for `CREATE2` in Ethereum (see `https://blockchair.com/ethereum/calls?q=type(create2)#`) + * When using CSV/TSV API (undocumented `?export=` functionality) amounts in USD are now shown as in the JSON API version (previously you had to divide them by 10000). `bitcoin.outputs.type`, `ethereum.transaction.type`, and `ethereum.calls.type` now yield strings (e.g. `pubkeyhash` instead of `2`). +* v.2.0.13 - Feb 13th, 2019 + * Added support for Cyrillic characters in fulltext search, e.g. `https://api.blockchair.com/bitcoin/outputs?q=script_bin(~привет)` +* v.2.0.12 - Feb 12th, 2019 + * Fixed a bug in Ethereum where some contract creations were erroneously shown as failed (thanks Daniel Luca for noticing) +* v.2.0.11 - Feb 5th, 2019 + * We're changing behavior of our `mempool` tables (for all supported coins except for Ethereum): now they don't contain the contents of the latest block (it was quite a clumsy thing to have both mempool transactions and transactions from the latest block in this table, but we've rebuilt our engine, so now `mempool` tables contain mempool content only, and it finally makes sense!). That means: + * `{chain}/mempool/blocks` is deprecated. Hint: if you used `mempool/blocks` to get info about the latest block you can simply switch to using `blocks?limit=1`, e.g. `https://api.blockchair.com/bitcoin/blocks?limit=1` + * `{chain}/mempool/transactions` and `{chain}/mempool/outputs` now don't contain info from the latest block, while `{chain}/transactions` and `{chain}/outputs` do + * Before this update when using (undocumented) `export` functionality there was no information about the latest block at all, now there is + * The same change to Ethereum will come in one of the next updates + * Dogecoin is out of beta. + * Bitcoin SV is out of beta. Please note there's still a possibility that we won't be able to offer some functionality in the long term if blocks suddenly become larger than 1 exabyte, we're still waiting for a more clear development roadmap. +* v.2.0.10 - Jan 29th, 2019 + * Added Dogecoin support in test mode (see `Dogecoin support` in the docs) +* v.2.0.9 - Dec 13th, 2018 + * Added Bitcoin SV support in test mode (see `Bitcoin SV support` in the docs); updated aggregation abilities (see `Data aggregation support` in the docs) +* v.2.0.8 - Nov 26th, 2018 + * Added the ability to retrieve raw transaction data in hex, see `Retrieving raw transactions` in the docs +* v.2.0.7 - Nov 22th, 2018 + * Now it's possible to broadcast transactions using our API, see `Broadcasting transactions` in the docs +* v.2.0.6 - Oct 8th, 2018 + * Added data aggregation of blockchain data in beta mode, see `Data aggregation support` in the docs +* v.2.0.5 - Oct 8th, 2018 + * Fixed bug where `balance` and `received` for bitcoin[-cash]|litecoin addresses in the `{chain}/dashboards/address/{address}` call were calculated wrong if there were specific unconfirmed transactions +* v.2.0.4 - Oct 3rd, 2018 + * Added some new useful fields to `{chain}/stats` calls +* v.2.0.3 - Sep 18th, 2018 + * Added `context.api.tested_features` with the list of features our API supports, but with no guarantee for backward compatibility if updated. Added Omni Layer and Wormhole support in testing mode (see "Tested features changelog") +* v.2.0.2 - Sep 9th, 2018 + * Added `address.contract_created` to the `ethereum/dashboards/address/{A}` call +* v.2.0.1 - Sep 1st, 2018 + * Added Litecoin support +* v.2.0.0 + * Migrating from API v.1 to API v.2 (see the docs) + +### Support + +* E-mail: [info@blockchair.com](mailto:info@blockchair.com) diff --git a/API.md b/API.md deleted file mode 100644 index 6b88fcde..00000000 --- a/API.md +++ /dev/null @@ -1,58 +0,0 @@ -# [Blockchair.com](https://blockchair.com/) API - -### API v.2 documentation -* English: [API_DOCUMENTATION_EN.md](API_DOCUMENTATION_EN.md). -* Russian: [API_DOCUMENTATION_RU.md](API_DOCUMENTATION_RU.md). - -### Changelog - -* v.2.0.6 - Oct 8th - Added data aggregation of blockchain data in beta mode, see `Data aggregation support` below -* v.2.0.5 - Oct 8th - Fixed bug where `balance` and `received` for bitcoin[-cash]|litecoin addresses in the `{chain}/dashboards/address/{address}` call were calculated wrong if there were specific unconfirmed transactions -* v.2.0.4 - Oct 3rd - Added some new useful fields to `{chain}/stats` calls -* v.2.0.3 - Sep 18th - Added `context.api.tested_features` with the list of features our API supports, but with no guarantee for backward compatibility if updated. Added Omni Layer and Wormhole support in testing mode (see "Tested features changelog") -* v.2.0.2 - Sep 9th, 2018 - Added `address.contract_created` to the `ethereum/dashboards/address/{A}` call -* v.2.0.1 - Sep 1st, 2018 - Added Litecoin support -* v.2.0.0 - Migrating from API v.1 to API v.2 (see the docs) - -##### Data aggregation support (since Oct 8th - please note this is a tested feature!) - -* v.b1 - Oct 8th - Bringing the ability to obtain aggregated data. Now you can use Blockchair not only to filter and sort blockchain data, but also to aggregate it. - -See the examples: -* https://api.blockchair.com/bitcoin/blocks?a=year,count()# - get the total number of Bitcoin blocks by year -* https://api.blockchair.com/bitcoin/transactions?a=month,median(fee_usd)# - get the median Bitcoin transaction fees by month -* https://api.blockchair.com/ethereum/blocks?a=miner,sum(generation)&s=sum(generation)(desc)# - get the list of Ethereum miners (except uncle miners) and sort it by the total amount minted -* https://api.blockchair.com/bitcoin-cash/blocks?a=sum(fee_total_usd)&q=id(478559..)# - calculate how much miners have collected in fees since the fork - -To use aggregation, put the fields by which you'd like to group by (zero, one, or several), and fields (at least one) which you'd like to calculate using some aggregate function under the `?a=` section. You can also sort the results by one of the fields included in the `?a=` section (`asc` or `desc`) using the `?s=` section, and apply additional filters (see the documentation for the `?q=` section). - -Possible fields: -* Bitcoin, Bitcoin Cash, Litecoin: - * Blocks table - * Group by: date (or week, month, year), version, guessed_miner - * To calculate: size, stripped_size (except BCH), weight (except BCH), transaction_count, witness_count, input_count, output_count, input_total, input_total_usd, output_total, output_total_usd, fee_total, fee_total_usd, fee_per_kb, fee_per_kb_usd, fee_per_kwu (except BCH), fee_per_kwu_usd (except BCH), cdd_total, generation, generation_usd, reward, reward_usd -- possible functions: avg(field), median(field), min(field), max(field), sum(field), count() - * Transactions table - * Group by: block_id, date (or week, month, year), version, is_coinbase, has_witness (except BCH), input_count, output_count - * To calculate: size, weight (except BCH), input_count, output_count, input_total, input_total_usd, output_total, output_total_usd, fee, fee_usd, fee_per_kb, fee_per_kb_usd, fee_per_kwu (except BCH), fee_per_kwu_usd (except BCH), cdd_total -- possible functions: avg(field), median(field), min(field), max(field), sum(field), count() - * Outputs table - * Group by: block_id, date (or week, month, year), type, is_from_coinbase, is_spendable, is_spent, spending_block_id, spending_date (no support for spending_week, spending_month, spending_year yet) - * To calculate: value, value_usd, spending_value_usd, lifespan, cdd -- possible functions: avg(field), median(field), min(field), max(field), sum(field), count() -* Ethereum: - * Blocks table - * Group by: date (or week, month, year), miner - * To calculate: size, difficulty, gas_used, gas_limit, uncle_count, transaction_count, synthetic_transaction_count, call_count, synthetic_call_count, value_total, value_total_usd, internal_value_total, internal_value_total_usd, generation, generation_usd, uncle_generation, uncle_generation_usd, fee_total, fee_total_usd, reward, reward_usd -- possible functions: avg(field), median(field), min(field), max(field), sum(field), count() - * Uncles table - * Group by: parent_block_id, date (or week, month, year), miner - * To calculate: size, difficulty, gas_used, gas_limit, generation, generation_usd -- possible functions: avg(field), median(field), min(field), max(field), sum(field), count() - * Transactions table - * Group by: block_id, date (or week, month, year), failed, type - * To calculate: call_count, value, value_usd, internal_value, internal_value_usd, fee, fee_usd, gas_used, gas_limit, gas_price -- possible functions: avg(field), median(field), min(field), max(field), sum(field), count() - * Calls table - * Group by: block_id, date (or week, month, year), failed, fail_reason, type, transferred - * To calculate: child_call_count, value, value_usd -- possible functions: avg(field), median(field), min(field), max(field), sum(field), count() - -### Support - -* E-mail: [info@blockchair.com](mailto:info@blockchair.com) -* Telegram chat: [@Blockchair](https://telegram.me/Blockchair) -* Twitter: [@Blockchair](https://twitter.com/Blockchair) diff --git a/API_DOCUMENTATION_EN.md b/API_DOCUMENTATION_EN.md deleted file mode 100644 index 954dd358..00000000 --- a/API_DOCUMENTATION_EN.md +++ /dev/null @@ -1,640 +0,0 @@ -### [Blockchair.com](https://blockchair.com/) API v.2.0.6 Documentation - -#### Changelog - -* v.2.0.6 - Oct 8th - Added data aggregation of blockchain data in beta mode, see `Data aggregation support` below -* v.2.0.5 - Oct 8th - Fixed bug where `balance` and `received` for bitcoin[-cash]|litecoin addresses in the `{chain}/dashboards/address/{address}` call were calculated wrong if there were specific unconfirmed transactions -* v.2.0.4 - Oct 3rd - Added some new useful fields to `{chain}/stats` calls -* v.2.0.3 - Sep 18th - Added `context.api.tested_features` with the list of features our API supports, but with no guarantee for backward compatibility if updated. Added Omni Layer and Wormhole support in testing mode (see the "Tested features changelog" below) -* v.2.0.2 - Sep 9th - Added `address.contract_created` to the `ethereum/dashboards/address/{A}` call -* v.2.0.1 - Sep 1st - Added Litecoin support - -#### Tested features changelog - -##### Data aggregation support (since Oct 8th) - -* v.b1 - Oct 8th - Bringing the ability to obtain aggregated data. Now you can use Blockchair not only to filter and sort blockchain data, but also to aggregate it. - -See the examples: -* https://api.blockchair.com/bitcoin/blocks?a=year,count()# - get the total number of Bitcoin blocks by year -* https://api.blockchair.com/bitcoin/transactions?a=month,median(fee_usd)# - get the median Bitcoin transaction fees by month -* https://api.blockchair.com/ethereum/blocks?a=miner,sum(generation)&s=sum(generation)(desc)# - get the list of Ethereum miners (except uncle miners) and sort it by the total amount minted -* https://api.blockchair.com/bitcoin-cash/blocks?a=sum(fee_total_usd)&q=id(478559..)# - calculate how much miners have collected in fees since the fork - -To use aggregation, put the fields by which you'd like to group by (zero, one, or several), and fields (at least one) which you'd like to calculate using some aggregate function under the `?a=` section. You can also sort the results by one of the fields included in the `?a=` section (`asc` or `desc`) using the `?s=` section, and apply additional filters (see the documentation for the `?q=` section). - -Possible fields: -* Bitcoin, Bitcoin Cash, Litecoin: - * Blocks table - * Group by: date (or week, month, year), version, guessed_miner - * To calculate: size, stripped_size (except BCH), weight (except BCH), transaction_count, witness_count, input_count, output_count, input_total, input_total_usd, output_total, output_total_usd, fee_total, fee_total_usd, fee_per_kb, fee_per_kb_usd, fee_per_kwu (except BCH), fee_per_kwu_usd (except BCH), cdd_total, generation, generation_usd, reward, reward_usd -- possible functions: avg(field), median(field), min(field), max(field), sum(field), count() - * Transactions table - * Group by: block_id, date (or week, month, year), version, is_coinbase, has_witness (except BCH), input_count, output_count - * To calculate: size, weight (except BCH), input_count, output_count, input_total, input_total_usd, output_total, output_total_usd, fee, fee_usd, fee_per_kb, fee_per_kb_usd, fee_per_kwu (except BCH), fee_per_kwu_usd (except BCH), cdd_total -- possible functions: avg(field), median(field), min(field), max(field), sum(field), count() - * Outputs table - * Group by: block_id, date (or week, month, year), type, is_from_coinbase, is_spendable, is_spent, spending_block_id, spending_date (no support for spending_week, spending_month, spending_year yet) - * To calculate: value, value_usd, spending_value_usd, lifespan, cdd -- possible functions: avg(field), median(field), min(field), max(field), sum(field), count() -* Ethereum: - * Blocks table - * Group by: date (or week, month, year), miner - * To calculate: size, difficulty, gas_used, gas_limit, uncle_count, transaction_count, synthetic_transaction_count, call_count, synthetic_call_count, value_total, value_total_usd, internal_value_total, internal_value_total_usd, generation, generation_usd, uncle_generation, uncle_generation_usd, fee_total, fee_total_usd, reward, reward_usd -- possible functions: avg(field), median(field), min(field), max(field), sum(field), count() - * Uncles table - * Group by: parent_block_id, date (or week, month, year), miner - * To calculate: size, difficulty, gas_used, gas_limit, generation, generation_usd -- possible functions: avg(field), median(field), min(field), max(field), sum(field), count() - * Transactions table - * Group by: block_id, date (or week, month, year), failed, type - * To calculate: call_count, value, value_usd, internal_value, internal_value_usd, fee, fee_usd, gas_used, gas_limit, gas_price -- possible functions: avg(field), median(field), min(field), max(field), sum(field), count() - * Calls table - * Group by: block_id, date (or week, month, year), failed, fail_reason, type, transferred - * To calculate: child_call_count, value, value_usd -- possible functions: avg(field), median(field), min(field), max(field), sum(field), count() - -##### Omni Layer and Wormhole support (since Sep 18th) - -* v.a1 - Sep 18th - Added alpha support for Omni Layer in Bitcoin (`bitcoin/omni/properties`, `bitcoin/omni/dashboards/property/{id}` calls, plus `_omni` key in the `bitcoin/dashboards/transaction` call and `_omni` key in the `bitcoin/dashboards/address` call), and support for Wormhole in Bitcoin Cash (`bitcoin-cash/wormhole/properties`, `bitcoin-cash/wormhole/dashboards/property/{id}` calls, plus `_wormhole` key in the `bitcoin-cash/dashboards/transaction` call and `_wormhole` key in the `bitcoin-cash/dashboards/address` call). Please don't use this in production yet, there will be massive changes! - -#### General Provisions - -* Requests to our server should be made through the HTTPS protocol by GET requests to the domain `api.blockchair.com` - -* The server response returns a JSON array always consisting of two subarrays: - * `data` - contains some data - * `context` - contains metadata, e.g., a status code, a query execution time, and so on. - -* `data` can contain either an associative array (e.g., for `bitcoin/stats`), or for infinitable-queries (see below) - an unnumbered array (for example, `bitcoin/blocks`), or for dashboard-queries (see below) - an associative array with keys which are parts of the query (e.g., for `bitcoin/dashboards/transactions/A,B`, the keys are `A` and `B`), and with values ​- arrays of data. -* `context`, depending on the call type, can contain the following useful values: - * `context.code` - server response code, can return: - * `200` if the request succeeds - * `400` if there is a user error in the request - * `402` if any limit on the number or complexity of requests is exceeded (see the restrictions below, please contact us at for private API access) - * `500` or` 503` in case of a server error (it makes sense to wait and repeat the same request or open a ticket at https://github.com/Blockchair/Blockchair.Support/issues/new or write to ) - * There is a field `context.error` with an error description in the case of` 40x` and `50x` errors - * `context.state` contains the number of the latest block in case of requests to the blockchains (for example, for all requests beginning with `bitcoin` there will be the latest block number for Bitcoin). It is useful in order, e.g., to calculate the number of network сonfirmations, or correctly iterate trough the results using `offset` - * `context.results` - contains the number of found results for dashboard-calls - * `context.limit` - applied limit to the number of results - * `context.offset` - applied offset - * `context.rows` - ​​contains the number of returned rows for infinitable-calls - * `context.pre_rows` - ​​for some infinitable-calls contains the number of rows that should've been returned before duplicate removal (note: this architecture is used for the `bitcoin[-cash].outputs` tables only) - * `context.total_rows` - ​​number of rows that a query returns - * `context.api` - an array of data on the status of the API: - * `context.api.version` - version of API - * `context.api.last_major_update` - time of the last update, that somehow broke backward compatibility - * `context.api.next_major_update` - time of the next scheduled update, that can break compatibility, or` null`, if no updates are scheduled - * `context.api.tested_features` - the list (comma-separated) of features with version numbers our API supports, but with no guarantee for backward compatibility if updated (in this case there will be no changes to `context.api.next_major_update` as well) - * `context.api.documentation` - an URL to the latest version of documentation - -Note: it makes sense to check `context.api.version` and, if `context.api.next_major_update` is not `null`, notify yourself and review the changelog. If there are no changes in the changelog that violate the compatibility of your application, make sure that the value of `context.api.next_major_update` won't exceed the current one. If there are changes, adjust the application logic so, that after the specified time a new logic is applied. Additional note: in case the backward compatibility is violated only for one API call, then `context.api.next_major_update` won't be `null` just for this call. - -* Request limits: as of now, we allow up to 30 requests per minute to our API. If this limit is exceeded, an error `402` will be returned. In case of abuse, your IP address can be blocked. If your application needs more requests, please contact us at . If you need to unload a large amount of information once, please contact us at and, in case the academic or research unloading goal - you will receive the data for free in a convenient format. - -* Disclaimer: we do not guarantee the reliability or integrity of the provided information. Information provided by our API should not be used for making critical decisions. We do not guarantee an uptime for our free API. - -#### Infinitable Calls (blockhain tables) - -Return data from the tables according to the filters (`q`), sorting (`s`), limit (`limit`), and offset (`offset`). - -A request should be construced like this: `https://api.blockchair.com/{blockchain}/[/mempool]{table}[?q={query}][&s={sorting}][&limit={limit}][&offset={offset}]` - -**Possible combinations of blockchains and tables:** -* Bitcoin: - * `bitcoin/blocks` - contains all Bitcoin blocks, including the latest one - * `bitcoin/transactions` - contains all Bitcoin transactions, excluding mempool transactions and transactions from the latest block - * `bitcoin/outputs` - contains all Bitcoin outputs, excluding the outputs contained in the mempool transactions as well as in the transactions from the latest block - * `bitcoin/mempool/blocks` - contains only the latest Bitcoin block - * `bitcoin/mempool/transactions` - contains Bitcoin mempool transactions as well as transactions from the latest block - * `bitcoin/mempool/outputs` - contains Bitcoin outputs included in mempool transactions as well as in transactions from the latest block -* Bitcoin Cash, Litecoin - the same as for Bitcoin -* Ethereum: - * `ethereum/blocks` - contains all Ethereum blocks, except the last 6 - * `ethereum/uncles` - contains all Ethereum uncles, except those that belong to the last 6 blocks - * `ethereum/transactions` - contains all Ethereum transactions, except transactions from the last 6 blocks - * `ethereum/calls` - contains all transaction calls, except calls for the last 6 blocks - * `ethereum/mempool/blocks` - contains the last 6 Ethereum blocks, some columns contain null - * `ethereum/mempool/transactions` - contains all Ethereum transactions from the last 6 blocks as well as mempool transactions - -Notes: to speed up the process, our architecture contains separate tables (`mempool*`) for unconfirmed transactions, as well as for blocks that with a certain probability can be forked off from the main chain. For Bitcoin, Bitcoin Cash, and Litecoin, `mempool*` contains the latest block transactions in addition to mempool transactions, and for Ethereum, that's the latest 6 blocks plus the mempool. Exception: for Bitcoin, Bitcoin Cash, and Litecoin, the `blocks` table also contains information about the latest block (this may change in the future). For Ethereum, we do not "replay" transactions entirely (i.e. not looking for internal calls) for the last 6 blocks, so there is no `mempool/calls` table. - -**You can use filters** as follows: `?q=field(value)[,field(value)...]`, where `field` is the column by which a filter is needed, and `value` is a value, special value, or a range of values. The possible columns are listed in the tables below. Possible expressions for values: -* `value` - e.g., ` bitcoin/blocks?q=id(0)` finds information about block 0 -* `left..` - non-strict inequality - e.g., `bitcoin/blocks?q=id(1..)` finds information about block 1 and above -* `left...` - strict inequality - e.g., `bitcoin/blocks?q=id(1...)` finds information about block 2 and above -* `..right` - non-strict inequality - e.g., `bitcoin/blocks?q=id(..1)` finds information about blocks 0 and 1 -* `...right` - strict inequality - e.g.,` bitcoin/blocks?q=id(...1)` finds information only about block 0 -* `left..right` - non-strict inequality - e.g., `bitcoin/blocks?q=id(1..3)` finds information about blocks 1, 2 and 3 -* `left...right` - strict inequality - e.g., `bitcoin/blocks?q=id(1...3)` finds information only about block 2 -* `~like` - occurrence in a string (`LIKE` operator), e.g., `bitcoin/blocks?q=coinbase_data_bin(~hello)` finds all blocks which contain `hello` in `coinbase_data_bin` -* `^like` - occurrence at the beginning of a string (`STARTS WITH` operator), e.g., `bitcoin/blocks?q=coinbase_data_hex(^00)` finds all blocks for which` coinbase_data_hex` begins with `00` - -For `time*`-fields, the value can be specified in the following formats: -* `YYYY-MM-DD HH:ii:ss` -* `YYYY-MM-DD` -* `YYYY-MM` - -Inequalities are also supported for such values, but the left and right values ​​must be in the same format, e.g.: `bitcoin/blocks?q=time(2009-01-03..2009-01-31)`. - -If you need to list several filters, you need to sepatate them by commas in the `?q=` section, e.g., `bitcoin/blocks?q=id(500000..),coinbase_data_bin(~hello)` - -We're currently testing support for `NOT` and `OR` operators (this may change in the future, including possible removal of these operators). - -The operator `NOT` is comma-separated before the expression to be inverted, e.g., `bitcoin/blocks?q=not,id(1..)` returns the block `0`. - -The `OR` operator is specified between the expressions and takes precedence (like it's when two expressions around `OR` are wrapped in parentheses), e.g., `bitcoin/blocks?q=id(1),or,id(2)` returns information about blocks 1 and 2. - -Maximum guaranteed supported number of filters in one query: 5. - -**Sorting** can be used as follows: `?s=field(direction)`, where `direction` can be either `asc` for sorting in ascending order, or `desc` for sorting in descending order, e.g. `bitcoin/blocks?s=id(asc)` - -If you need to apply several sorts, you can list them by commas, similar to filters. The maximum guaranteed number of sorts is 2. - -**Limit** is used like this: `?limit=N`, where N is a natural number from 1 to 100. The default is 10. In some cases `LIMIT` is ignored, and in such cases `context.limit` will be set to `NULL`. - -**Offset** can be used as a paginator, e.g., `?offset=10` returns the next 10 results. `context.offset` takes the value of the set `OFFSET`. The maximum value is 10000. If you need just the last page, it's easier and quicker to change the direction of the sorting to the opposite. Important: when iterating through the results, it is extremely likely that the number of rows in the database will increase because new blocks were found. To avoid that, you may add an additional condition that limits the block id to the value obtained in `context.state` in the first query. - -##### (bitcoin[-cash]|litecoin)/[mempool/]blocks - -Returns data about blocks - -| Column | Type | Description | Q? | S? | -|--------|------|-------------|----|----| -| id | int | Block height | + | + | -| hash | string `[0-9a-f]{64}` | Block hash | + | + | -| date | string `YYYY-MM-DD` | Block date (UTC) | | | -| time | string `YYYY-MM-DD HH:ii:ss` | Block time (UTC) | + | + | -| median_time | string `YYYY-MM-DD HH:ii:ss` | Block median time (UTC) | | | + | -| size | int | Block size, in bytes (may be more than 1 MB for Bitcoin, up to 32 MB for Bitcoin Cash) | + | + | -| stripped_size(\*) | int | Block size in bytes without taking witness information into account (up to 1 MB for Bitcoin) | + | + | -| weight (\*) | int | Block weight in weight units (up to 4 MWU) | + | + | -| version | int | Version field | + | + | -| version_hex | string `[0-9a-f]*` | Version field in hex | | | -| version_bits | string `[01]{30}` | Version field in binary form | | | -| merkle_root | `[0-9a-f]{64}` | Merkle root hash | | | -| nonce | int | Nonce value | + | + | -| bits | int | Bits field | + | + | -| difficulty | float | Difficulty | + | + | -| chainwork | string `[0-9a-f]{64}` | Chainwork field | | | -| coinbase_data_hex | string `[0-9a-f]*` | Hex information contained in the input of the coinbase transaction | + | | -| transaction_count | int | Number of transactions in the block | + | + | -| witness_count (\*) | int | Number of transactions in the block containing witness information | + | + | -| input_count | int | Number of inputs in all block transactions | + | + | -| output_count | int | Number of outputs in all block transactions | + | + | -| input_total | int | Sum of inputs in satoshi | + | + | -| input_total_usd | float | Sum of outputs in USD (hereinafter for USD - at the moment `date`) | + | + | -| output_total | int | Sum of outputs in Satoshi | + | + | -| output_total_usd | float | Sum of outputs in USD | + | + | -| fee_total | int | Total fee in Satoshi | + | + | -| fee_total_usd | float | Total fee in USD | + | + | -| fee_per_kb | float | Fee per kilobyte (1000 bytes of data) in satoshi | + | + | -| fee_per_kb_usd | float | Fee for kilobyte of data in USD | + | + | -| fee_per_kwu (\*) | float | Fee for 1000 weight units of data in Satoshi | + | + | -| fee_per_kwu_usd (\*) | float | Fee for 1000 weight units of data in USD | + | + | -| cdd_total | float | Number of coindays destroyed by all transactions of the block | + | + | -| generation | int | Miner reward for the block in Satoshi | + | + | -| generation_usd | float | Miner reward for the block in USD | + | + | -| reward | int | Miner total reward (reward + total fee) in Satoshi | + | + | -| reward_usd | float | Miner total reward (reward + total fee) in USD | + | + | -| guessed_miner | string `.*` | The supposed name of the miner who found the block (the heuristic is based on `coinbase_data_bin` and the addresses to which the reward goes) | + | + | - -Additional synthetic columns (you can search over them and / or sort them, but they are not shown) - -| Column | Type | Description | Q? | S? | -|--------|------|-------------|----|----| -| coinbase_data_bin | string `.*` | Text representation of coinbase data. Allows you to use the `LIKE` operator: `?q=coinbase_data_bin(~hello)` | + | | - -Notes: -- for the columns `id` and` hash` the increased efficiency at unloading of one record is applied -- there is no possibility to search over the `date` column directly, you can search like `?q=time(YYYY-MM-DD)` -- the search over the column `coinbase_data_hex` is done by the operator `^`, you can also use `~` for `coinbase_data_bin` (however, the field `coinbase_data_bin` will not be shown anyway) -- (\*) - only for Bitcoin -- the default sorting - id DESC - -##### (bitcoin[-cash]|litecoin)/[mempool/]transactions - -Returns transaction data - -| Column | Type | Description | Q? | S? | -|--------|------|-------------|----|----| -| block_id | int | The height (id) of the block containing the transaction | + | + | -| id | int | Internal transaction id (not related to the blockchain, used for internal purposes) | + | + | -| hash | string `[0-9a-f]{64}` | Transaction hash | + | | -| date | string `YYYY-MM-DD` | The date of the block containing the transaction (UTC) | | | -| time | string `YYYY-MM-DD HH:ii:ss` | Time of the block containing the transaction (UTC) | + | + | -| size | int | Transaction size in bytes | + | + | -| weight (\*) | int | Weight of transaction in weight units | + | + | -| version | int | Transaction version field | + | + | -| lock_time | int | Lock time - can be either a block height, or a unix timestamp | + | + | -| is_coinbase | boolean | Is it a coinbase (generating new coins) transaction? (For such a transaction `input_count` is equal to` 1` and means a synthetic coinbase input) | | + | | -| has_witness (\*) | boolean | Is there a witness part in the transaction (using SegWit)? | | + | | -| input_count | int | Number of inputs | + | + | -| output_count | int | Number of outputs | + | + | -| input_total | int | Input value in satoshi | + | + | -| input_total_usd | float | Input value in USD | + | + | -| output_total | int | Output value in Satoshi | + | + | -| output_total_usd | float | Total output value in USD | + | + | -| fee | int | Fee in Satoshi | + | + | -| fee_usd | float | Fee in USD | + | + | -| fee_per_kb | float | Fee per kilobyte (1000 bytes) of data in Satoshi | + | + | -| fee_per_kb_usd | float | Fee for kilobyte of data in USD | + | + | -| fee_per_kwu (\*) | float | Fee for 1000 weight units of data in Satoshi | + | + | -| fee_per_kwu_usd (\*) | float | Fee for 1000 weight units of data in USD | + | + | -| cdd_total | float | The number of destroyed coindays | + | + | - -Notes: -- for the columns `id` and` hash` the increased efficiency at unloading of one record is applied -- there is no possibility to search over `date` column, you can use `?q=time(YYYY-MM-DD instead -- (\*) - only for Bitcoin -- the default sort is id DESC - -##### (bitcoin[-cash]|litecoin)/[mempool/]outputs - -Returns information about the outputs (that become inputs when they are spent, and then `spending*` information appears) - -| Column | Type | Description | Q? | S? | -|--------|------|-------------|----|----| -| block_id | int | Id of a block containing the transaction cointaining the output | + | + | -| transaction_id | int | The internal transaction id containing the output | + | + | -| index | int | Output index in a transaction (from 0) | + | + | -| transaction_hash | string `[0-9a-f]{64}` | Transaction hash | | | -| date | string `YYYY-MM-DD` | Date of a block containing the output (UTC) | | | -| time | string `YYYY-MM-DD HH:ii:ss` | Time of a block containing the output (UTC) | + | + | -| value | int | Monetary value of output | + | + | -| value_usd | float | Monetary value of output in USD at the moment `date` | + | + | -| recipient | string `[0-9a-zA-Z\-]*` | Bitcoin address or synthetic address of an output recipient | + | + | -| type | string (enum) | Output type, one of the following: `pubkey/pubkeyhash/scripthash/multisig/nulldata/nonstandard/witness_v0_scripthash/witness_v0_keyhash` | + | + | -| script_hex | string `[0-9a-f]*` | Hex of the output script | + | | -| is_from_coinbase | boolean | Is it a coinbase transaction output? | | + | | -| is_spendable | null or boolean | Is it theoretically possible to spend this output? For `pubkey` and` multisig` outputs, the existence of the corresponding private key is tested, in that case `true` and `false` are the possible values, depending on the result of the check. For `nulldata` outputs, it is always `false`. For other types it is impossible to check trivially, in this case `null` is shown | + | | -| is_spent | boolean | Is this output spent? (Each field further contains `null` if it is not spent | + | | -| spending_block_id | null or int | Id of the block containing the spending transaction. `null` if the output is not yet spent. | | + | + | -| spending_transaction_id | null or int | Internal transaction id where the output is spent | + | + | -| spending_index | null or int | Input index in the spending transaction (from 0) | + | + | -| spending_transaction_hash | null or string `[0-9a-f]{64}` | Spending transaction hash | | | -| spending_date | null or string `YYYY-MM-DD` | Date of the block, in which the output is spent | | | -| spending_time | null or string `YYYY-MM-DD HH:ii:ss` | Time of the block in which the output is spent | + | + | -| spending_value_usd | null or float | Monetary value of output in USD at the time of `spending_date` | + | + | -| spending_sequence | null or int | The technical sequence value | + | + | -| spending_signature_hex | null or string `[0-9a-f]*` | Hex of the spending script (signature) | | | -| spending_witness (\*) | null or string (JSONB) | Witness information in the escaped JSONB format | | | -| lifespan | null or int | The number of seconds from the time of the output creation (`time`) to its spending (`spending_time`), `null` if the output is not spent | + | + | -| cdd | null or float | The number of coindays destroyed spending the output | + | + | - -Additional synthetic columns (you can search over them and / or sort them, but they are not shown) - -| Column | Type | Description | Q? | S? | -|--------|------|-------------|----|----| -| script_bin | string `.*` | Text representation of script_hex. Allows you to use the `LIKE` operator: `?q=script_bin(~hello)`| + | | - -Notes: -- for columns `transaction_id` and `spending_transaction_id`, the increased efficiency at unloading records if one specific transaction is specified (and not the range), is applied -- there is no possibility to search over the `date` and `spending_date` columns, you can use `?q=time(YYYY-MM-DD)` and `?q=spending_time(YYYY-MM-DD)` instead -- the search over `script_hex` column can be done by the operator `^`, you can also use `~` for `script_bin` (however, the field `script_bin` will still not be shown) -- (\*) - only for Bitcoin -- the default sort is - transaction_id DESC - -##### ethereum/[mempool/]blocks - -Returns block data - -| Column | Type | Description | Q? | S? | -|--------|------|-------------|----|----| -| id | int | Block id | + | + | -| hash | string `0x[0-9a-f]{64}` | Block hash (with 0x) | + | | -| date | string `YYYY-MM-DD` | Block date (UTC) | | | -| time | string `YYYY-MM-DD HH:ii:ss` | Block time (UTC) | + | + | -| size | int | Block size in bytes | + | + | -| miner | string `0x[0-9a-f]{40}` | Address of a rewarded miner (from 0x) | + | | -| extra_data_hex | string `[0-9a-f]*` | Additional data included by the miner | + | | -| difficulty | int | Difficulty | + | + | -| gas_used | int | Gas amount used by block transactions | + | + | -| gas_limit | int | Gas limit for a block set up by the miner | + | + | -| logs_bloom | string `[0-9a-f]*` | Logs Bloom | | | -| mix_hash | string `[0-9a-f] {64}` | Hash Mix hash | | | -| nonce | string `[0-9a-f]*` | Nonce value | | | -| receipts_root | string `[0-9a-f] {64}` | Receipts Root hash | | | -| sha3_uncles | string `[0-9a-f] {64}` | SHA3 Uncles hash | | | -| state_root | string `[0-9a-f] {64}` | State Root hash | | | -| total_difficulty | numeric string | Total difficulty | | | -| transactions_root | string `[0-9a-f] {64}` | Transactions Root hash | | | -| uncle_count | int | Number of uncles | + | + | -| transaction_count | int | Number of transactions in the block | + | + | -| synthetic_transaction_count | int | The number of synthetic transactions (they do not exist as separate transactions, but they change the state, e.g., genesis block transactions, miner rewards, DAO-fork transactions) | + | + | -| call_count (\*) | int | Total number of calls spawned by transactions | + | + | -| synthetic_call_count | int | Number of synthetic calls (same as synthetic transactions) | + | + | -| value_total | numeric string | Monetary value of all block transactions in wei, hereinafter `numeric string` - numeric value passed as a string, because wei-values do not fit into uint64 | + | + | -| value_total_usd | float | Monetary value of all block transactions in USD | + | + | -| internal_value_total (\*) | numeric string | Monetary value of all internal calls in the block (see note below) in wei | + | + | -| internal_value_total_usd (\*) | float | Monetary value of all internal calls in a block in USD | + | + | -| generation | numeric string | The reward of a miner for the block generation in wei (3 or 5 ether + reward for uncle inclusion) | + | + | -| generation_usd | float | The reward of a miner for the block generation in USD | + | + | -| uncle_generation (\*) | numeric string | Total reward of uncle miners in wei | + | + | -| uncle_generation_usd (\*) | float | Total reward of uncle miners in USD | + | + | -| fee_total (\*) | numeric string | Total fee in wei | + | + | -| fee_total_usd (\*) | float | Total fee in USD | + | + | -| reward (\*) | numeric string | Total reward of the miner in the wei (reward for finding the block + fees) | + | + | -| reward_usd (\*) | float | Total reward of the miner in USD | + | + | - -Additional synthetic columns (you can search over them and / or sort them, but they are not shown) - -| Column | Type | Description | Q? | S? | -|--------|------|-------------|----|----| -| extra_data_bin | string `.*` | Text representation of extra data. Allows you to use the `LIKE` operator: `?q=extra_data_bin(~hello)`| + | | - -Notes: -- (\*) - always `null` for `mempool / blocks` -- for `id` and` hash` columns the increased efficiency at unloading of one record is applied -- there is no possibility to search the `date` column, but you can use `?q=time(YYYY-MM-DD)` instead -- search by fields that contain values in wei (`value_total`,` internal_value_total`, `generation`,` uncle_generation`, `fee_total`,` reward`) can be with some inaccuracies -- the search over `extra_data_hex` column can be done by the operator `^`, you can also use `~`for `extra_data_bin` (however, the field `extra_data_bin` will still not be shown) -- the difference between `value_total` and `internal_value_total`: e.g., a transaction itself sends 0 eth, but this transaction is a call of a contract that sends someone, let's say, 10 eth. Then `value` will be 0 eth, and `internal_value` - 10 eth -- the default sort is id DESC - -##### ethereum/uncles - -Returns information about uncles - -| Column | Type | Description | Q? | S? | -|--------|------|-------------|----|----| -| parent_block_id | int | Parent block id | + | + | -| index | int | Uncle index in the block | + | + | -| hash | string `0x[0-9a-f]{64}` | Uncle hash (with 0x) | + | | -| date | string `YYYY-MM-DD` | Date of generation (UTC) | | | -| time | string `YYYY-MM-DD HH:ii:ss` | Time of generation (UTC) | + | + | -| size | int | Uncle size in bytes | + | + | -| miner | string `0x[0-9a-f]{40}` | Address of the rewarded miner (with 0x) | + | | -| extra_data_hex | string `[0-9a-f]*` | Additional data included by the miner | + | | -| difficulty | int | Difficulty | + | + | -| gas_used | int | Amount of gas used by transactions | + | + | -| gas_limit | int | Gas limit for the block set up by the miner | + | + | -| logs_bloom | string `[0-9a-f]*` | Logs Bloom | | | -| mix_hash | string `[0-9a-f]{64}` | Hash Mix hash | | | -| nonce | string `[0-9a-f]*` | Nonce value | | | -| receipts_root | string `[0-9a-f]{64}` | Receipts Root hash | | | -| sha3_uncles | string `[0-9a-f]{64}` | Uncles hash | | | -| state_root | string `[0-9a-f]{64}` | State Root hash | | | -| total_difficulty | numeric string | Total difficulty | | | -| transactions_root | string `[0-9a-f]{64}` | Transactions Root hash | | | -| generation | numeric string | The reward of the miner who generated the uncle, in wei | + | + | -| generation_usd | float | The award of the miner who generated uncle, in USD | + | + | - -Additional synthetic columns (you can search over them and / or sort them, but they are not shown) - -| Column | Type | Description | Q? | S? | -|--------|------|-------------|----|----| -| extra_data_bin | string `.*` | Text representation of extra data. Allows you to use the `LIKE` operator:`?Q=extra_data_bin(~hello)` | + | | - -Notes: - -- for the columns `parent_block_id` and `hash` increased efficiency when uploading one or more records is applied -- there is no possibility to search the `date` column directly, but you can use `?q=time(YYYY-MM-DD)` instead -- search by fields that contain values in wei (`generation`) can be with some inaccuracies -- the search over `extra_data_hex` column can be done by the operator `^`, you can also use `~` for `extra_data_bin` (however, the field `extra_data_bin` will still not be shown) -- sort by default - parent_block_id DESC - -##### ethereum/[mempool/]transactions - -Returns transaction information - -| Column | Type | Description | Q? | S? | -|--------|------|-------------|----|----| -| block_id | int | Id of the block containing the transaction | + | + | -| id | int | Transaction id (not related to the blockchain, used for internal purposes) | + | + | -| index (\*) (\*\*) | int | The transaction index number in the block | + | + | -| hash (\*\*) | string `0x[0-9a-f]{64}` | Transaction hash (with 0x) | + | | -| date | string `YYYY-MM-DD` | Date of the block containing the transaction (UTC) | | | -| time | string `YYYY-MM-DD HH:ii:ss` | Time of the block containing the transaction (UTC) | + | + | -| size | int | Transaction size in bytes | + | + | -| failed (\*) | bool | Failed transaction or not? + | | | -| type (\*) | string (enum) | Transaction type with one of the following values: `call/create/call_tree/create_tree/synthetic_coinbase`. Description in the note. | | + | | -| sender (\*\*) | string `0x[0-9a-f]{40}` | Address of the transaction sender (with 0x) | + | | -| recipient | string `0x[0-9a-f]{40}` | Address of the transaction recipient (with 0x) | + | | -| call_count (\*) | int | Number of calls in the transaction | + | + | -| value | numeric string | Monetary value of transaction in wei, here and below `numeric string` - is a numeric value passed as a string, because wei-values do not fit into uint64 | + | + | -| value_usd | float | Value of transaction in USD | + | + | -| internal_value (\*) | numeric string | Value of all inner calls in the transaction in wei | + | + | -| internal_value_usd (\*) | float | Value of all internal calls in the transaction in USD | + | + | -| fee (\*) (\*\*) | numeric string | Fee in wei | + | + | -| fee_usd (\*) (\*\*) | float | Fee in USD | + | + | -| gas_used (\*) (\*\*) | int | Amount of gas used by a transaction | + | + | -| gas_limit (\*\*) | int | Gas limit for transaction set by the sender | + | + | -| gas_price (\*\*) | int | Price for gas set by the sender | + | + | -| input_hex (\*\*) | string `[0-9a-f]*` | Transaction input data | + | | -| nonce (\*\*) | string `[0-9a-f]*` | Nonce value | | | -| v (\*\*) | string `[0-9a-f]*` | V value | | | -| r (\*\*) | string `[0-9a-f]*` | R value | | | -| s (\*\*) | string `[0-9a-f]*` | S value | | | - -Additional synthetic columns (you can search over them and / or sort them, but they are not shown) - -| Column | Type | Description | Q? | S? | -|--------|------|-------------|----|----| -| input_bin | string `.*` | Text representation of input data. Allows you to use the `LIKE` operator: `?q=input_bin(~hello)` | + | | - -Notes: - -- (\*) - is always `null` for `mempool/transactions` -- (\*\*) - is always equal to `null` if `type` = `synthetic_coinbase` -- for the columns `id` and` hash` the increased efficiency at unloading of one record is applied -- there is no possibility to search over `date` column, you can search like `?q=time(YYYY-MM-DD)` instead -- search by fields that contain values in wei (`value`,` internal_value`) can be with some inaccuracies -- the search over `input_hex` column can be done by the operator `^`, you can also use `~` for `input_bin` (however, the field `input_bin` will still not be included in output) -- the difference between `value_total` and `internal_value_total`: e.g., a transaction itself sends 0 eth, but this transaction is a call of a contract that sends someone, let's say, 10 eth. Then `value` will be 0 eth, and `internal_value` - 10 eth -- the default sort is - id DESC -- possible types (`type`) of transactions: - * call - the transaction transfers the value, but there are no more calls (a simple ether sending, not in favor of a contract, or the call to a contract that does nothing) - * create - create a new contract - * call_tree - the transaction calls a contract that makes some other calls - * create_tree - create a new contract that create contracts or starts making calls - * synthetic_coinbase - a synthetic transaction for awarding a reward to the miner (block or uncle) - -##### ethereum/calls - -Returns information about calls - -| Column | Type | Description | Q? | S? | -|--------|------|-------------|----|----| -| block_id | int | Block id containing a call | + | + | -| transaction_id | int | Transaction id containing the call | + | + | -| transaction_hash (\*\*) | string `0x[0-9a-f]{64}` | Transaction hash (with 0x) containing the call | | | -| index | string | Call index within the transaction (tree-like, e.g., "0.8.1") | + | + | -| depth | int | Call depth within the call tree (starting at 0) | + | + | -| date | string `YYYY-MM-DD` | Date of the block that contains the call (UTC) | | | -| time | string `YYYY-MM-DD HH:ii:ss` | Time of the block that contains the call (UTC) | + | + | -| failed | bool | Failed call or not | + | | -| fail_reason | string `.*` or null | If failed, then the failure description, if not, then `null` | + | | -| type | string (enum) | The call type, one of the following values: `call/delegatecall/staticcall/callcode/selfdesctruct/create/synthetic_coinbase` | + | | -| sender (\*\*) | string `0x[0-9a-f]{40}` | Sender's address (with 0x) | + | | -| recipient | string `0x[0-9a-f]{40}` | Recipient's address (with 0x) | + | | -| child_call_count | int | Number of child calls | + | + | -| value | numeric string | Call value in wei, hereinafter `numeric string` - is a numeric string passed as a string, because wei-values do not fit into uint64 | + | + | -| value_usd | float | Call value in USD | + | + | -| transferred | bool | Has ether been transferred? (`false` if `failed`, or if the type of transaction does not change the state, e.g., `staticcall` | + | | -| input_hex (\*\*) | string `[0-9a-f]*` | Input call data | | | -| output_hex (\*\*) | string `[0-9a-f]*` | Output call data | | | - -Notes: - -- (\*\*) - is always `null` if` type` = `synthetic_coinbase` -- for the column `transaction_id` increased efficiency when uploading one record is applied -- there is no possibility to search over `date` column, use searching `?q=time(YYYY-MM-DD)` instead -- search by fields that contain values in wei (`value`,` internal_value`) can be with some inaccuracies -- the default sort is transaction_id DESC -- sorting by `index` is alphabetical (ie "0.2" goes after "0.11"), in some cases a switch to natural sorting is used (for example, when there is a filter for `transaction_id`) - -##### Notes - -- for unconfirmed transactions (and outputs in the case of bitcoin[-cash]), the following rules are applied: - - their `block_id` is equal to `-1` - - `date` and` time` indicate the time when the transaction was received by our node -- when using `offset`, it is reasonable to add to the filters the maximum block number (`?q=block_id(..N)`), since it is very likely that during the iteration new rows will be added to the table. For convenience, you can take the value of `context.state` from the first result of any query containing the number of the latest block at the query time and use this result later on. - -#### Dashboard calls - -The API supports a number of calls that produce some aggregated data, or data in a more convenient form for certain entities. - -##### (bitcoin[-cash]|litecoin|ethereum)/dashboards/block/{A} and (bitcoin[-cash]|litecoin|ethereum)/dashboards/blocks/{A[,B,...]} - -As the input data, it takes the height or hash of the block(s). `data` returns an array with block heights or block hashes used as keys, and arrays of elements as values: -* `block` - information about the block in infinitable-format `(bitcoin[-cash]|ethereum)/blocks` -* `transactions` - the array of all hashes of transactions included in the block -* only for Ethereum - `synthetic_transactions` - array of internal ids of synthetic transactions (they do not have a hash) (`null` instead of the array until the block receives 6 confirmations) -* only for Ethereum - `uncles` - the array of hashes of the block's uncles (`null` instead of the array until the block receives 6 confirmations, in case there are no uncles and more than 6 confirmations - an empty array (`[]`)) - -`context.results` contains the number of found blocks. - -##### ethereum/dashboards/uncle/{A} and ethereum/dashboards/uncles/{A[,B,...]} - -As the input data, it takes an uncle hash(es). `data` returns an array with uncle hashes used as keys, and arrays of elements as values: -* `uncle` - information about the block in infinitable-format `ethereum/uncles` - -`context.results` contains the number of found uncles. - -##### (bitcoin[-cash]|litecoin|ethereum)/dashboards/transaction/{A} and (bitcoin[-cash]|litecoin|ethereum)/dashboards/transactions/{A[,B,...]} - -At the input data, it takes an internal blockchair-id or a hash of a transaction (transactions). `data` returns an array with identifiers or hashes of transactions used as keys, and arrays of elements as keys: -* `transaction` - transaction information in infinitable-format `bitcoin[-cash]/transactions` -* (only bitcoin[-cash]|litecoin) `inputs` - array of all transaction inputs, sorted by `spending_index` in infinitable-format `bitcoin[-cash]/outputs` -* (only bitcoin[-cash]|litecoin) `outputs` - array of all transaction outputs, sorted by `index` in infinitable-format `bitcoin[-cash]/outputs` -* (only ethereum) `calls` - the array of all calls made during the execution of the transaction (always `null` for mempool transactions and the last 6 blocks) - -`context.results` contains the number of found transactions. - -##### (bitcoin[-cash]|litecoin|ethereum)/dashboards/transaction/{hash}/priority - -For mempool transactions shows priority (`position`) (for Bitcoin - by `fee_per_kwu`, for Bitcoin Cash - by `fee_per_kb`, for Ethereum - by `gas_price`) over other transactions (`out_of` mempool transactions). It has the same structure as the `(bitcoin[-cash]|ethereum)/dashboards/transaction/{A}` call - -##### (bitcoin[-cash]|litecoin)/dashboards/address/{A} - -Uses address as the input data. `data` returns an array with one element (if the address is found), in that case the address is the key, and the value is an array consisting of the following elements: -* `address` - * `address.type` - address type (type of output is the same as `bitcoin[-cash].outputs.type`) - * `address.script_hex` - address script - * `address.balance` - address balance in satoshi (hereinafter - including unconfirmed outputs) - int - * `address.balance_usd` - address balance in USD - float - * `address.received` - total received in satoshi - * `address.received_usd` - total received in USD - * `address.spent` - total spent in satoshi - * `address.spent_usd` - total spent in USD - * `address.output_count` - the number of outputs this address received - * `address.unspent_output_count` - number of unspent outputs for this address (i.e. the number of inputs for an address can be calculated as `output_count`-`unspent_output_count`) - * `address.first_seen_receiving` - timestamp (UTC) when the first time this address received coins - * `address.last_seen_receiving` - timestamp (UTC) when the last time this address received coins - * `address.first_seen_spending` - timestamp (UTC) when the first time this address sent coins - * `address.last_seen_spending` - timestamp (UTC) when the last time this address sent coins - * `address.transaction_count` - number of unique transactions this address participating in -* `transactions` - an array of the last 100 hashes the address is participating in - -`context.results` contains the number of found addresses (0 or 1, until the `addresses` call is implemented). - -To iterate `transactions`, `?offset=N` is supported. - -##### ethereum/dashboards/address/{A} - -Uses address as the input data. `data` returns an array with one element (if the address is found), in that case the address is the key, and the value is an array consisting of the following elements: -* `address` - * `address.type` - address type (`account` - for an address, `contract` - for a contract) - * `address.contract_code_hex` - hex code of the contract at the momemt of creation (for a contract), or null (for an address) - * `address.contract_created` - for a contract - if the contact was indeed created then true, if not (i.e. with a failed `create` call) - false, or null (for an address) - * `address.contract_destroyed` - for a contract - if the contact was successfully destroyed (SELFDESCTRUCT) then true, if not - false, or null (for an address) - * `address.balance` - exact address balance in wei (here and below for values in wei - numeric string) - * `address.balance_usd` - address balance in USD - float - * `address.received_approximate` - total received in wei (approximately) (\*) - * `address.received_usd` - total received in USD (approximately) (\*) - * `address.spent_approximate` - total spent in wei (approximately) (\*) - * `address.spent_usd` - total spent in USD (approximately) (\*) - * `address.fees_approximate` - total spent in transaction fees in wei (approximately) (\*) - * `address.fees_usd` - total spent in transaction fees in USD (approximately) (\*) - * `address.receiving_call_count` - number of calls in favor of this address, where value transfer has occured (\*\*) - * `address.spending_call_count` - number of calls that was made by this address, where value transfer has occured (\*\*) - * `address.call_count` - total number of calls this address participating in (may be greater than` receiving_call_count` + `spending_call_count`, because it also takes into account failed calls) - * `address.transaction_count` - number of transactions this address participating in - * `address.first_seen_receiving` - timestamp (UTC) when this address received a successful incoming call for the first time - * `address.last_seen_receiving` - timestamp (UTC) when this address received a successful incoming call for the last time - * `address.first_seen_spending` - timestamp (UTC) when this address sent a successful call for the first time - * `address.last_seen_spending` - timestamp (UTC) when this address sent a successful call for the last time -* `calls` - an array of the last 100 calls with the address, each element of an array containing the following columns of `ethereum/calls`: `block_id`, `transaction_hash`,` index`, `time`,` sender`, `recipient`, `value`,` value_usd`, `transferred` - -`context.results` contains the number of found addresses (0 or 1, until the `addresses` call is implemented). - -To iterate `calls`, `?offset=N` is supported. - -Notes: -- (\*) - in these columns, the value in wei can be rounded. For a million of calls, the error can be more than 1 ether. -- (\*\*) - counted only those calls that fit the following condition: ethereum/calls.transferred = true (see the `ethereum/calls` documentation), i.e. those calls as well as failed calls that do not change state (staticcall, etc.) are not considered - -##### (bitcoin[-cash]|litecoin|ethereum)/stats - -Returns an array with blockchain statistics: -* `blocks` - total number of blocks -* (only ethereum) `uncles` - total number of uncles -* `transactions` - total number of transactions -* (only ethereum) `calls` - total number of internal calls -* `blocks_24h` - blocks for the last 24 hours -* `circulation` for bitcoin[-cash]|litecoin, `circulation_approximate` for ethereum - number of coins in circulation (in Satoshi, or in wei for Ethereum - an approximate value) -* `transactions_24h` - transactions for the last 24 hours -* `difficulty` - current difficulty -* `volume_24h` for bitcoin[-cash]|litecoin, `volume_24h_approximate` for ethereum - monetary volume of transactions for the last 24 hours (for ethereum - an approximate value) -* `mempool_transactions` - number of transactions in the mempool -* (only ethereum) `mempool_median_gas_price` - median gas price in the mempool -* (only bitcoin[-cash]|litecoin) `mempool_size` - the mempool size in bytes -* `mempool_tps` - number of transactions per second added to the mempool -* (only ethereum) `mempool_total_value_approximate` - mempool monetary value -* (only bitcoin[-cash]|litecoin) `mempool_total_fee_usd` - total mempool fee, in USD -* `best_block_height` - the latest block height -* `best_block_hash` - the latest block hash -* `best_block_time` - the latest block time -* (only ethereum) `uncles_24h` - number of uncles for the last 24 hours -* (only bitcoin[-cash]|litecoin) `nodes` - number of complete nodes -* `hashrate_24h` - hashrate (hashes per second) in average for the last 24 hours -* `market_price_usd` - average market price of 1 coin in USD (market data source: CoinGecko) -* `market_price_btc` - average market price of 1 coin in BTC (for Bitcoin always returns 1) -* `market_price_usd_change_24h_percentage` - market price change in percent for 24 hours -* `market_cap_usd` - market capitalization (coins in circulation * price per coin in USD) -* `market_dominance_percentage` - dominance index (how much % of the total cryptocurrency market is the market capitalization of the coin) -... there's also some other self-explanatory keys - -##### stats - -Returns data on four calls: -* `bitcoin/stats` -* `bitcoin-cash/stats` -* `ethereum/stats` -* `litecoin/stats` - -#### API request examples - -Suppose we would like to receive all the latest transactions from the Ethereum blockchain which amount to more than $1M USD. The following request should be done for this: -* `https://api.blockchair.com/ethereum/transactions?q=internal_value_usd(10000000..)&s=id(desc)` - -In this request we refer to the blockhain (`ethereum`), a table (`transactions`), set up the amount condition (`q=internal_value_usd(10000000..)`), and sort in descending order (`&s=id(desc)`). - -Suppose, a script with this request to the API for some reason did not work for a while, or a huge amount of transactions worth more than $1 million appeared. With the standard limit of 10 results, the script skipped some transactions. Then firstly we should do the following: -* `https://api.blockchair.com/ethereum/transactions?q=internal_value_usd(10000000..)&s=id(desc)` - -From its result we save `context.state`, put it in a variable `_S_`, and further to obtain the following results we apply `offset`: -* `https://api.blockchair.com/ethereum/transactions?q=internal_value_usd(10000000..),block_id(.._S_)&s=id(desc)&offset=10` - -Increase offset value until getting a data set with the transaction that we already knew about. - -#### Support - -* E-mail: [info@blockchair.com](mailto:info@blockchair.com) -* Telegram chat: [@Blockchair](https://telegram.me/Blockchair) -* Twitter: [@Blockchair](https://twitter.com/Blockchair) diff --git a/API_DOCUMENTATION_RU.md b/API_DOCUMENTATION_RU.md index 2cc70656..49673f20 100644 --- a/API_DOCUMENTATION_RU.md +++ b/API_DOCUMENTATION_RU.md @@ -1,6 +1,6 @@ -## [Blockchair.com](https://blockchair.com/) API v.2.0.6 - документация +## [Blockchair.com](483cc1a6-db56-43ba-b4c4-3fa0ce50b005) API v.2.0.10 - документация -![alt text](https://blockchair.com/images/logo_full.png "Blockchair logo") +![Blockchair logo](https://blockchair.com/images/logo_full.png "Blockchair logo") ### Содержание @@ -27,24 +27,49 @@ + [Адрес Ethereum](#ethereumdashboardsaddressa) + [Статистика](#bitcoin-cashlitecoinethereumstats) + [Статистика по всем блокчейнам](#stats) + + [Статистика сети](#bitcoin-cashlitecoinnodes) + [Пример](#пример-работы-с-api) ++ [Рассылка транзакций](#рассылка-транзакций) ++ [Получение транзакций в сыром виде](#получение-транзакций-в-сыром-виде) + [Поддержка](#поддержка) ### Changelog +* v.2.0.10 - Jan 29th 2019 - Added [Dogecoin support](#dogecoin-support-since-jan-29th-2019) in test mode +* v.2.0.9 - 12 декабря - Добавлена [поддержка Bitcoin SV](#поддержка-bitcoin-sv-с-12-декабря) в тестовом режиме; обновлены возможности [агрегации данных](#поддержка-агрегирования-данных-с-8-октября) +* v.2.0.8 - 26 ноября - Появилась возможность получать транзакции в сыром виде, см. [Получение транзакций в сыром виде](#получение-транзакций-в-сыром-виде) +* v.2.0.7 - 22 ноября - Появилась возможность рассылать транзакции через API, см. [Рассылка транзакций](#рассылка-транзакций) * v.2.0.6 - 8 октября - В бета-режиме добавлена возможность агрегировать информацию из блокчейнов, см. `Поддержка агрегирования данных` ниже * v.2.0.5 - 8 октября - Исправлен баг с подсчётом `balance` и `received` у bitcoin[-cash]|litecoin-адресов в колле `{chain}/dashboards/address/{address}`, когда имелись специфические неподтверждённые транзакции * v.2.0.4 - 3 октября - Добавлены некоторые полезные поля к коллам `{chain}/stats` * v.2.0.3 - 18 сентября - Добавлен ключ `context.api.tested_features` со списком тестируемых фич, поддерживаемых нашим API (у тестируемых фич нет гарантий поддержки в будущем, гарантий, что в какой-то момент не потеряется совместимость при обновлении). Добавлена поддержка Omni Layer и Wormhole в режиме тестирования (см. ниже) * v.2.0.2 - 9 сентября - Добавлено поле `address.contract_created` для колла `ethereum/dashboards/address/{A}` -* v.2.0.1 - 1 сентября - Добавлена поддержка Litecoin +* v.2.0.1 - 1 сентября 2018 - Добавлена поддержка Litecoin ### Changelog тестируемых фич -##### Поддержка агрегирования данных (с 8 октября) +##### Dogecoin support (since Jan 29th 2019) + +* v.rc3 - Feb 5th - It's now possible to retrieve the list of Dogecoin nodes using the `dogecoin/nodes` call (the output format is compatible with other coins) +* v.rc2 - Feb 2nd - Groundhog Day! Unlike for other coins, the latest Dogecoin block along with its transactions isn't stored in `mempool` tables anymore. `dogecoin/mempool/blocks` is now deprecated, while `dogecoin/mempool/transactions` and `dogecoin/mempool/outputs` show only mempool data. +* v.rc1 - Jan 29th - We're now processing the Dogecoin chain. All API calls are fully compatible with Bitcoin Cash (i.e. replace `bitcoin-cash` with `dogecoin` in URLs) with a few exceptions: + * There's no node list for Dogecoin yet; + * The `blocks` table has one additional field called `is_aux` - it is a boolean field showing whether a block was mined using AuxPoW. + +It is expected that Dogecoin will be out of beta mode very soon. Wow. + +##### Поддержка Bitcoin SV (с 12 декабря) + +* v.b1 - 12 декабря - Ура! Теперь мы предоставляем данные по Bitcoin SV (BSV). Все API-вызовы совместимы с таковыми для Bitcoin Cash, например, если вы хотите получить последние nulldata-выходы (OP_RETURN), то просто замените `bitcoin-cash` на `bitcoin-sv`: https://api.blockchair.com/bitcoin-sv/outputs?q=type(nulldata)# + +Пожалуйста, имейте в виду, что поддержка Bitcoin SV осуществляется в тестовом режиме и не предназначена для использования в рабочей среде, пока Bitcoin SV не продемонстрирует более конструктивную дорожную карту (например, мы не сможем предоставить некоторый функционал, если блоки внезапно увеличатся до 1 экзабайта...) + +##### Поддержка агрегирования данных (с 8 октября 2018) * v.b1 - 8 октября - Внедрение возможности получать агрегированную информацию. Теперь вы можете использовать Blockchair не только для фильтрации и сортировки информации из блокчейнов, но и для агрегации данных. +Пожалуйста, не используйте это в рабочей среде, могут быть фундаментальные изменения! + См. примеры: * https://api.blockchair.com/bitcoin/blocks?a=year,count()# - выдаёт количество блоков в Bitcoin по годам * https://api.blockchair.com/bitcoin/transactions?a=month,median(fee_usd)# - медианные комиссии за транзакции в Bitcoin по месяцам @@ -649,6 +674,17 @@ API поддерживает ряд коллов, которые выдают к * `ethereum/stats` * `litecoin/stats` +#### (bitcoin[-cash]|litecoin)/nodes +Возвращает информацию о доступных нодах. +* `nodes` - ноды + * `version` - User Agent клиента + * `country` - страна (определяется по GeoIP) + * `height` - последний блок в цепочке ноды + * `flags` - флаги [сервисов](https://en.bitcoin.it/wiki/Protocol_documentation#version) +* `count` - количество +* `countries` - количество нод по странам +* `versions` - количество нод по User Agent + ### Пример работы с API Допустим, нам требуется получать все последние транзакции из блокчейна Эфириума на сумму более 1 млн. долларов. Для этого необходимо составить следующий запрос: @@ -664,6 +700,30 @@ API поддерживает ряд коллов, которые выдают к Увеличиваем значение offset пока не получим выборку с транзакцией, о которой мы уже знали. +### Рассылка транзакций + +Для рассылки транзакции по сети, нужно выполнить POST-запрос к `https://api.blockchair.com/{chain}/push/transaction` (где `{chain}` может быть: `bitcoin`, `bitcoin-cash`, `ethereum`, или `litecoin`) с `data`, содержащим транзакцию в сыром шестнадцатеричном виде (в Ethereum начинается с `0x`). Пример: + +``` +curl -v --data "data=01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0704ffff001d0104ffffffff0100f2052a0100000043410496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858eeac00000000" https://api.blockchair.com/bitcoin/push/transaction +``` + +Если транзакция была успешно разослана по сети, API вернёт JSON-ответ (код 200), содержищий массив `data` с ключом `transaction_hash`, содержащим хеш самой транзакции. В случае ошибки (неправильный формат транзакции, трата уже потраченных выходов, и т.д.) API вернёт код 400. + +Пример успешного ответа: + +``` +{"data":{"transaction_hash": "0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098…"},"context":{"code":200,… +``` + +### Получение транзакций в сыром виде + +Можно получить транзакцию в сыром виде напрямую от наших нод. Для этого требуется выполнить следующий API-запрос: `https://api.blockchair.com/{chain}/raw/transaction/{txhash}` (где `{chain}` может быть: `bitcoin`, `bitcoin-cash`, `ethereum`, или `litecoin`) + +Ответ содержит два ключа: +* `raw_transaction` — транзакция в сыром виде в шестнадцатеричной с.и.; +* `decoded_raw_transaction` (недоступно для Ethereum) — транзакция в сыром виде в JSON. Пожалуйста, имейте в виду, что структура JSON-массива может измениться с обновлением наших нод, и это не будет отмечено в журнале изменений. + ### Поддержка * E-mail: [info@blockchair.com](mailto:info@blockchair.com) diff --git a/Assets/README.md b/Assets/README.md new file mode 100644 index 00000000..347b9860 --- /dev/null +++ b/Assets/README.md @@ -0,0 +1 @@ +This is a directory for images and other assets. diff --git a/Assets/sql.png b/Assets/sql.png new file mode 100644 index 00000000..b6bf2dd1 Binary files /dev/null and b/Assets/sql.png differ diff --git a/PRIVACY.md b/PRIVACY.md new file mode 100644 index 00000000..3616f116 --- /dev/null +++ b/PRIVACY.md @@ -0,0 +1,62 @@ +###### TL;DR: Blockchair does not collect personal data or share it with third parties. We don't track you. +* * * + +## Why is this important? + +**One of the key advantages of cryptocurrencies is that they enable (pseudo)anonymous transactions.** In most cases the user’s address and transaction details are made public and cannot be deleted, but their personal identity remains unknown if no link exists between the user and their blockchain data. + +Privacy is at risk when you share any information with third parties. Cryptocurrency exchanges with KYC policies, online retailers that require delivery addresses and web wallets associated with phone numbers all require you to share information. + +What’s more, most web servers maintain default logs of your IP address and User Agent (browser name and operating system), the dates and times of your browsing activity and, most importantly, the URLs you visited. Ordinarily, a cryptocurrency address page is only visited by the address owner, while the transaction page is visited by the transaction parties. **Blockchain explorers can therefore easily trace the digital fingerprint that links addresses and transactions. Unfortunately, this data is also picked up by the web analytics tools (Google Analytics, Baidu Tongji, Yandex.Metrica), advertising platforms and similar third-party services.** + +User data can be traced in others ways too. CDN providers like Cloudflare, Incapsula and AWS Shield act as reverse proxies, which means some websites require you to request data from a CDN in order to use the site. You therefore share your information with the provider. + +In addition to these data tracking services, there are several other ways how users can be identified online. + +* HTTP referer: a client request header that allows a server to trace the previous site you visited. Say you visit example.com followed by explorer.com/1YourBitcoinAddress then the former will receive information that you have come from the latter; +* Web beacon (bug): an invisible web page element that confirms a user has visited a web page. This is used to collect user analytics; +* Cookies: user activity data stored in the user’s browser. Third-party cookies can also be embedded in the site’s code (if it contains elements from other sites); +* Evercookie: a JavaScript app that stores zombie cookies on a computer. These cookies are extremely difficult to remove since Evercookie recreates them whenever they are deleted; +* Device / browser fingerprint: the device and browser information collected for user identification; +* Browser extensions. + +* * * + +## Why is it unsafe to share you personal data? + +Most blockchain explorers and cryptocurrency companies store user information, including available balances, lists of transactions and types of cryptocurrency. + +They might sell this information, publish it, share it with government agencies, or they might be hacked. If it becomes public knowledge that you have significant funds stored in cryptocurrency, you’re likely to be targeted by cyber criminals. Your personal safety may be at risk too. + +* * * + +## Why is Blockchair the safer option? + +* When you connect to Blockchair your browser automatically sends us information about your computer, User Agent, IP address, and the page you want to visit. Since this data may expose your identity, **we do not permanently store information about you**; +* **We do not use third-party cookies which can be used to identify you.** We may only set our own cookies to improve your user experience and help us to fight botnets and spammers. See below for details; +* **Your browser won’t send HTTP referer headers when leaving Blockchair.com. This means you can move to other sites without your browsing activity being traced by those sites;** +* **We do not use CDN-providers, including those used to distribute JavaScript libraries and styles. We do not use any third-party site elements, web analytics tools (such as Google Analytics) and hit counters. Therefore, other parties do not receive information about you.** + +* * * + +## What data do we store and how do we use this data? + +We only collect anonymous aggregated data that allows us to improve our website features. We count visitors, analyze popular searches, cryptocurrencies, sortings and other queries. + +We also store the incoming IP addresses in masked or clear form for short periods of 1 to 2 days. This is to limit the rate of API requests. + +Your device may store first-party cookies, such as those that keep the night mode on, store referer information, unique visitor and session ID. + +Collected data is used to improve user experience and compile website traffic statistics. Session data is deleted on a regular basis. + +* * * + +## Privacy Policy updates + +We will publish any updates to our Privacy Policy at this page ([https://blockchair.com/privacy](https://blockchair.com/privacy)) and in the GitHub repository at [https://github.com/Blockchair/Blockchair.Support/blob/master/PRIVACY.md](https://github.com/Blockchair/Blockchair.Support/blob/master/PRIVACY.md) plus the link to the updated version will be available at the bottom of all our site pages. + +* * * + +## Contacts + +Please share your comments and suggestions at . diff --git a/README.md b/README.md index dcd5c2f0..05502a65 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ This is our public repository for issues and feature requests. Please feel free to submit any ideas as well as bugs using [the "New Issue" button](https://github.com/Blockchair/Blockchair.Support/issues/new)! * API documentation and changelog: https://github.com/Blockchair/Blockchair.Support/blob/master/API.md -* Questions regarding Bitcoin / Bitcoin Cash / Ethereum / Litecoin payments? Please refer to our FAQ first: https://github.com/Blockchair/Blockchair.Support/blob/master/FAQ_PAYMENTS.md +* Direct SQL Access documentation: https://github.com/Blockchair/Blockchair.Support/blob/master/SQL.md +* Questions regarding a payment? Please refer to our FAQ first: https://github.com/Blockchair/Blockchair.Support/blob/master/FAQ_PAYMENTS.md Additional contacts: * E-mail: [info@blockchair.com](mailto:info@blockchair.com) -* Telegram group: [@Blockchair](https://telegram.me/Blockchair) * Twitter: [@Blockchair](https://twitter.com/Blockchair) diff --git a/SQL.md b/SQL.md new file mode 100644 index 00000000..629beedc --- /dev/null +++ b/SQL.md @@ -0,0 +1,101 @@ +## [Blockchair.com](https://blockchair.com/) Direct SQL Access documentation + +Example + +### Table of contents + ++ [Changelog](#link_changelog) ++ [Overview](#link_overview) ++ [Obtaining access](#link_obtainingaccess) ++ [Connecting to the server](#link_connecting) ++ [Database schema](#link_schema) ++ [Query example](#link_example) ++ [Support](#link_support) + +Example + +### Changelog + +* v.0.0.1 - May 3rd, 2019 + * We begin beta testing direct access to our databases. If you're interested in participating in the beta test, please reach us out at [](mailto:info@blockchair.com). Note that while in beta, there may be some compatibility breaking changes. + +### Overview + +Blockchair's Direct SQL Access allows you to query our databases directly bypassing our API. While in some cases our API works a lot faster (e.g. querying the balance of an address), sometimes it's handy to have an ability to execute an arbitrary query (e.g. you can create your own filters to aggregate data however you want, or you can use window functions). + +We start with supporting three blockchains - Bitcoin (BTC), Bitcoin Cash (BCH), and Litecoin (LTC). More blockchains are coming in the future. + +All our databases are working in real time - as soon as there's a new block it is instantly populated into the database. + +### Obtaining access + +While Blockchair has a public API available without obtaining a key, this feature requires dedicated access. Please contact us at [](mailto:info@blockchair.com) for pricing. As always, we provide free access for academic purposes in some cases. + + +### Connecting to the server + +The database server is PostgreSQL 11. + +The connection parameters are: +* Server: *\* +* Port: `5432` +* Login: *\* +* Password: *\* +* Database name: `blockchair` + +The simplest way to connect is to use `psql` utility: + +`$ psql -h -p 5432 -U blockchair` + +Please note that we allow neither connections to the `postgres` database, nor access to `public` schemas. External users do not have writing permissions, including creating views. + +By default, there's a limit of 1 connection per user. + +### Database schema + +The following schemas are available: +* `bitcoin` +* `bitcoincash` +* `litecoin` + +Each schema contains: +* `blocks` table +* `transactions` table +* `outputs` table +* `usd(BIGINT, TIMESTAMP DEFAULT current_date)` function to convert satoshi values to USD values using exchange rate on a specified date + +To get columns description use `\d`, e.g. `\d bitcoin.blocks`. The columns are consistent with the described columns in [the API documentation](API.md). There are no `*_usd` columns, please use the `usd` function instead (e.g. `blocks.output_total_usd` can be accessed as `usd(blocks.output_total, blocks.time)`). + +There are following indexes available: +* `blocks.id` +* `blocks.hash` +* `transactions.block_id` +* `transactions.id` +* `transactions.hash` +* `outputs.block_id` +* `outputs.transaction_id` +* `outputs.spending_block_id` +* `outputs.spending_transaction_id` + +### Query example + +``` +blockchair=> SELECT id, encode(hash, 'hex'), time FROM bitcoin.blocks WHERE id = 0 +blockchair-> UNION ALL +blockchair-> SELECT id, encode(hash, 'hex'), time FROM bitcoincash.blocks WHERE id = 0 +blockchair-> UNION ALL +blockchair-> SELECT id, encode(hash, 'hex'), time FROM litecoin.blocks WHERE id = 0; + id | encode | time +----+------------------------------------------------------------------+--------------------- + 0 | 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f | 2009-01-03 18:15:05 + 0 | 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f | 2009-01-03 18:15:05 + 0 | 12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2 | 2011-10-07 07:31:05 +(3 rows) +``` + +### Support + +Support is available in two languages: English and Russian. + +* E-mail: [info@blockchair.com](mailto:info@blockchair.com) +* Telegram chat: [@Blockchair](https://telegram.me/Blockchair)