diff --git a/API_DOCUMENTATION_EN.md b/API_DOCUMENTATION_EN.md index 3dd7ccab..dd06152c 100644 --- a/API_DOCUMENTATION_EN.md +++ b/API_DOCUMENTATION_EN.md @@ -1,6 +1,6 @@ -## [Blockchair.com](https://blockchair.com/) API v.2.0.6 Documentation +## [Blockchair.com](https://blockchair.com/) API v.2.0.7 Documentation -![alt text](https://blockchair.com/images/logo_full.png "Blockchair logo") +![Blockchair logo](https://blockchair.com/images/logo_full.png "Blockchair logo") ### Table of contents @@ -28,11 +28,13 @@ + [Stats](#bitcoin-cashlitecoinethereumstats) + [General stats](#stats) + [API request example](#api-request-examples) ++ [Broadcasting transactions](#broadcasting-transactions) + [Support](#support) ### Changelog +* v.2.0.7 - Nov 22th - Now it's possible to broadcast transactions using our API, see [Broadcasting transactions](#broadcast) * 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 @@ -664,6 +666,22 @@ From its result we save `context.state`, put it in a variable `_S_`, and further Increase offset value until getting a data set with the transaction that we already knew about. +### Broadcasting transactions + +In order to broadcast a transaction into the network, you should make a POST request to `https://api.blockchair.com/{chain}/push/transaction` with `data` holding hex represenatation of a transaction (for Ethereum it should start with `0x`). An example: + +``` +curl -v --data "data=01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0704ffff001d0104ffffffff0100f2052a0100000043410496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858eeac00000000" https://api.blockchair.com/bitcoin/push/transaction +``` + +If the transaction has been successfully broadcast to the network, API will return a JSON response (code 200) containing `data` array with `transaction_hash` key holding the hash of the received transaction. In case of any error (wrong transaction format, spending already spent outputs, etc.) API returns status code 400. + +Example of a successful response: + +``` +{"data":{"transaction_hash": "0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098…"},"context":{"code":200,… +``` + ### Support * E-mail: [info@blockchair.com](mailto:info@blockchair.com)