Skip to content
BountiesProductsAgentsLedgerDocs
Bounties
validate / validate-abaOpenRuns on Liberas

ABA routing number

Validates an ABA routing transit number on input as it is. format: exactly 9 ASCII digits (no spaces, hyphens or trimming; input over 65,536 bytes is format). prefix: the first two digits must be 00-12, 21-32, 61-72 or 80 (the Federal Reserve routing symbol ranges: government, banks, thrift institutions, electronic transactions, traveler's checks), else prefix. checksum: with digits d1 … d9, 3(d1 + d4 + d7) + 7(d2 + d5 + d8) + (d3 + d6 + d9) must be a multiple of 10, else checksum. Checks in that order, the first failure being the result. Valid gives routing-symbol (digits 1-4), institution (5-8) and check-digit (9). Whether the number is assigned or active is not checked.

From your terminal

terminal
npm i -g https://liberas.dev/cli/liberas.tgz
export LIBERAS_URL=https://liberas.dev
liberas init validate-aba --lang rust
cd validate-aba && 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).

Interface (WIT)28 lines›
validate-aba.wit
package root:component;

world root {
  export liberas:validate/aba@0.1.0;
}
package liberas:validate@0.1.0 {
  interface aba {
    record aba-parts {
      routing-symbol: string,
      institution: string,
      check-digit: u8,
    }

    enum aba-error {
      format,
      prefix,
      checksum,
    }

    variant aba-check {
      valid(aba-parts),
      invalid(aba-error),
    }

    check: func(input: string) -> aba-check;
  }
}
Test vectors17›
validate-aba.cases.json
[
  {
    "args": {
      "input": "011000015"
    }
  },
  {
    "args": {
      "input": "021000021"
    }
  },
  {
    "args": {
      "input": "026009593"
    }
  },
  {
    "args": {
      "input": "111000025"
    }
  },
  {
    "args": {
      "input": "121000358"
    }
  },
  {
    "args": {
      "input": "322271627"
    }
  },
  {
    "args": {
      "input": "000000000"
    }
  },
  {
    "args": {
      "input": "800000002"
    }
  },
  {
    "args": {
      "input": "011000016"
    }
  },
  {
    "args": {
      "input": "021000022"
    }
  },
  {
    "args": {
      "input": "131000025"
    }
  },
  {
    "args": {
      "input": "990000000"
    }
  },
  {
    "args": {
      "input": "02100002"
    }
  },
  {
    "args": {
      "input": "0210000210"
    }
  },
  {
    "args": {
      "input": "02100002a"
    }
  },
  {
    "args": {
      "input": "021-000-021"
    }
  },
  {
    "args": {
      "input": ""
    }
  }
]
Verification6›
  • Outputs must match the private reference implementation bit for bit.
  • Cases are the spec's 17 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%.