# Asset quantities in StarkEx

In the Ethereum blockchain, token quantities are represented by a 256-bit number. However, for the sake of efficiency, quantities in StarkEx are represented by a 64-bit number. The largest number of digits that a 64-bit number can represent is much less than that which a 256-bit number can represent. So in order to support trading in significant volume, the smallest unit that StarkEx can use for an asset is larger than the smallest unit that Ethereum can use.

The inputs to all offchain transactions and some onchain requests are given in units of the offchain asset, so the code that generates the transaction signature must use the correct factor for converting 256-bit quantities of onchain asset quantities to a 64-bit StarkEx representation.

 Converting onchain asset quantities This factor is called the quantization factor or quantum. The quantum represents the smallest amount of an asset that users can trade offchain, or with which they can pay offchain fees.

You decide the value of the quantum according to the requirements of your application’s business logic.

## Quantization

The quantum is the smallest unit of a token in the StarkEx system. It is similar to an exchange rate that you use to find the onchain value of a quantity of a token in StarkEx, according to the following formula:

$\text{quantum} \cdot \text{StarkEx_amount} = \text{onchain_amount}$
Example: Defining the quantum

Consider one possible quantization for ETH, which is an onchain asset:

 Onchain asset The smallest unit of ETH is 1 WEI, which is $10^{-18}$ ETH. Offchain asset The smallest unit with which you can conduct transactions of the offchain asset that corresponds to ETH represents $10^{-11}$ onchain ETH, or $10^{7}$ onchain WEI.

So the operator defines the quantum for ETH to be $10^{7}$.

Example: Calculating the amount of an onchain asset

This example shows how to find how many units of onchain WEI are represented by 17 units of the corresponding offchain asset.

• In Ethereum, 1 WEI = $10^{-18}$ETH.

• Let $\text{quantum}=10^7$.

• Let $\text{StarkEx_amount}=17$. This is the number of corresponding assets in a StarkEx offchain vault.

Plugging in these values to the formula above gives the following:

$10^7 \cdot 17 = 170,000,000$

170,000,000 is the amount of WEI locked onchain that is associated with the corresponding StarkEx offchain vault, which is the same as $10^{-11} \cdot 17$ ETH.

 The quantum is necessary for every asset that can be represented onchain. For example, in the deposit flow, the onchain deposit transaction gets an unquantized amount of tokens from the user, yet the parameter to the onchain call is a quantized amount.