Giter Site home page Giter Site logo

bartromgens / bitcoinnodestats Goto Github PK

View Code? Open in Web Editor NEW
14.0 14.0 3.0 186 KB

Bitcoin node status and statistics web interface based on Django

Home Page: http://bitcoinnodestats.romgens.com/

License: MIT License

Python 63.75% CSS 0.78% JavaScript 21.53% HTML 13.46% Shell 0.48%
bitcoin django stats

bitcoinnodestats's People

Contributors

bartromgens avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bitcoinnodestats's Issues

The program is trying to use my rpcpassword as the port?

I have am getting a 500 Internal Server Error when I try to run this.

Here's the traceback, as pretty as it can be:

Traceback (most recent call last):
  File "/srv/httpd/bitcoinnodestats/env/lib/python3.4/site-packages/django/core/handlers/base.py", line 149, in get_response
    response = self.process_exception_by_middleware(e, request)
  File "/srv/httpd/bitcoinnodestats/env/lib/python3.4/site-packages/django/core/handlers/base.py", line 147, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/srv/httpd/bitcoinnodestats/env/lib/python3.4/site-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/srv/httpd/bitcoinnodestats/env/lib/python3.4/site-packages/django/views/generic/base.py", line 88, in dispatch
    return handler(request, *args, **kwargs)
  File "/srv/httpd/bitcoinnodestats/env/lib/python3.4/site-packages/django/views/generic/base.py", line 157, in get
    context = self.get_context_data(**kwargs)
  File "/srv/httpd/bitcoinnodestats/bitcoinnodestats/views.py", line 37, in get_context_data
    date_end=date_end
  File "/srv/httpd/bitcoinnodestats/nodedata/models.py", line 194, in __init__
    self.current_data = create_node_data(save=False)
  File "/srv/httpd/bitcoinnodestats/nodedata/models.py", line 26, in create_node_data
    proxy = bitcoin.rpc.Proxy(btc_conf_file=local_settings.BITCOIN_CONF_FILE)
  File "/srv/httpd/bitcoinnodestats/env/lib/python3.4/site-packages/bitcoin/rpc.py", line 286, in __init__
    **kwargs)
  File "/srv/httpd/bitcoinnodestats/env/lib/python3.4/site-packages/bitcoin/rpc.py", line 152, in __init__
    if self.__url.port is None:
  File "/usr/lib64/python3.4/urllib/parse.py", line 156, in port
    port = int(port, 10)
ValueError: invalid literal for int() with base 10: '(j^'
Exception ignored in: <bound method Proxy.__del__ of <bitcoin.rpc.Proxy object at 0x7f986b80de10>>
Traceback (most recent call last):
  File "/srv/httpd/bitcoinnodestats/env/lib/python3.4/site-packages/bitcoin/rpc.py", line 216, in __del__
    self.__conn.close()
AttributeError: 'Proxy' object has no attribute '_BaseProxy__conn'
[17/Mar/2017 00:54:16] "GET / HTTP/1.1" 500 99293

It looks as though it's trying to parse the beginning of my password as a port number. FYI the first three characters of my (very long and complex...ahem) password are indeed (j^, which is definitely an invalid literal for int() with base 10. So why is that my password, and what does it stop there? I tried quoting it, but it just does the same thing - up to the caret. So in env/lib/python3.4/site-packages/bitcoin/rpc.py I put a little print state that mirrors the assignation below at line 141:

print('%s://%s:%s@%s:%d' %
    ('https' if conf['rpcssl'] else 'http',
     conf['rpcuser'], conf['rpcpassword'],
     conf['rpchost'], conf['rpcport']))

And that printed http://<user>:"<password>"@127.0.0.1:8332. So the password and port seem to have been passed successfully. But then I looked into urlparse. From the docstring:

"""Parse a URL into 6 components:
<scheme>://<netloc>/<path>;<params>?<query>#<fragment>
Return a 6-tuple: (scheme, netloc, path, params, query, fragment).
Note that we don't break the components up in smaller bits
(e.g. netloc is a single string) and we don't expand % escapes."""

Putting a print(netloc) at line 155 in /usr/lib64/python3.4/urllib/parse.py (right above if port is not None) it shows <user>:<password-fragment>. To be fair, after the ^ there was a / in the password after that which was followed by a : later. I'm going to stop there before I reveal too much of my password ;)

But that's OK! Because changing my password to a string of letters worked. So it seems that there's a bug (or misuse of urllib?) upstream, as it seems like your software passed it up the chain just fine. Can you confirm this? (Honestly I'm just glad to have that deep dive into python internals turn into a working solution)

Slow page load with larger number of data points

All chart data is generated from raw node status snapshots, on a each page request. These is no caching. When more stats are gathered, page loads become slower.

It is rather easy to pre-generate and/or cache the data. Needs to be implemented though.

AssertionError

Server seems to start OK, but I'm getting an AssertionError when I browse to the page:

Internal Server Error: /
Traceback (most recent call last):
File "/home/pi/bitcoinnodestats/env/lib/python3.4/site-packages/django/core/handlers/base.py", line 149, in get_response
response = self.process_exception_by_middleware(e, request)
File "/home/pi/bitcoinnodestats/env/lib/python3.4/site-packages/django/core/handlers/base.py", line 147, in get_response
response = wrapped_callback(request, _callback_args, *_callback_kwargs)
File "/home/pi/bitcoinnodestats/env/lib/python3.4/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, _args, *_kwargs)
File "/home/pi/bitcoinnodestats/env/lib/python3.4/site-packages/django/views/generic/base.py", line 88, in dispatch
return handler(request, _args, *_kwargs)
File "/home/pi/bitcoinnodestats/env/lib/python3.4/site-packages/django/views/generic/base.py", line 157, in get
context = self.get_context_data(**kwargs)
File "/home/pi/bitcoinnodestats/bitcoinnodestats/views.py", line 12, in get_context_data
context['stats'] = NodeStats()
File "/home/pi/bitcoinnodestats/nodedata/models.py", line 195, in init
assert self.deltatime_sec > 0
AssertionError

It should be noted that this is a new node that's still syncing the blockchain. I'm not sure if that has anything to do with the error above. Also, the server is running on a Raspberry Pi running Raspbian Jessie (Debian Jessie).

Support for Django 2.2+

Django 1.11 is End-Of-Life since April 2020 and Django 2.2 is the current LTS release.

I tried to run bitcoinnodestats with Django 2.2 and Python 3.7 but it fails if started with python3.7 manage.py runserver. I can supply the backtrace if requested.

Are there any plans to adapt the project for newer Django versions?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.