Skip to content

Instantly share code, notes, and snippets.

@strophy
strophy / errors.grpc_conf
Created Feb 2, 2021
dash platform nginx grpc error config
View errors.grpc_conf
# Standard HTTP-to-gRPC status code mappings
# Ref: https://github.com/grpc/grpc/blob/master/doc/http-grpc-status-mapping.md
#
error_page 400 = @grpc_internal;
error_page 401 = @grpc_unauthenticated;
error_page 403 = @grpc_permission_denied;
error_page 404 = @grpc_unimplemented;
error_page 429 = @grpc_unavailable;
error_page 502 = @grpc_unavailable;
error_page 503 = @grpc_unavailable;
@strophy
strophy / grpc.conf
Last active Feb 15, 2021
dash platform nginx grpc config
View grpc.conf
server {
listen 3010 http2;
limit_req zone=protect_api burst=300 nodelay;
limit_req_status 429;
location = /org.dash.platform.dapi.v0.Core/subscribeToTransactionsWithProofs {
grpc_pass grpc://127.0.0.1:3006;
grpc_buffer_size 128k;
}
@strophy
strophy / default.conf
Last active Feb 15, 2021
dash platform nginx default config
View default.conf
limit_req_zone $binary_remote_addr zone=protect_api:15m rate=120r/m;
server {
listen 3000 default_server;
limit_req zone=protect_api burst=300 nodelay;
limit_req_status 429;
# Docker DNS resolver
# resolver 127.0.0.11 ipv6=off;
@strophy
strophy / grpc.yaml
Last active Feb 3, 2021
dash platform envoy configuration file
View grpc.yaml
static_resources:
listeners:
- name: listener_0
address:
socket_address:
address: 0.0.0.0
port_value: 8080
filter_chains:
- filters:
@strophy
strophy / genesis.json
Last active Nov 16, 2021
dash platform tenderdash genesis file
View genesis.json
{
"genesis_time": "2021-07-22T12:57:05.429Z",
"chain_id": "dash-testnet-6",
"initial_height": "0",
"initial_core_chain_locked_height": 542300,
"initial_proposal_core_chain_lock": null,
"consensus_params": {
"block": {
"max_bytes": "22020096",
"max_gas": "-1",
@strophy
strophy / export_grafana_dashboards.sh
Created Jan 13, 2021 — forked from UdjinM6/export_grafana_dashboards.sh
Export all public Graphana dashboards
View export_grafana_dashboards.sh
#!/bin/bash
full_url="http://your_graphana_host_here"
name="dashboards"
create_slug () {
echo "$1" | iconv -t ascii//TRANSLIT | sed -r s/[^a-zA-Z0-9]+/-/g | sed -r s/^-+\|-+$//g | tr A-Z a-z
}
process_db_json() {
@strophy
strophy / mn-status-output
Created Apr 2, 2020
Suggested sample output of mn status commands
View mn-status-output
$ mn status
{
"hostname": "", # hostname
"uptime": "", # uptime
"distro": "", # cat /etc/issue
"user": "", # whoami
"loadAverage": "", # uptime
"diskFree": "", # df -h /
"memFree": "", # free -h
"cpus": , # lscpu | grep 'CPU(s)' -m 1
@strophy
strophy / find_payments.sh
Created Mar 25, 2020
Find all superblock payments to a given list of addresses (CSV two fields: address,description)
View find_payments.sh
#!/bin/bash
n=0
echo "Reading csv from stdin..." 1>&2
while IFS=,$'\r' read a b;do
echo "$a - $b" 1>&2
ADDRESS[$n]="$a"
DESC[$n]="$b"
((n++))
done
@strophy
strophy / superblock.sh
Last active Mar 24, 2020
Calculate timestamp, block, blockhash and coinbase payout amount for all Dash superblocks to date
View superblock.sh
#!/bin/bash
height=$(dash-cli getblockcount)
for ((block=332320;block<height;block+=16616));do
blockhash=$(dash-cli getblockhash $block)
txhash=$(dash-cli getblock $blockhash|jq -r '.tx[0]')
time=$(dash-cli getblock $blockhash|jq -r '.time')
time=$(TZ=GMT date -d @$time +"%Y%m%d%H%M")
amount=$(dash-cli getrawtransaction $txhash 1|jq '.vout|map(.valueSat)|add')
@strophy
strophy / config.yml
Created Jan 24, 2020
ytt docker-dash configuration templating
View config.yml
#@data/values
---
network: testnet