Skip to content

jonasschnelli/bitcoin_txref_code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Confirmed Transaction Reference Codes

Build Status Coverage Status

Simple C implementation for ctxref codes after BIP XXXX

Build steps

Object code:

$  gcc -O3 -c txref_code.c segwit_addr.c

Tests:

$ gcc -O3 txref_code.c segwit_addr.c tests.c -o test

Example:

/* ENCODE */
char encoded_txref[32]; //buffer should be at least strlen(hrp) + 19 + 1(0 byte)
char *hrp = "tx"; //mainnet

// now encode for height 100 and pos 100
int res = btc_txref_encode(encoded_txref, hrp, TXREF_MAGIC_BTC_MAINNET, 100, 100);
printf("%s\n", encoded_txref);

/* DECODE */
int height;
int pos;
char hrpbuf[strlen(encoded_txref)];
char magic;
res = btc_txref_decode(encoded_txref, hrpbuf, &magic, &height, &pos);

About

Confirmed Transaction Reference Code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages