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 / orpc-router-to-mcp-tools.ts
Created March 29, 2025 17:05
converting oRPC routers to MCP tools - beginning, it's buggy.. can't figure out how to provide the procedure's inputSchema as mcp tool schema... should be `inputSchema.shape` but.. it errors
interface McpToolResult {
content: Array<{ type: string; text: string }>;
isError?: boolean;
}
interface OrpcProcedureMeta {
meta?: {
tool_name?: string;
};
@tunnckoCore
tunnckoCore / ethscriptions-openapi.json
Created March 29, 2025 08:07
Ethscriptions OpenAPI spec - json format
{
"openapi": "3.0.1",
"info": {
"title": "Ethscriptions API V2",
"version": "v2",
"description": "## Overview\n\nWelcome to the Ethscriptions Indexer API docs!\n\nThis API enables you to learn everything about the ethscriptions protocol. All instances of the open source [Ethscriptions Indexer](https://github.com/0xFacet/ethscriptions-indexer) expose this API.\n\nIf you don't want to run your own instance of the indexer you can use ours for free using the base URL `https://api.ethscriptions.com/v2`.\n\n## Community and Support\n \nJoin our community on [GitHub](https://github.com/0xFacet/ethscriptions-indexer) and [Discord](https://discord.gg/ethscriptions) to contribute, get support, and share your experiences with the Ethscriptions Indexer.\n\n"
},
"paths": {
"/ethscription_transfers": {
"get": {
@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