January 2019
Beginner to intermediate
372 pages
11h 17m
English
Any programming language's JSON-RPC implementation can be used to communicate with a Bitcoin node. Let's execute an API using the Python JSON-RPC implementation, which will automatically generate all the Python methods for RPC calls. Python has several libraries with support for JSON-RPC, but we will be using python-bitcoinlib, which not only provides a JSON-RPC implementation but can also interface with Bitcoin data structures and protocols. The following Python script accepts a transaction ID in hexadecimal format and converts it into raw bytes using the lx() function. An RPC object, proxy_connection, which can be used to invoke any API, is created. The gettransaction ...