Skip to content
Last updated

Overview

The Blocky AS CLI tool provides a local non-TEE server that executes functions and provides mock attestations. This is useful for cost savings and quick local development loops. If you would like to run your functions on genuine TEEs, however, we also offer free developer API keys that are preloaded with 500 complimentary calls. Follow the steps below to claim a key and configure the Blocky AS CLI to communicate with our production servers.

Get a Developer API Key

  1. Head over to our Developer Portal and sign-up to claim your free API key.

  2. Add your API key to the example config.toml:

    BKY_AS_API_KEY=your_api_key_here
    sed -i -e "s|^\(auth_token *= *\)\".*\"|\1\"$BKY_AS_API_KEY\"|" config.toml
  3. Fetch the TEE platform and Blocky AS server code measurement for the latest release and add it to the config:

    MEASUREMENT=$(curl -s https://docs.blocky.rocks/v0.1.0-beta.13/code_measurement.toml)
    PLATFORM=$(echo "$MEASUREMENT" | yq -p toml '.code_measurement[0].platform')
    CODE=$(echo "$MEASUREMENT" | yq -p toml '.code_measurement[0].code')
    sed -i '/acceptable_measurements = \[/,/\]/c\
    acceptable_measurements = [\
    { platform = "'"$PLATFORM"'", code = "'"$CODE"'" },\
    ]' config.toml
  4. Update the host to the latest release URL:

    sed -i 's|^host = .*|host = "https://api.bky.sh/prod/delphi/v0.1.0-beta.13"|' config.toml
  5. Your config should now resemble:

    # a set of acceptable server enclave measurements for CLI to interact with
    acceptable_measurements = [
    { platform = "", code = "" },
    ]
    # token authorizing CLI's access to the server
    auth_token = "your_api_key_here"
    
    # the server that the CLI interacts with.
    # `local-server` is a special host value that will start a local attestation
    # service server for testing and development. To interact with a production
    # server, replace `local-server` with the appropriate server endpoint.
    host = "https://api.bky.sh/prod/delphi/v0.1.0-beta.13"
  6. Re-run our example function and you should now see that it was executed by one of our production Blocky AS servers on a real TEE platform:

    cat fn-call.json | bky-as attest-fn-call > out.json
    jq -r ".enclave_attested_application_public_key.claims.enclave_measurement" out.json

    which outputs

    {
      "platform": "nitro",
      "code": "933fdfbf5a849ed07c0a8201f8813b8ab976f72e93722b3e4a28dbb41d2741fb581604845b6272b04a0fa5a8b59647bd.4b4d5b3661b3efc12920900c80e126e4ce783c522de6c02a2a5bf7af3a2b9327b86776f188e4be1c1c404a129dbda493.7e1fadfbec59aba9d45e3042fd322d5e61b3e849d7c7ea20084d946fce976d48773ae723c0e57e2d6311ff3667a3a8b5"
    }

Next Steps

If you would like to purchase additional API calls contact us via email for subscription pricing and details. Additionally, join our Discord server if you have general questions about setup and tool usage.