Bitcoin: Rest -API document *
introduction
————
The BRECOIN CORRE (BTC) project offers a relaxing API for interaction with IT blockchain. This artist offers a detailed overview of the rest -API, tends how to use them and some exams of the intensity.
First steps
————
To vegetate the BTC Rest -API, you have to make an API key from the officer of the Core website. You can do this by registering on the [official website] (
As soon as Yuu has received your API key, you can use it to create a creator of the library in your preferred programming language (e.g. Python, JavaScript, Ruby). The library’s client offers an interface to access the BTC Rest -API.
Rest -API endpoints
———–
The BTC RET -API provides several endpoints for interaction with the blockchain:
* Blocks: Get the latest block by ID Orget all blocks.
* Ttransactions: Get the details of a transaction from ID All transactions.
* Walelts: Receive the information, including balance and address.
Knot : short information, magic network status and amombs.
Get the legislator
Everything that the Latte Block, you can use the Follower end:
`!
Get/Blockchain/Last_Block/Last_block
`S
Replace D/Blocks/Vthy your coveted version (e.g. Savage for BRECOIN CORRE 0.7.X).
Tras action of details
To get the details of a transformation from ID or to receive the deceptive endpoints:
!
Get/ transaction/ V1/ transaction/ transaction/ transaction
`S
Replace {{txid} ’with the desirect transaction id.
For example, to get the details of the transaction by ID:
!
Get/ transaction/ transaction/ 123456898900000000BDEFF
`S
Wallette information
To obtain information, including bathing and address, you can use the Folling endpoint:
!
Get/Arasch pockets/wallet/wallet/wallet.
`S
Replace {{WIALID} ’with the desirect id.
For examination to get a wake by ID:
!
Get/Wallets/Walts/1234568989000000000000.
`S
node information
No information that includes network statistics and are no longer available. You can use the Folling endpoint:
!
Get /knot /knot
`S
This end point returns a list of available nodes in your local network.
Example Cliness Code (Python)
---------------------------------------
He was an exam code for the use of the BC Rest API with Python:
Comfort
Import inquiries
Set up API key and version
ap_key = “your_pi_Key_Key_hey”
Version = “0.7.x”
Set up URL
Endpoint_url = f “htps: // {veration}/vlockchain/vlock/last_block”
Create a library object
climate = Requests.Client ()
Entry:
Get the lock
pursponse = clinic.get (inpoint_url)
Check the answer neither
selected.status_code = = 200:
Analyze the JSON RESPEL
block_data = .json ()
Print (“later block:”, block_data)
different:
print (f “error: {response.status_code}”)))
Choose requirements.
Print (f “http error: {http_err}”)
“ S
Diploma
———-
The BRECOIN CORRE REST -API offers a powerful setting in the blockchain. If you can use this API, you can carry out a cable range of settings and call up block information for managing carllets. This artist is proven by a detailed overview of the rest -API and the exams of the elements used in Python.
Để lại một bình luận