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

Add docstring to genaddr function #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
17 changes: 16 additions & 1 deletion manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@
db = leveldb.LevelDB("objects")

def genaddr(seed):
"""
Generate a private key and address from a given seed.

Args:
seed (str): The seed value to generate the private key and address.

Returns:
tuple: A tuple containing the private key and address.

Example:
>>> from manager import genaddr
>>> seed = "your_seed_here"
>>> private_key, address = genaddr(seed)
>>> print(f"Private Key: {private_key}")
>>> print(f"Address: {address}")
"""
priv = bin_sha256(seed)
addr = bin_sha256(privtopub(priv)[1:])[-20:]
return priv,addr
Expand Down Expand Up @@ -86,4 +102,3 @@ def receive(obj):
if parent.difficulty != blk.difficulty: return
if parent.number != blk.number: return
db.Put(blk.hash(),blk.serialize())