Skip to content

Instantly share code, notes, and snippets.

View obycode's full-sized avatar

Brice obycode

View GitHub Profile
#!/bin/bash
# Set your node's API endpoints
INFO_URL="http://localhost:20443/v2/info"
ACCOUNT_URL="http://localhost:20443/v2/accounts/ST34CYSTX9853GG3TDY4FQZ9FM6F386MT0FHM0DMS?proof=0"
# Function to get the current block height
get_current_block_height() {
curl -s -X GET "$INFO_URL" | jq .burn_block_height
}
@obycode
obycode / stxdev.sh
Last active May 23, 2025 20:27
Tools for dealing with blocks
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
API_BASE="https://api.hiro.so"
declare -a CURL_OPTS=(-sS --fail)
if [[ -n "${HIRO_API_KEY:-}" ]]; then
CURL_OPTS+=( -H "Authorization: Bearer $HIRO_API_KEY" )
fi
@obycode
obycode / sip-address.js
Created October 16, 2025 02:35
SIP Vote Address Generation
import { c32address } from "c32check";
import bs58check from "bs58check";
const sipNumber = 33; // 👈 change me
const VERSION_SP_MAINNET = 22;
// Always make a 20-byte "hash": [00...00 | ASCII("yes-sip-N"|"no-sip-N")]
function makeHashHex(msg) {
const ascii = Buffer.from(msg, "ascii"); // explicit ASCII
if (ascii.length > 20) {