Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 75 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,75 @@
# tbot
### T3rnBot - Bot Auto Bridge Multi-Chain (Arbitrum Sepolia, OP Sepolia, Blast Sepolia, Base Sepolia)

T3rnBot adalah bot otomatis yang melakukan bridging token di antara beberapa jaringan, termasuk
Arbitrum Sepolia, OP Sepolia, Blast Sepolia, dan Base Sepolia. Bot ini dirancang untuk memudahkan
transfer token antarjaringan dengan cepat dan efisien.


### Fitur
- **Auto Bridging Multi-Chain:** Mengotomatisasi proses bridging dari Arbitrum Sepolia, OP Sepolia,
Blast Sepolia, dan Base Sepolia.
- **Notifikasi Transaksi Real-Time:** Menampilkan hasil transaksi yang berhasil secara real-time
dengan detail seperti hash transaksi, jumlah ETH yang dikirim, dan total transaksi yang sukses.
- **Penandaan Jaringan dengan Warna:** Output menampilkan warna berbeda untuk setiap jaringan
(Arbitrum, OP, Blast, Base) agar mudah diidentifikasi.
- **Pengecekan Koneksi Jaringan:** Bot akan memeriksa apakah terhubung ke setiap jaringan sebelum
memulai proses bridging.
- **Retry Transaksi:** Jika ada kegagalan dalam perkiraan gas atau pengiriman transaksi, bot akan
menampilkan pesan kesalahan.

### Instalasi

1. Clone repository ini ke lokal Anda:

```bash
git clone https://github.com/hnfdm/tbot-asc.git
```

2. Masuk ke direktori proyek:
```bash
cd tbot-asc
```

3. Install dependencies yang diperlukan:
```bash
pip install web3 eth_account
```

### Konfigurasi

1. Ganti `private_keys`, `my_addresses`, dan `labels` dengan pk dan address di file `config.py`.

2. Atur rpc dan ca di file `config.py` sesuai dengan jaringan yang ingin Anda gunakan.

3. Masukkan data hex pada `config.py` dengan cara lakukan swap manual & copy HEX.

### Cara Penggunaan

1. Jalankan bot dengan perintah berikut:

```bash
python t3rn.py
```

2. Bot akan secara otomatis melakukan bridging antarjaringan sesuai dengan konfigurasi yang telah diatur.

### FAQ

- Q: "Pip install error?"
- A: "Pake virtual environtment"
```bash
python3 -m venv t3rn
```
```bash
source t3rn/bin/activate
```

- Q: "Error estimating gas...R07..." / "BRN ga sinkron?"
- A: "Ganti HEX dengan punya kalian & pastikan dari transaksi yang sudah berhasil"

### Catatan
- Jangan lupa pakein screen/tmux.
- Pastikan saldo yang cukup tersedia di setiap jaringan sebelum memulai bridging.

### Acknowledgements
- Inspired by [airdropinsiders](https://github.com/airdropinsiders)
39 changes: 39 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
data_bridge = {
"ARB - BASE": '0x56591d5962737370000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000dd76822450987d8e929f17ae50e7d9f0b99fbb960000000000000000000000000000000000000000000000001628f91136a77ce00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016345785d8a00000',
"ARB - OP": '0x56591d596f707370000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000dd76822450987d8e929f17ae50e7d9f0b99fbb960000000000000000000000000000000000000000000000001628f90e8e8ef7f90000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016345785d8a00000',

"OP - ARB": '0x56591d5961726274000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000dd76822450987d8e929f17ae50e7d9f0b99fbb960000000000000000000000000000000000000000000000001628f90e8ff11d210000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016345785d8a00000',
"OP - BASE": '0x56591d5962737370000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000dd76822450987d8e929f17ae50e7d9f0b99fbb960000000000000000000000000000000000000000000000001628f91136a77ce00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016345785d8a00000',

"BASE - OP": '0x56591d596f707370000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000dd76822450987d8e929f17ae50e7d9f0b99fbb960000000000000000000000000000000000000000000000001628f90e8e8ef7f90000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016345785d8a00000',
"BASE - ARB": '0x56591d5961726274000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000dd76822450987d8e929f17ae50e7d9f0b99fbb960000000000000000000000000000000000000000000000001628f90e8ff11d210000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016345785d8a00000',
}

networks = {
'ARB Sepolia': {
'rpc_url': 'https://arb-sepolia.g.alchemy.com/v2/xYu4WpjXgnrRuWucBGGiWzXeott18G-9',
'chain_id': 421614,
'contract_address': '0x8D86c3573928CE125f9b2df59918c383aa2B514D'
},
'OP Sepolia': {
'rpc_url': 'https://opt-sepolia.g.alchemy.com/v2/Xr-VU76P_nl32pDDXh102_x6zRQsxxaV',
'chain_id': 11155420,
'contract_address': '0xF221750e52aA080835d2957F2Eed0d5d7dDD8C38'
},
'Blast Sepolia': {
'rpc_url': 'https://blast-sepolia.g.alchemy.com/v2/Gv98S5D61xGly9QOcYhtmVMKOM5g06rT',
'chain_id': 168587773,
'contract_address': '0x1D5FD4ed9bDdCCF5A74718B556E9d15743cB26A2'
},
'Base Sepolia': {
'rpc_url': 'https://base-sepolia.g.alchemy.com/v2/ia2mGIJ9XRc2xrsJOsyrjU5QkoVqCvtu',
'chain_id': 84532,
'contract_address': '0x30A0155082629940d4bd9Cd41D6EF90876a0F1b5'
}
}

private_keys = ['pk']

my_addresses = ['0xDD76822450987d8e929F17aE50e7D9f0B99fBB96']

labels = ['WalletX']
13 changes: 0 additions & 13 deletions data_bridge.py

This file was deleted.

13 changes: 0 additions & 13 deletions keys_and_addresses.py

This file was deleted.

24 changes: 0 additions & 24 deletions network_config.py

This file was deleted.

73 changes: 33 additions & 40 deletions t3rn-bot.py → t3rn.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
from eth_account import Account
import time
import os
from data_bridge import data_bridge
from keys_and_addresses import private_keys, my_addresses, labels
from network_config import networks
from config import networks, private_keys, my_addresses, labels, data_bridge
import codecs

# Fungsi untuk memusatkan teks
Expand Down Expand Up @@ -36,7 +34,7 @@ def clear_terminal():
"""

chain_symbols = {
'Arbitrum Sepolia': '\033[34m',
'ARB Sepolia': '\033[34m',
'OP Sepolia': '\033[91m',
'Blast Sepolia': '\033[93m',
'Base Sepolia': '\033[96m'
Expand All @@ -47,7 +45,7 @@ def clear_terminal():
menu_color = '\033[95m'

explorer_urls = {
'Arbitrum Sepolia': 'https://sepolia.arbiscan.io/tx/',
'ARB Sepolia': 'https://sepolia.arbiscan.io/tx/',
'OP Sepolia': 'https://sepolia-optimism.etherscan.io/tx/',
'Blast Sepolia': 'https://testnet.blastscan.io/tx/',
'Base Sepolia': 'https://sepolia.basescan.org/tx/',
Expand All @@ -61,7 +59,7 @@ def get_brn_balance(web3, my_address):
def send_bridge_transaction(web3, account, my_address, data, network_name):
my_address = Web3.to_checksum_address(my_address) # Mengonversi alamat ke format checksum
nonce = web3.eth.get_transaction_count(my_address, 'pending')
value_in_ether = 0.8
value_in_ether = 1.6
value_in_wei = web3.to_wei(value_in_ether, 'ether')

try:
Expand Down Expand Up @@ -100,12 +98,9 @@ def send_bridge_transaction(web3, account, my_address, data, network_name):
try:
tx_hash = web3.eth.send_raw_transaction(signed_txn.raw_transaction)
tx_receipt = web3.eth.wait_for_transaction_receipt(tx_hash)

balance = web3.eth.get_balance(my_address)
formatted_balance = web3.from_wei(balance, 'ether')

brn_balance = get_brn_balance(Web3(Web3.HTTPProvider('https://brn.rpc.caldera.xyz/http')), my_address)

explorer_link = f"{explorer_urls[network_name]}{web3.to_hex(tx_hash)}"

print(f"{green_color} Alamat Pengirim: {account.address}")
Expand Down Expand Up @@ -133,12 +128,10 @@ def process_network_transactions(network_name, bridges, chain_data, successful_t
if result:
tx_hash, value_sent = result
successful_txs += 1

if value_sent is not None:
print(f"{chain_symbols[network_name]} Total Tx Sukses: {successful_txs} | {labels[i]} | Bridge: {bridge} | Jumlah Bridge: {value_sent:.5f} ETH ✅{reset_color}\n")
else:
print(f"{chain_symbols[network_name]} Total Tx Sukses: {successful_txs} | {labels[i]} | Bridge: {bridge} ✅{reset_color}\n")

print(f"{'='*150}")
print("\n")
time.sleep(3)
Expand All @@ -150,9 +143,9 @@ def display_menu():
print("")
print(f"{chain_symbols['OP Sepolia']}1. OP -> BASE Sepolia{reset_color}")
print(f"{chain_symbols['Base Sepolia']}2. BASE -> OP Sepolia{reset_color}")
print(f"{chain_symbols['Arbitrum Sepolia']}3. BASE -> Arbitrum Sepolia{reset_color}")
print(f"{chain_symbols['Arbitrum Sepolia']}4. Arbitrum -> BASE Sepolia{reset_color}")
print(f"{menu_color}5. Run all transactions repeatedly..recommended.. {reset_color}")
print(f"{chain_symbols['ARB Sepolia']}3. BASE -> ARB Sepolia{reset_color}")
print(f"{chain_symbols['ARB Sepolia']}4. ARB -> BASE Sepolia{reset_color}")
print(f"{menu_color}5. Run All & Looping (Recommended) {reset_color}")
print("")
choice = input("choose (1-5): ")
return choice
Expand All @@ -176,53 +169,53 @@ def main():
print(f"{menu_color}Jalankan transaksi OP -> BASE Sepolia secara terus-menerus...{reset_color}")
while True:
successful_txs = process_network_transactions('OP Sepolia', ["OP - BASE"], networks['OP Sepolia'], successful_txs)
print("Wait 10 Second for Safety (OP -> BASE)...")
time.sleep(10)
print("Wait 5s for Safety (OP -> BASE)...")
time.sleep(5)

elif choice == '2':
print(f"{menu_color}Jalankan transaksi BASE -> OP Sepolia secara terus-menerus...{reset_color}")
while True:
successful_txs = process_network_transactions('Base Sepolia', ["BASE - OP"], networks['Base Sepolia'], successful_txs)
print("Wait 10 Second for Safety (BASE -> OP)...")
time.sleep(10)
print("Wait 5s for Safety (BASE -> OP)...")
time.sleep(5)

elif choice == '3':
print(f"{menu_color}Jalankan transaksi BASE -> Arbitrum Sepolia secara terus-menerus...{reset_color}")
print(f"{menu_color}Jalankan transaksi BASE -> ARB Sepolia secara terus-menerus...{reset_color}")
while True:
successful_txs = process_network_transactions('Base Sepolia', ["BASE - Arbitrum"], networks['Base Sepolia'], successful_txs)
print("Wait 10 Second for Safety (BASE -> Arbitrum)...")
time.sleep(10)
successful_txs = process_network_transactions('Base Sepolia', ["BASE - ARB"], networks['Base Sepolia'], successful_txs)
print("Wait 5s for Safety (BASE -> ARB)...")
time.sleep(5)

elif choice == '4':
print(f"{menu_color}Jalankan transaksi Arbitrum -> BASE Sepolia secara terus-menerus...{reset_color}")
print(f"{menu_color}Jalankan transaksi ARB -> BASE Sepolia secara terus-menerus...{reset_color}")
while True:
successful_txs = process_network_transactions('Arbitrum Sepolia', ["Arbitrum - BASE"], networks['Arbitrum Sepolia'], successful_txs)
print("Wait 10 Second for Safety (Arbitrum -> BASE)...")
time.sleep(10)
successful_txs = process_network_transactions('ARB Sepolia', ["ARB - BASE"], networks['ARB Sepolia'], successful_txs)
print("Wait 5s for Safety (ARB -> BASE)...")
time.sleep(5)

elif choice == '5':
print(f"{menu_color}Jalankan transaksi secara terus-menerus dari OP -> BASE, BASE -> OP, BASE -> Arbitrum, Arbitrum -> BASE{reset_color}")
print(f"{menu_color}Jalankan transaksi secara terus-menerus dari OP -> BASE, BASE -> OP, BASE -> ARB, ARB -> BASE{reset_color}")
while True:
successful_txs = process_network_transactions('OP Sepolia', ["OP - BASE"], networks['OP Sepolia'], successful_txs)
print("Wait 10 Second for Safety (OP -> BASE)...")
time.sleep(10)
print("Wait 5s for Safety (OP -> BASE)...")
time.sleep(5)

successful_txs = process_network_transactions('Base Sepolia', ["BASE - OP"], networks['Base Sepolia'], successful_txs)
print("Wait 10 Second for Safety (BASE -> OP)...")
time.sleep(10)
print("Wait 5s for Safety (BASE -> OP)...")
time.sleep(5)

successful_txs = process_network_transactions('Base Sepolia', ["BASE - Arbitrum"], networks['Base Sepolia'], successful_txs)
print("Wait 10 Second for Safety (BASE -> Arbitrum)...")
time.sleep(10)
successful_txs = process_network_transactions('Base Sepolia', ["BASE - ARB"], networks['Base Sepolia'], successful_txs)
print("Wait 5s for Safety (BASE -> ARB)...")
time.sleep(5)

successful_txs = process_network_transactions('Arbitrum Sepolia', ["Arbitrum - BASE"], networks['Arbitrum Sepolia'], successful_txs)
print("Wait 10 Second for Safety (Arbitrum -> BASE)...")
time.sleep(10)
successful_txs = process_network_transactions('ARB Sepolia', ["ARB - BASE"], networks['ARB Sepolia'], successful_txs)
print("Wait 5s for Safety (ARB -> BASE)...")
time.sleep(5)

except Exception as e:
print(f"Terjadi kesalahan: {e}")
print("Wait 5 Second for Safety...")
time.sleep(5)
print(f"Error cok ^^ {e}")
print("Wait 10s for Safety...")
time.sleep(10)

if __name__ == "__main__":
main()