title: Create an ethereum public address from a private key
body: <p><a href="https://www.freecodecamp.org/news/how-to-create-an-ethereum-wallet-address-from-a-private-key-ae72b0eee27b/" rel="nofollow noreferrer">https://www.freecodecamp.org/news/how-to-create-an-ethereum-wallet-address-from-a-private-key-ae72b0eee27b/</a></p>
  
  <p>Why the <strong>secp256k1 Elliptic Curve</strong> fail ?</p>
  
  <pre><code>// C#
  
  // I am using HashLib
  var ecdsaRaw = Ecdsa(Encoding.ASCII.GetBytes(privKey));
  var ecdsaCombined = (BitConverter.ToString(ecdsaRaw.Item1) + BitConverter.ToString(ecdsaRaw.Item2)).Replace("-", "");
  var finalResult = HashFactory.Crypto.SHA3.CreateKeccak256().ComputeString(ecdsaCombined, Encoding.ASCII).ToString().Replace("-", "");
  var pubKey = "0x" + finalResult.Substring(finalResult.Length - 40, 40);
  Console.WriteLine("ECDSA + Keccak256 : " + pubKey);
  
  // Ecdsa Method 
  public static Tuple&lt;byte[], byte[]&gt; Ecdsa(byte[] privateKey)
  {
       var privKeyInt = new BigInteger(+1, privateKey);
  
       var parameters = SecNamedCurves.GetByName("secp256k1");
       var qa = parameters.G.Multiply(privKeyInt);
  
       var pubKeyX = qa.X.ToBigInteger().ToByteArrayUnsigned();
       var pubKeyY = qa.Y.ToBigInteger().ToByteArrayUnsigned();
  
       return Tuple.Create(pubKeyX, pubKeyY);
  }
  </code></pre>
  
  <blockquote>
    <p>Output :</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/qgQIc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qgQIc.png" alt="enter image description here"></a></p>
  
  <blockquote>
    <p>Expected Output :</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/za19Z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/za19Z.png" alt="enter image description here"></a></p>