Bitcoin Forum
May 06, 2024, 10:55:40 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Can't do POST request on C# to blockr.io  (Read 393 times)
martinblack (OP)
Newbie
*
Offline Offline

Activity: 12
Merit: 0


View Profile
April 22, 2016, 09: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);
        }
    }
BitcoinCleanup.com: Learn why Bitcoin isn't bad for the environment
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
KenR
Hero Member
*****
Offline Offline

Activity: 910
Merit: 1000


「きみはこれ&#


View Profile
April 22, 2016, 01:16:54 PM
 #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.

  ████
█ ████
█ ████
█ ████
█ ████ █
█ ████ █
█ ████ █
█ ████ █
█ ████ █
  ████ █
  ████ █
  ████ █
  ████
  ████
█ ████
█ ████
█ ████
█ ████ █
█ ████ █
█ ████ █
█ ████ █
█ ████ █
  ████ █
  ████ █
  ████ █
  ████
  .WEBSITE.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  .ANN THREAD.
.
▄▄▄▄▄▄▄▄
  ████
█ ████
█ ████
█ ████
█ ████ █
█ ████ █
█ ████ █
█ ████ █
█ ████ █
  ████ █
  ████ █
  ████ █
  ████
martinblack (OP)
Newbie
*
Offline Offline

Activity: 12
Merit: 0


View Profile
April 22, 2016, 08: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.
KenR
Hero Member
*****
Offline Offline

Activity: 910
Merit: 1000


「きみはこれ&#


View Profile
April 23, 2016, 08: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.

  ████
█ ████
█ ████
█ ████
█ ████ █
█ ████ █
█ ████ █
█ ████ █
█ ████ █
  ████ █
  ████ █
  ████ █
  ████
  ████
█ ████
█ ████
█ ████
█ ████ █
█ ████ █
█ ████ █
█ ████ █
█ ████ █
  ████ █
  ████ █
  ████ █
  ████
  .WEBSITE.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  .ANN THREAD.
.
▄▄▄▄▄▄▄▄
  ████
█ ████
█ ████
█ ████
█ ████ █
█ ████ █
█ ████ █
█ ████ █
█ ████ █
  ████ █
  ████ █
  ████ █
  ████
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!