Exemplo n.º 1
0
    def __init__(self: Wallet, seed: str, sequence: int) -> None:
        """
        Generate a new Wallet.

        Args:
            seed: The seed from which the public and private keys are derived.
            sequence: The next sequence number for the account.
        """
        #: The core value that is used to derive all other information about
        #: this wallet. MUST be kept secret!
        self.seed = seed

        pk, sk = derive_keypair(self.seed)
        #: The public key that is used to identify this wallet's signatures, as
        #: a hexadecimal string.
        self.public_key = pk
        #: The private key that is used to create signatures, as a hexadecimal
        #: string. MUST be kept secret!
        self.private_key = sk

        #: The address that publicly identifies this wallet, as a base58 string.
        self.classic_address = derive_classic_address(self.public_key)

        #: The next available sequence number to use for transactions from this
        #: wallet.
        #: Must be updated by the user. Increments on the ledger with every successful
        #: transaction submission, and stays the same with every failed transaction
        #: submission.
        self.sequence = sequence
Exemplo n.º 2
0
    def __init__(self: Wallet, seed: str, sequence: int) -> None:
        """
        Generate a new Wallet.

        Args:
            seed: The seed from which the public and private keys are derived.
            sequence: The next sequence number for the account.
        """
        self.seed = seed
        """
        The core value that is used to derive all other information about
        this wallet. MUST be kept secret!
        """

        pk, sk = derive_keypair(self.seed)
        self.public_key = pk
        """
        The public key that is used to identify this wallet's signatures, as
        a hexadecimal string.
        """

        self.private_key = sk
        """
        The private key that is used to create signatures, as a hexadecimal
        string. MUST be kept secret!
        """

        self.classic_address = derive_classic_address(self.public_key)
        """The address that publicly identifies this wallet, as a base58 string."""

        self.sequence = sequence
        """
Exemplo n.º 3
0
    def __init__(self: Wallet, seed: str) -> None:
        """
        Generate a new Wallet.

        Args:
            seed: The seed from which the public and private keys are derived.
        """
        #: The core value that is used to derive all other information about
        #: this wallet. MUST be kept secret!
        self.seed = seed

        pk, sk = derive_keypair(self.seed)
        #: The public key that is used to identify this wallet's signatures, as
        #: a hexadecimal string.
        self.public_key = pk
        #: The private key that is used to create signatures, as a hexadecimal
        #: string. MUST be kept secret!
        self.private_key = sk

        #: The address that publicly identifies this wallet, as a base58 string.
        self.classic_address = derive_classic_address(self.public_key)

        #: The next available sequence number to use for transactions from this
        #: wallet. Must be maintained by the user; is not updated by the library.
        self.next_sequence_num = 0
Exemplo n.º 4
0
 def test_derive_keypair_secp256k1(self):
     public, private = keypairs.derive_keypair(
         "sp5fghtJtpUorTwvof1NpDXAzNwf5")
     self.assertEqual(
         public,
         "030D58EB48B4420B1F7B9DF55087E0E29FEF0E8468F9A6825B01CA2C361042D435",
     )
     self.assertEqual(
         private,
         "00D78B9735C3F26501C7337B8A5727FD53A6EFDBC6AA55984F098488561F985E23",
     )
Exemplo n.º 5
0
 def test_derive_keypair_ed25519(self):
     public, private = keypairs.derive_keypair(
         "sEdSKaCy2JT7JaM7v95H9SxkhP9wS2r")
     self.assertEqual(
         public,
         "ED01FA53FA5A7E77798F882ECE20B1ABC00BB358A9E55A202D0D0676BD0CE37A63",
     )
     self.assertEqual(
         private,
         "EDB4C4E046826BD26190D09715FC31F4E6A728204EADD112905B08B14B7F15C4F3",
     )
Exemplo n.º 6
0
    def __init__(self: Wallet, seed: str) -> None:
        """
        Generate a new Wallet.

        Args:
            seed: The seed from which the public and private keys are derived.
        """
        self.seed = seed
        self.pub_key, self.priv_key = derive_keypair(self.seed)
        self.classic_address = derive_classic_address(self.pub_key)
        self.next_sequence_num = 0
Exemplo n.º 7
0
 def test_derive_keypair_secp256k1_validator(self):
     public, private = keypairs.derive_keypair(
         "sp5fghtJtpUorTwvof1NpDXAzNwf5",
         validator=True,
     )
     self.assertEqual(
         public,
         "03B462771E99AAE9C7912AF47D6120C0B0DA972A4043A17F26320A52056DA46EA8",
     )
     self.assertEqual(
         private,
         "001A6B48BF0DE7C7E425B61E0444E3921182B6529867685257CEDC3E7EF13F0F18",
     )
Exemplo n.º 8
0
 def test_derive_keypair_ed25519_validator(self):
     with self.assertRaises(XRPLKeypairsException):
         keypairs.derive_keypair("sEdSKaCy2JT7JaM7v95H9SxkhP9wS2r",
                                 validator=True)