简体   繁体   中英

How do i import my ethereum wallet using private key in android app with the help of web3j?

Help me out how do i resolve the issue of ethereum smartcontract for getting my wallet when i enter my private key in the text area

Use WalletUtils functionality
The WalletUtils class can be used to load your credentials from various 
formats:

WalletUtils.loadCredentials(String password,String source)
WalletUtils.loadBip39Credentials(String password,String mnemonic)
WalletUtils.loadBip39Credentials(String password,String mnemonic)
WalletUtils.loadJsonCredentials(String password,String content)

http://docs.web3j.io/latest/transactions/credentials/#use-walletutils-functionality

These are the methods provided by the web3j library can anyone help me out to import my wallet from 
ethereum using private key??

It's not a good idea to enter your private key in a smartcontract. Everything saaved on the blockchain has public visibilty. So if you enter your private key in a smartcontract it will be visible by anyone. It's better to send ether to the contract from your wallet and than let the smartcontract manages them following your rules.

Using Credentials.create :

String privateKey = "0x40f315666f065b1113eaa538357ed9150db08e329fff15e417977bdc13099403";
Credentials credentials = Credentials.create(privateKey);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM