from paydex_base_sdk.keypair import Keypair print("create a random keypair") kp = Keypair.random() print("Secret: {}".format(kp.secret)) print("Public Key: {}".format(kp.public_key)) print("") # create a keypair from secret print("create a keypair from secret") secret = "SBRR6ZPBHHTDXYSFRZR2QZCGDZURNE5ON4M4F3HQA42G3Z62SFCR7EEJ" kp = Keypair.from_secret(secret) print("Secret: {}".format(kp.secret)) print("Public Key: {}".format(kp.public_key)) print("") # create a keypair from public key print("create a keypair from public key") public_key = "GDCZ6JDZMWYORTIHEO2E4ZXKBQ2TLXNRQJPJH5RCFN7Q7I24G4RGLXP6" kp = Keypair.from_public_key(public_key) print("Public Key: {}".format(kp.public_key))
def test_create_random(self): kp = Keypair.random() public_key = kp.public_key secret = kp.secret assert StrKey.is_valid_ed25519_public_key(public_key) assert StrKey.is_valid_ed25519_secret_seed(secret)
def test_not_isinstance_equal(self): assert Keypair.random() != "bad type"
import requests from paydex_base_sdk.keypair import Keypair keypair = Keypair.random() print("Public Key: " + keypair.public_key) print("Secret Seed: " + keypair.secret) url = 'https://testhorizon.paydex.io/' response = requests.get(url, params={'addr': keypair.public_key}) print(response)