app.py 414 B

1234567891011121314151617
  1. from flask import Flask, render_template
  2. import rpc
  3. # DarkFi blockchain-explorer daemon JSON-RPC configuration
  4. # TODO: make this configurable
  5. URL = "127.0.0.1"
  6. PORT = 14567
  7. app = Flask(__name__)
  8. @app.route('/')
  9. async def index():
  10. blocks = await rpc.get_last_n_blocks(10, URL, PORT)
  11. stats = await rpc.get_basic_statistics(URL, PORT)
  12. return render_template('index.html', blocks=blocks, stats=stats)