背景:
因为需要频繁使用eth ropsten转账, python调用感觉不太方便, 所以整理了一个简单的转账客户端
代码:
package main
import (
"context"
"crypto/ecdsa"
"fmt"
"log"
"math/big"
"os"
"strconv"
//"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
//"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto/sha3"
"github.com/ethereum/go-ethereum/ethclient"
)
func main() {
args := os.Args
if len(args) != 4 {
fmt.Println(`
pls input correct parameters
usage:
$ ./transfer {to_address} {toke_type} {amount}
to_address: to token address
token_type: a***/usdt
amount: amount of token
ex:
./transfer xxxxxxxxxxxxxxx usdt 1`)
return
}
toArg := args[1]
amountArg1 := args[3]
token_type := args[2]
var tokenAddress common.Address
var gasLimit uint64
base := new(big.Float)
if token_type == "a***" {
/* a*** */

本文介绍了一款基于Go语言实现的简易以太坊转账客户端,该客户端支持a***及USDT两种代币的转账操作,并详细展示了如何通过私钥进行交易签名并发送到ropsten测试网。

3564

被折叠的 条评论
为什么被折叠?



