1
KeyStore keyStore = new KeyStore(seedFile.toString(), Geth.LightScryptN, Geth.LightScryptP);
byte[] jsonAccount = keyStore.exportKey(keyStore.getAccounts().get(0), seed, seed);
Account importAccount = keyStore.importKey(jsonAccount, seed, seed);

transaction = Geth.newTransaction(nonceValue, Geth.newAddressFromHex(toAddress), new BigInt(amount), gas, new BigInt(gasTransaction), null);
transaction = keyStore.signTxPassphrase(importAccount, seed, transaction, new BigInt(3));

By using this code I signed transaction successfully and got all the value successfully.

Then I'm calling API by passing hash value to send transaction.

transaction.getSigHash().getHex()

https://api-ropsten.etherscan.io/api?module=proxy&action=eth_sendRawTransaction&hex=yourhex&apikey=YourApiKeyToken

I'm getting response like this.

{"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid RLP.","data":"RlpIncorrectListLen"},"id":1}

Please help me who knows the answer.

0

The Geth transaction object has a method encodeRLP() - the result of this method is what you need to send to etherscan - not the signature hash

| improve this answer | |
  • Thanks for your response. I got byte array from encodeRLP(). And convert byte array to base64 string. But the string is not generated properly. – Bandish Aug 16 '18 at 15:59
  • you need to convert to hex - not base64 - you can e.g. khex for this github.com/walleth/khex - and then just use ByteArray.toHexString() – ligi Aug 16 '18 at 16:06
  • Thank you so much ligi. By your help my transaction is working perfectly. – Bandish Aug 17 '18 at 7:16
  • You are very welcome - please accept the answer when it solves your problem. – ligi Aug 17 '18 at 10:25
  • My wallet runs completely. But as geth.aar works on file so if I want to generate same address in different device then is it possible? – Bandish Aug 22 '18 at 11:37

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.