Last active
          August 20, 2024 15:27 
        
      - 
      
- 
        Save kehiy/bb850f6bd2b684ce3a4353bfe942f4aa to your computer and use it in GitHub Desktop. 
    A python script that generates Pactus address and save them in a JSON file
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import json | |
| import secrets | |
| from pactus.crypto import CryptoConfig | |
| from pactus.crypto.address import AddressType, Address | |
| from pactus.crypto.bls.private_key import PrivateKey, PublicKey | |
| def main() -> None: | |
| addresses = [] | |
| CryptoConfig.use_testnet() | |
| for _ in range(10): # replace the amount of addresses you want here. | |
| ikm = secrets.token_bytes(32) | |
| sec = PrivateKey.key_gen(ikm) | |
| pub = sec.public_key() | |
| addr = pub.account_address() | |
| addresses.append(addr.string()) | |
| print(f"Address generated: {addr.string()}") | |
| with open("address.json", 'w') as file: | |
| json.dump(addresses, file) | |
| if __name__ == "__main__": | |
| main() | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment