Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@loon3
loon3 / Client.php
Created January 14, 2024 16:30
Counterparty API - PHP example
<?php
namespace JsonRPC;
use Exception;
use BadFunctionCallException;
use InvalidArgumentException;
use RuntimeException;
class ConnectionFailureException extends Exception {};
class ServerErrorException extends Exception {};
/**
* JsonRPC client class
@loon3
loon3 / psbt.md
Last active January 4, 2024 21:44
Counterparty Asset PSBTs for BTC market

Counterparty Asset PSBT Structure

Note: Uses Counterparty send message type ID = 0

Party A (Seller)

  1. Inputs:

    • Input 1: 546 satoshis (from Party A's address).
  2. Outputs:

  • Output 1: 546 satoshis intended for Party B's address which becomes asset recipient (address is alterable).
@loon3
loon3 / filterBlock.py
Created May 23, 2023 14:25
filter blocks for burned sats
import os
import requests
import json
import subprocess
from bitcoin.core import b2lx, b2x, CBlock
from bitcoin.core.script import OP_RETURN, CScript
from Crypto.Cipher import ARC4
def read_cookie_file(cookie_file_path):
@loon3
loon3 / clock.py
Created March 9, 2023 20:57
Create your own Brick Brock Clock
from PIL import Image, ImageDraw
import math
import numpy as np
# Load input image
input_image = Image.open("brick.png")
# Create blank output image
output_image = Image.new("RGB", (1200, 1200), "white")
@loon3
loon3 / 12x12-random.py
Created March 7, 2023 18:31
twelvefold-python
from PIL import Image
import random
# Load the input image and convert it to RGBA mode
input_image = Image.open("input_image.png").convert("RGBA")
# Calculate the size of each grid cell based on the input image size
cell_width = 200
cell_height = 200
@loon3
loon3 / ecies-bitcoin-example.js
Created August 26, 2022 17:57
ECIES Bitcoin Example
import { encrypt, decrypt } from 'eciesjs'
var bitcoinjs = require('bitcoinjs-lib')
let aliceKeyPriv = bitcoinjs.ECPair.fromWIF("5KAHnHT2x4XMFnjVZZJNkbmDKB8qtTZrqmotNwe4F8g31nvnpTN").privateKey
let aliceKeyPub = bitcoinjs.ECPair.fromWIF("5KAHnHT2x4XMFnjVZZJNkbmDKB8qtTZrqmotNwe4F8g31nvnpTN").publicKey
let data = Buffer.from('this is a test')
let final = decrypt(aliceKeyPriv, encrypt(aliceKeyPub, data)).toString()
console.log(final)
@loon3
loon3 / BtcBlockDates2021.csv
Created April 5, 2022 02:11
Bitcoin Block Height by Date, 2021
We can't make this file beautiful and searchable because it's too large.
01-01-2021,663945
01-01-2021,663946
01-01-2021,663947
01-01-2021,663948
01-01-2021,663949
01-01-2021,663950
01-01-2021,663951
01-01-2021,663952
01-01-2021,663953
01-01-2021,663954
<?php
header('Content-Type: application/json');
require 'includes/Client.php';
use JsonRPC\Client;
$cp_server = 'http://public.coindaddy.io:4000/api/';
$cp_user = 'rpc';
$cp_password = '1234';
@loon3
loon3 / gist:4ead91dab16d410004a0a865ef36906b
Created May 2, 2019 18:26
message verification server
var express = require('express');
var app = express();
var port = process.env.PORT || 8080;
var Message = require('bitcore-message');
//var mysql = require('mysql');
// start the server
app.listen(port);
@loon3
loon3 / BVAM-cip-proposal.md
Created August 28, 2016 19:57 — forked from deweller/BVAM-cip-proposal.md
BVAM CIP Proposal
CIP: <unassigned>
Title: Blockchain Validated Asset Metadata (BVAM)
Author: Devon Weller <devon@tokenly.com>
Discussions-To: https://counterpartytalk.org/t/cip-proposal-blockchain-validated-asset-metadata-bvam/2210
Status: Draft
Type: Informational
Created: 2016-07-22