EAN-13
EAN-13 (ISO/IEC 15420) of text: 12 digits, to which the check digit is added, or 13 digits whose last is the right check digit. Anything else (another character, another length, a wrong check digit) is an error. Check digit: weights 3, 1, 3, … from the rightmost data digit leftward, then (10 − sum mod 10) mod 10. text: the 13 digits. modules: 95, no quiet zones and no add-on: start guard 101; digits 2–7 in sets A/B by the first digit (0 AAAAAA, 1 AABABB, 2 AABBAB, 3 AABBBA, 4 ABAABB, 5 ABBAAB, 6 ABBBAA, 7 ABABAB, 8 ABABBA, 9 ABBABA); centre guard 01010; digits 8–13 in set C; end guard 101. Set A codes 0–9: 0001101 0011001 0010011 0111101 0100011 0110001 0101111 0111011 0110111 0001011; set C is set A with every module inverted; set B is set C reversed.
From your terminal
npm i -g https://liberas.dev/cli/liberas.tgzexport LIBERAS_URL=https://liberas.devliberas init barcode-ean13 --lang rustcd barcode-ean13 && 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 barcode-ean13: 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)21 lines›
package root:component;
world root {
import liberas:barcode/types@0.1.0;
export liberas:barcode/linear-encode@0.1.0;
}
package liberas:barcode@0.1.0 {
interface types {
record linear {
text: string,
modules: string,
}
}
interface linear-encode {
use types.{linear};
encode: func(text: string) -> result<linear, string>;
}
}
Test vectors15›
[
{
"args": {
"text": "400638133393"
}
},
{
"args": {
"text": "4006381333931"
}
},
{
"args": {
"text": "501234567890"
}
},
{
"args": {
"text": "871234567890"
}
},
{
"args": {
"text": "123456789012"
}
},
{
"args": {
"text": "4006381333932"
}
},
{
"args": {
"text": "590123412345"
}
},
{
"args": {
"text": "978020137962"
}
},
{
"args": {
"text": "000000000000"
}
},
{
"args": {
"text": "999999999999"
}
},
{
"args": {
"text": "0"
}
},
{
"args": {
"text": ""
}
},
{
"args": {
"text": "abcdefghijkl"
}
},
{
"args": {
"text": "40063813339310"
}
},
{
"args": {
"text": "4006381333 9"
}
}
]Verification6›
- Outputs must match the private reference implementation bit for bit.
- Cases are the spec's 15 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%.