Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to import wallet by keystore and password? #9

Closed
skywinder opened this issue Aug 26, 2018 · 9 comments
Closed

how to import wallet by keystore and password? #9

skywinder opened this issue Aug 26, 2018 · 9 comments
Labels
question Further information is requested

Comments

@skywinder
Copy link
Collaborator

From @chenshuai0710 on August 9, 2018 9:58

hi,I want to import wallet by keystore and password. what should I do?
thanks

Copied from original issue: BANKEX/web3swift#210

@QA411
Copy link

QA411 commented Aug 30, 2018

hi , you Now solved ?

@shamatar
Copy link
Contributor

What kind of keystore do you have? Is it from Geth?

@QA411
Copy link

QA411 commented Aug 30, 2018

@shamatar
keystore
eg:
{"address":"f13445645b52f597ca92e6f7c9987b16bc07ddb6","crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"9ade19530af3e29106ed908bb46f3041"},"ciphertext":"d6236558690e5e9952ead703a4bc5bbe17a49cf47e8d8b4896fc46149c79586e","kdf":"scrypt","kdfparams":{"dklen":32,"n":4096,"p":6,"r":8,"salt":"127c2275de524cc6bd7ce21f804882d7aded732a77b5875026b56b97b1b1305a"},"mac":"288313bb2bb4ceccfa53f81e5c2803f45992222d3da74b94aa38e2a219088063"},"id":"e2092a8b-68bd-4801-bc3e-555e5dfc0878","version":3}

@shamatar
Copy link
Contributor

There is an example for it in tests too

        guard let data = Data(...) // here is data from your keystore JSON
        guard let keystoreData = getKeystoreData() else {return}
        guard let keystoreV3 = EthereumKeystoreV3.init(keystoreData) else {return} // there is also an init() taking a JSON String
        let web3Rinkeby = Web3.InfuraRinkebyWeb3()
        let keystoreManager = KeystoreManager.init([keystoreV3])

Would you try and give your feedback

@QA411
Copy link

QA411 commented Aug 30, 2018

@shamatar My goal is to get the private key by keystore and password.

@shamatar
Copy link
Contributor

If you want to export the private key - just use the

public func UNSAFE_getPrivateKeyData(password: String, account: EthereumAddress) throws -> Data

Otherwise if you follow the normal workflow for sending ETH, tokens or interacting with a smart-contract you can use an encrypted keystore and only supply a password to decrypt it when sending a transaction.

@QA411
Copy link

QA411 commented Aug 30, 2018

thanks for reply! other question,privateKey is Data type. How to transform type?
eg: 8b4466d6d85fb8f8c90e0008987b09af9b249d1599d36dcbdae2d9e3ede8d779

I tried Base64EncodingOptions ......

@shamatar
Copy link
Contributor

shamatar commented Aug 30, 2018 via email

@BaldyAsh
Copy link
Collaborator

Done in documentation and closed

BaldyAsh added a commit that referenced this issue Dec 21, 2018
Adding erc777 and erc1400, fixes in other ercs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants