我想要一些关于Erc-20交易的信息。我想把Erc-20托肯从第一个钱包转移到第二个钱包,我有女贞钥匙,但我想和Api一起传输,那么我如何传输Erc-20令牌呢?
发布于 2019-11-18 08:22:40
安装NodeJS。
运行npm install web3@1.2.1。
实现文件send.js:
const Web3 = require("web3");
async function send(value, firstWalletPrivateKey, secondWalletPublicAddress) {
const web3 = new Web3("https://mainnet.infura.io");
const options = {
value : value,
gas : 21000,
to : secondWalletPublicAddress,
gasPrice: await web3.eth.getGasPrice()
};
const signedTx = await web3.eth.accounts.signTransaction(options, firstWalletPrivateKey);
const txReceipt = await web3.eth.sendSignedTransaction(signedTx.rawTransaction);
console.log(JSON.stringify(txReceipt, null, 4));
}
send(your_value, your_firstWalletPrivateKey, your_secondWalletPublicAddress);运行node send.js。
https://ethereum.stackexchange.com/questions/77584
复制相似问题