python-bitcoinlib
python-bitcoinlib copied to clipboard
bitcoin.params [bug]?
root@redwood:/etc/znc/modules# cat test.py
import bitcoin.rpc
txid = '55374e78c86bb739c0ef69f92e3f0cfa9b233e293426170c65a2fe381fd54593'
proxy = **bitcoin.rpc.Proxy(btc_conf_file='/etc/znc/bitcoin.conf')**
root@redwood:/etc/znc/modules# python3.5 test.py
Traceback (most recent call last):
File "test.py", line 3, in
Params is defined here: https://github.com/petertodd/python-bitcoinlib/blob/master/bitcoin/init.py#L62 but, bitcoin.rpc DOES contain "import bitcoin" https://github.com/petertodd/python-bitcoinlib/blob/master/bitcoin/rpc.py#L45
This has been a strange issue for me, as well, affecting me only when doing some tinkering though an interpreter. Does this continue to be an issue for you too?
Having the same problem on macOS, never had that problem on Ubuntu. Where you able to fix it?
Hi Sir, Im having the same error in ubuntu version 18 from bitcoin.rpc import RawProxy
p= RawProxy() Traceback (most recent call last): File "
", line 1, in File "/home/user/.local/lib/python3.6/site-packages/bitcoin/rpc.py", line 288, in init **kwargs) File "/home/user/.local/lib/python3.6/site-packages/bitcoin/rpc.py", line 164, in init service_port = bitcoin.params.RPC_PORT
i've tried to set a service_port but still encounter an issue
p= RawProxy(service_port=8332)
Traceback (most recent call last):
File "
Hope you can help me.
Hi Gillian,
I ended up not using this library, started working directly with bitcoin-qt RPC, it's actually simpler than I thought it would be. You can find the documentation here: https://bitcoin.org/en/developer-reference#remote-procedure-calls-rpcs
Hi sir, Thank you for the quick response, may I ask if you have any idea how to integrate bitcoin-qt in python project?. Sorry I'm just a new in python and bitcoin. Hope you can help me.
Sure, I'm using the requests library for python. Basically this is the template for every rpc you'll do.
`import requests
url = "http://127.0.0.1:8332" auth = ("user","password") headers = {"Content-type":"text/plain"} data = '{"jsonrpc": "2.0", "method": "getblockcount", "id":"0", "params":[]}'
r = requests.post(url, auth=auth, headers=headers, data=data)`
The response is saved in r, you can get the content with r.text or r.content. This is assuming you are running bitcoind, just change the variables to match your node and the method and parameters for every call you want to make. Hope this helps!
Hi Sir, Thank you for your help. I've tried the command and its working perfectly.
Hi sir, May I ask if you have been connected to testnet of bitcoin?. Because I want to try or test transaction of bitcoin or transfer of bitcoin from one account to another. Hope you could help me.
On Fri, Jun 15, 2018 at 5:22 AM, Luis Gerardo Delgado < [email protected]> wrote:
Sure, I'm using the requests library for python. Basically this is the template for every rpc you'll do.
`import requests
url = "http://127.0.0.1:8332" auth = ("user","password") headers = {"Content-type":"text/plain"} data = '{"jsonrpc": "2.0", "method": "getblockcount", "id":"0", "params":[]}'
r = requests.post(url, auth=auth, headers=headers, data=data)`
The response is saved in r, you can get the content with r.text or r.content. This is assuming you are running bitcoind, just change the variables to match your node and the method and parameters for every call you want to make. Hope this helps!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/petertodd/python-bitcoinlib/issues/142#issuecomment-397442429, or mute the thread https://github.com/notifications/unsubscribe-auth/Aj-CwEuJsuaI07YGPMSj9rcUk6x1M4jUks5t8tQNgaJpZM4O7K9w .
Same error
Same. Any news on this?
I got the same problem on ubuntu 20.04
I wonder if you guys have a different bitcoin
module installed in your PYTHON_PATH?