ISIN
Validates an International Securities Identification Number (ISO 6166) on input as it is: no trimming, separators or case folding. format: exactly 12 characters: two A-Z, nine A-Z or 0-9, then one 0-9 (anything else, including lowercase, non-ASCII and input over 65,536 bytes, is format). checksum: replace each letter of the first 11 characters by its two-digit value (A=10 … Z=35) and take the Luhn check digit of the resulting digit string: from its rightmost digit leftward, double every other digit starting with the rightmost, subtract 9 from doubles over 9, sum all digits; check = (10 - sum mod 10) mod 10; it must equal the 12th character, else checksum. The country prefix is not checked against ISO 3166 (XS, EU and the like pass). Valid gives country (characters 1-2), nsin (3-11) and check-digit.
From your terminal
npm i -g https://liberas.dev/cli/liberas.tgzexport LIBERAS_URL=https://liberas.devliberas init validate-isin --lang rustcd validate-isin && 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-isin: 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)27 lines›
package root:component;
world root {
export liberas:validate/isin@0.1.0;
}
package liberas:validate@0.1.0 {
interface isin {
record isin-parts {
country: string,
nsin: string,
check-digit: u8,
}
enum isin-error {
format,
checksum,
}
variant isin-check {
valid(isin-parts),
invalid(isin-error),
}
check: func(input: string) -> isin-check;
}
}
Test vectors18›
[
{
"args": {
"input": "US0378331005"
}
},
{
"args": {
"input": "US5949181045"
}
},
{
"args": {
"input": "AU0000XVGZA3"
}
},
{
"args": {
"input": "GB0002634946"
}
},
{
"args": {
"input": "DE000BAY0017"
}
},
{
"args": {
"input": "KR7005930003"
}
},
{
"args": {
"input": "XS2021832634"
}
},
{
"args": {
"input": "US0378331006"
}
},
{
"args": {
"input": "AU0000XVGZA4"
}
},
{
"args": {
"input": "us0378331005"
}
},
{
"args": {
"input": "US037833100"
}
},
{
"args": {
"input": "US03783310055"
}
},
{
"args": {
"input": "US0378331005 "
}
},
{
"args": {
"input": "US-0378331005"
}
},
{
"args": {
"input": "1S0378331005"
}
},
{
"args": {
"input": "US037833100A"
}
},
{
"args": {
"input": ""
}
},
{
"args": {
"input": "US0378331005"
}
}
]Verification6›
- Outputs must match the private reference implementation bit for bit.
- Cases are the spec's 18 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 1,000,000 instructions.
- Unbuilt, the bounty rises 10% of its shares every 7 days, up to +100%.