Closed pieman64 closed 5 years ago
What's incorrect ? TEST_PRIVATE_KEY is a constant that you're supposed to replace with your own private key.
@Spl3en the first line of the code block states:
# Loads a wallet from a key store file
key store is incorrect, right?
The first line of the code block states seems to make you confused.
Loading a wallet from a private key is correct. TEST_PRIVATE_KEY is a constant you can replace with your own private key in bytes.
But the code is nothing to do with a key store file as that would require a path to the file.
I'm not confused by the TEST_PRIVATE_KEY constant in bytes.
For version 0.8 the documentation at https://www.icondev.io/docs/python-sdk-1#section-loading-a-wallet-and-storing-the-keystore is:
# Loads a wallet from bytes of the private key
wallet = KeyWallet.load(b'-B\x99...xedy')
# Loads a wallet from a keystore file
wallet = KeyWallet.load("./keystore", "password")
Notice loading a keystore file for V0.8 is totally different for V0.9. V0.9 docs are wrong, right?
How to load a keystore file for V0.9 is totally the same as V0.8. You can load your own wallet with the keystore file or bytes of the private key as below.
# Loads a wallet from bytes of the private key
wallet = KeyWallet.load(b'-B\x99...xedy')
# Loads a wallet from a keystore file
wallet = KeyWallet.load("./keystore", "password")
Loads a wallet from bytes of the private key
Loads a wallet from a keystore file
@boyeon555 but look at the first post above and you will see that is NOT what V0.9 docs show.
I think V0.9 docs had been made more simple than the previous version and skipped it. You can refer to README of python SDK.
No @boyeon555 the docs are not simpler they are WRONG. Please amend accordingly as new users of the rep will not be able to load a wallet from a keystore with the incorrect code. The code shown is to load a wallet from from a private key!
Alright @pieman64, I submitted a pull request to the documentation : https://github.com/icon-project/documentation/pull/25
Please don't hesitate to send a pull request with your patches, it's very easy to do with the GitHub interface without knowing anything about git if you're not familiar with that tool.
Thanks for the correction @Spl3en
Thanks to you for reporting this issue. 👍
At https://www.icondev.io/v0.9/docs/python-sdk#section-wallet you have the following text:
Please confirm the first line of the code block above is incorrect.