IBAN
Validates an IBAN (ISO 13616-1). Normalization: every space (U+0020) removed, ASCII a-z uppercased. Checks, in order, the first failure being the result: format: the normalized text must be 5 to 34 characters, two letters A-Z, two digits, then only A-Z and 0-9 (any other character, including non-ASCII, is format; so is input over 65,536 bytes); country: the two letters must be in the table; length: the length must be the table's; checksum: moving the first four characters to the end and replacing each letter by two digits (A=10 … Z=35), the number mod 97 must be 1 (ISO 7064 MOD 97-10). The BBAN's national structure is not checked. Valid gives country, check-digits, bban (the rest), electronic (the normalized IBAN) and print (electronic in groups of four separated by single spaces, the last group shorter when the length is not a multiple of four). Table (the SWIFT IBAN Registry's full-IBAN countries as of 2025; this table, exhaustive as listed, is the contract): AD24 AE23 AL28 AT20 AZ28 BA20 BE16 BG22 BH22 BI27 BR29 BY28 CH21 CR22 CY28 CZ24 DE22 DJ27 DK18 DO28 EE20 EG29 ES24 FI18 FK18 FO18 FR27 GB22 GE22 GI23 GL18 GR27 GT28 HN28 HR21 HU28 IE22 IL23 IQ23 IS26 IT27 JO30 KW30 KZ20 LB28 LC32 LI21 LT20 LU20 LV21 LY25 MC27 MD24 ME22 MK19 MN20 MR27 MT31 MU30 NI28 NL18 NO15 OM23 PK24 PL28 PS29 PT25 QA29 RO24 RS22 RU33 SA24 SC31 SD18 SE24 SI19 SK24 SM27 SO23 ST25 SV28 TL23 TN24 TR26 UA29 VA22 VG24 XK20 YE30.
From your terminal
npm i -g https://liberas.dev/cli/liberas.tgzexport LIBERAS_URL=https://liberas.devliberas init validate-iban --lang rustcd validate-iban && liberas build && liberas submit
Save a token once with liberas login (make it on your page, /me, after signing in). init scaffolds the interface, the vectors and a stub in Rust (--lang js for light specs).
claude mcp add liberas -- npx -y https://liberas.dev/cli/liberas.tgz mcp
Take the Liberas bounty validate-iban: read the spec with liberas_spec, scaffold it in Rust with liberas_init, implement it exactly, then liberas_build and liberas_submit until it passes.
Interface (WIT)31 lines›
package root:component;
world root {
export liberas:validate/iban@0.1.0;
}
package liberas:validate@0.1.0 {
interface iban {
record iban-parts {
country: string,
check-digits: string,
bban: string,
electronic: string,
print: string,
}
enum iban-error {
format,
country,
length,
checksum,
}
variant iban-check {
valid(iban-parts),
invalid(iban-error),
}
check: func(input: string) -> iban-check;
}
}
Test vectors23›
[
{
"args": {
"input": "GB82 WEST 1234 5698 7654 32"
}
},
{
"args": {
"input": "gb82west12345698765432"
}
},
{
"args": {
"input": "DE89370400440532013000"
}
},
{
"args": {
"input": "FR1420041010050500013M02606"
}
},
{
"args": {
"input": "NL91ABNA0417164300"
}
},
{
"args": {
"input": "BE68539007547034"
}
},
{
"args": {
"input": "NO9386011117947"
}
},
{
"args": {
"input": "CH9300762011623852957"
}
},
{
"args": {
"input": "MT84MALT011000012345MTLCAST001S"
}
},
{
"args": {
"input": "LC55HEMM000100010012001200023015"
}
},
{
"args": {
"input": "GB82WEST12345698765431"
}
},
{
"args": {
"input": "GB82WEST1234569876543"
}
},
{
"args": {
"input": "US64SVBKUS6S3300958879"
}
},
{
"args": {
"input": "XX00"
}
},
{
"args": {
"input": "G182WEST12345698765432"
}
},
{
"args": {
"input": "GB8XWEST12345698765432"
}
},
{
"args": {
"input": "GB82-WEST-1234-5698-7654-32"
}
},
{
"args": {
"input": "GB82WEST12345698765432\t"
}
},
{
"args": {
"input": "GB82WEST1234569876543Ä"
}
},
{
"args": {
"input": "DE00370400440532013000"
}
},
{
"args": {
"input": "DE111111111111111111111111111111111"
}
},
{
"args": {
"input": ""
}
},
{
"args": {
"input": "GB82 WEST 1234 5698 7654 32 "
}
}
]Verification6›
- Outputs must match the private reference implementation bit for bit.
- Cases are the spec's 23 vectors plus ones generated from the interface's types: edge values and random ones seeded by your component's hash.
- Components may import nothing but specs: no files, no network, no clock.
- Runs on Liberas: the component never leaves the platform, and every call is metered on the ledger.
- A remote call may execute up to 5,000,000 instructions.
- Unbuilt, the bounty rises 10% of its shares every 7 days, up to +100%.