<p>According to the <a href="https://github.com/OpenAssets/open-assets-protocol/blob/master/specification.mediawiki" rel="nofollow">Open Assets Protocol Spec</a>, the amounts are encoded in something called the <a href="https://en.wikipedia.org/wiki/LEB128" rel="nofollow">unsigned LEB128</a> encoding. So for 300 the binary looks like:</p>

<p>100101100</p>

<p>You have to pad to a multiple of 7 (we have 9 bits, so this becomes 14):</p>

<p>00000100101100</p>

<p>Now split into groups of 7:</p>

<p>0000010 0101100</p>

<p>Add in a 0 bit for the very first one, and 1 for every other group of 7:</p>

<p>00000010 10101100</p>

<p>In hex, this is:</p>

<p>0x02 0xac</p>

<p>Put this in Little Endian order:</p>

<p>0xac 0x02</p>

<p>You can do the same for the 624,485 number and get the 0xe5 0x8e 0x26.</p>

CC BY-SA 3.0
2015-11-22T15:03:05.343Z
2015-11-22T15:03:05.343Z
Jimmy Song
<p>I'm studying open asset protocol, however I have no idea how to read asset quantity list.</p>

<p>The Open Assets Protocol documentation tells that data in marker output </p>

<pre><code>0xac 0x02 0x00 0xe5 0x8e 0x26
</code></pre>

<p>means </p>

<pre><code>The asset quantity list:
                                   - '0xac 0x02' means output 0 has an asset quantity of 300.
                                   - Output 1 is skipped and has an asset quantity of 0
                                     because it is the marker output.
                                   - '0x00' means output 2 has an asset quantity of 0.
                                   - '0xe5 0x8e 0x26' means output 3 has an asset quantity of 624,485.
                                   - Outputs after output 3 (if any) have an asset quantity of 0."
</code></pre>

<p>Could you tell me how they calculate quantity of assets by the marker output?
I thought that 0xac is 13(c)*16^0 + 10(a)*16^1 = 173, but it seems the idea is not correct.</p>

<op-return><open-assets>
How to read the asset quantity list of open asset protocol?
Toshi
# How to read the asset quantity list of open asset protocol?

(Asked by: username_0 on 2015-11-22)

I'm studying open asset protocol, however I have no idea how to read asset quantity list.

The Open Assets Protocol documentation tells that data in marker output

```
0xac 0x02 0x00 0xe5 0x8e 0x26

```

means

```
The asset quantity list:
                                   - '0xac 0x02' means output 0 has an asset quantity of 300.
                                   - Output 1 is skipped and has an asset quantity of 0
                                     because it is the marker output.
                                   - '0x00' means output 2 has an asset quantity of 0.
                                   - '0xe5 0x8e 0x26' means output 3 has an asset quantity of 624,485.
                                   - Outputs after output 3 (if any) have an asset quantity of 0."

```

Could you tell me how they calculate quantity of assets by the marker output?
I thought that 0xac is 13(c)\*16^0 + 10(a)\*16^1 = 173, but it seems the idea is not correct.

**Tags:** op-return, open-assets


---

## 1 answers

### Answer by username_1 on 2015-11-22. Score: 2 | Accepted answer

According to the [Open Assets Protocol Spec](https://github.com/OpenAssets/open-assets-protocol/blob/master/specification.mediawiki), the amounts are encoded in something called the [unsigned LEB128](https://en.wikipedia.org/wiki/LEB128) encoding. So for 300 the binary looks like:

100101100

You have to pad to a multiple of 7 (we have 9 bits, so this becomes 14):

00000100101100

Now split into groups of 7:

0000010 0101100

Add in a 0 bit for the very first one, and 1 for every other group of 7:

00000010 10101100

In hex, this is:

0x02 0xac

Put this in Little Endian order:

0xac 0x02

You can do the same for the 624,485 number and get the 0xe5 0x8e 0x26.


---

