Signal21 documentation

Signal21 is the leading data and visualization platform for the Bitcoin and the Stacks blockchains.

Helper Functions

get_max_block()

Transactions count in the last 200 blocks using get__max__block()

SELECT count(1) 
FROM transactions 
WHERE block_height >= get_max_block() - 200

block_height_bucket(value int, start_block int, bucket_size int)

Creates a bucket based on value

Bucket is defined as a range of size bucket_size , first bucket starts at start_block value, last bucket ends with get_max_block()

For instance, this is a bucketized report on total supply of STX

SELECT 
  block_height_bucket(block_height, 1, 300) block_height, 
  AVG((value -> 'result' ->> 'total-liquid-supply-ustx') :: NUMERIC / 1000000) amount 
FROM function_history 
WHERE fname = 'get-pox-info' 
GROUP BY 1
ORDER BY 1

IDN functions

idn_utf8_nfkc_normalize(text)

Shows NFKC normalization

idn_idna_decode(text, text default NULL)

IDNA (2003) decoding

idn_idna_encode(text, text default NULL)

IDNA (2003) encoding

idn_pr29_check(text)

PR29 check

idn_punycode_encode(text)

Punycode encoding

idn_punycode_decode(text)

Punycode decoding

idn2_lookup(text, text default NULL)

IDNA (2008) encoding

idn2_register(text, text default NULL, text default NULL)

IDNA (2008) register

SELECT idn2_register(u&'\00DF', NULL, 'IDN2_FLAG_NONE') = 'xn--zca';

idn_constants()

Shows IDNA constants