Author

Topic: Is it possible to simulate bitcoin address using C#? (Read 179 times)

legendary
Activity: 3444
Merit: 10558
What are the requirements to create similar programming just like what webtricks did before in his project? Any recommended readings?

the topic you shared already contains good information for you to read. also if you want to experiment you can "translate" the code in that topic to c# which isn't really that hard to begin with. if you use .Net Framework then you'll have access to RIPEMD160 and SHA256 and the ECC code is in that topic. BigInt becomes BigInteger (found in System.Numerics) and the points such as G have to be defined as a "struct" that contains 2 BigIntegers (x and y).
if you use .Net Core then you won't have RIPEMD160 anymore but you can copy it from any crypto library or even .Net Framework source code itself (link)
hero member
Activity: 2254
Merit: 831
To get a bitcoin address, you need to have a public key. To have a public key, you need to have a private key. You can not find them in the backward steps.

Private key (Eliptic Curve Multiplication) - Publick Key (Hash Function) - Address
k - K - A (irreversible)
And K = k * G

What you ask is the reverse math of the formula and it is impossible.

You can see the explanation for Eliptic Curve at https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch04.asciidoc#elliptic_curve

https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch04.asciidoc
legendary
Activity: 1904
Merit: 1563
Bitcoin Casino Est. 2013
WOW! Thank you @hatshepsut93 and @OmegaStarScream for recommending some resources. This can significantly help boost my learning curve between the use of C# as well as learning the algorithm involved in this bitcoin generation address.

I'll ask questions here if there are any issues I encountered throughout the process.  Smiley
staff
Activity: 3472
Merit: 6129
Take a look at NBitcoin's[1] library, you can either call it[2] or check the source code to see how is it done from scratch.

[1] https://github.com/MetacoSA/NBitcoin
[2] https://programmingblockchain.gitbook.io/programmingblockchain/bitcoin_transfer/bitcoin_address
legendary
Activity: 2954
Merit: 2145
"Simulate" is not the right word here, you are asking how to generate a real Bitcoin address in C#. You can use any programming language available, they are all capable of doing this task.

Generating Bitcoin address requires cryptographic hash function utilities and elliptic curve utilities, though webtrics implemented some elliptic curve functions from scratch in his example. Generally, it's a bad practice to implement something that has already been done and is freely available in forms of libraries, unless done for educational purposes.

So, the simple approach would be to import all the functions that you need, and just assemble your wallet generation function with them.

You can also look for existing C# implementations of it, for example here.
legendary
Activity: 1904
Merit: 1563
Bitcoin Casino Est. 2013
Hey greetings,

I've been slowly reading the book of Andreas Antonopolous and currently reading chapter 4 - keys addresses and recently came across the thread created by @webtricks about How Bitcoin Addresses are generated? Understand the Math behind Bitcoin.

Is it possible to create a similar bitcoin address generation using C# programming language in visual studio from a console? I came across with this idea because I am currently enrolled in an online class and it happens that we're using C# programming language in our subject and also have the willingness to learn how these bitcoin addresses are generated from scratch.

What are the requirements to create similar programming just like what webtricks did before in his project? Any recommended readings?
Jump to: