> ## Documentation Index
> Fetch the complete documentation index at: https://docs.boundless.network/llms.txt
> Use this file to discover all available pages before exploring further.

# Use a Proof

> After receiving a Boundless proof, you are ready to consume it in your app to access verifiable compute.

## Overview

After [requesting a proof](/developers/tutorials/request), the next step is to use that proof in the application's workflow.
The exact way proofs are used will vary depending on the architecture of the application.
However, there is a common pattern; once a proof is received from the Boundless market, the next step will be to verify that proof onchain.

<img src="https://mintcdn.com/boundless/4Kv5qykQFNwNQlTu/images/use-a-proof.png?fit=max&auto=format&n=4Kv5qykQFNwNQlTu&q=85&s=dbd9024b42c6e782e507383b867295d3" alt="Use a Proof" width="1920" height="1080" data-path="images/use-a-proof.png" />

It is recommended that the application contract calls the [RiscZeroVerifierRouter](https://dev.risczero.com/api/blockchain-integration/contracts/verifier) for verification.
This allows handling many types of proofs, and proof system versions seamlessly.
In Boundless, the seal, which is often a zk-STARK or SNARK, will usually be Merkle inclusion proof into an aggregated proof.
These Merkle inclusion proofs are cheap to verify, and reuse a cached verification result from a batch of proofs verified with a single SNARK.

## Proof Verification

The [Boundless Foundry Template](https://github.com/boundless-xyz/boundless-foundry-template), walks through a simple application which, with an input number, *x*:

1. Uses a simple guest program to check if *x* is even.
2. Requests, and receives, a proof of *x* being even from the Boundless Market.
3. Calls the `set` function on the `EvenNumber` smart contract with the arguments: *x* and the seal (the proof bytes).
4. The `set` function verifies the proof that *x* is even; if the proof is valid, the `number` variable (in smart contract state) is set to equal *x*.

Concretely, receiving the proof ([see code](https://github.com/boundless-xyz/boundless-foundry-template/blob/main/apps/src/main.rs)) from the Boundless Market returns a journal and a seal:

```rust theme={null}
let fulfillment = boundless_client
    .wait_for_request_fulfillment(request_id, Duration::from_secs(5), expires_at)
    .await?;
```

Using Alloys [sol! Macro](https://alloy.rs/contract-interactions/using-sol%21/), the rust types/bindings are generated for the [`EvenNumber.sol`](https://github.com/boundless-xyz/boundless-foundry-template/blob/main/contracts/src/EvenNumber.sol) contract.
To create an `EvenNumber` contract instance:

```rust theme={null}
let even_number = IEvenNumber::new(
    args.even_number_address,
    boundless_client.provider().clone(),
);
```

To call the `set` function on the `EvenNumber` contract, a “set number” transaction is created:

```rust theme={null}
let set_number = even_number
    .set(U256::from(args.number), seal)
    .from(boundless_client.caller());
```

Finally, this transaction is broadcasted with:

```rust theme={null}
let pending_tx = set_number.send().await.context("failed to broadcast tx")?;
let tx_hash = pending_tx
    .with_timeout(Some(TX_TIMEOUT))
    .watch()
    .await
    .context("failed to confirm tx")?;
tracing::info!("Tx {:?} confirmed", tx_hash);
```

Definition of the `set` function on [`EvenNumber.sol`](https://github.com/boundless-xyz/boundless-foundry-template/blob/main/contracts/src/EvenNumber.sol):

```solidity [EvenNumber.sol] theme={null}
/// @notice Set the even number stored on the contract. Requires a RISC  Zero proof that the number is even.
function set(uint256 x, bytes calldata seal) public {
  bytes memory journal = abi.encode(x);
  verifier.verify(seal, imageId, sha256(journal));
  number = x;
}
```

Calling the [`set` function](https://github.com/boundless-xyz/boundless-foundry-template/blob/main/contracts/src/EvenNumber.sol) will verify the proof via the [RISC Zero verifier contract](https://dev.risczero.com/api/blockchain-integration/contracts/verifier).
The `verify` call will revert if the proof is invalid, otherwise the number variable will be updated to x, which is now certainly even.

Each application will have its own requirements and flows, but this is a common pattern and a good starting point for building your own application.

<Check>
  Relevant links: [Boundless Foundry Template](https://github.com/boundless-xyz/boundless-foundry-template/tree/main), [Journal](https://dev.risczero.com/terminology#journal), [Seal](https://dev.risczero.com/terminology#seal)
</Check>
