---
# System prepended metadata

title: Rust Engineer Interview Task

---

# Rust Engineer Interview Task

This document outlines a take-home assignment for the Rust Engneer position at Bilinear Labs.

## Important Information

* The task should take no more than 3 hours to complete. Please report the total time spent and a breakdown of how that time was used.
* You are expected to ask questions. Some parts are intentionally left ambiguous.
* You are encouraged to use AI tools during the task.

## The Task
Implement a service called `merkle-tree-service` in Rust that manages a Merkle Tree. The Merkle Tree shall:
* Be incremental. Meaning that only appending leaves is allowed. No modifications nor removal are allowed.
* Have fixed depth. The tree shall have a fixed depth of 32. No matter how many leaves were inserted. Consider the empty leaves to be zero.

The service shall have the following endpoints:
* `/add-leaf`: Adds a single `leaf` to the Merkle Tree.
* `/add-leaves`: Adds multiple leaves to the Merkle Tree.
* `/get-num-leaves` Returns the number of leaves in the Merkle Tree.
* `/get-root`: Returns the Merkle root of the tree.
* `/get-proof`: Returns the Merkle proof for the leaf at the given `index`.

## Deliverables
* The AI model(s) you used and the prompts.
* The code, along with a README explaining how to use the service. Please share it via a **private** GitHub repository.
