Skip to content

Instantly share code, notes, and snippets.

View urtho's full-sized avatar
⛓️
Algorand rocks!

Paweł Pierścionek urtho

⛓️
Algorand rocks!
View GitHub Profile
### Keybase proof
I hereby claim:
* I am urtho on github.
* I am urtho (https://keybase.io/urtho) on keybase.
* I have a public key ASB70lwmrm_T-oS_08jpyUXS_6SpKCKVr107IahfCZNaTgo
To claim this, I am signing this object:
@urtho
urtho / algorand.sql
Last active October 28, 2024 21:11
ClickHouse SQL functions for Algorand
-- convert 32byte binary public address to Algorand human readable 58 char address witch checksum
-- ugly but compatible with Clickhouse buggy SQL analyzer
-- https://github.com/ClickHouse/ClickHouse/issues/58994
CREATE OR REPLACE FUNCTION fn_algorandAddrEncode
AS (addr) -> (
arrayStringConcat(arrayMap(
i -> substring(
'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567',
reinterpretAsUInt8((bitShiftRight(bitSlice(addr|| substr(SHA512_256(addr),-4), i*5+1, 5),3))) + 1,
1
@urtho
urtho / index.js
Created January 8, 2022 18:23
dirty way of calculating per minute blockchain ingestion rate of indexer
const lineByLine = require('n-readlines');
const liner = new lineByLine(process.argv[2]);
let line;
var regex = /\((\d+) txn/;
let ft = 0;
let at = 0;
let txns = 0;
let pdt = 0;
@urtho
urtho / index.ts
Last active March 7, 2022 17:16
Example ARC-0014 sign-in auth scheme for Algorand wallets.
import algosdk from 'algosdk';
import {TextEncoder, TextDecoder} from "util";
import nacl from 'tweetnacl';
const token = '...';
const server = '...';
const port = 443;
const client = new algosdk.Algodv2(token, server, port);