在本课程中,您将学习如何将ETH从一个帐户转移到另一个帐户。如果您已熟悉以太坊,那么您就知道如何交易包括您打算转账的以太币数量量,燃气限额,燃气价格,一个随机数(nonce),接收地址以及可选择性的添加的数据。 在广告发送到网络之前,必须使用发送方的私钥对该交易进行签名。
In this course, you will learn how to transfer ETH from one account to another. If you are familiar with Ether, then you will know how to deal, including the amount of money you intend to transfer, gas limits, gas prices, a random number (nonce), receiving addresses and optional additions.
假设您已经连接了客户端,下一步就是加载您的私钥。
Assuming that you have connected to a client, the next step is to load your private key.
之后我们需要获得帐户的随机数(nonce)。 每笔交易都需要一个nonce。 根据定义,nonce是仅使用一次的数字。 如果是发送交易的新帐户,则该随机数将为“0”。 来自帐户的每个新事务都必须具有前一个nonce增加1的nonce。很难对所有nonce进行手动跟踪,于是ethereum客户端提供一个帮助方法,它将返回你应该使用的下一个nonce。
If you send a new account for a transaction, the random number will be “0.” Every new transaction from an account must have the previous nence by one. It is difficult to track all nónce manually, so the client will provide a way of helping, and it will return to the next nónce that you should use.
该函数需要我们发送的帐户的公共地址 - 这个我们可以从私钥派生。
The function requires the public address of the account we send -- this we can derive from the private key.
接下来我们可以读取我们应该用于帐户交易的随机数。
And then we can read the random numbers that we should use for account transactions.
下一步是设置我们将要转移的ETH数量。 但是我们必须将ETH以太转换为wei,因为这是以太坊区块链所使用的。 以太网支持最多18个小数位,因此1个ETH为1加18个零。 这里有一个小工具可以帮助您在ETH和wei之间进行转换: https://etherconverter.netlify.com
The next step is to set the number of ETHs that we're going to transfer. But we have to convert the ETH into wei, because it is used in the Tetau block chain. The THnet supports up to 18 decimal places, so one ETH is 1 plus 18 zero. Here's a small tool to help you convert between ETH and wei:
ETH转账的燃气应设上限为“21000”单位。
The ETH transfer gas shall be capped at “2100” units.
燃气价格必须以wei为单位设定。 在撰写本文时,将在一个区块中比较快的打包交易的燃气价格为30 gwei。
Gas prices must be set in wei. At the time of writing, the gas price for the faster packaged transactions in a block was 30 gwei.
然而,燃气价格总是根据市场需求和用户愿意支付的价格而波动的,因此对燃气价格进行硬编码有时并不理想。 go-ethereum客户端提供函数,用于根据'x'个先前块来获得平均燃气价格。
However, gas prices tend to fluctuate according to market demand and prices that users are willing to pay, so hard coding of gas prices is sometimes not ideal. Go-etherium client provides functions based on x27; xx27; one previous block to obtain an average gas price.
接下来我们弄清楚我们将ETH发送给谁。
And then we figure out who we're sending it to.
现在我们最终可以通过导入go-ethereum包并调用来生成我们的未签名以太坊事务,这个函数需要接收nonce,地址,值,燃气上限值,燃气价格和可选发的数据。 发送ETH的数据字段为“nil”。 在与智能合约进行交互时,我们将使用数据字段,仅仅转账以太币是不需要数据字段的。
Now, we can finally import the go-etherium package and switch it to generate our unsigned euphoria, a function that requires receiving data on nónce, address, value, gas ceiling, gas price, and optional data. Sending the ETH data field is 'nil. When interacting with an intelligent contract, we will use the data field, which is not required for the data field when merely transferring it in too much currency.
下一步是使用发件人的私钥对事务进行签名。 为此,我们调用方法,该方法接受一个未签名的事务和我们之前构造的私钥。 方法需要EIP155签名者,这个也需要我们先从客户端拿到链ID。
The next step is to use the sender’s private key to sign the transaction. To that end, we call the method of accepting an unsigned matter and the private key that we constructed earlier.
现在我们终于准备通过在客户端上调用“SendTransaction”来将已签名的事务广播到整个网络。
Now we are finally ready to broadcast the signed services to the entire network by calling the "SendTransaction" on the client.
然后你可以去Etherscan看交易的确认过程: https://rinkeby.etherscan.io/tx/0x77006fcb3938f648e2cc65bafd27dec30b9bfbe9df41f78498b9c8b7322a249e
Then you can go to Etherscan to see the confirmation process of the transaction:
title: ETH转账 description: "这本迷你书的本意是给任何想用Go进行以太坊开发的同学一个概括的介绍。本意是如果你已经对以太坊和Go有一些熟悉,但是对于怎么把两者结合起来还有些无从下手,那这本书就是一个好的起点。" image: "https://ipfs.decert.me/QmfZm4ZahZBcpLNoMwNBX5kNLNaQ6PsPRV7oiJXTudvYWy" sidebar_label: "ETH转账"
Tile: ETH transfer description: & Quot; this minibook is meant to be a general introduction to anyone who wants to use Go to develop it. It's meant that if you're familiar with Ethio and Go, but you don't know how to combine them, it's a good starting point. &quat; image: &quat; 在本课程中,您将学习如何将ETH从一个帐户转移到另一个帐户。如果您已熟悉以太坊,那么您就知道如何交易包括您打算转账的以太币数量量,燃气限额,燃气价格,一个随机数(nonce),接收地址以及可选择性的添加的数据。 在广告发送到网络之前,必须使用发送方的私钥对该交易进行签名。 In this course, you will learn how to transfer ETH from one account to another. If you are familiar with Ether, then you will know how to deal, including the amount of money you intend to transfer, gas limits, gas prices, a random number (nonce), receiving addresses and optional additions. 假设您已经连接了客户端,下一步就是加载您的私钥。 Assuming that you have connected to a client, the next step is to load your private key. 之后我们需要获得帐户的随机数(nonce)。 每笔交易都需要一个nonce。 根据定义,nonce是仅使用一次的数字。 如果是发送交易的新帐户,则该随机数将为“0”。 来自帐户的每个新事务都必须具有前一个nonce增加1的nonce。很难对所有nonce进行手动跟踪,于是ethereum客户端提供一个帮助方法,它将返回你应该使用的下一个nonce。 If you send a new account for a transaction, the random number will be “0.” Every new transaction from an account must have the previous nence by one. It is difficult to track all nónce manually, so the client will provide a way of helping, and it will return to the next nónce that you should use. 该函数需要我们发送的帐户的公共地址 - 这个我们可以从私钥派生。 The function requires the public address of the account we send -- this we can derive from the private key. 接下来我们可以读取我们应该用于帐户交易的随机数。 And then we can read the random numbers that we should use for account transactions. 下一步是设置我们将要转移的ETH数量。 但是我们必须将ETH以太转换为wei,因为这是以太坊区块链所使用的。 以太网支持最多18个小数位,因此1个ETH为1加18个零。 这里有一个小工具可以帮助您在ETH和wei之间进行转换: https://etherconverter.netlify.com The next step is to set the number of ETHs that we're going to transfer. But we have to convert the ETH into wei, because it is used in the Tetau block chain. The THnet supports up to 18 decimal places, so one ETH is 1 plus 18 zero. Here's a small tool to help you convert between ETH and wei: ETH转账的燃气应设上限为“21000”单位。 The ETH transfer gas shall be capped at “2100” units. 燃气价格必须以wei为单位设定。 在撰写本文时,将在一个区块中比较快的打包交易的燃气价格为30 gwei。 Gas prices must be set in wei. At the time of writing, the gas price for the faster packaged transactions in a block was 30 gwei. 然而,燃气价格总是根据市场需求和用户愿意支付的价格而波动的,因此对燃气价格进行硬编码有时并不理想。 go-ethereum客户端提供函数,用于根据'x'个先前块来获得平均燃气价格。 However, gas prices tend to fluctuate according to market demand and prices that users are willing to pay, so hard coding of gas prices is sometimes not ideal. Go-etherium client provides functions based on x27; xx27; one previous block to obtain an average gas price. 接下来我们弄清楚我们将ETH发送给谁。 And then we figure out who we're sending it to. 现在我们最终可以通过导入go-ethereum包并调用来生成我们的未签名以太坊事务,这个函数需要接收nonce,地址,值,燃气上限值,燃气价格和可选发的数据。 发送ETH的数据字段为“nil”。 在与智能合约进行交互时,我们将使用数据字段,仅仅转账以太币是不需要数据字段的。 Now, we can finally import the go-etherium package and switch it to generate our unsigned euphoria, a function that requires receiving data on nónce, address, value, gas ceiling, gas price, and optional data. Sending the ETH data field is 'nil. When interacting with an intelligent contract, we will use the data field, which is not required for the data field when merely transferring it in too much currency. 下一步是使用发件人的私钥对事务进行签名。 为此,我们调用方法,该方法接受一个未签名的事务和我们之前构造的私钥。 方法需要EIP155签名者,这个也需要我们先从客户端拿到链ID。 The next step is to use the sender’s private key to sign the transaction. To that end, we call the method of accepting an unsigned matter and the private key that we constructed earlier. 现在我们终于准备通过在客户端上调用“SendTransaction”来将已签名的事务广播到整个网络。 Now we are finally ready to broadcast the signed services to the entire network by calling the "SendTransaction" on the client. 然后你可以去Etherscan看交易的确认过程: https://rinkeby.etherscan.io/tx/0x77006fcb3938f648e2cc65bafd27dec30b9bfbe9df41f78498b9c8b7322a249e Then you can go to Etherscan to see the confirmation process of the transaction:
注册有任何问题请添加 微信:MVIP619 拉你进入群
打开微信扫一扫
添加客服
进入交流群
发表评论