Author

Topic: Can't do POST request on C# to blockr.io (Read 393 times)

hero member
Activity: 910
Merit: 1000
「きみはこれ&#
April 23, 2016, 04:32:33 AM
#4
Where is the "Response" function ? Isn't it suppose to be followed by the "Request" client ? I have never used Blockr API but check the req,res part again.

Hey Ken.
The issue was that I was selecting the whole transaction as the input and not choosing the appropriate indexes, so I was creating a transaction with no signatures for those inputs I didn't have the private keys for.

Damn, you think you get Bitcoin, until you need to create a TX manually.

Haha I get the complexcities  but choosing a scripting language is always better than c# or java. Try doing the same in py scripts, much easier.
newbie
Activity: 12
Merit: 0
April 22, 2016, 04:54:49 PM
#3
Where is the "Response" function ? Isn't it suppose to be followed by the "Request" client ? I have never used Blockr API but check the req,res part again.

Hey Ken.
The issue was that I was selecting the whole transaction as the input and not choosing the appropriate indexes, so I was creating a transaction with no signatures for those inputs I didn't have the private keys for.

Damn, you think you get Bitcoin, until you need to create a TX manually.
hero member
Activity: 910
Merit: 1000
「きみはこれ&#
April 22, 2016, 09:16:54 AM
#2
Where is the "Response" function ? Isn't it suppose to be followed by the "Request" client ? I have never used Blockr API but check the req,res part again.
newbie
Activity: 12
Merit: 0
April 22, 2016, 05:02:42 AM
#1
Trying to write a method to push a TX, I never programatically done a POST request, so I'm clearly messing somewhere bad.

According to the documentation from blockr, I'm supposed to do this:

Quote
    To publish a transaction make a POST (!) request with your transaction hex to the push API.

    Using curl this would be like (shell example):

    curl -d '{"hex":"TX_HASH"}' http://btc.blockr.io/api/v1/tx/push

I'm getting 500 errors left and right.

I'm doing this on C#, could someone help?

Code:
Post("http://btc.blockr.io/api/v1/tx/push", "hex", HexString);


    public static void Post(string RequestURL, string Post1, string Post2)
    {
        using (var wb = new WebClient())
        {
            var data = new NameValueCollection();
            data[Post1] = Post2;
            var response = wb.UploadValues(RequestURL, "POST", data);
        }
    }
Jump to: