mynode/rootfs/standard/usr/bin/gen_seed.py

29 lines
731 B
Python
Raw Normal View History

#!/usr/local/bin/python3
2021-12-29 18:50:03 +00:00
import base64, codecs, json, requests
2021-03-09 03:55:39 +00:00
import os
2019-06-15 23:02:44 +00:00
def format_seed_numbered(seed):
formatted_seed = ""
count = 1
for word in seed:
formatted_seed += "{}: {}\n".format(count, word)
count += 1
return formatted_seed.rstrip()
def format_seed_raw(seed):
s = ""
for word in seed:
s += word + " "
return s.rstrip()
# This is the main entry point for the program
if __name__ == "__main__":
2021-12-29 18:50:03 +00:00
REST_GEN_SEED_URL="https://localhost:10080/v1/genseed"
REST_CERT_PATH="/home/bitcoin/.lnd/tls.cert"
2021-03-09 03:55:39 +00:00
2019-06-15 23:02:44 +00:00
# Generate the seed
2021-12-29 18:50:03 +00:00
r = requests.get(REST_GEN_SEED_URL, verify=REST_CERT_PATH)
data = r.json()
formatted_seed = format_seed_raw( data['cipher_seed_mnemonic'] )
2019-06-15 23:02:44 +00:00
print(formatted_seed)