# Service Bus

## Overview of the ConfidentialServiceBus Contract

The `ConfidentialServiceBus` is a critical part of the NotVault SDK. Its core functionality lies in providing a confidential service bus that makes use of a zkSNARK verifier to ensure the creator of the message knows the value of the hash being published.

### Contract Structure

The `ConfidentialServiceBus` contract encompasses the following main components:

1. **Events**:
   * `set_value`: An event emitted when a new value is set, including the owner's address, the key, the value, and the block timestamp.
2. **Functions**:
   * `getValue`: A view function that retrieves a value from `valuesMap` using an owner's address and a key.
   * `setValue`: A function that verifies a zkSNARK proof and then sets a value in the `valuesMap`. It emits the `set_value` event.

### Functions Description

* **getValue Function**

  This function retrieves a value from the `valuesMap` for a given owner and a key. It is a view function and hence does not alter the state of the contract. The function signature is as follows:

  ```solidity
  function getValue(address owner, uint256 key) public view returns (uint256);
  ```
* **setValue Function**

  This function sets a value in the `valuesMap` after verifying a provided zkSNARK proof. It emits a `set_value` event that contains the owner's address, the key, the value, and the block timestamp. The function signature is:

  ```solidity
  function setValue(bytes calldata proof, uint[2] memory input) public;
  ```

This contract provides a confidential service bus using the power of zkSNARKs and an EVM compatible blockchain. This approach ensures that the data's integrity is maintained while keeping the original value confidential, hence the name `ConfidentialServiceBus`.
