# Zalary

## Introduction

Zalary is salary payment platform that allows employees to get confidentially paid whenever they want. Some of the features of Zalary include

• Confidential payments using Aztec protocol.
• Get paid as often as every block.
• Easy to use.
• Ability to prove your salary onchain.
• Employers can add funds in fiat or crypto (convert using wyre)
• Employees can withdraw funds in fiat or crypto (convert using wyre)
• Beutiful and easy to use UI

### Upcoming stuff

• Convert between different cryptos using Airswap/0x/Uniswap
• UI for confidential payments (Waiting for metamask support)
• Integration with something like compound to allow employers/employees to directly invest their money.

### Confidentiality

We are using two types of Zero Knowledge proofs for payment streaming. The first is dividend computation proof in Aztect that proves that

``````note[1].value * za = note[2].value * zb + note[3].value
``````

In our systen, we are proving that.

``````TS * PD = PA * TD + RV
``````

Where

• TS = Total salary of the employee. It is stored in a confidential note in the smart contract.
• PD = Payment Duration. It is the duration for which the employee wants to withdraw salary. It is provided by the employee in an unencrypted form.
• PA = Payment Amount. It is the amount that the employee is trying to withdraw for duration of PD. It is kept in a secret note generated by the employee and sent to the smart contract.
• TD = Total duration over which the employee is will be given the total salary. It is public information.
• RV = Residual Value is stored in secret note generated by the employer as is needed only for mathematical approximation. Employee is incentivized to try to minimize this and hence only use it for rounding off.

The above equation can also be read

``````Total salary = Payment Amount * Total duration / Payment Duration + Residue Value
``````

This proof proves that the amount that the employee is trying to withdraw is correct. For actually withdrawing the amound, we need to another proof. We'll be using Aztec's Join and split proofs that proove that a note can be split into two parts and the parts can be transfered individually. We keep the current balance of contract in a note and use this proof to split it into two notes. One note is salary being currently withdrawn and is transferred to the employee. The other part is the new remaining balance and is kept as it is.