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

BIC (SWIFT code)

Parses a business identifier code (ISO 9362:2014): 8 or 11 characters, uppercase only, nothing around: institution (business party prefix, 4 of A-Z and 0-9), country (2 of A-Z, not checked against ISO 3166), location (business party suffix, 2 of A-Z and 0-9) and, for 11 characters, branch (3 of A-Z and 0-9, XXX included as given). test is whether the location's second character is 0 (a test and training BIC). branch is none for 8 characters. None for any other input: lowercase letters, spaces or separators, other lengths or non-ASCII.

From your terminal

terminal
npm i -g https://liberas.dev/cli/liberas.tgz
export LIBERAS_URL=https://liberas.dev
liberas init validate-bic --lang rust
cd validate-bic && 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)19 lines›
validate-bic.wit
package root:component;

world root {
  export liberas:validate/bic@0.1.0;
}
package liberas:validate@0.1.0 {
  interface bic {
    record bic-parts {
      institution: string,
      country: string,
      location: string,
      branch: option<string>,
      test: bool,
    }

    parse: func(input: string) -> option<bic-parts>;
  }
}
Test vectors16›
validate-bic.cases.json
[
  {
    "args": {
      "input": "DEUTDEFF"
    }
  },
  {
    "args": {
      "input": "DEUTDEFF500"
    }
  },
  {
    "args": {
      "input": "NEDSZAJJXXX"
    }
  },
  {
    "args": {
      "input": "BOFAUS3N"
    }
  },
  {
    "args": {
      "input": "BNPAFRP0"
    }
  },
  {
    "args": {
      "input": "1234DEFF"
    }
  },
  {
    "args": {
      "input": "DEUT1EFF"
    }
  },
  {
    "args": {
      "input": "deutdeff"
    }
  },
  {
    "args": {
      "input": "DEUTDEF"
    }
  },
  {
    "args": {
      "input": "DEUTDEFF5"
    }
  },
  {
    "args": {
      "input": "DEUTDEFF50"
    }
  },
  {
    "args": {
      "input": "DEUTDEFF5000"
    }
  },
  {
    "args": {
      "input": "DEUT DEFF"
    }
  },
  {
    "args": {
      "input": "DEUTDEFF-500"
    }
  },
  {
    "args": {
      "input": ""
    }
  },
  {
    "args": {
      "input": "DEUTDEFÜ"
    }
  }
]
Verification6›
  • Outputs must match the private reference implementation bit for bit.
  • Cases are the spec's 16 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%.