Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation since 12/01/2019 in all areas

  1. 1 point
    How to pull stats from a coin daemon and throw them into influxdb, and then use Grafana to create a pretty graph. Setup a VM, VPS, raspberry pi, whatever to play on this. Anything breaks its pretty easy to delete stuff. Using ubuntu/debian for the example. The idea is relatively simple. Ask the daemon for information, throw that into influxdb and then have Grafana pull from that database. Install denarius daemon Install python denarius rpc https://github.com/buzzkillb/python-denariusrpc Install grafana https://grafana.com/docs/grafana/latest/installation/debian/ Install influxdb https://docs.influxdata.com/influxdb/v1.7/introduction/installation/ One this is all done we need a test to see if python is working with the daemon. Switch in rpc_user and rpc_password that's inside of denarius.conf test.py from denariusrpc.authproxy import AuthServiceProxy, JSONRPCException # rpc_user and rpc_password are set in the denarius.conf file rpc_connection = AuthServiceProxy("http://%s:%[email protected]:32369"%(rpc_user, rpc_password)) best_block_hash = rpc_connection.getbestblockhash() print(rpc_connection.getblock(best_block_hash)) # batch support : print timestamps of blocks 0 to 99 in 2 RPC round-trips: commands = [ [ "getblockhash", height] for height in range(100) ] block_hashes = rpc_connection.batch_(commands) blocks = rpc_connection.batch_([ [ "getblock", h ] for h in block_hashes ]) block_times = [ block["time"] for block in blocks ] print(block_times) test run python test.py Lets double check another test run to get current Denarius price from Coinvex. testcoinvex.py from denariusrpc.authproxy import AuthServiceProxy, JSONRPCException import requests, urllib, json #southexchange #coinvex coinvex_url = requests.get('https://coinvex.org/api/v1/public/getlastmarketdata') coinvex_data = json.loads(coinvex_url.text) coinvex_price = coinvex_data['result']['coins'] for r in coinvex_price: if r["name"] == "Denarius": coinvex_last = float(r["price"]) print format(coinvex_last, '0.8f') test run python testcoinvex.py Works? The next post will show how to take this data and put into influxdb.
  2. 1 point
  3. 1 point
    Lets make sure to run that python file over and over and over on every new block. Go into denarius.conf and add this line. I have my files in a influx directory. blocknotify=/home/USERNAME/influx/block.sh Lets create block.sh in the influx directory and throw our sample.py in there #!/bin/bash python /home/USERNAME/influx/sample.py make block.sh executable chmod +x block.sh stop and restart daemon to pick this change up denariusd stop denariusd If it all went right your grafana page should start updating the block count.
  4. 1 point
    Login to your localhost grafana. http://192.168.1.337:3000/ on the left click the gear -> data sources add data source search for influxdb use settings like this save and test Go back to the grafana homepage and click + and add query Your query would look something like this. Remember to select your mydb database, my screenshot is using another name for the DB. Visualization General Click Save at the top right Should see something like this on your homepage.
  5. 1 point
    Create a new database ininfluxdb. Run influx to get into the command prompt. influx create database CREATE DATABASE mydb use database USE mydb from a second command line, lets make a sample.py sample.py from denariusrpc.authproxy import AuthServiceProxy, JSONRPCException import time import sys import datetime import urllib import json from influxdb import InfluxDBClient # rpc_user and rpc_password are set in the denarius.conf file rpc_connection = AuthServiceProxy("http://%s:%[email protected]:32369"%("rpc_user", "rpc_password")) #test blocktest = rpc_connection.getblockcount() print(blocktest) # Configure InfluxDB connection variables host = "127.0.0.1" # My Ubuntu NUC port = 8086 # default port user = "admin" # the user/password created for the pi, with write access password = "admin" dbname = "mydb" # the database we created earlier interval = 60 # Sample period in seconds # Create the InfluxDB client object client = InfluxDBClient(host, port, user, password, dbname) # think of measurement as a SQL table, it's not...but... measurement = "measurement" # location will be used as a grouping tag later blockchain = "denarius" blockcount = rpc_connection.getblockcount() block = rpc_connection.getblockbynumber(blockcount) grafanatime = block['time'] * 1000000000 hash = block['hash'] size = block['size'] height = block['height'] version = block['version'] merkleroot = block['merkleroot'] mint = int(block['mint']) timed = block['time'] nonce = block['nonce'] bits = block['bits'] difficulty = float(block['difficulty']) blocktrust = block['blocktrust'] chaintrust = block['chaintrust'] chainwork = block['chainwork'] previousblockhash = block['previousblockhash'] #nextblockhash = block['nextblockhash'] flags = block['flags'] proofhash = block['proofhash'] entropybit = block['entropybit'] modifier = block['modifier'] modifierchecksum = block['modifierchecksum'] data = [ { "measurement": measurement, "tags": { "blockchain": blockchain, }, "time": grafanatime, "fields": { #"block" : i, "hash" : hash, "size" : size, "height" : height, "version" : version, "merkleroot" : merkleroot, "mint" : mint, "time" : timed, "nonce" : nonce, "bits" : bits, "difficulty" : difficulty, "blocktrust" : blocktrust, "chaintrust" : chaintrust, "chainwork" : chainwork, # "nextblockhash" : nextblockhash, "flags" : flags, "proofhash" : proofhash, "entropybit" : entropybit, "modifier" : modifier, "modifierchecksum" : modifierchecksum } } ] # Send the JSON data to InfluxDB print(difficulty) client.write_points(data) If you run python sample.py you should see data appear in your influxdb. Run below a few times to throw data in. python sample.py In the other command line running influx already, make sure you are using the correct database and lets see if the data is inside. use mydb SELECT * FROM /.*/ LIMIT 10 You should see output, now we need to connect influxdb to grafana.
  6. 1 point
    Download Denarius Wallet Install IPFS (locally or vps) https://docs.ipfs.io/guides/guides/install/ Ubuntu (AMD64) Find latest here - https://dist.ipfs.io/#go-ipfs wget https://dist.ipfs.io/go-ipfs/v0.4.22/go-ipfs_v0.4.22_linux-amd64.tar.gz tar xvfz go-ipfs_v0.4.22_linux-amd64.tar.gz cd go-ipfs sudo ./install.sh ipfs version #start ipfs node and take note of your IPFS node ID ipfs init #example output ``` initializing IPFS node at /home/travanx/.ipfs generating 2048-bit RSA keypair...done peer identity: QmNyud5DGEmkBGYcV4QA69JHiTuWLU6EkStpviddZTgiag to get started, enter: ipfs cat /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/readme ``` #try reading the readme ipfs cat /ipfs/QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv/readme #start IPFS service ipfs daemon denarius.conf jupiterlocal=1 if you want to specify your IPFS server and its not local add jupiterip=yournodeIP:5001 To upload a file #example command to upload using daemon or QT from debug console, other use the Jupiter tab in the QT jupiterupload /home/USERNAME/Downloads/denarius-256.png Carsen uploaded the below image using localhost, then turned off his localhost IPFS server and because Denarius is amazing the file still shows up.
  7. 1 point
    Hi, I was able to compile the wallet (daemon - denariusd) I had to use makefile.arm instead of makefile.unix. However, another problem arose - the wallet does not sync. I am trying to download the last chaindata from https://pos.watch/chaindata.zip but after start denariusd it do not get new blocks but stay at 2667869 Instead there are errors: ProcessMessages(ping, 8 bytes) : Exception 'CDataStream::read() : end of data: iostream error' caught, normally caused by a message being shorter than its stated length ProcessMessage(ping, 8 bytes) FAILED ERROR: CheckProofOfStake() : INFO: read txPrev failed WARNING: AcceptBlock(): check proof-of-stake failed for block e4888052fe3768e83389654f56990f7aa7f8076b4f7f132e465cf971798e8eca ERROR: ProcessBlock() : AcceptBlock FAILED ERROR: FetchInputs() : 225ef5b75d mempool Tx prev not found 3de53cd669 and many ORPHANs: ProcessBlock: ORPHAN BLOCK, prev=0000000000186ef85ab2 ERROR: ProcessBlock() : already have block (orphan) 0000000000179db13774 ProcessBlock: ORPHAN BLOCK, prev=6d3bdd0dcf999bc64882 ERROR: ProcessBlock() : already have block (orphan) 024efe77cb8538559247 ProcessBlock: ORPHAN BLOCK, prev=a89d8af759325f8412dc ERROR: ProcessBlock() : already have block (orphan) 00000000001cf2ae2380 ProcessBlock: ORPHAN BLOCK, prev=6e70ef0fd2ceb20cdef7 ERROR: ProcessBlock() : already have block (orphan) 41e8f7dd14b9daaba330 ProcessBlock: ORPHAN BLOCK, prev=8f20ac4f7e1b82ea1c1c ERROR: ProcessBlock() : already have block (orphan) 00000000001aa9bd4a30
×
×
  • Create New...