xrpl-dev-portal icon indicating copy to clipboard operation
xrpl-dev-portal copied to clipboard

XRPL seed / address generation issue

Open wilhelm31620 opened this issue 1 year ago • 1 comments
trafficstars

I know I'm probably missing something obvious but I'm really not sure what it is.

I made a simple search for finding strings in XRPL address using python. It works well, it finds addresses. BUT...

The mnemonic when put into a wallet is not correct. Dropped mnemonic into one of the online code things to check address and it agrees with Xaman wallet, so I'm sure it's me. Really not sure what I'm missing.

Any help would be good.

given - cigar swim extra grain half trade pair slice chase short kick bid address should be - rJFsq5AXWe7mb2wTPJHBbAd84v34SXJWca

import xrpl
import random
import bip39
import threading

from xrpl.clients import JsonRpcClient

url = "https://s1.ripple.com:51234/"
client = xrpl.clients.JsonRpcClient(url)


stringy = ["rWill", "rRach", "rFaye","rBruce","rr"]
steps = len(stringy)
print(steps)
runs = 1

def my_thread(count, stringy):
    #step_count = len(stringy)
    while count > 0:
        bytes_16 = (random.randbytes(16)) # 16 bytes is 12 words, 32 bytes is 24 words
        phrase = bip39.encode_bytes(bytes_16)
        
        
        phrase = "cigar swim extra grain half trade pair slice chase short kick bid" # use this to lock phrase for testing
        bytes_16 = bip39.decode_phrase(phrase)
        # print(bytes_16)

        #valid = bip39.check_phrase(phrase)
        #words = phrase.split()
        CryptoAlgorithm = xrpl.CryptoAlgorithm.SECP256K1 # SECP256K1 ED25519
        seed = xrpl.core.addresscodec.encode_seed(bytes_16,CryptoAlgorithm)
        wallet = xrpl.wallet.Wallet.from_seed(seed,algorithm=CryptoAlgorithm)
        #wallet.create(algorithm=CryptoAlgorithm.ED25519)
        keys = xrpl.core.keypairs.derive_keypair(seed)
        addr0 = xrpl.core.keypairs.derive_classic_address(keys[0])
        # addr1 = xrpl.core.keypairs.derive_classic_address(keys[1])
        # print(bytes_16)
        print(phrase)
        print(seed)
        print(keys)
        print(addr0)
        # print(addr1)
        print(wallet)
        addr_xrpl = addr0
      
     

        step_count = len(stringy)
        while step_count > 1:
            
            if stringy[step_count-1] in addr_xrpl:
                print(count, " - ", addr_xrpl, " ",keys, " ", seed)

            step_count = step_count-1
        count = count-1

wilhelm31620 avatar Sep 04 '24 21:09 wilhelm31620