[[ ":$PATH:" != *":$HOME/.bky:"* ]] && export PATH="$PATH:$HOME/.bky" ln -sf "$HOME/.bky/bky-as-v0.1.0-beta.13" "$HOME/.bky/bky-as" ## Overview The [Blocky Compiler](https://github.com/blocky/compiler) supports building with cached dependencies for faster compilation times. Additionally, the [Blocky AS CLI](https://github.com/blocky/attestation-service-cli) provides a local non-TEE server that executes functions and returns mock attestations. Together, these functionalities allow developers to quickly and cheaply write functions for Blocky AS. > *By using these mechanisms you are potentially creating inconsistent WASM binaries and fake TEE attestations. Do not use these mechanisms in your production pipelines.* ## Cache Build Dependencies The Blocky Compiler is configured to use cached dependencies by default. The first compilation may be slow if you do not already have the necessary dependencies on your system, but subsequent builds use those cached dependencies and as a result take less time. See for yourself by building one of our examples: 1. Clone the Blocky AS [examples repository](https://github.com/blocky/attestation-service-examples/tree/release/v0.1.0-beta.13) and navigate to the `attest_fn_call` directory: git clone --branch main git@github.com:blocky/attestation-service-examples.git cd attestation-service-examples/attest_fn_call 2. Compile [main.go](https://github.com/blocky/attestation-service-examples/tree/release/v0.1.0-beta.13/attest_fn_call/main.go) twice and use a tool such as `time` to capture how long each compilation takes: ```bash time -f $'Build completed in %e seconds\n' bky-c build . ./main.wasm time -f $'Build completed in %e seconds\n' bky-c build . ./main.wasm ``` which outputs /usr/bin/time -f $'Build completed in %e seconds\n' bky-c build --reproducible . ./main.wasm 2>&1 /usr/bin/time -f $'Build completed in %e seconds\n' bky-c build . ./main.wasm 2>&1 When you are finished developing and wish to use your function in production, you should recompile with the `--reproducible` flag. This forces the compiler to download all dependencies regardless of whether they already exist on your system. bky-c build --reproducible . ./main.wasm ## Run a Local Non-TEE Server The Blocky AS CLI tool includes a non-TEE server implementation that provides the same WASM host functionalities that our real TEE-servers do. Our WASM environment allows your functions to log messages, make HTTP calls, verify attestations, and more. By using the local non-TEE server, you can test the behavior of your functions in our WASM environment without having to make calls to a real Blocky TEE server. To develop with a local non-TEE server, update the `host` string in your config to `"local-server"` as shown below: cat config.toml Now when you invoke `bky-as attest-fn-call`, a local non-TEE server is started that handles your function call instead of a Blocky AS TEE server. After executing your function, the server returns a mock attestation containing the function output and exits. These mock attestations will successfully verify with `bky-as verify-fn-call`, but remember they are not real TEE attestations. They are provided to ease development and testing, but do not come with any of the security, integrity, or confidentiality guarantees associated with real TEEs. > *The local server only works with the `attest-fn-call` and `verify-fn-call` commands. It does not work with the `plumbing` commands.* ## Next Steps You are now set up to quickly compile and test applications against a local Blocky AS server. For more information on our WASM runtime, see our [Limitations](/attestation-service/limitations) page. Check out our [examples repository](https://github.com/blocky/attestation-service-examples/tree/release/v0.1.0-beta.13) to see the different types of applications you can build with Blocky AS. rm -rf attestation-service-examples