Skip to content

Instantly share code, notes, and snippets.

View bladedoyle's full-sized avatar

Blade Doyle bladedoyle

View GitHub Profile
#!/usr/bin/env python3
import bitarray
from hashlib import blake2b
# POW Constants
BASE_EDGE_BITS = 24
PROOFSIZE = 42;
# https://github.com/mimblewimble/grin/blob/cccaf984936d4792f8b6c39e6b500ad2e3f08817/core/src/pow/types.rs#L314
@bladedoyle
bladedoyle / gist:7d354d67399e3b4fc3e94e8dfd4f18dc
Last active January 21, 2021 23:51
grinup installer script ideas
* option to install binaries (if pre-built exist for this arch)
* option to build from source
* option to install/build a specific branch/tag
* option to build debug or release
* option to accept wallet seed words to restore from
* options where to place/find wallet_data and chain_data
* resource validation (ex: warn if not enough disk space to hold chain_data)
* option to configure auto-start/keepalive (systemd, supervisord, other)
* option to check for updates / install updates
- use "release channels"? stable, beta, master
@bladedoyle
bladedoyle / 5 beta3 wallet panic
Created December 17, 2020 00:02
grin v5 beta3 wallet panic
On startup I see this panic message once: "Cannot start a runtime from within a runtime"
Full message:
20201216 23:20:15.448 INFO grin_util::logger - log4rs is initialized, file level: Info, stdout level: Warn, min. level: Info
20201216 23:20:15.448 INFO grin_wallet - Using wallet configuration file at /home/grin/.grin/main/grin-wallet.toml
20201216 23:20:15.448 INFO grin_wallet - This is Grin Wallet version 5.0.0-beta.3 (git v5.0.0-beta.3), built for x86_64-unknown-linux-gnu by rustc 1.48.0 (7eac88abb 2020-11-16).
20201216 23:20:15.536 WARN grin_wallet_controller::controller - Starting TOR Hidden Service for API listener at address xd5sj6kfqi5r3iuh6hv4frufpijb4mny3byyojemisumwsdwtsvsxbad, binding to 0.0.0.0:3415
20201216 23:20:21.541 WARN grin_wallet_controller::controller - Starting HTTP Foreign listener API server at 0.0.0.0:3415.
20201216 23:20:21.541 WARN grin_wallet_controller::controller - HTTP Foreign listener started.
@bladedoyle
bladedoyle / owner_apiv3_example.py
Created November 17, 2020 19:55
Grin Wallet Owner API V3 example in Python
#!/usr/bin/python3
# Start the node: $ grin
# Configure Wallet:
# owner_api_listen_port = 3420
# api_secret_path = "/home/bdoyle/.grin/main/.owner_api_secret"
# Start the wallet owner api: $ grin-wallet owner_api
# Install g++
# Install python3 and python3-pip
# pip3 install secp256k1
@bladedoyle
bladedoyle / grin-cold-storage-wallet-howto.txt
Last active December 3, 2019 19:55
How To: Grin Cold-Storage Wallet
These steps describe one possible method to create a grin wallet offline and add coins - i.e cold-storage.
1) Download the grin-wallet - either the executable or the source code and compile it into an executable
2) Partition and format a USB thumb drive (drive 1)
3) Copy the grin-wallet executable to the USB thumb drive 1
4) Copy a Grin TX slate file to the USB thumb drive 1
5) On a second USB thumb drive, or a CD/DVD, (drive 2) create a bootable image (https://linuxmint-installation-guide.readthedocs.io/en/latest/burn.html)
6) Unplug your network cable
7) Boot the image you created on drive 2
8) Insert and mount the drive with grin-wallet and slate file (drive 1)
@bladedoyle
bladedoyle / gist:bcbcd80706268d7223b6de7e8c9fe24d
Last active July 15, 2019 18:07
How to find a transaction on the grin blockchain
How to find a transaction on the grin blockchain:
-------------------------------------------------
If you have the slate file, you can get the shared transaction id with:
cat payment_slate.json | jq .id
The transaction id will look like this:
6d7e9c04-18b4-4b8f-b3a3-b52bd6e9b18a
You can then get the status from your wallet:
# MOVED: to https://github.com/grin-pool/nicehash_bot
# This script has been moved into grin-pool/utils repo:
# https://github.com/grin-pool/utils
@bladedoyle
bladedoyle / gist:421d3f508945bdf59c93d515ee420fc9
Last active October 10, 2019 14:41
grin share value notes
Pool finds block 4300 - https://grinscan.net/block/4300
Secondary scale = 529
scale = factor = Scaling difficulty =
for primary pow (cuckatooN solution) where N>=31 = 2^(1+EDGEBITS-24)*N
for secondary pow - (cuckatoo29 solution) = variable, retargeted every block, stored as header field "secondary_scaling"
Example: Three workers contributed shares:
Worker A submitted 50 cuckaroo29 shares
Worker B submitted 25 cuckaroo29 shares and
@bladedoyle
bladedoyle / letsencrypt-create-or-renew.sh
Created December 26, 2017 21:01
LetsEncrypt - create or renew certificates on startup and once per day - can be used as nginx docker entrypoint
#!/bin/bash
# LetsEncrypt - create or renew certificates on startup and once per day
# can be used as nginx docker entrypoint, or standalone via cron
#
# Ex:
# letsencrypt-create-or-renew.sh /usr/local/nginx/sbin/nginx -c /etc/nginx/nginx.conf
#
# If used in Dockerfile, I suggest the following:
# ENTRYPOINT ["/tini", "--", "/letsencrypt-create-or-renew.sh"]