public static string CalculateContractAddress(string address, BigInteger nonce) { var sha3 = new Sha3Keccack(); return (sha3.CalculateHash(RLP.RLP.EncodeList(RLP.RLP.EncodeElement(address.HexToByteArray()), RLP.RLP.EncodeElement(nonce.ToBytesForRLPEncoding()))).ToHex().Substring(24)); }
public static string CalculateContractAddress(string address, BigInteger nonce) { if (string.IsNullOrEmpty(address)) { throw new System.ArgumentException($"'{nameof(address)}' cannot be null or empty.", nameof(address)); } var sha3 = new Sha3Keccack(); return sha3.CalculateHash(RLP.RLP.EncodeList(RLP.RLP.EncodeElement(address.HexToByteArray()), RLP.RLP.EncodeElement(nonce.ToBytesForRLPEncoding()))).ToHex().Substring(24).ConvertToEthereumChecksumAddress(); }