def multi_input(height):
    txes = rpc_command(height)
    all_addr = list()
    for tx in txes:
        tx_indexes = dq.get_txid(tx)
        in_addrs = dq.get_addr_txin(tx_indexes)
        out_addrs = dq.get_addr_txout(tx_indexes)
        
        if is_mi_cond(in_addrs, out_addrs):
            first_addr = in_addrs.pop()
            while len(in_addrs) > 0:
                second_addr = in_addrs.pop()      
                addr_set = make_addr_set(first_addr, second_addr)
                all_addr.append(addr_set)
                
    return all_addr
Esempio n. 2
0
def one_time_change(height):
    txes = rpc_command(height)
    all_addr = list()
    for tx in txes:
        tx_index = dq.get_txid(tx)
        in_addrs = dq.get_addr_txin(tx_index)
        out_addrs = dq.get_addr_txout(tx_index)

        if is_mi_cond(in_addrs, out_addrs):
            first_addr = in_addrs.pop()
            while len(in_addrs) > 0:
                second_addr = in_addrs.pop()
                addr_set = make_addr_set(first_addr, second_addr)
                all_addr.append(addr_set)

            is_utxo, utxo_addrs = get_utxo(tx_index)
            if is_utxo:
                #print("UTXO:", utxo_addrs)
                otc_addr = is_otc_cond(in_addrs, utxo_addrs, tx_index)
                if otc_addr is not None:
                    #print("OTC:", otc_addr)

                    all_addr.append(make_addr_set(first_addr, otc_addr))
    return all_addr
Esempio n. 3
0
def multi_input(height):
    cluster_dict = dict()
    txes = rpc_command(height)
    max_cluster_num = 0
    mi_addr = set()
    all_addr = set()
    for tx in txes:
        tx_indexes = dq.get_txid(tx)
        in_addrs = dq.get_addr_txin(tx_indexes)
        out_addrs = dq.get_addr_txout(tx_indexes)

        if is_mi_cond(in_addrs, out_addrs):
            #print(tx, in_addrs)

            ##### update cluster dict #################
            '''
            1. cluster_dict의 key와 item을 돌면서
            2. 현재 만들어진 address_set과 교집합이 있는가? 판단
            3. 교집합이 있다면 그 집합에 넣을것
            4. 교집합이 없다면 cluster 번호를 새로 만들것
            '''
            need_new_cls_num = True
            for key, addr_set in cluster_dict.items():
                if len(addr_set & in_addrs) > 0:
                    cluster_dict[key] = cluster_dict[key].union(in_addrs)
                    need_new_cls_num = False
                    break
            if need_new_cls_num:
                if len(cluster_dict.keys()) == 0:
                    cls_num = 0
                else:
                    cls_num_set = sorted(list(cluster_dict.keys()))
                    cls_num = cls_num_set[-1] + 1
                cluster_dict.update({cls_num: in_addrs})
            ############################################
    return cluster_dict