Skip to content

Instantly share code, notes, and snippets.

@stonegao
stonegao / coinswap-design.md
Created April 26, 2024 04:37 — forked from chris-belcher/coinswap-design.md
Design for a CoinSwap Implementation for Massively Improving Bitcoin Privacy and Fungibility

Design for a CoinSwap Implementation for Massively Improving Bitcoin Privacy and Fungibility

25/5/2020

Abstract

Imagine a future where a user Alice has bitcoins and wants to send them with maximal privacy, so she creates a special kind of transaction. For anyone looking at the blockchain her transaction appears completely normal with her coins seemingly going from address A to address B. But in reality her coins end up in address Z which is entirely unconnected to either A or B.

Now imagine another user, Carol, who isn't too bothered by privacy and sends her bitcoin using a regular wallet which exists today. But because Carol's transaction looks exactly the same as Alice's, anybody analyzing the blockchain must now deal with the possibility that Carol's transaction actually sent her coins to a totally unconnected address. So Carol's privacy is improved even though she didn't change her behaviour, and perhaps had never even heard of this software.

@stonegao
stonegao / closeAuxAccount.ts
Created April 26, 2024 02:27 — forked from Henry-E/closeAuxAccount.ts
Close aux token account
import * as anchor from "@coral-xyz/anchor";
import { PublicKey, Transaction, ComputeBudgetProgram } from "@solana/web3.js";
import * as token from "@solana/spl-token";
const provider = anchor.AnchorProvider.env();
anchor.setProvider(provider);
// Assumes your running with `anchor run closeAux --provider.cluster mainnet --provider.wallet ~/.config/solana/your-key.json`
const payer = provider.wallet["payer"];

深入理解以太坊

-w1544

目标

  • 理解以太坊的底层运行机制
    • 本文主要关注为什么这么做、基本原理、实现效果,2/8法则,花 20% 的精力掌握 80% 的内容
    • 细节实现会留 reference,如果想研究,建议用以下方式:1. 走一遍 demo,搞清楚所有的细节,例如 EVM 合约的执行流程;2. 自己实现一遍,比如 MPT、EVM,甚至整个以太坊客户端。
  • 概览以太坊生态全景
@stonegao
stonegao / gist:a1d2c44814e6ab9689dc3ba712f4b453
Created November 28, 2023 03:05 — forked from levelsio/gist:5bc87fd1b1ffbf4a705047bebd9b4790
Secret of Monkey Island: Amsterdam (by @levelsio) or how to create your own ChatGPT image+text-based adventure game
# 2023-11-27 MIT LICENSE
Here's the open source version of my ChatGPT game MonkeyIslandAmsterdam.com.
It's an unofficial image+text-based adventure game edition of Monkey Island in Amsterdam, my home town.
Please use it however you want. It'd be nice to see more ChatGPT-based games appear from this. If you get inspired by it, please link back to my X https://x.com/levelsio or this Gist so more people can do the same!
Send me your ChatGPT text adventure game on X, I'd love to try it!
@stonegao
stonegao / EIP138128.md
Created November 6, 2023 09:16 — forked from Shungy/EIP138128.md
EIP138128: Custom selector and encodings (Very early draft)

Using LEB128 encoding scheme for custom abi/interface.

ERC-138128: Custom function selector and calldata encoding scheme declaration standard

  • A contract SHOULD use ERC-165 standard to declare its support for ERC-138128 standard.
  • A contract supporting ERC-138128 MUST have these two view functions: customSelectors() and customEncodings().

customSelectors()

This function is used to declare alternative function selectors for any number of standard function signatures. This function MUST have the following interface.

@stonegao
stonegao / nestjs.Dockerfile
Created October 10, 2023 11:24 — forked from CorneilleEdi/nestjs.Dockerfile
NestJS Dockerfile with multi-stage
FROM node:16-alpine as builder
RUN apk add curl bash
# install node-prune (https://github.com/tj/node-prune)
RUN curl -sfL https://gobinaries.com/tj/node-prune | bash -s -- -b /usr/local/bin
USER node
WORKDIR /home/node
@stonegao
stonegao / gist:2366309
Created April 12, 2012 10:24 — forked from lardissone/gist:2152225
Nginx config file to serve static file over POST
server {
listen 80;
client_max_body_size 4G;
access_log /var/sites/webapp/logs/access.maintenance.log;
error_log /var/sites/webapp/logs/error.maintenance.log info;
server_name api.webapp.com;
# this guy redirects any path to /api.json
@stonegao
stonegao / fix_exfat_drive.md
Created September 9, 2023 02:09 — forked from scottopell/fix_exfat_drive.md
Fix corrupted exFAT disk macOS/OSX

exFAT support on macOS seems to have some bugs because my external drives with exFAT formatting will randomly get corrupted.

Disk Utility is unable to repair this at first, but the fix is this:

  1. Use diskutil list to find the right drive id.
  2. You want the id under the IDENTIFIER column, it should look like disk1s1
  3. Run sudo fsck_exfat -d <id from above>. eg sudo fsck_exfat -d disk1s3
  4. -d is debug so you'll see all your files output as they're processed.
  5. Answer YES if it gives you the prompt Main boot region needs to be updated. Yes/No?
@stonegao
stonegao / install_guide.md
Created June 30, 2023 03:34 — forked from teebaumcrypto/install_guide.md
lighthouse & reth install and sync mainnet ethereum

Specs

CPU

  • AMD Ryzen 9 7900X AM5, 4.70 GHz, 12-Core

RAM

  • Corsair 6000-40 Vengeance 2 x 32GB 6000 MHz (DDR5)

Nvme

  • WD Black SN850X 4 TB M.2 2280
@stonegao
stonegao / p2pk.rs
Created June 15, 2023 11:55 — forked from sgeisler/p2pk.rs
// bitcoin = "*"
// bitcoin_hashes = "*"
use bitcoin::{Address, Network, Script};
use bitcoin::util::address::Payload;
use bitcoin::util::psbt::serialize::Deserialize;
use bitcoin_hashes::{hash160, Hash};
fn main() {
let bytes: &[u8] = &[