Skip to content
Snippets Groups Projects

Draft: initial user flow for creating a wallet

Merged Janssen, D.D. (Dylan, Student M-CS) requested to merge 2-implement_all_user_flows into main
1 file
+ 47
0
Compare changes
  • Side-by-side
  • Inline
wallet.py 0 → 100755
+ 47
0
#!/bin/env python3
from typing import Union
from bitcoinlib.wallets import Wallet, HDKey, WalletKey
import os
from util import DBManager
db = DBManager()
def new_wallet(userId: Union[int, str]) -> Wallet:
"""
Creates a new regular wallet.
userId: name of the wallet
"""
return Wallet.create(name=userId,
network=os.getenv("BTC_NETWORK"),
db_uri=db.db_uri)
def new_multig_wallet(userId: Union[int, str],
sigs: int, klist: list[HDKey]) -> WalletKey:
"""
Creates a new multisig wallet.
userId: name of the wallet
sigs: number of signatures needed for the wallet
klist: list of (public master) keys inside the wallet
"""
return Wallet.create(name=userId,
sigs_required=sigs,
keys=klist,
network=os.getenv("BTC_NETWORK"),
db_uri=db.db_uri)
def new_HD_key() -> HDKey:
"""
Generates a new Hierarchical Deterministic key
"""
return HDKey(network=os.getenv("BTC_NETWORK"))
def main():
pass
if __name__ == "__main__":
main()
Loading