waves_logo Docs
  • Overview
    Overview
  • How-to Guides
    • Reading Blockchain Data
      Reading Blockchain Data
    • Creating & Broadcasting Transactions
      Creating & Broadcasting Transactions
    • Tokenization
      Tokenization
    • Airdrop
      Airdrop
    • Payments
      Payments
    • Exchange Tokens
      Exchange Tokens
    • Simple Voting
      Simple Voting
    • List as argument
      List as argument
    How-to Guides
  • Waves Smart Contracts
    Waves Smart Contracts
  • dApp
    • Creating & Launching dApp
      Creating & Launching dApp
    dApp
  • Smart Account
    • Creating smart account
      Creating smart account
    • Creating and deploying a script manually
      Creating and deploying a script manually
    • Video tutorials
      • Introduction to the Waves blockchain, Waves Smart Accounts and Waves Smart Assets
        Introduction to the Waves blockchain, Waves Smart Accounts and Waves Smart Assets
      • Waves Smart Account with multisignature
        Waves Smart Account with multisignature
      • Waves Smart Account with escrow service
        Waves Smart Account with escrow service
      • Creating multisignature account via Waves IDE tools
        Creating multisignature account via Waves IDE tools
      • Creating multisignature account via Waves Client
        Creating multisignature account via Waves Client
      • Waves console explained
        Waves console explained
      Video tutorials
    Smart Account
  • Smart Asset
    Smart Asset
  • Developer Tools
    • Waves IDE
      Waves IDE
    • Visual Studio Code Extension
      Visual Studio Code Extension
    • Surfboard
      Surfboard
    • Ride REPL
      Ride REPL
    Developer Tools
  • Signer ◆
    Signer ◆
  • Waves API
    • Data Service API
      Data Service API
    • Node REST API
      Node REST API
    • Node gRPC Server
      Node gRPC Server
    • Blockchain Updates
      Blockchain Updates
    Waves API
  • Client Libraries
    • Waves C#
      • Install SDK
        Install SDK
      • Run Code Sample
        • Send Transactions
          Send Transactions
        • Use Crypto Utilities
          Use Crypto Utilities
        • Interact With Node
          Interact With Node
        • Set Up Smart Contracts
          Set Up Smart Contracts
        Run Code Sample
      Waves C#
    • Gowaves
      • Install SDK
        Install SDK
      • Run Code Sample
        • Send Transactions
          Send Transactions
        • Use Crypto Utilities
          Use Crypto Utilities
        • Interact With Node
          Interact With Node
        • Set Up Smart Contracts
          Set Up Smart Contracts
        Run Code Sample
      Gowaves
    • WavesJ
      • Install SDK
        Install SDK
      • Run Code Sample
        • Send Transactions
          Send Transactions
        • Use Crypto Utilities
          Use Crypto Utilities
        • Interact With Node
          Interact With Node
        • Set Up Smart Contracts
          Set Up Smart Contracts
        Run Code Sample
      WavesJ
    • Ts-lib-crypto
      • Install SDK
        Install SDK
      Ts-lib-crypto
    • Waves-PHP
      • Install SDK
        Install SDK
      Waves-PHP
    • PyWaves-CE
      • Install SDK
        Install SDK
      • Run Code Sample
        • Send Transactions
          Send Transactions
        • Use Crypto Utilities
          Use Crypto Utilities
        • Interact With Node
          Interact With Node
        • Set Up Smart Contracts
          Set Up Smart Contracts
        Run Code Sample
      PyWaves-CE
    • Waves-rust
      • Install SDK
        Install SDK
      Waves-rust
    Client Libraries
      • English
      • Русский
      On this page
        • Private Key
        • Public Key
        • Address
      waves_logo Docs

          # Use Crypto Utilities

          You can work with the Private Key, Public Key, and Address methods.

          # Private Key

          You can create a private key from:

          • Seed phrase.
          • Seed bytes.
          • Randomly generated seed bytes.
          • Bytes.
          • Encoded string.

          # Create Private Key from Seed Phrase

          # Necessary import.
          import pywaves as pw
          
          # Specify your account's seed phrase.
          seed_phrase = "PASTE YOUR SEED PHRASE"
          
          # Creation of the private key from the seed phrase.
          address = pw.Address(seed=seed_phrase)
          privateKey = address.privateKey
          
          # Print the output.
          print("Sender's Private Key:", privateKey)
          

          # Create Private Key from Seed Bytes

          # Necessary imports.
          import pywaves as pw
          import base58
          
          # Creation of a byte array.
          seed_bytes = bytes([1, 2, 3, 4, 5, 6, 7]) # Byte array example.
          
          # Encoding bytes to a Base58 string to use as a seed.
          seed_phrase = base58.b58encode(seed_bytes).decode()
          
          # Creation of the private key from the seed bytes.
          address = pw.Address(seed=seed_phrase)
          privateKey = address.privateKey
          
          # Print the output.
          print("Sender's Private Key:", privateKey)
          

          # Create Private Key from Randomly Generated Seed Bytes

          # Necessary imports.
          import pywaves as pw
          import os
          import base58
          
          # Generation of random seed bytes.
          random_seed_bytes = os.urandom(32)
          
          # Encoding to Base58 to use as a seed.
          seed_phrase = base58.b58encode(random_seed_bytes).decode()
          
          # Creation of the private key from the randomly generated seed bytes.
          address = pw.Address(seed=seed_phrase)
          privateKey = address.privateKey
          
          # Print the output.
          print("Sender's Private Key:", privateKey)
          

          # Create Private Key from Bytes

          # Necessary imports.
          import pywaves as pw
          import base58
          
          # Creation of a byte array.
          bytes_array = bytes([56, 253, 37, 64, 2, 38, 78, 37, 158, 211, 233, 117, 14, 88, 20, 42,
          247, 21, 55, 87, 117, 248, 175, 77, 77, 157, 169, 233, 7, 116, 157, 236]) # Bytes example.
          
          # Encoding bytes to Base58 string to use as a seed.
          seed_phrase = base58.b58encode(bytes_array).decode()
          
          # Creation of the private key from the bytes.
          address = pw.Address(seed=seed_phrase)
          privateKey = address.privateKey
          
          # Print the output.
          print("Sender's Private Key:", privateKey)
          

          # Create Private Key from an Encoded String

          # Necessary import.
          import pywaves as pw
          
          # Creation of a Base58 string.
          base58_string = "A5u9Ugt2nG1rWfLkL7pzZrtkP8LgF2rD3g1XBjsF8ZzV" # Base58 string example.
          
          # Creation of the private key from the Base58 string seed.
          address = pw.Address(seed=seed_phrase)
          privateKey = address.privateKey
          
          # Print the output.
          print("Sender's Private Key:", privateKey)
          

          # Public Key

          You can create a public key from an address. Place the following code after the address generation:

          # Creation of the public key.
          publicKey = address.publicKey 
          
          # Print the output.
          print("Sender's Public Key:", address.publicKey)
          

          # Address

          You can create an address from the private key. Place the following code after the private key generation:

          # Set the node link and chain ID.
          pw.setNode(
          	# Specify the link for the network:
          	# - Mainnet: 'https://nodes.wavesnodes.com/'
          	# - Testnet: 'https://nodes-testnet.wavesnodes.com/'
          	# - Stagenet: 'https://nodes-stagenet.wavesnodes.com/'
          	node='https://nodes-testnet.wavesnodes.com', 
          
          	# Specify the network chain ID:
          	# - Mainnet: 'M'
          	# - Testnet: 'T'
          	# - Stagenet: 'S'
          	chain='T'
          )
          
          # Print the output.
          print("Sender's Address:", address)
          
          Send Transactions
          Interact With Node
          Send Transactions
          Interact With Node