def forge_nat(value) -> bytes:
    """
    Encode a number using LEB128 encoding (Zarith)
    :param int value: the value to encode
    :return: encoded value
    :rtype: bytes
    """
    if value < 0:
        raise ValueError('Value cannot be negative.')

    buf = bytearray()
    more = True

    while more:
        byte = value & 0x7f
        value >>= 7

        if value:
            byte |= 0x80
        else:
            more = False

        buf.append(byte)

    return bytes(buf)