-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
ArrayIndexOutOfBoundsException in TransactionEncoder.signMessage #420
Comments
I have solved it , because use the
can not work, should use "m/44'/60'/0'/0/0" to create Credentials
|
I was able to recreate this error by using the following: @Test
public void testSignedEthTransactionData() {
BigInteger nonce = BigInteger.ZERO;
BigInteger gasPrice = BigInteger.ONE;
BigInteger gasLimit = BigInteger.valueOf(21000);
String to = "0x0000000000000000000000000000000000000000";
BigInteger value = BigInteger.TEN.pow(19); // lets assume 1 * (10 ** 18)
System.out.println(value.longValue());
RawTransaction raw = RawTransaction.createEtherTransaction(nonce, gasPrice, gasLimit, to, value);
Credentials creds = Credentials.create("0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141");
byte[] signedMessage = TransactionEncoder.signMessage(raw, creds);
System.out.println(Hex.toHexString(signedMessage));
} Essentially using a private key outside the bounds allowed by secp256k1, some more details here. The odd thing is the signing operation still "works" (no exceptions) even if we go beyond the upper bounds of the range, for example: However upon trying to feed the same value into MetaMask or MEW I was instantly rejected (MEW actually claimed to unlock the account, but no further info). Perhaps a bounds check is required? Anyways, I'm not well versed in cryptography so maybe someone more experienced can chime in here. |
@qoire if the privatekey was created by "m/44'/60'/0'/0/0" can work nice |
related #403 |
@qoire u can use my code. i use bitcoinj to make it . EthMnemonic |
@badboy-tian @qoire Is this still an issue with web3j 4.0.0-alpha-1? |
Closed due to inactivity. If this is still a problem please open a new issue and follow the instructions. Conversation move to #919 |
but error:
I do not know why, please help me, thank you very much
The text was updated successfully, but these errors were encountered: