如何在EVM批量打各种*RC20

简单来说,evm上的各种*20都是发送tx_data来打“铭文”虽然有种返璞归真的感觉,但是真的能炒上去。毕竟啥共识都是共识。至于交易只能靠检索器(也就是纯纯的中心化)检索器说是你的就是你的这就很离谱了,这也是为啥我总不喜欢这种玩意,去中心化精神完全抛弃了。

但是有人玩就是好的。刚好朋友要打,我就顺手写了个脚本,这个脚本比目前市面上的要快,且可以调整手续费

1.为什么说它快: 因为是本地拼接消息,可以批量生成一堆消息,在同一个高度全部上链。也就是说别人脚本在一个个的等的时候,你已经在50个同时等上链了。2.调整手续费,现在evm基本上都是eip1559,需要给节点小费,手动制定小费,会更快上链。具体怎么操作,见下面讲解

准备工作:

python环境,根据电脑不同自己google。只要能跑起来hello world即可。个人rpc推荐 alchemy

如何操作:

将下面脚本导入到你的代码编译器中,修改下面内容

private_key = "填写你的钱包私钥"
recipient_address = "填写你的接受钱包地址"
mainnet: '填写你的rpc链接',
data = '填写tx里面的内容' (下面的代码就是打pols的)

重点来了,如何比别人快 send_transaction(1, rpc_map.get("mainnet"), data, is_wait=True, priority_fee=100)

1修改成你想要的总数量 is_wait 如果是True就是等待上一个消息上链之后才发送下一个,False就是不等待疯狂冲 (问题来了,如果是自建的rpc那么就没限制,可以写false,如果是alchemy rpc这种一般会有请求限制,也就是最好用True) priority_fee就是小费给多少,去浏览器看,比如polygon的浏览器

显示:Priority: 350,那你写360基本上就是秒上了。注意:因为gas一直在变动,输入一个gas的时候,建议一次少打一点比如现在是350,我写360,总共100张,一会会就打完了。然后再看看gas是多少,再来调整(能省不少钱呢)小费不是总GAS!!! 是Priority!!!注意看下图!!!Priority是104.6 这个时候你输入110,基本上秒打。

脚本完全代码放到下面,希望大家冲的时候冷静,不要浪费gas。哈哈

from web3 import Web3, HTTPProvider, Account
from web3.middleware import geth_poa_middleware

private_key = "填写你的钱包私钥"
recipient_address = "填写你的接受钱包地址"
data = 'data:,{"p":"prc-20","op":"mint","tick":"pols","amt":"100000000"}'
rpc_map = {
    'mainnet': '填写你的rpc链接',
}


def get_transaction_eip1559(rpc_url, text_data, priority_fee):
    web3 = Web3(HTTPProvider(rpc_url))
    web3.middleware_onion.inject(geth_poa_middleware, layer=0)  # Inject POA middleware
    # Check if connected to Ethereum network
    if not web3.isConnected():
        raise Exception("Not connected to Ethereum network")
    # Set up the sender's account
    sender_account = Account.from_key(private_key)
    sender_address = sender_account.address

    # Transaction details
    value = web3.toWei(0, 'ether')
    # Get the nonce for the sender's account
    nonce = web3.eth.getTransactionCount(sender_address, 'pending')
    base_fee = web3.eth.get_block('latest')['baseFeePerGas']

    # Transaction details
    max_priority_fee_per_gas = web3.toWei(priority_fee, 'gwei')  # Tip for the miner, adjust as needed
    max_fee_per_gas = base_fee + max_priority_fee_per_gas
    # EIP-1559 transaction parameters

    # Convert data to hex and add as data to the transaction
    data_hex = web3.toHex(text=text_data)

    # Estimate gas limit for the transaction
    gas_estimate = web3.eth.estimate_gas({
        'to': recipient_address,
        'value': value,
        'from': sender_address,
        'data': data_hex
    })

    # Create the transaction dictionary
    transaction = {
        'type': '0x2',  # Indicates an EIP-1559 transaction
        'chainId': web3.eth.chain_id,
        'nonce': nonce,
        'maxPriorityFeePerGas': max_priority_fee_per_gas,
        'maxFeePerGas': max_fee_per_gas,
        'gas': gas_estimate,
        'to': recipient_address,
        'value': value,
        'data': data_hex
    }
    print(f"Transaction: {transaction}")
    return transaction, web3, private_key, nonce


def signed_send(transaction, web3, private_key, is_wait=True):
    # Sign the transaction
    signed_tx = web3.eth.account.sign_transaction(transaction, private_key)
    # Send the transaction
    tx_hash = web3.eth.sendRawTransaction(signed_tx.rawTransaction)
    # Get the transaction hash
    print(f"Transaction hash: {tx_hash.hex()}")
    # Wait for the transaction receipt (optional)
    if is_wait:
        tx_receipt = web3.eth.waitForTransactionReceipt(tx_hash)
        print(f"Transaction receipt: {tx_receipt}")
        print(f"Transaction status: {tx_receipt['status']}")


def send_transaction(number, rpc, test_data, is_wait=True, priority_fee=400):
    transaction, web3, private_key, nonce = get_transaction_eip1559(rpc, test_data, priority_fee)
    for i in range(number):
        transaction.update({'nonce': nonce})
        signed_send(transaction, web3, private_key, is_wait)
        nonce = nonce + 1


if __name__ == '__main__':
    send_transaction(1, rpc_map.get("mainnet"), data, is_wait=True, priority_fee=100)
Subscribe to Daniel
Receive the latest updates directly to your inbox.
Mint this entry as an NFT to add it to your collection.
Verification
This entry has been permanently stored onchain and signed by its creator.