Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
https://FullStack.cash is where I play.

Chris Troutner christroutner

💭
https://FullStack.cash is where I play.
View GitHub Profile
View double-spend.js
/*
Double spend 1000 satoshis.
This script requires access to two different instances of bch-api, using two
different BCHN full nodes. A single full node will prevent you from broadcasting
an intentional double spend.
*/
// Set NETWORK to either testnet or mainnet
const NETWORK = "mainnet";
View README.md

This gist captures an error that I saw that seems to be hard to replicate, so I wanted to capture it here for posterity.

This error was captured with a typical try/catch statement:

try {
} catch (err) {
  console.log('Error in sendTokens(): ', err)
}
View scan-ipfs-dht.js
/*
Scan the DHT for peers with `/wss` in their multiaddr.
The purpose of this program is to catalog the secure websockets (wss) peers
on the network that are also configured as circuit relays, so that they can
be used to strengthen network connections between web browsers.
This is a prototype program. A proof of concept. It demonstrates the approach
taken to scan the DHT.
@christroutner
christroutner / check-merit.js
Created Apr 15, 2021
Calculate merit for a BCH address
View check-merit.js
const BCHJS = require('@psf/bch-js')
const bchjs = new BCHJS()
const BchMsgLib = require('bch-message-lib')
const bchMsgLib = new BchMsgLib({bchjs})
const TOKENID =
'38e97c5d7d3585a2cbf3f9580c82ca33985f9cb0845d4dcce220cb709f9538b0' // PSF
@christroutner
christroutner / SLPDB-query.json
Created Feb 22, 2021
Find NFT Group (parent) given a TXID of an NFT
View SLPDB-query.json
{
"v": 3,
"q": {
"db": ["g"],
"aggregate": [
{
"$match": {
"tokenDetails.tokenIdHex": {
"$in": [
"eeddccc4d716f04157ea132ac93a48040fea34a6b57f3d8f0cccb7d1a731ab2b"
@christroutner
christroutner / hydrateUtxo-test.js
Created Feb 21, 2021
Testing duplicate UTXOs with hydrateUtxoDetails()
View hydrateUtxo-test.js
const BCHJS = require("@psf/bch-js");
const bchjs = new BCHJS();
async function start() {
try {
const slpaddress =
"simpleledger:qrjawdrlxmnaxynsddl32zdj9x5t7xrzrukhln79m7";
let bchAddress = bchjs.SLP.Address.toCashAddress(slpaddress);
utxos = await bchjs.Electrumx.utxo(bchAddress);
View generateKeyPairs.js
/*
Exploring HD wallets.
This script explores the ability to use the tree structure of HD wallets to
generate nested key pairs.
*/
const BCHJS = require("@psf/bch-js");
const bchjs = new BCHJS();
const lang = "english"; // Set the language of the wallet.
@christroutner
christroutner / electrum-abc-rpi-install.md
Last active Dec 17, 2020
Steps for installing Electrum ABC on a Raspberry Pi
View electrum-abc-rpi-install.md

Running the latest version of Raspbian OS, based on 12/17/2020

Following the README here: https://github.com/Bitcoin-ABC/ElectrumABC

sudo apt-get install python3-pyqt5 python3-pyqt5.qtsvg
git clone https://github.com/Bitcoin-ABC/ElectrumABC
mv ElectrumABC/ electrumABC/
cd electrumABC/
@christroutner
christroutner / fund002-air-drop.json
Created Oct 15, 2020
FUND002 Air Drop Addresses and Quantities
View fund002-air-drop.json
[
{
"address": "simpleledger:qprmqyzeez234fqfleeaafz27tntgn426gl5th2ya5",
"qty": 23906
},
{
"address": "simpleledger:qprcpvmvpxuxpcdvsa7tpmgz9nmft69cfvfww3vdla",
"qty": 10453
},
{
@christroutner
christroutner / psf-token-holders-10-15-2020.json
Created Oct 15, 2020
PSF Token Holders as of 10-15-2020
View psf-token-holders-10-15-2020.json
[
{
"address": "simpleledger:qz9l5w0fvp670a8r48apsv0xqek840320c90neac9g",
"qty": 166999.27707535,
"adjustedQty": 0
},
{
"address": "simpleledger:pz0nzggy8ad7mjyctkq3jlhw6u5qqq8zxs5c96la5r",
"qty": 80692.99349675,
"adjustedQty": 0