Blog

Filter posts by Category Or Tag of the Blog section!

Tron Network hex from address

Sunday, 30 January 2022

I was recently implementing the Dedicated wallet for Trasi and I had to create the hex, based on the generated wallet as most of the Tron services take the hex of the address instead of the address itself.



  

public static string CreateHex(this String address)

        {

           var stringBuilder = new StringBuilder();



            var bytes = Base58.Bitcoin.Decode(address); 



            for (int i = 0; i < bytes.Length - 4; i++)

            {

                var t = bytes[i];

                stringBuilder.Append(t.ToString("X2"));

            }



            return stringBuilder.ToString();

        }


 

I created the above helper based toHex which is available in tronweb. And about the Base58, it lives in SimpleBase

comments powered by Disqus