Help me use python-bitcoinrpc

1

I have got the api working and i can run commands like

access = AuthServiceProxy("http://root:123@127.0.0.1:8332")
access.getinfo()

However not sure how to use more complicated commands such as: move "fromaccount" "toaccount" amount ( minconf "comment" )

Tried something like this, but i get a syntax error in python.

name = "bob"
name2 = "sam"
balance = 0.0001
access.move(name name2 balance)

Doing it like this i get JSONRPCException:

name = "bob"
name2 = "sam"
balance = 0.0001
access.move('%s' '%s' '%s'), (name, name2, balance)

Any help appreciated.

hash tables

Posted 2015-04-20T11:44:20.257

Reputation: 141

Do bob and sam represent accounts in your bitcoin-core wallet?George Kimionis 2015-04-20T12:36:52.313

yes, those accounts exist.hash tables 2015-04-20T12:46:20.243

try this one: acess.move(name, name2, balance), Sam and Bob should be bitcoin address.moshaholo 2015-04-20T14:25:04.663

Answers

2

Try this:

access.move(name, name2, balance)

Nick ODell

Posted 2015-04-20T11:44:20.257

Reputation: 26 536

1

Steps to transfer bitcoin from Sam to Bob:

  • Create a python script to connect to Sam's RPC server. Suppose Sam's IP is 172.28.128.4

    from jsonrpc import ServiceProxy
    access = ServiceProxy("http://user:password@172.28.128.4:8332")
    print(access.sendtoaddress(Bob's_Bitcoin_Address, Transfer_Balance))
    

  • moshaholo

    Posted 2015-04-20T11:44:20.257

    Reputation: 575

    I have an environmental variable called BTCRPCURL which allows ServiceProxy(os.environ.get("BTCRCURL"))Wizard Of Ozzie 2015-04-21T02:42:41.543