Skip to content

Instantly share code, notes, and snippets.

@buckyroberts
Created November 23, 2020 19:21
Show Gist options
  • Save buckyroberts/f64a5580d55a26f2e7871f06a14c4c8b to your computer and use it in GitHub Desktop.
Save buckyroberts/f64a5580d55a26f2e7871f06a14c4c8b to your computer and use it in GitHub Desktop.
from django.core.management.utils import get_random_secret_key
from nacl.encoding import HexEncoder
from thenewboston.accounts.manage import create_account
"""
Running this script will produce all keys necessary for deploying a new node.
Account Number Signing Key:
2ea2542cb0b1176bd773beb58051c8baba832df30fe1f853e62ec9628032e087
Account Number:
a007f798fe362a3fc891f48dcee52fb8278f65821c55275d726a8e4f53a96536
NID Signing Key:
642df386806978baf63d660773983d13f19a714615c8acab74a0e16b775ca6c8
NID:
4a1331c318325ee601757aa4be45b34260fedf2f42071a871e16479b6cfd4746
SECRET_KEY:
okjd6yv)7wt#+ir#v2-j$9w!brgw3(k1#a28is5i7puk59itptm
"""
def display_key_pair(*, label):
"""
Create and display key pair information
"""
private_key, public_key = create_account()
private_key = private_key.encode(encoder=HexEncoder).decode('utf-8')
public_key = public_key.encode(encoder=HexEncoder).decode('utf-8')
print(f'\n{label} Signing Key:\n{private_key}')
print(f'\n{label}:\n{public_key}')
def run():
"""
Generate node keys
"""
display_key_pair(label='Account Number')
display_key_pair(label='NID')
random_secret_key = get_random_secret_key()
print(f'\nSECRET_KEY:\n{random_secret_key}')
if __name__ == '__main__':
run()
@nmj18txstate
Copy link

Running the script is giving error "No module named "thenewboston", please help.

PS C:\Users\nitya\AppData\Local\Programs\thenewboston> python generate_node_keys.py
Traceback (most recent call last):
File "generate_node_keys.py", line 3, in
from thenewboston.accounts.manage import create_account
ModuleNotFoundError: No module named 'thenewboston'

@moki298
Copy link

moki298 commented Feb 12, 2021

Running the script is giving error "No module named "thenewboston", please help.

PS C:\Users\nitya\AppData\Local\Programs\thenewboston> python generate_node_keys.py
Traceback (most recent call last):
File "generate_node_keys.py", line 3, in
from thenewboston.accounts.manage import create_account
ModuleNotFoundError: No module named 'thenewboston'

Run pip3 install thenewboston

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment