simpleCoin/wallet.py
def generate_ECDSA_keys():
    """This function takes care of creating your private and public (your address) keys.
    It's very important you don't lose any of them or those wallets will be lost
    forever. If someone else get access to your private key, you risk losing your coins.

    private_key: str
    public_ley: base64 (to make it shorter)
    """
    filename = input("Write the name of your new address: ") + ".key"
    while True:
        sk = ecdsa.SigningKey.generate(curve=ecdsa.SECP256k1) #this is your sign (private key)
        private_key = sk.to_string().hex() #convert your private key to hex
        vk = sk.get_verifying_key() #this is your verification key (public key)
        public_key = vk.to_string().hex()
        #we are going to encode the public key to make it shorter
        public_key = base64.b64encode(bytes.fromhex(public_key))
        if allowed_characters(public_key):
            break

    with open(filename, "w") as f:
        key_data = {
            'private_key': private_key,
            'public_key': public_key.decode()
        }
        json.dump(key_data, f, sort_keys=True, indent=4)
        print("Private key: {0}\nWallet address / Public key: {1}".format(private_key, public_key.decode()))
    print("Your new address and private key are now in the file {0}".format(filename))
This function takes care of creating your private and public (your address) keys.
    It's very important you don't lose any of them or those wallets will be lost
    forever. If someone else get access to your private key, you risk losing your coins.

    private_key: str
    public_ley: base64 (to make it shorter)
    
This function takes care of creating your private and public (your address) keys.
It's very important you don't lose any of them or those wallets will be lost
forever. If someone else get access to your private key, you risk losing your coins.

str
public_ley: base64 (to make it shorter)
This function takes care of creating your private and public ( your address ) keys . It ' s very important you don ' t lose any of them or those wallets will be lost forever . If someone else get access to your private key you risk losing your coins . str public_ley : base64 ( to make it shorter )
def generate_ECDSA_keys():
    filename = input("Write the name of your new address: ") + ".key"
    while True:
        sk = ecdsa.SigningKey.generate(curve=ecdsa.SECP256k1) 
        private_key = sk.to_string().hex() 
        vk = sk.get_verifying_key() 
        public_key = vk.to_string().hex()
        public_key = base64.b64encode(bytes.fromhex(public_key))
        if allowed_characters(public_key):
            break
    with open(filename, "w") as f:
        key_data = {
            'private_key': private_key,
            'public_key': public_key.decode()
        }
        json.dump(key_data, f, sort_keys=True, indent=4)
        print("Private key: {0}\nWallet address / Public key: {1}".format(private_key, public_key.decode()))
    print("Your new address and private key are now in the file {0}".format(filename))
def generate_ECDSA_keys ( ) : filename = input ( "Write the name of your new address: " ) + ".key" while True : sk = ecdsa . SigningKey . generate ( curve = ecdsa . SECP256k1 ) private_key = sk . to_string ( ) . hex ( ) vk = sk . get_verifying_key ( ) public_key = vk . to_string ( ) . hex ( ) public_key = base64 . b64encode ( bytes . fromhex ( public_key ) ) if allowed_characters ( public_key ) : break with open ( filename , "w" ) as f : key_data = { 'private_key' : private_key , 'public_key' : public_key . decode ( ) } json . dump ( key_data , f , sort_keys = True , indent = 4 ) print ( "Private key: {0}\nWallet address / Public key: {1}" . format ( private_key , public_key . decode ( ) ) ) print ( "Your new address and private key are now in the file {0}" . format ( filename ) )
This function takes care of creating your private and public (your address) keys.
This function takes care of creating your private and public ( your address ) keys .
"""This function takes care of creating your private and public (your address) keys.
    It's very important you don't lose any of them or those wallets will be lost
    forever. If someone else get access to your private key, you risk losing your coins.

    private_key: str
    public_ley: base64 (to make it shorter)
    """ #this is your sign (private key) #convert your private key to hex #this is your verification key (public key) #we are going to encode the public key to make it shorter