def get_input_addresses(unsigned_tx):
    """
    Helper function to get the addresses needed used in an unsigned transaction.
    You will next have to retrieve the keys for these addreses in order to sign.

    Depending on how they are generated, unsigned transactions often use
    inputs whose address would be hard to know in advance, hence this step.

    Note:
    - if the same address is used in multiple inputs, it will be returned multiple times
    - this funciton does not work for p2sh inputs
    """
    addresses = []
    for input_obj in unsigned_tx['tx']['inputs']:
        addresses.append(input_obj['addresses'][0])
    return addresses
