I am creating a wallet app and trying to sign and send raw transactions using eth-lightwallet.
function functionCallWallet(){
var fromAddr = document.getElementById('functionCaller').value
var contractAddr = document.getElementById('contractAddr').value
console.log("Contract Address:"+contractAddr);
var abi = JSON.parse(document.getElementById('contractAbi').value)
console.log(abi);
console.log(typeof abi);
var contract = web3.eth.contract(abi).at(contractAddr);
var functionName = document.getElementById('functionName').value;
var args = document.getElementById('functionArgs').value.split(",");
var gasPrice = 50000000000
var gas = 3141592
txOptions = {
gasPrice: gasPrice,
gasLimit: gas,
value: 10000000,
nonce:2.0e20
}
txOptions.to = contractAddr;
var functionCallTx = txutils.functionTx(abi,functionName,args,txOptions);
var password = prompt('Enter password ', 'Password');
lightwallet.keystore.deriveKeyFromPassword(password, function(err, pwDerivedKey) {
var signedFunctionTx = signing.signTx(global_keystore,pwDerivedKey,functionCallTx,fromAddr);
console.log("Signed function transaction:"+signedFunctionTx);
console.log('');
web3.eth.sendRawTransaction('0x'+signedFunctionTx, function(err, hash) {
console.log(err);
console.log(hash);
});
})
}
I am able to sign the transaction correctly. But when it comes to sending the raw transaction on the network I am unsuccessful. In the web3 api they use https://github.com/ethereum/wiki/wiki/JavaScript-API#example-45 they use the ethereumjs-accounts library to serialize the raw transaction to hex. Does eth-lightwallet also have a serialize to hex function so that it could be used and then data is in format used by the web3 sendRawTransaction function or do have to use the ethereumjs-accounts library mentioned in web3 docs ?
I am getting this error, obviously I am not serializing it the correct way but I will put the error anyway
Error: rlp: input string too long for uint64, decoding into (types.Transaction)(types.txdata).AccountNonce
at Object.module.exports.InvalidResponse