Skip to content

Instantly share code, notes, and snippets.

View weikengchen's full-sized avatar

Weikeng Chen weikengchen

View GitHub Profile
@weikengchen
weikengchen / citrea-risc0-to-bitvm-circuit_attestation.log
Created July 25, 2025 04:56
Attestation for Citrea Risc0 to BitVM Circuit MPC Phase 2 Trusted Setup ceremony
Hey, I'm weikengchen-14937807 and I have contributed to the Citrea Risc0 to BitVM Circuit MPC Phase2 Trusted Setup ceremony.
The following are my contribution signatures:
Circuit # 1 (verify_for_guest)
Contributor # 9
Contribution Hash: 539e4817 122bedc6 86e76090 533491a4
3b02578d 80af1cbd 61ec88fc 95d308f3
93a2af9c 1d9f1f53 eaf43fdb 6d48818a
eb22b359 3827a5d1 4c75bfa3 702b08bc
# Remark: This script contains functionality for GF(2^n), but currently works only over GF(p)! A few small adaptations are needed for GF(2^n).
from sage.rings.polynomial.polynomial_gf2x import GF2X_BuildIrred_list
from math import *
import itertools
p = 2^31 - 1
n = len(p.bits()) # bit
t = 16 # BabyBear (t = 24 for sponge, t = 16 for compression)
FIELD = 1
@weikengchen
weikengchen / rationale.md
Created December 20, 2024 03:13
Covenant support rationale of Weikeng

General

I am in favor of having more opcodes, especially if we one day have multi-byte opcode, having some opcodes in the Bitcoin script language that are less frequently used is okay.

In fact, as long as these opcodes do not become DDoS factors, everything else is the script developer's own discretion.

@weikengchen
weikengchen / risc-zero-stark-to-snark-prover_attestation.log
Created April 11, 2024 18:19
Attestation for RISC Zero STARK-to-SNARK Prover MPC Phase 2 Trusted Setup ceremony
Hey, I'm weikengchen-14937807 and I have contributed to the RISC Zero STARK-to-SNARK Prover MPC Phase2 Trusted Setup ceremony.
The following are my contribution signatures:
Circuit # 1 (stark_verify)
Contributor # 52
Contribution Hash: 263f5ee7 18e3e48c f3ab881f ed9b31e0
7bd41652 1a0505ad ab7cb123 12fec584
70c0a631 dc9dd678 625a017c 2a3f4dac
55c74a41 0e72512e c9f6adfc 06924d48
@weikengchen
weikengchen / article-1-profiler-with-debug.txt
Created December 15, 2023 08:59
article-1-profiler-with-debug.txt
Total: 173088891 cycles, 164265269 instructions
···· Load the bootstrapping key: 3297 cycles, 15 instructions
········ Cycle: 25620 => 28903: sw a1, 0(a0) at 0x20219c that writes to 0x1fc3c8 and marks pages 0x1fc000, 0xd00fc00, 0xd680400 as dirty takes 3283 cycles
···· Load the ciphertext to be bootstrapped: 11 cycles, 11 instructions
···· Perform trivial encryption and rotation: 123989 cycles, 66103 instructions
········ Cycle: 29166 => 30261: sb a3, -1(a1) at 0x202760 that writes to 0x1fe3c7 and marks pages 0x1fe000 as dirty takes 1095 cycles
········ Cycle: 30322 => 31417: sw a3, 0(a1) at 0x202818, due to bltu a4, -40(a2) at 0x202840, that writes to 0x1fc400 and marks pages 0x1fc400 as dirty takes 1095 cycles
········ Cycle: 31768 => 32863: sw a3, 0(a1) at 0x202818, due to bltu a4, -40(a2) at 0x202840, that writes to 0x1fc800 and marks pages 0x1fc800 as dirty takes 1095 cycles
········ Cycle: 33214 => 34309: sw a3, 0(a1) at 0x202818, due to bltu a4, -40(a2) at 0x202840, that writes to 0x1fcc00 and marks pa
@weikengchen
weikengchen / article-1-profiler-expanded.txt
Created December 15, 2023 03:41
article-1-profiler-expanded.txt
Total: 159822833 cycles, 151688413 instructions
···· Load the bootstrapping key: 3297 cycles, 15 instructions
········ Cycle: 24526 => 27809: sw a1, 0(a0) at 0x202348 that writes to 0x1fc3c8 and marks pages 0x1fc000, 0xd00fc00, 0xd680400 as dirty takes 3283 cycles
···· Load the ciphertext to be bootstrapped: 11 cycles, 11 instructions
···· Perform trivial encryption and rotation: 123982 cycles, 66096 instructions
········ Cycle: 28072 => 29167: sb a3, -1(a1) at 0x2026fc that writes to 0x1fe3c7 and marks pages 0x1fe000 as dirty takes 1095 cycles
········ Cycle: 29228 => 30323: sw a3, 0(a1) at 0x2027b4, due to bltu a4, -40(a2) at 0x2027dc, that writes to 0x1fc400 and marks pages 0x1fc400 as dirty takes 1095 cycles
········ Cycle: 30674 => 31769: sw a3, 0(a1) at 0x2027b4, due to bltu a4, -40(a2) at 0x2027dc, that writes to 0x1fc800 and marks pages 0x1fc800 as dirty takes 1095 cycles
········ Cycle: 32120 => 33215: sw a3, 0(a1) at 0x2027b4, due to bltu a4, -40(a2) at 0x2027dc, that writes to 0x1fcc00 and marks pa
@weikengchen
weikengchen / article-1-profiler-output.txt
Created December 15, 2023 00:44
article-1-profiler-output.txt
Total: 159726565 cycles, 151686471 instructions
···· Load the bootstrapping key: 3297 cycles, 15 instructions
········ Cycle: 23432 => 26715: sw a1, 0(a0) at 0x2008c4 that writes to 0x1fc3c8 and marks pages 0x1fc000, 0xd00fc00, 0xd680400 as dirty takes 3283 cycles
···· Load the ciphertext to be bootstrapped: 11 cycles, 11 instructions
···· Perform trivial encryption and rotation: 123982 cycles, 66096 instructions
········ Cycle: 26978 => 28073: sb a3, -1(a1) at 0x201fcc that writes to 0x1fe3c7 and marks pages 0x1fe000 as dirty takes 1095 cycles
········ Cycle: 28134 => 29229: sw a3, 0(a1) at 0x202084, due to bltu a4, -40(a2) at 0x2020ac, that writes to 0x1fc400 and marks pages 0x1fc400 as dirty takes 1095 cycles
········ Cycle: 29580 => 30675: sw a3, 0(a1) at 0x202084, due to bltu a4, -40(a2) at 0x2020ac, that writes to 0x1fc800 and marks pages 0x1fc800 as dirty takes 1095 cycles
········ Cycle: 31026 => 32121: sw a3, 0(a1) at 0x202084, due to bltu a4, -40(a2) at 0x2020ac, that writes to 0x1fcc00 and marks pa
@weikengchen
weikengchen / profiler-output.txt
Last active December 13, 2023 02:55
profiler-output.txt
Total: 13774441 cycles, 11144089 instructions
···· Load the bootstrapping key: 3297 cycles, 15 instructions
········ Cycle: 23393 => 26676: sw a1, 0(a0) at 0x200904 that writes to 0x1fc3c8 and marks pages 0x1fc000, 0xd00fc00, 0xd680400 as dirty takes 3283 cycles
···· Load the ciphertext to be bootstrapped: 11 cycles, 11 instructions
···· Perform trivial encryption and rotation: 126203 cycles, 66129 instructions
········ Cycle: 26928 => 28023: addi sp, sp, -2032 at 0x201c18, due to jalr ra, ra, 616 at 0x2009b4, that marks pages 0x201c00 as dirty takes 1095 cycles
········ Cycle: 28023 => 30212: sw sp, 2028(ra) at 0x201c1c that writes to 0x1f03bc and marks pages 0x1f0000, 0xd00f800 as dirty takes 2189 cycles
········ Cycle: 30225 => 32414: sb a0, 0(a1) at 0x200b6c that writes to 0x1ee3b0 and marks pages 0x1ee000, 0xd00f400 as dirty takes 2189 cycles
········ Cycle: 32484 => 33579: sw a3, 24(a1) at 0x200c48 that writes to 0x1ee400 and marks pages 0x1ee400 as dirty takes 1095 cycles
········ Cycle: 33930 => 35025
@weikengchen
weikengchen / maci-v1-trusted-setup-ceremony_attestation.log
Created October 21, 2023 03:34
Attestation for Maci v1 Trusted Setup Ceremony MPC Phase 2 Trusted Setup ceremony
Hey, I'm weikengchen-14937807 and I have contributed to the Maci v1 Trusted Setup Ceremony.
The following are my contribution signatures:
Circuit # 1 (processmessages_6-8-2-3)
Contributor # 39
Contribution Hash: 2032a997 6ca70cec 61e4e6a9 1abfb63c
1555f9e9 5c6dbe2b 324a1d96 80b2d247
d04c6a99 573b17d3 22b242dc 6d828396
839895ad 01b5143c 2b62c339 25fbe309
@weikengchen
weikengchen / demo.cpp
Created June 25, 2019 20:56
Demonstration application for AG-2PC
#include <emp-tool/emp-tool.h>
#include "test/single_execution.h"
using namespace std;
using namespace emp;
int main(int argc, char** argv) {
int port, party;
parse_party_and_port(argv, &party, &port);
NetIO* io = new NetIO(party==ALICE ? nullptr:IP, port);