Hi
I'm creating an ASP.NET website in c#.
I want to allow a registered user to create his own bitcoin wallet in the website in which he will be able to deposit and withdraw bitcoins to an external wallet.
I have experience with ASP.NET and C# but i am pretty new the crypto world.
I've heard about libraries like BitcoinLib and BitcoinSharp but i wasn't able to find a good documentation that would explain to a newbie like me how to create a wallet in my website.
I also tried to use the blockchain.info api but it takes too much to complete a transaction and i have heard some bad comments about that api.
Also, i don't feel comfortable with relying on a third party api.
I would really appreciate if someone would give me or address me to a proper explanation of how i can implement such system in my website.
Thank you very much
hi,
first you should check some basic stuff:
https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_listthanks god we have json-rpc which can be used for wallet-communication.
so C# offers two basic options for this realization:
1. use standard http json reqests. EXAMPLE: (C#)
if you use http
s JSON-RPC calls (SSL --> see "rpcssl") PLEASE MAKE SURE TO HAVE ACTUAL OPENSSL VERSION INSTALLED!
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("http://localhost.:8332");
webRequest.Credentials = new NetworkCredential("user", "pwd");
/// important, otherwise the service can't desirialse your request properly
webRequest.ContentType = "application/json-rpc";
webRequest.Method = "POST";
JObject joe = new JObject();
joe.Add(new JProperty("jsonrpc", "1.0"));
joe.Add(new JProperty("id", "1"));
joe.Add(new JProperty("method", Method));
// params is a collection values which the method requires..
if (Params.Keys.Count == 0)
{
joe.Add(new JProperty("params", new JArray()));
}
else
{
JArray props = new JArray();
// add the props in the reverse order!
for (int i = Params.Keys.Count - 1; i >= 0; i--)
{
.... // add the params
}
joe.Add(new JProperty("params", props));
}
// serialize json for the request
string s = JsonConvert.SerializeObject(joe);
byte[] byteArray = Encoding.UTF8.GetBytes(s);
webRequest.ContentLength = byteArray.Length;
Stream dataStream = webRequest.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
WebResponse webResponse = webRequest.GetResponse();
... // deserialze the response
the 2. option is json.Net (
http://james.newtonking.com/json ) which is a high performance JSON package for .Net
cheers,
bitsta