Skip to content

Instantly share code, notes, and snippets.

@kehiy
Last active August 20, 2024 15:27
Show Gist options
  • Save kehiy/bb850f6bd2b684ce3a4353bfe942f4aa to your computer and use it in GitHub Desktop.
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
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