Skip to content

Instantly share code, notes, and snippets.

View cf's full-sized avatar
💭
monday 忙day

Carter Feldman cf

💭
monday 忙day
View GitHub Profile
@cf
cf / merkle_proof_depth_30.asm
Created December 14, 2023 04:04
Merkle Proof in TapScript
// root
<0x227c4fdcd6c57bf13f6af315dfeebfab6976e46276f11cc6160bbd0fb5ee22ec>
// sibling_1
<0x8869ff2c22b28cc10510d9853292803328be4fb0e80495e8bb8d271f5b889636>
// sibling_2
<0x848930bd7ba8cac54661072113fb278869e07bb8587f91392933374d017bcbe1>
// sibling_3
<0x7cdd2986268250628d0c10e385c58c6191e6fbe05191bcc04f133f2cea72c1c4>
// sibling_4
@cf
cf / bigint255_mul15_x17.asm
Created December 11, 2023 14:29
BigInt 255 Multiplication on Bitcoin Core
This file has been truncated, but you can view the full file.
//44347314585423944296568073680235476145090606693409235654433373536726375170836
<25099>
<22628>
<4378>
<17693>
<627>
<25528>
<24377>
<28384>
<14745>
@cf
cf / bigint255_mul15_x17.asm
Created December 11, 2023 14:23
BigInt 255 Multiplication on Bitcoin Core
This file has been truncated, but you can view the full file.
// 47146146047289644837830156546653938753825339844208394066840267548397344669800
<26683>
<25330>
<16353>
<18358>
<9138>
<2972>
<13605>
<11722>
<22216>
@cf
cf / OP_MOD_U30_U15_x2.asm
Last active February 10, 2024 00:21
OP_MOD for Bitcoin Mainnet
/*
compute x % y given: q_lo = floor(x/y)&0x7fff, q_hi = floor(x/y)>>15, x_lo = x&0x7fff, x_hi = x>>15, y_lo = y&0x7ff, y_hi = y>>15
<q_hi>
<q_lo>
<x_hi>
<x_lo>
@cf
cf / mul128.asm
Created December 7, 2023 08:27
mul128.asm for bitcoin
This file has been truncated, but you can view the full file.
<0>
<0>
<0>
<0>
<0>
<0>
<0>
<0>
<0>
<0>
@cf
cf / README.md
Created November 24, 2023 13:16
bn256 bitcoin script

bn256 for bitcoin is totally possible without branches

don't believe me?

see below

@cf
cf / goldilocks.metal
Created October 26, 2023 14:49
[Metal] Goldilocks add and mul
#include <metal_stdlib>
/*
Goldilocks add and mul with ❤️ from Carter (Public Domain)
*/
inline ulong reduce128(ulong x_hi, ulong x_lo){
ulong x_hi_hi = x_hi>>32;
ulong x_hi_lo = x_hi & 0xffffffff;
ulong t0 = x_lo - x_hi_hi;
if(t0 > x_lo){
t0 -= 0xffffffff;

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@cf
cf / README.md
Created June 15, 2023 09:26
A Hackers Guide to Layer 2: Zero Merkle Trees from Scratch
@cf
cf / tablestore.d.ts
Created July 24, 2021 14:51
Typescript Definitions for TableStore
// Type definitions for tablestore 5.0
// Project: https://github.com/aliyun/aliyun-tablestore-nodejs-sdk
// Definitions by: Carter Jack Feldman <https://github.com/cf>
// TypeScript Version: 4.2
import Int64buf from 'int64-buffer';
import { Buffer } from 'buffer';
declare namespace TableStore {