首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何从尾部进行事务处理

如何从尾部进行事务处理
EN

Ethereum用户
提问于 2021-05-27 08:28:38
回答 1查看 260关注 0票数 2

我一直无法找到从临时尾尾设备进行ETH事务的方法,因为通常的钱包(如MyCrypto )似乎不在那里运行。

EN

回答 1

Ethereum用户

发布于 2021-05-27 08:41:58

如果您有一个用于钱包的BIP39短语,并且想要进行一个简单的ETH事务,那么对尾4.18工作的步骤如下。

  1. 启动尾部时,添加管理用户。
  2. 下载一个独立版本的https://github.com/iancoleman/bip39,并从您的BIP39短语中获取相关地址的私钥。
  3. 设置一个适合https://github.com/ethereum/web3.py python包的环境。以下操作应来自健忘症用户终端。
代码语言:javascript
复制
sudo apt update && sudo apt install python3-dev gcc
torsocks curl https://bootstrap.pypa.io/get-pip.py | torsocks python3
PATH=$PATH:/home/amnesia/.local/bin
torsocks pip install --upgrade pip setuptools web3
  1. 根据需要编辑以下python代码,即替换私钥、目标地址、发送金额、天然气价格( https://ethgasstation.info )并将其保存为prepare_tx.py
代码语言:javascript
复制
from web3 import Web3
from web3.auto import w3

gas_price = Web3.toWei("<GAS_PRICE>", "gwei")
amount_now = Web3.toWei("<ETHER_TO_TRANSFER>", "ether")
to_address = "<RECEIVER_ADDRESS>"
private_key = "<SENDER_PRIVATE_KEY>"

for nonce in [0, 1, 2, 3, 4]:
    gas = 21000
    gas_total = gas * gas_price
    tx_amount = amount_now - gas_total

    tx = {
        "chainId": 1,  # main ETH chain
        "nonce": nonce,
        "to": to_address,
        "value": tx_amount,
        "gas": gas,
        "gasPrice": gas_price,
    }

    signed = w3.eth.account.sign_transaction(tx, private_key)
    s = signed.rawTransaction
    s_ = "0x" + "".join(format(x, "02x") for x in s)
    print(f"nonce={nonce}")
    print(s_)
    print("-")
  1. 运行prepare_tx.py以获得具有不同非get的签名事务字符串。
  2. 复制并粘贴已签名的事务字符串到https://etherscan.io/pushTx。试着粘贴第一个,如果不起作用,粘贴第二个等等。
票数 1
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/99759

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档