print( f"====== Step2: try to build, sign and submit a transaction with ttl in the past (= tip - 1)" ) src_address = read_address_from_file(ADDRESSES_DIR_PATH, "user1") dst_address = created_addresses_dict.get(list(created_addresses_dict)[0])[0] transferred_amount = 1 signing_key = USER1_SKEY_FILE_PATH current_tip = get_current_tip() print(f"current_tip: {current_tip}") tx_ttl = current_tip - 1 print(f"tx_ttl: {tx_ttl}") tx_fee = calculate_tx_fee(1, 2, tx_ttl, signing_keys=[signing_key]) print(f"tx_fee: {tx_fee}") # create the list of transaction inputs input_utxo = get_utxo_with_highest_value(src_address) src_addr_highest_utxo_amount = input_utxo[2] input_utxos_list_for_tx = [str(input_utxo[0]) + "#" + str(input_utxo[1])] # create the list of transaction outputs change = src_addr_highest_utxo_amount - tx_fee - transferred_amount out_change_list = [ dst_address + "+" + str(transferred_amount), src_address + "+" + str(change) ] tx_body_file, tx_signed_file = None, None
) print(f"====== Step3: create 1 stake addresses registration cert") stake_addr_reg_cert_file = create_stake_addr_registration_cert( tmp_directory_for_script_files, stake_addr_vkey_file, addr_name) print( f"Stake address registration certificate created - {stake_addr_reg_cert_file}" ) print( f"====== Step4: send some funds from user1 (the faucet) to {addr_name}.addr" ) key_deposit = get_key_deposit() pool_deposit = get_pool_deposit() tx_ttl = calculate_tx_ttl() tx_fee = calculate_tx_fee(1, 2, tx_ttl, signing_keys=[USER1_SKEY_FILE_PATH]) src_address = USER1_ADDRESS dst_addresses_list = [addr] transferred_amounts_list = [ int(4 * tx_fee + key_deposit + pool_deposit + pool_pledge) ] signing_keys_list = [USER1_SKEY_FILE_PATH] src_add_balance_init = get_address_balance(src_address) dst_init_balance = get_address_balance(dst_addresses_list[0]) print( f"Send {transferred_amounts_list} Lovelace from {src_address} to {dst_addresses_list}" ) send_funds(src_address,
) print( f"====== Step2: Send funds from user1 (faucet) to {list(created_addresses_dict)[0]}" ) src_address = read_address_from_file(ADDRESSES_DIR_PATH, "user1") dst_addresses_list = [ created_addresses_dict.get(list(created_addresses_dict)[0])[0] ] print("Calculate the ttl for the funds transfer transaction") tx_ttl = calculate_tx_ttl() print("Calculate the tx fee for the funds transfer transaction") tx_fee = calculate_tx_fee(1, len(dst_addresses_list) + 1, tx_ttl, signing_keys=[USER1_SKEY_FILE_PATH]) transferred_amounts_list = [tx_fee + 2000] signing_keys_list = [USER1_SKEY_FILE_PATH] src_add_balance_init = get_address_balance(src_address) dst_init_balances = {} for dst_address in dst_addresses_list: dst_addr_balance = get_address_balance(dst_address) dst_init_balances[dst_address] = dst_addr_balance print( f"Send {transferred_amounts_list} Lovelace from {src_address} to {dst_addresses_list}" ) send_funds(src_address,