Skip to content

Instantly share code, notes, and snippets.

View rithvikvibhu's full-sized avatar

Rithvik Vibhu rithvikvibhu

View GitHub Profile
@rithvikvibhu
rithvikvibhu / missing-blind-bids.js
Last active June 20, 2023 18:56
missing-blind-bids.js
const { WalletClient } = require('hs-client');
const { Network } = require('hsd');
// Edit these:
const NETWORK = 'main';
const API_KEY = 'apikey';
const WALLET_NAME = 'walletname';
/** @type {import('hsd/lib/protocol/network')} */
@rithvikvibhu
rithvikvibhu / test-tx-for-swap.sh
Last active March 28, 2023 17:50
test-tx-for-swap.sh
# Check if a tx is an atomic name swap (Bob atomic swap, Shakedex sale, FxWallet marketplace sale)
# Bob swap (HIP-4) hints:
# - in0.witness[0] ends with 84
# - last output value = price
# - out0 = FINALIZE
# Shakedex (HIP-1) transfer hints:
# - in0.witness[0] ends with 84
# - last output value = price
const path = require('node:path');
const bdb = require('bdb');
const bio = require('bufio');
const MasterKey = require('hsd/lib/wallet/masterkey');
const layouts = require('hsd/lib/wallet/layout');
const layout = layouts.wdb;
// SET THESE VALUES:
const FILTER_SECRETS = true;
const HSD_DATA_LOC = '/path/to/any/hsd_data';
@rithvikvibhu
rithvikvibhu / batch-regtest-setup.js
Created August 19, 2022 12:54
Bob setup chain for testing
// Based on hsd/test/wallet-auction-test.js (hsd 686, #764)
// Opens 800 names and places 2 bids per name
// After running this, refresh Bob and try other bulk actions (reveal all, etc.)
const { WalletClient, NodeClient } = require('hs-client');
const { Address, Network } = require('hsd');
// Edit these:
const NETWORK = 'regtest';
const API_KEY = 'apikey';
#!/bin/bash
declare -a tlds=("aaa" "aarp" "abarth" "abb" "abbott" "abbvie" "abc" "able" "abogado" "abudhabi" "ac" "academy" "accenture" "accountant" "accountants" "aco" "actor" "ad" "adac" "ads" "adult" "ae" "aeg" "aero" "aetna" "af" "afl" "africa" "ag" "agakhan" "agency" "ai" "aig" "airbus" "airforce" "airtel" "akdn" "al" "alfaromeo" "alibaba" "alipay" "allfinanz" "allstate" "ally" "alsace" "alstom" "am" "amazon" "americanexpress" "americanfamily" "amex" "amfam" "amica" "amsterdam" "analytics" "android" "anquan" "anz" "ao" "aol" "apartments" "app" "apple" "aq" "aquarelle" "ar" "arab" "aramco" "archi" "army" "arpa" "art" "arte" "as" "asda" "asia" "associates" "at" "athleta" "attorney" "au" "auction" "audi" "audible" "audio" "auspost" "author" "auto" "autos" "avianca" "aw" "aws" "ax" "axa" "az" "azure" "ba" "baby" "baidu" "banamex" "bananarepublic" "band" "bank" "bar" "barcelona" "barclaycard" "barclays" "barefoot" "bargains" "baseball" "basketball" "bauhaus" "bayern" "bb" "bbc" "bbt" "bbva" "bcg" "bcn" "bd"
// USAGE: hsd --log-console=false --plugins=/path/to/this/file/renewal-count-plugin.js
'use strict';
const fs = require('fs').promises;
const layout = require('hsd/lib/blockchain/layout');
const { types } = require('hsd/lib/covenants/rules');
const TXMeta = require('hsd/lib/primitives/txmeta');
const plugin = exports;
// node list-transferring-names.js
const { NodeClient, WalletClient } = require('hs-client');
const { Network } = require('hsd');
// Edit these:
const NETWORK = 'main';
const API_KEY = 'api-key-here';
const WALLET_NAME = 'walletname';
// run: node api-key.js
const os = require('node:os');
const path = require('node:path');
const bdb = require('bdb');
const BOB_DB_LOC = path.join(os.homedir(), '.config/Bob/db');
const WALLET_API_KEY = 'walletApiKey';
const NODE_API_KEY = 'nodeApiKey';
/**
* This script finds an address given an account extended public key
* Usage: edit these fields below and run it like `node find-address.js`
*/
const assert = require('node:assert/strict');
const HDPublicKey = require('hsd/lib/hd/public');
const Address = require('hsd/lib/primitives/address');
// **********
# Usage
#
# Install dependencies:
# $ pip install selenium beautifulsoup4
# Run:
# $ python download-gtlds-applications.py
import json
from selenium import webdriver
from selenium.webdriver.common.by import By