In python I'm using the line :
hex_string1 = format(index, 'x').zfill(64)
to format each index to a 64 character hexadecimal digit. This means that index 1,2,3, and on will all go up by 1 hexadecimally and the representation of this is also in the string.
I have another variable that I want to format but not hexadecimally. I want to format this variable so that I can search for it in the index by any means.
The variable is the wallet address of the 64 character hexadecimal string. You may be wondering what I'm working on and it's a new platform for my ethereum cryptocurrency exchange that can parse wallets and see data within already created wallets.
My code so far is:
def get_hex_string_at_index(index, length):hex_string1 = format(index, 'x').zfill(length)account = Account.from_key(hex_string1)map_account = 1result_string = hex_string1 +" " + account.address # Format the last 40 charactershex_string = result_string[:64] # Only take the first 64 characters of the hex stringreturn result_string
In the map_account variable I want to use format() like what was used in the hex_string1 variable so that I can format the account.address to the index and search for it in the index. With hex_string1 = format(index, 'x').zfill(64) you can get the index by using int(variable,16) and that will map the hexadecjmal string to the integer its on. I want something like this for the account.address. You guys will probably have to make new code with the format() function to do this. Please can someone show me what to do?