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 & 127
        value >>= 7
        if value:
            byte |= 128
        else:
            more = False
        buf.append(byte)
    return bytes(buf)
