XMLHttpRequest is not defined while sending request to blockchain service via C

0 votes

I'm trying to request the balance from https://blockchain.info/. Following instructions https://github.com/blockchain/service-my-wallet-v3#installation I've installed node.js and npm and successfully started the server. Now I'm trying to request the balance of my wallet:

string responseString;
string urlRequest = "http://127.0.0.1:3000/api/v2/create";
var request = (HttpWebRequest)WebRequest.Create(urlRequest);

request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";

string requestData = "password=PASS&api_code=CODE";
byte[] dataStream = Encoding.UTF8.GetBytes(requestData);
request.ContentLength = dataStream.Length;
Stream newStream = request.GetRequestStream();
newStream.Write(dataStream, 0, dataStream.Length);
newStream.Close();
var response = (HttpWebResponse)request.GetResponse();
responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
Console.WriteLine(responseString);
return responseString;

But I get response 500 and in node.js command prompt written "Error generating the entropyReferenceError: XMLHttpRequest is not defined.

Sep 20, 2018 in Blockchain by digger
• 26,740 points
1,015 views

1 answer to this question.

0 votes

use post data in url link and it worked:

string responseString;
string urlRequest = "http://127.0.0.1:3000/merchant/WALLET_ID/balance?password=PASS&api_code=API_CODE";
var request = (HttpWebRequest)WebRequest.Create(urlRequest);

request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
var response = (HttpWebResponse)request.GetResponse();
responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
Console.WriteLine(responseString);
return responseString;
answered Sep 20, 2018 by slayer
• 29,350 points

Related Questions In Blockchain

0 votes
1 answer
+1 vote
3 answers

Is it possible to store data about arbitrary objects on the blockchain using smart contracts?

Basically you implement requested logic on by ...READ MORE

answered Aug 30, 2018 in Blockchain by Artem
1,218 views
+1 vote
1 answer

I would like to create a blockchain network which will stay at the same level of complexity, is it possible?

You can very easily create a cryptocurrency having a ...READ MORE

answered Apr 4, 2018 in Blockchain by Christine
• 15,790 points
638 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,663 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,215 views
+1 vote
5 answers

How to solve "truffle: command not found" error in blockchain?

First try restarting the system and then ...READ MORE

answered Jul 16, 2018 in Blockchain by slayer
• 29,350 points
11,273 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP