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?

  • 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

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.

  • Need There Any Different Hosting , or My Regular sharing hosting ? – user56799 Nov 18 '19 at 8:24
  • @user56799: WHAT????? – goodvibration Nov 18 '19 at 8:24
  • How can i install nodejs. , ? – user56799 Nov 18 '19 at 8:30
  • @user56799: Don't push it. Search install nodejs on Google. – goodvibration Nov 18 '19 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.