1

On my node there is an account, which I know the address and password, but do not know privateKey. This account has tokens ERC20 and ETH for gas. How can I transfer tokens to another wallet?

The usual translation I do so:

var privateKey = new EthJS.Buffer.Buffer(senderPrivateKey, 'hex')
var txParams = {
    nonce:    web3.toHex(count),
      gasPrice: gasPriceHex, 
    gasLimit: gasLimit,
      to: contractAddress, 
    value:    '0x00', 
    data:     contract.transferFrom.getData(senderAccount, recipientAccount, numberTokens),
      chainId: web3.toHex(1),
}
var tx=new EthJS.Tx(txParams);
tx.sign(privateKey),serializedTx=tx.serialize().toString('hex');
web3.eth.sendRawTransaction('0x'+serializedTx, function(err, hash) {
    if (!err)
        console.log(hash);
    else
        console.log(err);
});

I can do web3.personal.unlockAccount, but how do I sign a transaction without private Key?

Your Answer

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

Browse other questions tagged or ask your own question.