Closed jestevez closed 6 years ago
Sorry is not issue, is wrong pom.xml dependencies, I've overwritten the com.fasterxml.jackson version with old version.
Use which version? @jestevez
Hi @Schefferk
Change the pom.xml version 2.8.5 and replace .jars in modules folder of my server (Glassfish) ./glassfish4/glassfish/modules/
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.8.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-base</artifactId>
<version>2.8.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
<version>2.8.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.8.5</version>
</dependency>
This still seems to be an issue when generating wallets and trying to load them later, which is a problem.
A quick manual fix is to delete the extra 'kdf' entry that is generated.
@jestevez please confirm if that is the case and reopen the issue.
Hi @iikirilov , The generated json is incorrect "SyntaxError: Duplicate key 'kdf'"
Good stuff, I would appreciate a PR to fix this issue.
@nnbosko @jestevez Cannot replicate with web3j-4.0.0-alpha-1. I am using the same sample code.
Was it fixed in a PR?
I use the version web3j-3.3.1
but I have no idea what problem is
xiefei.jnu@foxmail.com
From: Ivaylo Kirilov Date: 2018-11-09 19:30 To: web3j/web3j CC: Schefferk; Mention Subject: Re: [web3j/web3j] WalletUtils.generateNewWalletFile Generate invalid JSON file (#120) Cannot replicate with web3j-4.0.0-alpha-1. I am using the same sample code. Was it fixed in a PR? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
I can confirm this is working with web3j 3.3.1 using the sample code above. I get a valid JSON file with only 1 instance of kdf
@Schefferk @nnbosko @jestevez Can you please provide a sample project which causes this error so I can try in a similar environment as you?
This problem was found in version 2.2.2, since in the latest versions the "kdf" attribute of the json is not duplicated
Hi I am using web3j 4.3.0 and I encountered the same issue .
String walletPassword = "1234!";
String walletDirectory = "./src/main/resources/wallets";
String walletName = WalletUtils.generateNewWalletFile(walletPassword, new File(walletDirectory));
System.out.println("Wallet Location:"+ walletDirectory+"/"+walletName);
Credentials credentials = WalletUtils.loadCredentials(walletPassword, walletDirectory + "/" + walletName);
Hi,
I am creating and opening a wallet and it generates the following error
Sample CODE
String password = "123456"; String destDir = "/home/usuario/wallet/"; ObjectMapper objectMapper = ObjectMapperFactory.getObjectMapper();
String walletFileName = WalletUtils.generateNewWalletFile(password, new File(destDir), false); WalletFile walletFile = objectMapper.readValue(new File(destDir + File.separator + walletFileName), WalletFile.class);
System.out.println(walletFile.getAddress());
Incorrect JSON Wallet, "kdf":"scrypt" duplicate
{"address":"b2b20205121b7270252e913b00a06439345f3f0a","id":"9a7dea4e-d7fc-4f1b-bed1-bcb2c2d5029e","version":3,"crypto":{"cipher":"aes-128-ctr","ciphertext":"d3def4aea86746940706f0f65b703bdffbf10d363b7104f00f29e127036de330","cipherparams":{"iv":"dbb942ba5efbe05c6844ffeec7c06015"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":4096,"p":6,"r":8,"salt":"d8a02a8286588f1f178fb5b51a756bfcfc0adb1e2026e576774ca8eb25e20de3"},"kdf":"scrypt","mac":"0474dd700d96667683517585058f17e8535c2c15e1b3d38a67f64e5af02af9da"}}
Generated exception
com.fasterxml.jackson.databind.JsonMappingException: Missing property 'kdfparams' for external type id 'kdf at [Source: /home/usuario/wallet/UTC--2017-06-30T21-04-49.960000000Z--b2b20205121b7270252e913b00a06439345f3f0a.json; line: 1, column: 503] (through reference chain: org.web3j.crypto.WalletFile["crypto"])