# 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 off-chain transactions and some on-chain requests are given in units of the off-chain asset, so the code that generates the transaction signature must use the correct factor for converting 256-bit quantities of on-chain asset quantities to a 64-bit StarkEx representation.

 Converting on-chain asset quantities This factor is called the quantization factor or quantum. The quantum represents the smallest amount of an asset that users can trade off-chain, or with which they can pay off-chain 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 on-chain value of a quantity of a token in StarkEx, according to the following formula:

$\text{quantum} \cdot \text{StarkEx_amount} = \text{on-chain_amount}$
Example: Defining the quantum

Consider one possible quantization for ETH, which is an on-chain asset:

 On-chain asset The smallest unit of ETH is 1 WEI, which is $10^{-18}$ ETH. Off-chain asset The smallest unit with which you can conduct transactions of the off-chain asset that corresponds to ETH represents $10^{-11}$ on-chain ETH, or $10^{7}$ on-chain WEI.

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

Example: Calculating the amount of an on-chain asset

This example shows how to find how many units of on-chain WEI are represented by 17 units of the corresponding off-chain 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 off-chain 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 on-chain that is associated with the corresponding StarkEx off-chain vault, which is the same as $10^{-11} \cdot 17$ ETH.

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