Skip to content

Instantly share code, notes, and snippets.

View Rexagon's full-sized avatar
🦀

Ivan Kalinin Rexagon

🦀
View GitHub Profile
@Rexagon
Rexagon / tycho_block.tlb
Created October 20, 2025 14:51
Tycho TLB scheme
unit$_ = Unit;
true$_ = True;
// EMPTY False;
bool_false$0 = Bool;
bool_true$1 = Bool;
bool_false$0 = BoolFalse;
bool_true$1 = BoolTrue;
nothing$0 {X:Type} = Maybe X;
just$1 {X:Type} value:X = Maybe X;
left$0 {X:Type} {Y:Type} value:X = Either X Y;
@Rexagon
Rexagon / chksig_proposal.md
Last active October 20, 2025 14:00
CHKSIG proposal

Draft

Improved signature verification for TON L2 networks

The appearance of new networks in which a user can reuse the same key for the same contracts carries new risks. The proposed solution allows using same keys and contracts across different L2 networks without worrying about new replay attacks, as the signatures themselves will be different everywhere and will depend on a unique network ID (later referred to as global_id).

Most contracts verify the signature of external message with CHKSIGNU or CHKSIGNS. Therefore, to minimize the number of any changes, we propose adding new behavior for these opcodes (enabled/disabled via capability). This new behavior only needs to be implemented on the L2 side, however, it will require at least the reservation of one additional opcode, which is needed for explicit verification of signatures with other ids.

Changed opcodes

syntax = "proto3";
package indexer;
service TychoIndexer {
// Indexer node status.
rpc GetStatus (GetStatusRequest) returns (GetStatusResponse);
// Subscribe for block events.
rpc WatchBlockIds (WatchBlockIdsRequest) returns (stream WatchBlockIdsEvent);
// Returns a stream of BOC-encoded block data chunks if found,
use std::io::IsTerminal;
use std::num::NonZeroUsize;
use std::path::{Path, PathBuf};
use anyhow::Result;
use serde::de::Visitor;
use serde::{Deserialize, Deserializer, Serialize};
use tracing::Subscriber;
use tracing_appender::rolling::Rotation;
use tracing_subscriber::filter::Directive;
import os
def process_file(file_path):
if "test" in file_path or "network" in file_path or "target" in file_path:
return
if not file_path.endswith(".rs"):
return
modified_lines = []
@Rexagon
Rexagon / gen-ticktock.fif
Last active May 24, 2024 13:04
Generates a simple hello-world contract
"TonUtil.fif" include
"Asm.fif" include
"Lists.fif" include
"GetOpt.fif" include
{ show-options-help 1 halt } : usage
false =: tick
false =: tock
variable extra-currencies
@Rexagon
Rexagon / config.ts
Created September 1, 2023 13:14
Get config params
import { Address, ProviderRpcClient } from "everscale-inpage-provider";
import { EverscaleStandaloneClient } from "everscale-standalone-client/nodejs";
const ever = new ProviderRpcClient({
forceUseFallback: true,
fallback: () =>
EverscaleStandaloneClient.create({
connection: {
id: 123,
type: "proto",
@Rexagon
Rexagon / tlb.pest
Created February 1, 2023 20:42
Pest grammar for TL-B
WHITESPACE = _{ " " | NEWLINE }
COMMENT = _{
("//" ~ (!NEWLINE ~ ANY)*) |
("/*" ~ (!"*/" ~ ANY)* ~ "*/")
}
tlb_scheme = _{ SOI ~ (declaration)* ~ EOI }
declaration = { constructor ~ type_arg* ~ field_group* ~ "=" ~ output_type ~ ";" }
@Rexagon
Rexagon / global_config.json
Created November 21, 2022 20:48
Broxus testnet global config
{
"@type": "config.global",
"dht": {
"@type": "dht.config.global",
"k": 6,
"a": 3,
"static_nodes": {
"@type": "dht.nodes",
"nodes": [
{
te6ccgECdQEAFD4AA7d61FeCHf8yG3+VsHLEilQ6UuYy8wcpWi1+/eB+QyLiYMAAAahJB7OYkL2Pl+S0sBbapRCERwSsVWKsZ/1WGbNouh5HwPhxSiGAAAGoP8TeAJYumenAAFSARBWHSAUEAQIbBIgLyR0Jj8WYgCdHLREDAgBxygFZfVBPmUqMAAAAAAAGAAIAAAAEW8033SNQ2/1TE9Nzuof+lf33h4/sRfFyiGy4DaJos2pa1CzcAJ5KDiw9CQAAAAAAAAAAATMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIJyjI1j6xocdf/ts8UpUE4PQBjq+eZ4ePLwpE1tDGf3pHcFUnuY03DQrIX8ExegcAhTl+187mhCPuegYR4tBS3ejwIB4HEGAgHdCgcBASAIAbFoAVqK8EO/5kNv8rYOWJFKh0pcxl5g5StFr9+8D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