forked from zaivanza/binance-withdraw-ccxt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
73 lines (59 loc) · 2.24 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import time
import ccxt
from termcolor import cprint
from web3 import Web3
import random
def check_balance(address, number, web3):
try:
balance = web3.eth.get_balance(web3.toChecksumAddress(address))
humanReadable = web3.fromWei(balance,'ether')
cprint(f'{number}. {address} : {humanReadable}', 'white')
except Exception as error:
cprint(f'{number}. {address} = {error}', 'red')
def binance_withdraw(address, amount_to_withdrawal, symbolWithdraw, network, API_KEY, API_SECRET):
account_binance = ccxt.binance({
'apiKey': API_KEY,
'secret': API_SECRET,
'enableRateLimit': True,
'options': {
'defaultType': 'spot'
}
})
try:
account_binance.withdraw(
code = symbolWithdraw,
amount = amount_to_withdrawal,
address = address,
tag = None,
params = {
"network": network
}
)
cprint(f">>> Успешно | {address} | {amount_to_withdrawal}", "green")
except Exception as error:
cprint(f">>> Неудачно | {address} | ошибка : {error}", "red")
if __name__ == "__main__":
with open("wallets.txt", "r") as f:
wallets_list = [row.strip() for row in f]
symbolWithdraw = 'ETH'
network = 'Arbitrum'
# RPC = 'https://mainnet.optimism.io'
# RPC = 'https://bsc-dataseed.binance.org'
# RPC = 'https://polygon-rpc.com'
RPC = 'https://arb1.arbitrum.io/rpc'
web3 = Web3(Web3.HTTPProvider(RPC))
# api_keys of binance
API_KEY = "your_api_key"
API_SECRET = "your_api_secret"
cprint('\a\n/// start check balance...', 'white')
number = 0
for wallet in wallets_list:
address = web3.toChecksumAddress(wallet)
number = number + 1
check_balance(address, number, web3) # проверяет баланс ETH
# cprint('\a\n/// start withdrawing...', 'white')
for wallet in wallets_list:
address = web3.toChecksumAddress(wallet)
amount_to_withdrawal = round(random.uniform(0.001, 0.002), 6) # amount from ... to ...
binance_withdraw(address, amount_to_withdrawal, symbolWithdraw, network, API_KEY, API_SECRET)
time.sleep(random.randint(10, 30))