Skip to Content
Foundations of Blockchain
book

Foundations of Blockchain

by Koshik Raj
January 2019
Beginner to intermediate
372 pages
11h 17m
English
Packt Publishing
Content preview from Foundations of Blockchain

Communicating using scripting language through the JSON-RPC implementation

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Blockchain Basics

Blockchain Basics

Daniel Drescher
What Is Blockchain?

What Is Blockchain?

Sir John Hargrave, Evan Karnoupakis
Mastering Blockchain

Mastering Blockchain

Lorne Lantz, Daniel Cawrey

Publisher Resources

ISBN: 9781789139396Supplemental Content