I want some Information about Erc-20 Transactions. I want to transfer Erc-20Token from first wallet to a second wallet, I have Privet Key, But I want to transfer with Api, So How can I transfer the Erc-20 Tokens?
2
-
you should first know the address of the ERC20 smart contract, then you can do that easily with Metamask in your browser – Majd TL Nov 18 '19 at 9:44
-
But i want to Withdraw On my storage wallet to user wallet , when click user withdraw button , I want to use this for exchanger – user56799 Nov 18 '19 at 12:20
Add a comment
|
Install NodeJS.
Run npm install web3@1.2.1
.
Implement file 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);
Run node send.js
.