Bitcoin Forum
May 06, 2024, 07:38:02 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [Wiki] Python JSON-RPC example  (Read 2631 times)
Luke-Jr (OP)
Legendary
*
expert
Offline Offline

Activity: 2576
Merit: 1186



View Profile
April 09, 2011, 02:14:26 PM
 #1

Does this wording satisfy everyone?

Quote
For Python, python-jsonrpc is the official JSON-RPC implementation. It automatically generates Python methods for RPC calls. However, due to its design for supporting old versions of Python, it is also rather inefficient. jgarzik has forked it as Python-BitcoinRPC and optimized it for current versions (at least Python 2.6+, though not 3.x). Generally, this version is recommended.

While BitcoinRPC lacks a few obscure features from jsonrpc, software using only the ServiceProxy class can be written the same to work with either version the user might choose to install:

1715024282
Hero Member
*
Offline Offline

Posts: 1715024282

View Profile Personal Message (Offline)

Ignore
1715024282
Reply with quote  #2

1715024282
Report to moderator
1715024282
Hero Member
*
Offline Offline

Posts: 1715024282

View Profile Personal Message (Offline)

Ignore
1715024282
Reply with quote  #2

1715024282
Report to moderator
"In a nutshell, the network works like a distributed timestamp server, stamping the first transaction to spend a coin. It takes advantage of the nature of information being easy to spread but hard to stifle." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715024282
Hero Member
*
Offline Offline

Posts: 1715024282

View Profile Personal Message (Offline)

Ignore
1715024282
Reply with quote  #2

1715024282
Report to moderator
1715024282
Hero Member
*
Offline Offline

Posts: 1715024282

View Profile Personal Message (Offline)

Ignore
1715024282
Reply with quote  #2

1715024282
Report to moderator
1715024282
Hero Member
*
Offline Offline

Posts: 1715024282

View Profile Personal Message (Offline)

Ignore
1715024282
Reply with quote  #2

1715024282
Report to moderator
Gavin Andresen
Legendary
*
qt
Offline Offline

Activity: 1652
Merit: 2216


Chief Scientist


View Profile WWW
April 09, 2011, 03:53:28 PM
 #2

What is meant by "rather inefficient"?  Speed of serializing/deserializing?

I can't imagine that is a significant factor for communicating with bitcoin; if you're running into JSON-RPC bottlenecks (is anybody running into performance bottlenecks due to JSON-RPC yet?  If you are, what are you doing?) then the lack of persistent connections, lack of JSON-RPC-2.0-multicall support, or bitcoin single-threaded RPC are likely much, much bigger issues.


How often do you get the chance to work on a potentially world-changing project?
genjix
Legendary
*
expert
Offline Offline

Activity: 1232
Merit: 1072


View Profile
April 09, 2011, 05:00:18 PM
 #3

Why do we even recommend JSON-RPC at all?

It's not even an official library for Python and it isn't very good (uses floats and has no persistent connections). We should only be recommending jgarzik's version.
jgarzik
Legendary
*
qt
Offline Offline

Activity: 1596
Merit: 1091


View Profile
April 09, 2011, 05:10:25 PM
 #4

For the record, after my wiki edits were reverted, I wash my hands of the matter.  I do not participate in edit wars.

Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
Luke-Jr (OP)
Legendary
*
expert
Offline Offline

Activity: 2576
Merit: 1186



View Profile
April 09, 2011, 05:33:49 PM
 #5

What is meant by "rather inefficient"?  Speed of serializing/deserializing?
That also, but my understanding is that python-jsonrpc only supports single-request-per-connection HTTP/1.0, whereas jgarzik's bitcoinrpc supports HTTP/1.1 persistent connections.
Why do we even recommend JSON-RPC at all?

It's not even an official library for Python and it isn't very good (uses floats and has no persistent connections). We should only be recommending jgarzik's version.
Who recommends it? The proposed summary clearly recommend jgarzik's fork. It is an official library for JSON-RPC.

genjix
Legendary
*
expert
Offline Offline

Activity: 1232
Merit: 1072


View Profile
April 09, 2011, 05:49:03 PM
 #6

I modified JSON-RPC -> jgarzik incorporated code from that -> you've added backwards compatibility.

Stop recommending Dinosaurs when we're at Mammals. It's evolution.

It's even backwards compatible with JSON-RPC if you're a strange person.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!