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

fix & format example key creation #3128

Merged
merged 3 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions docs/web3.eth.account.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,13 @@ account you can just generate a random number that acts as a private key.

To create a private key using web3.py and command line you can do:

```shell
python -c "from web3 import Web3; w3 = Web3(); acc = w3.eth.account.create(); print(f'private key={w3.toHex(acc.privateKey)}, account={acc.address}')"
```
.. code-block:: shell

python -c "from web3 import Web3; w3 = Web3(); acc = w3.eth.account.create(); print(f'private key={w3.to_hex(acc.key)}, account={acc.address}')"
fselmo marked this conversation as resolved.
Show resolved Hide resolved

Which outputs a new private key and an account pair:
Which outputs a new private key and an account pair::
fselmo marked this conversation as resolved.
Show resolved Hide resolved

```
private key=0x480c4aec9fa..., account=0x9202a9d5D2d129CB400a40e00aC822a53ED81167
```
private key=0x480c4aec9fa..., account=0x9202a9d5D2d129CB400a40e00aC822a53ED81167

- *Never store private key with your source*. Use environment variables
to store the key. Read more below.
Expand Down
1 change: 1 addition & 0 deletions newsfragments/3128.docs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix formatting in documentation for creating an account.