Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: TKeenan on April 30, 2015, 05:05:13 PM



Title: How to convey transaction to network
Post by: TKeenan on April 30, 2015, 05:05:13 PM
I have a most perfectly formed transaction ready to go.  What is the easiest way to transmit it into the bitcoin network for processing? 

I don't want to set up and run bitcoind on a local machine.  Too much agro.  Is there a trusted node with a permanent IP which I can send (via some protocol) the bytes to?  What is the minimum handshaking that must be done to establish a connection to this node with a know IP.  Is there an easier way?  Does blockchain.info support that?


Title: Re: How to convey transaction to network
Post by: virtualx on April 30, 2015, 05:08:31 PM
I have a most perfectly formed transaction ready to go.  What is the easiest way to transmit it into the bitcoin network for processing? 

I don't want to set up and run bitcoind on a local machine.  Too much agro.  Is there a trusted node with a permanent IP which I can send (via some protocol) the bytes to?  What is the minimum handshaking that must be done to establish a connection to this node with a know IP.  Is there an easier way?  Does blockchain.info support that?

You can use a thin client library for that, have a look at pybitcoinlib. Transactions can be pushed using blockchain.info or an exchange.



Title: Re: How to convey transaction to network
Post by: fbueller on April 30, 2015, 05:20:48 PM
Substitute the tx hex for your own, and this is good to go. I haven't used it over the CLI before, it will reject transactions sometimes, so watch out for that. It sometimes states there is a problem with the transaction, but it gets broadcast anyway.

curl -X POST -d tx=010000000158891e8f28100642464417f53845c3953a43e31b35d061bdbf6ca3a64fffabb8000000008c493046022100a9d501a6f59c45a24e65e5030903cfd80ba33910f24d6a505961d64fa5042b4f02210089fa7cc00ab2b5fc15499fa259a057e6d0911d4e849f1720cc6bc58e941fe7e20141041a2756dd506e45a1142c7f7f03ae9d3d9954f8543f4c3ca56f025df66f1afcba6086cec8d4135cbb5f5f1d731f25ba0884fc06945c9bbf69b9b543ca91866e79ffffffff01204e0000000000001976a914d04b020dab70a7dd7055db3bbc70d27c1b25a99c88ac00000000 https://blockchain.info/pushtx

Otherwise, you might be able to do something similar for this form: https://insight.bitpay.com/tx/send

There are probably several of these insight servers around, some googling might help you have some redundancy for broadcasting.


Title: Re: How to convey transaction to network
Post by: tspacepilot on April 30, 2015, 05:27:45 PM
I have a most perfectly formed transaction ready to go.  What is the easiest way to transmit it into the bitcoin network for processing?  

I don't want to set up and run bitcoind on a local machine.  Too much agro.  Is there a trusted node with a permanent IP which I can send (via some protocol) the bytes to?  What is the minimum handshaking that must be done to establish a connection to this node with a know IP.  Is there an easier way?  Does blockchain.info support that?

You can use a thin client library for that, have a look at pybitcoinlib. Transactions can be pushed using blockchain.info or an exchange.


I poked around a bit in that library, I see where in an example "import socket" is used to send to a local IP.  I guess socket uses TCP for the connection.  However, like the OP, I'd also be interested in knowing if it's possible to connect in this way to any particular full node.  

@OP, the blockchain tool to accept a raw transaction over HTTP is here: https://blockchain.info/pushtx


Title: Re: How to convey transaction to network
Post by: samson on April 30, 2015, 09:26:17 PM
Someone wrote a blog entry which covers this - scroll down a little and there's a python script to do it.

http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html


Title: Re: How to convey transaction to network
Post by: TKeenan on May 01, 2015, 10:29:23 AM
@OP, the blockchain tool to accept a raw transaction over HTTP is here: https://blockchain.info/pushtx

Hmm, that's seems cool.  

However, I can't get this one to publish.  Any idea what's up?

010000000128442f044ac462554b880776d3e2e33794e6fec7c1f01ee9e7e82ae66534034300000 0
006a47304402203fe2ee295c4c27b6d2d90e5aeaa83b651d2ad729d99b57fb292d4ea4e07a1d690 2
201265c12ec5bbe379c973c358738a07ee369e9237dd600ad07b7db41729b8457d012103611dc2a 5
7e244ab48a6d1b9bbb8958a0743c002d141def726cd2d2732dd01561ffffffff03c027090000000 0
001976a914c5760f778c8d2fcd0f7e8aa1a163ca8089c9fe9488ac309c3800000000001976a9140 c
c3ed93022d209d7907939a5be757db143e568c88ac0000000000000000266a24313337352054686 f
6d61732053742e2053616e2052616661656c2c20434120393230363700000000


I have a most perfectly formed transaction ready to go.
Maybe not! ;)


Title: Re: How to convey transaction to network
Post by: TheButterZone on May 01, 2015, 07:03:16 PM
010000000128442f044ac462554b880776d3e2e33794e6fec7c1f01ee9e7e82ae66534034300000 0
006a47304402203fe2ee295c4c27b6d2d90e5aeaa83b651d2ad729d99b57fb292d4ea4e07a1d690 2
201265c12ec5bbe379c973c358738a07ee369e9237dd600ad07b7db41729b8457d012103611dc2a 5
7e244ab48a6d1b9bbb8958a0743c002d141def726cd2d2732dd01561ffffffff03c027090000000 0
001976a914c5760f778c8d2fcd0f7e8aa1a163ca8089c9fe9488ac309c3800000000001976a9140 c
c3ed93022d209d7907939a5be757db143e568c88ac0000000000000000266a24313337352054686 f
6d61732053742e2053616e2052616661656c2c20434120393230363700000000

Need to remove all spaces and carriage returns from that hex so that it is an unbroken string of characters, then it's valid. I just broadcasted it via Electrum.


Title: Re: How to convey transaction to network
Post by: TKeenan on May 02, 2015, 06:05:00 AM
010000000128442f044ac462554b880776d3e2e33794e6fec7c1f01ee9e7e82ae66534034300000 0
006a47304402203fe2ee295c4c27b6d2d90e5aeaa83b651d2ad729d99b57fb292d4ea4e07a1d690 2
201265c12ec5bbe379c973c358738a07ee369e9237dd600ad07b7db41729b8457d012103611dc2a 5
7e244ab48a6d1b9bbb8958a0743c002d141def726cd2d2732dd01561ffffffff03c027090000000 0
001976a914c5760f778c8d2fcd0f7e8aa1a163ca8089c9fe9488ac309c3800000000001976a9140 c
c3ed93022d209d7907939a5be757db143e568c88ac0000000000000000266a24313337352054686 f
6d61732053742e2053616e2052616661656c2c20434120393230363700000000

Need to remove all spaces and carriage returns from that hex so that it is an unbroken string of characters, then it's valid. I just broadcasted it via Electrum.
Nice!  Thanks very much for that.  :)

OOPs, bad news.  Blockchain.info blocks transactions with an OP_Return as 'non standard transactions' - https://blockchain.info/rejected (https://blockchain.info/rejected) .  Is there a better API to push transactions into?



Title: Re: How to convey transaction to network
Post by: TheButterZone on May 02, 2015, 09:10:57 AM
You could try http://eligius.st/~wizkid057/newstats/pushtxn.php


Title: Re: How to convey transaction to network
Post by: TKeenan on May 02, 2015, 10:30:46 AM
You could try http://eligius.st/~wizkid057/newstats/pushtxn.php
Yeah, I don't know how to write the WebRequest object in .Net to send to the push URL at blockr.  Having trouble with the encoding and stuff. 

Blockchain.info has a sweet API for .Net - but then they go and block OP_Return.  Why do they block OP_Return?  That is totally stupid.  Does any other blockchain API providers have a nice .Net code on GitHub? 

Holy shit this is hard.


Title: Re: How to convey transaction to network
Post by: Muhammed Zakir on May 03, 2015, 06:26:52 AM
https://en.bitcoin.it/wiki/Transaction_broadcasting

https://bitcointalk.org/index.php?topic=902674.0

https://bitcointalk.org/index.php?topic=496249.0


Title: Re: How to convey transaction to network
Post by: tspacepilot on May 04, 2015, 04:12:57 PM
You could try http://eligius.st/~wizkid057/newstats/pushtxn.php
Yeah, I don't know how to write the WebRequest object in .Net to send to the push URL at blockr.  Having trouble with the encoding and stuff. 

Blockchain.info has a sweet API for .Net - but then they go and block OP_Return.  Why do they block OP_Return?  That is totally stupid.  Does any other blockchain API providers have a nice .Net code on GitHub? 

Holy shit this is hard.

I don't understand what .NET has to do with it.  If you're using that blockchain API, can't you just use HTTP POST.  Programming language shouldn't matter should it?


Title: Re: How to convey transaction to network
Post by: virtualx on May 04, 2015, 08:49:38 PM
You could try http://eligius.st/~wizkid057/newstats/pushtxn.php
Yeah, I don't know how to write the WebRequest object in .Net to send to the push URL at blockr.  Having trouble with the encoding and stuff. 

Blockchain.info has a sweet API for .Net - but then they go and block OP_Return.  Why do they block OP_Return?  That is totally stupid.  Does any other blockchain API providers have a nice .Net code on GitHub? 

Holy shit this is hard.

I don't understand what .NET has to do with it.  If you're using that blockchain API, can't you just use HTTP POST.  Programming language shouldn't matter should it?

It should work with any language that can do HTTP POST including very low level programming languages. I think .NET is ops preferred language.


Title: Re: How to convey transaction to network
Post by: TKeenan on May 06, 2015, 09:49:13 AM
It should work with any language that can do HTTP POST including very low level programming languages. I think .NET is ops preferred language.

Yep.  Exactly.  But could somebody post an example of an HTTP POST in .Net that sends a transaction into a node (the network) - (which node?) (a permanent known node?). 

Please post some code which does this if you can.


Title: Re: How to convey transaction to network
Post by: InceptionCoin on May 06, 2015, 02:19:14 PM
OOPs, bad news.  Blockchain.info blocks transactions with an OP_Return as 'non standard transactions' - https://blockchain.info/rejected (https://blockchain.info/rejected) .  Is there a better API to push transactions into?
Standard node doesn't relay non-standard tx. So it never reaches mining pool. So you need to push into directly to pull, as TheButterZone sad before eligius pool allows it.


Title: Re: How to convey transaction to network
Post by: TKeenan on May 06, 2015, 02:46:14 PM
OOPs, bad news.  Blockchain.info blocks transactions with an OP_Return as 'non standard transactions' - https://blockchain.info/rejected (https://blockchain.info/rejected) .  Is there a better API to push transactions into?
Standard node doesn't relay non-standard tx. So it never reaches mining pool. So you need to push into directly to pull, as TheButterZone sad before eligius pool allows it.
When will 80byte OP_Return become standard?


Title: Re: How to convey transaction to network
Post by: tspacepilot on May 06, 2015, 05:54:32 PM
It should work with any language that can do HTTP POST including very low level programming languages. I think .NET is ops preferred language.

Yep.  Exactly.  But could somebody post an example of an HTTP POST in .Net that sends a transaction into a node (the network) - (which node?) (a permanent known node?). 

Please post some code which does this if you can.

Sorry, I don't know anything about .NET, but almost every language I've worked with has some sort of system("systemcommandhere") call.  Why not just use .NET's version of system() and then the classic curl binary:

$ curl -X POST --data "foo=bar&baz=quux" URL


Title: Re: How to convey transaction to network
Post by: unamis76 on May 06, 2015, 06:17:35 PM
Easiest way? You've answered yourself, yes, Blockchain can do that https://blockchain.info/pushtx

You can also just use Electrum... or Armory if you have it. You can also push it here https://btc.blockr.io/tx/push. Also here https://brainwallet.org/#tx


Title: Re: How to convey transaction to network
Post by: virtualx on May 06, 2015, 09:05:20 PM
It should work with any language that can do HTTP POST including very low level programming languages. I think .NET is ops preferred language.

Yep.  Exactly.  But could somebody post an example of an HTTP POST in .Net that sends a transaction into a node (the network) - (which node?) (a permanent known node?). 

Please post some code which does this if you can.

Sorry, I don't know anything about .NET, but almost every language I've worked with has some sort of system("systemcommandhere") call.  Why not just use .NET's version of system() and then the classic curl binary:

$ curl -X POST --data "foo=bar&baz=quux" URL

HTTP post with command line is probably the easiest method. He could use a wrapper for a HTTP client request or execute a system call. I don't think Windows comes with a copy of curl but there are windows ports of curl.

He can use something like this:

Code:
ProcessStartInfo transaction = new ProcessStartInfo ("curl.exe .....", "parameters"); 
Process.Start (transaction);


Title: Re: How to convey transaction to network
Post by: InceptionCoin on May 15, 2015, 12:40:49 PM
OOPs, bad news.  Blockchain.info blocks transactions with an OP_Return as 'non standard transactions' - https://blockchain.info/rejected (https://blockchain.info/rejected) .  Is there a better API to push transactions into?
Standard node doesn't relay non-standard tx. So it never reaches mining pool. So you need to push into directly to pull, as TheButterZone sad before eligius pool allows it.
When will 80byte OP_Return become standard?
Here https://github.com/bitcoin/bitcoin/blob/f0043c2d6d2ceddd631a76b424dd8c163f3dad66/src/main.cpp#L885 bitcoin-core prohibits to accept to memory(and eventually to relay) non-standart txs unless it explicitly setted in params. I dont know are txs with OP_Return non-standart now, but if so they will not be relayed by bitcoin-core standart wallet.