Search code examples
javaandroidweb3-java

how to use Credential wallet path with metamask account on infura in Web3j


Web3j web3 = Web3j.build(new HttpService()); // defaults to http://localhost:8545/ Credentials credentials = WalletUtils.loadCredentials("password", "/path/to/walletfile");

  1. How to connect rinkeby network using Web3j.

  2. I try to change "/path/to/walletfile" by a private key of metamask account. Without success.

How can I make it works? Thx.


Solution

  • An easy way to do this is using your private key. In metamask click "account details" and "export private key".

    Then use Credentials.create("YourPrivateKey")