Given an unsigned serialized transaction, add more inputs and outputs to it.
    @new_inputs and @new_outputs will be virtualchain-formatted:
    * new_inputs[i] will have {'outpoint': {'index':..., 'hash':...}, 'script':..., 'witness_script': ...}
    * new_outputs[i] will have {'script':..., 'value':... (in fundamental units, e.g. satoshis!)}

def btc_tx_extend(partial_tx_hex, new_inputs, new_outputs, **blockchain_opts):
    """
    Given an unsigned serialized transaction, add more inputs and outputs to it.
    @new_inputs and @new_outputs will be virtualchain-formatted:
    * new_inputs[i] will have {'outpoint': {'index':..., 'hash':...}, 'script':..., 'witness_script': ...}
    * new_outputs[i] will have {'script':..., 'value':... (in fundamental units, e.g. satoshis!)}
    """

    # recover tx
    tx = btc_tx_deserialize(partial_tx_hex)
    tx_inputs, tx_outputs = tx['ins'], tx['outs']
    locktime, version = tx['locktime'], tx['version']

    tx_inputs += new_inputs
    tx_outputs += new_outputs

    new_tx = {
        'ins': tx_inputs,
        'outs': tx_outputs,
        'locktime': locktime,
        'version': version,
    }

    new_unsigned_tx = btc_tx_serialize(new_tx)
    return new_unsigned_tx