Skip to content

Instantly share code, notes, and snippets.

View tunnckoCore's full-sized avatar
🔒
Fighting for freedom, security and privacy 🔐

Charlike Mike Reagent tunnckoCore

🔒
Fighting for freedom, security and privacy 🔐
View GitHub Profile
@tunnckoCore
tunnckoCore / readme.md
Last active January 28, 2025 01:00
ESIP-12 transfer ethscriptions through facet contracts

ESIP-9 transfer ethscriptions through facet contracts

  1. Create a facet transaction to a global/main/single facet-deployed contract (could be factory for creating L2 nft contracts)
  2. In facet data pass the ethscription ids, similar to how we do ESIP-5
  3. Ethscriptions indexers detects transactions to this facet contract, easily by just inspecting transaction's input calldata hex

Somethig like that

@tunnckoCore
tunnckoCore / string-validator.ts
Created January 5, 2025 19:01
typescript string validation with proper both compile-time and runtime checking
// eventually
// import type { StandardSchemaV1 } from '@standard-schema/spec';
// import { SchemaError } from '@standard-schema/utils';
// Utility types for length checking
type Length<T extends string, Counter extends number[] = []> = T extends `${string}${infer Tail}`
? Length<Tail, [...Counter, 0]>
: Counter['length'];
type Compare<
@tunnckoCore
tunnckoCore / ebert.json
Created January 3, 2025 21:37
ebert ethscriptions lunar surface and back journey
{
"name": "Ebert's Moon Mission",
"description": "Ebert was converted into an electromagnetic wave. He was then muonically beamed to the moon at the speed of light and returned to Earth's surface moments later. And yes...this actually happened. The voyage was made possible through the use of two radio telescopes, and with help from ham radio operators from across the world.",
"total_supply": "4",
"logo_image_uri": "https://white-glad-hare-157.mypinata.cloud/ipfs/QmZRXyQr8MwwEvUHME9KBdtP46QsxemuLX95DX2brQxpho",
"banner_image_uri": "https://white-glad-hare-157.mypinata.cloud/ipfs/QmW3XJUvdq1hoawim5f8oddZsFdQNBK7Rv7MZHf7UMxFDA",
"background_color": "#2457CA",
"twitter_link": "https://x.com/whoisebert",
"website_link": "https://whoisebert.xyz/",
"telegram_link": "https://t.me/whoisebert",
@tunnckoCore
tunnckoCore / README.md
Last active January 4, 2025 04:23
Get collection items and metadata (attributes) from Ordex API

Usage

import { fetchCollectionMeta, getCollectionMetdata } = './index.ts';

const collection = await fetchCollectionMeta('mickey-mouse');
collection.items = await getCollectionMetdata('mickey-mouse', (acc, item) => acc.concat(item));

console.log('mickey-mouse', collection);
@tunnckoCore
tunnckoCore / index.js
Last active November 22, 2024 20:34
Ordex Bulk Withdrawal - Unescrow
import { http, createPublicClient, createWalletClient } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { mainnet } from 'viem/chains';
export const publicClient = createPublicClient({
chain: mainnet,
transport: http(),
});
const ethscriptionIds = [
@tunnckoCore
tunnckoCore / a_readme.md
Last active November 3, 2024 01:46
zod cli parser

example defineCommand

import { z } from 'zod';

import { defineCommand } from './src/define-command.ts';
import { defineOptionsRaw } from './src/define-options.ts';

export const lint = defineCommand({
  name: 'lint',
@tunnckoCore
tunnckoCore / index.ts
Created October 17, 2024 03:10
ML KEM based encrypt/decrypt, sign/verify, signcryption; ML-KEM-768-SHA256-AES256-GCM / ML-KEM-768-SHAKE256-XCHACHA20POLY1305 / ML-KEM-768-SHAKE256-XSALSA20POLY1305
import { gcm } from '@noble/ciphers/aes';
import { chacha20poly1305, xchacha20poly1305 } from '@noble/ciphers/chacha';
import { xsalsa20poly1305 } from '@noble/ciphers/salsa';
import { gcm as gcmWebCrypto } from '@noble/ciphers/webcrypto';
import { sha256 } from '@noble/hashes/sha2';
import { shake256 } from '@noble/hashes/sha3';
import { randomBytes } from '@noble/hashes/utils';
import { ml_dsa44, ml_dsa65, ml_dsa87 } from '@noble/post-quantum/ml-dsa';
import { ml_kem512, ml_kem768, ml_kem1024 } from '@noble/post-quantum/ml-kem';
@tunnckoCore
tunnckoCore / ethscriptions-user-markets.md
Last active November 27, 2024 19:41
Ethscriptions user-owned and user-controlled markets

Motivation and how the process currently works

The current approach is that a user escrows their Ethscriptions to a Marketplace contract that uses the ESIP-2 (contract-based transfers) for transferring when a sale happens. That escrowing process is required, and thankfully tho can be just a one-time cheap thing through the ESIP-5 Bulk transfers. While i was working on indexer, there was few people that transferred over 3000 ethscriptions at one go, for just a few dollars, and that was pre-Blobs with medium to high gas fees. Now would probably be just few cents.

The listing process is not "on-chain", the user just makes a listing through a marketplace site, that listing goes in a database and shows it to other marketplace users. When a user wants to buy, it actually calls the market's' contract with specific "listing id", the "ethscription id" which wants to buy, and the price asked by the seller. All that happens under the hood and is not complex to the end user. Nothing bad in all that.

The other side

@tunnckoCore
tunnckoCore / web-native-totp.js
Last active August 23, 2024 20:54
Web Crypto API native TOTP (Time-based One-Time Passwords), in 60 lines
// SPDX-License-Identifier: Apache-2.0
// RFC 4648 base32 alphabet without pad
export const BASE32_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
/**
* Generate secret
* @param length optional, length (defaults to `24`)
* @returns secret
*/
@tunnckoCore
tunnckoCore / example_with_create_facet_client.ts
Last active September 14, 2024 15:35
Facet actions / clients for Viem, or standalone
import { english, generateMnemonic, mnemonicToAccount } from "viem/accounts";
import { sepolia } from "viem/chains";
import { createFacetClient } from "./index.ts";
const mnemonic = generateMnemonic(english, 256);
const account = mnemonicToAccount(mnemonic);
const facet = createFacetClient({
account,
chain: sepolia,