Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: etotheipi on October 29, 2011, 07:07:47 PM



Title: Webpage to paste raw tx for broadcast?
Post by: etotheipi on October 29, 2011, 07:07:47 PM
A couple months ago I ran across apage someone made with a giant text-input box, where you could copy a serialized Tx into it and it would be broadcast onto the network.  Does anyone know if this still exists, and if so, what is the link to it?    Extra-credit:  does it work with the testnet, too?


Title: Re: Webpage to paste raw tx for broadcast?
Post by: Andrew Vorobyov on November 01, 2011, 09:27:41 PM
bump... can somebody do it?


Title: Re: Webpage to paste raw tx for broadcast?
Post by: btc_artist on November 01, 2011, 09:31:22 PM
What would be the reason to have something like this?  What is the use case?


Title: Re: Webpage to paste raw tx for broadcast?
Post by: etotheipi on November 01, 2011, 09:37:01 PM
I can construct transactions offline, signing them with a private key only kept on an offline computer.  But then that packet must be transferred to an online computer and broadcast.  Right now, the Satoshi client has no tx-forwarding capability.  So I have 3  options:

(1) Write a program that can connect to the BTC network with peer discovery, networking protocol, etc (HARD)
(2) Modify the client source code to allow tx-forwarding (HARD -- I could spend a week just figuring out how to compile it)
(3) Copy-and-paste the serialized tx into a webpage where someone has already done this work for the rest of us (takes 10 seconds)

Personally, I prefer option 3.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: btc_artist on November 01, 2011, 10:06:29 PM
Okay that makes sense.  So you would basically use this to be able to send/spend bitcoins that have have in offline storage (paper wallet, etc).

This sounds like an interesting project I might like to take on to get my feet wet.  Can you give me an example of an offline transaction you would construct and what the resultant data packet would be that would need to be sent?  I will have to do some reading about the bitcoin protocol, but if you give me an example, that will get me jump started.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: etotheipi on November 01, 2011, 10:15:28 PM
There's a couple different ways to communicate a transaction with ASCII characters as I was proposing here, but the binary structure is constant.  See the first image I posted on this page:

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

That shows exactly how a Tx is serialized in binary, and has an example of every kind of "standard" TxIn and TxOut.  This is exactly how the data is stored in your .bitcoin/blk0001.dat file, and exactly how it would be communicated to a tx-forwarder.  The only question is if it's a webpage for pasting ASCII, how do you represent that binary data in ASCII?  I think the best option is simply representing it in hex:  two hexbytes per binary byte.  Here's an example transaction, and what I would expect to be able to copy into the webpage:

Code:
01000000020f7b7fb86d4cf646058e41d3b007183fdf79736ed19b2a7468abc5bd04b16e91000000008c493046022100b2ee39d2fcc2e5544a57c30f7b4e49cfb82222666d034fb90e22348e17e28e0f022100db91c3199cc7b41d4d7afce0ccb4ceb424b9476d51c06142583daf53ce0a9b66014104c32215a9093011bd3c41283ace3d002c666077b24a605b3cfc8f71019a0f43df66f389f3d9a62188a494b869dc7e5f9dffc98a76d3088a21e9b738ec9eba98cbffffffff97004125528f7b5ed33465caaae021c0b815f3e6a3707641d5a0bca43fc14949010000008a473044022033d02c2e896f1a1252488d534cfb08abf3e7ea90aba7ba6f57abf189cef1d837022005668d755013b0e59a2af5145f10efe62ea716d333268b0b5a3efbd82d1439be014104c32215a9093011bd3c41283ace3d002c666077b24a605b3cfc8f71019a0f43df66f389f3d9a62188a494b869dc7e5f9dffc98a76d3088a21e9b738ec9eba98cbffffffff0100c2eb0b000000001976a91402bf4b2889c6ada8190c252e70bde1a1909f961788ac00000000

If you want to try following the binary bytemap, here's a pretty-printed version of the same data (each row is 32 bytes):
Code:
0x0000:     01000000 020f7b7f b86d4cf6 46058e41  d3b00718 3fdf7973 6ed19b2a 7468abc5
0x0020:     bd04b16e 91000000 008c4930 46022100  b2ee39d2 fcc2e554 4a57c30f 7b4e49cf
0x0040:     b8222266 6d034fb9 0e22348e 17e28e0f  022100db 91c3199c c7b41d4d 7afce0cc
0x0060:     b4ceb424 b9476d51 c0614258 3daf53ce  0a9b6601 4104c322 15a90930 11bd3c41
0x0080:     283ace3d 002c6660 77b24a60 5b3cfc8f  71019a0f 43df66f3 89f3d9a6 2188a494
0x00a0:     b869dc7e 5f9dffc9 8a76d308 8a21e9b7  38ec9eba 98cbffff ffff9700 4125528f
0x00c0:     7b5ed334 65caaae0 21c0b815 f3e6a370  7641d5a0 bca43fc1 49490100 00008a47
0x00e0:     30440220 33d02c2e 896f1a12 52488d53  4cfb08ab f3e7ea90 aba7ba6f 57abf189
0x0100:     cef1d837 02200566 8d755013 b0e59a2a  f5145f10 efe62ea7 16d33326 8b0b5a3e
0x0120:     fbd82d14 39be0141 04c32215 a9093011  bd3c4128 3ace3d00 2c666077 b24a605b
0x0140:     3cfc8f71 019a0f43 df66f389 f3d9a621  88a494b8 69dc7e5f 9dffc98a 76d3088a
0x0160:     21e9b738 ec9eba98 cbffffff ff0100c2  eb0b0000 00001976 a91402bf 4b2889c6
0x0180:     ada8190c 252e70bd e1a1909f 961788ac  00000000


Title: Re: Webpage to paste raw tx for broadcast?
Post by: btc_artist on November 01, 2011, 10:32:55 PM
Nice diagrams.  This will give me something to chew on as a familiarize myself with the protocol.

I'm thinking that the easiest way to set this up as a web service would be to patch the client source code to allow injecting pre-constructed transactions, and then use the client to handle communicating with peers and broadcasting the tx.  I think it's either that or writing my own script to handle peer discovery and communication.  I'll have to start messing around with this on testnet.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: terrytibbs on November 01, 2011, 10:37:11 PM
Have you guys seen this? https://bitcointalk.org/index.php?topic=28278.msg383312#msg383312


Title: Re: Webpage to paste raw tx for broadcast?
Post by: btc_artist on November 01, 2011, 10:39:48 PM
I hadn't seen that patch.  I'll have to take a look at that.

I think I'll still have a go at setting this up as a webpage, since that would be a lot more convenient for people than patching the client.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: etotheipi on November 01, 2011, 10:47:22 PM
Have you guys seen this? https://bitcointalk.org/index.php?topic=28278.msg383312#msg383312

I've seen that discussion before, and that was actually going to be my last resort if I couldn't find this webpage...

I hadn't seen that patch.  I'll have to take a look at that.

I think I'll still have a go at setting this up as a webpage, since that would be a lot more convenient for people than patching the client.

Don't let me discourage you from diving into BTC -- it can be a fun, amazingly-educational experience.  But I know for sure that three months ago there was a tx-broadcast webpage already in existence.  Unfortunately, I lost all my bookmarks and am trying to locate it again...

On the other hand, it may not be too difficult to setup such a webpage if you use the patch linked to from terrytibs:  run an instance of the patched bitcoind, then make a webpage with a simple text-input box.  The POST (?) command will simply convert the input text to binary, and pass it to your patched bitcoind for broadcast.  You probably don't even need to know anything about BTC to do it!  Just make sure there's someway to identify that there was an error... I imagine 90% of people trying to post txs in this way will have done something incorrectly the first few tries.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: btc_artist on November 01, 2011, 10:58:28 PM
Don't let me discourage you from diving into BTC -- it can be a fun, amazingly-educational experience.  But I know for sure that three months ago there was a tx-broadcast webpage already in existence.  Unfortunately, I lost all my bookmarks and am trying to locate it again...
If you find the page, that's great!  I think I'm still going to go ahead with this for the learning experience.

On the other hand, it may not be too difficult to setup such a webpage if you use the patch linked to from terrytibs:  run an instance of the patched bitcoind, then make a webpage with a simple text-input box.  The POST (?) command will simply convert the input text to binary, and pass it to your patched bitcoind for broadcast.  You probably don't even need to know anything about BTC to do it!  Just make sure there's someway to identify that there was an error... I imagine 90% of people trying to post txs in this way will have done something incorrectly the first few tries.
Sounds like we're thinking alike. :)  I'm going to give this a try.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: nibor on November 01, 2011, 11:19:53 PM
Is quite simple to do in bitcoinj. Do you have a format in mind? If so send me an sample will see what I can do. Please DOUBLE check it is signed correctly! Make it a transaction that sends to my address below and I will have more motivation!

I was thinking that if www.bitaddress.org could also create/sign transactions (not trival as need to link all the inputs), then if you had this web site you could then create transaction totally offline.





Title: Re: Webpage to paste raw tx for broadcast?
Post by: Maged on November 01, 2011, 11:56:51 PM
It looks like the site that used the patch to accept transactions entered on a webpage no longer exists:
https://bitcointalk.org/index.php?topic=28278.msg384518#msg384518


Title: Re: Webpage to paste raw tx for broadcast?
Post by: btc_artist on November 02, 2011, 12:02:15 AM
Is quite simple to do in bitcoinj. Do you have a format in mind? If so send me an sample will see what I can do. Please DOUBLE check it is signed correctly! Make it a transaction that sends to my address below and I will have more motivation!

I was thinking that if www.bitaddress.org could also create/sign transactions (not trival as need to link all the inputs), then if you had this web site you could then create transaction totally offline.

It might not be a good idea to construct the transactions online, because that means you're giving your private key to a 3rd party (and sending it over the wire).

It looks like the site that used the patch to accept transactions entered on a webpage no longer exists:
https://bitcointalk.org/index.php?topic=28278.msg384518#msg384518

Yes, it looks like the domain is not online anymore.  In any case, I'm working on getting a page up that will do this.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: etotheipi on November 02, 2011, 12:54:33 AM
Is quite simple to do in bitcoinj. Do you have a format in mind? If so send me an sample will see what I can do. Please DOUBLE check it is signed correctly! Make it a transaction that sends to my address below and I will have more motivation!
I was thinking that if www.bitaddress.org could also create/sign transactions (not trival as need to link all the inputs), then if you had this web site you could then create transaction totally offline.

I just created a tx, transferring 1.0 BTC to the address in your signature.  I plugged this tx and the previous one into my ECDSA unit-test (which works on other Blockchain tx-pairs) and it passed.  So I'm fairly confident that this is signed correctly.  Here's the raw hex:

Code:
0100000001f658dbc28e703d86ee17c9a2d3b167a8508b082fa0745f55be5144a4369873aa010000008c49304602210041e1186ca9a41fdfe1569d5d807ca7ff6c5ffd19d2ad1be42f7f2a20cdc8f1cc0221003366b5d64fe81e53910e156914091d12646bc0d1d662b7a65ead3ebe4ab8f6c40141048d103d81ac9691cf13f3fc94e44968ef67b27f58b27372c13108552d24a6ee04785838f34624b294afee83749b64478bb8480c20b242c376e77eea2b3dc48b4bffffffff0200e1f505000000001976a9141b00a2f6899335366f04b277e19d777559c35bc888ac40aeeb02000000001976a9140e0aec36fe2545fb31a41164fb6954adcd96b34288ac00000000

And a pretty version of it:
Code:
0x0000:  01000000 01f658db c28e703d 86ee17c9 a2d3b167 a8508b08 2fa0745f 55be5144
0x0020:  a4369873 aa010000 008c4930 46022100 41e1186c a9a41fdf e1569d5d 807ca7ff
0x0040:  6c5ffd19 d2ad1be4 2f7f2a20 cdc8f1cc 02210033 66b5d64f e81e5391 0e156914
0x0060:  091d1264 6bc0d1d6 62b7a65e ad3ebe4a b8f6c401 41048d10 3d81ac96 91cf13f3
0x0080:  fc94e449 68ef67b2 7f58b273 72c13108 552d24a6 ee047858 38f34624 b294afee
0x00a0:  83749b64 478bb848 0c20b242 c376e77e ea2b3dc4 8b4bffff ffff0200 e1f50500
0x00c0:  00000019 76a9141b 00a2f689 9335366f 04b277e1 9d777559 c35bc888 ac40aeeb
0x00e0:  02000000 001976a9 140e0aec 36fe2545 fb31a411 64fb6954 adcd96b3 4288ac00
0x0100:  000000

@btc_novice:  I'll happily toss you a BTC too, to test your solution, if you get something running.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: nibor on November 02, 2011, 07:06:07 AM
Damn! now I have to do it.

Your string was perfect. I can load into the bitcoinj transaction object 1st time. It contains the following transaction:

  9072559e9e2772cd6ac88683531a512cba6c2fee82b2476ed5e84c24abe5f526
     from 12HFYcL3Gj8EPhgeXk5689z8Wcc7x7FsNx
       to 13Tn1QkAcqnQvGA7kBiCBH7NbijNcr6GMs 1.00 BTC
       to 12HFYcL3Gj8EPhgeXk5689z8Wcc7x7FsNx 0.49 BTC

So that was the only tricky bit done.

I just now need to write the easy but dull jetty wrapper for it.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: nibor on November 02, 2011, 08:32:00 AM
Have written basics. And it works.

Source is at:
http://bitcoinstatus.rowit.co.uk/transactionupload/Main.java
http://bitcoinstatus.rowit.co.uk/transactionupload/SendTransactionServer.java

Screenshot at:
http://bitcoinstatus.rowit.co.uk/transactionupload/Capture.PNG

Transaction at:
http://blockexplorer.com/t/6UV8aA8m21

Is a mess! Will tidy up at sort out hosting it over next few days.

Have returned 0.5 BTC. You can pay the 0.5 back yourself when I have it hosted.




Title: Re: Webpage to paste raw tx for broadcast?
Post by: dogisland on November 02, 2011, 09:49:01 AM
Is a mess! Will tidy up at sort out hosting it over next few days.

It's a fine start.

If you know anything about Maven then I would consider creating a pom.xml if I were you. You can then include bitcoinj in a clean fashion. http://code.google.com/p/bitcoinj/wiki/UsingMaven

The benefit with that is then you could then host the code on Heroku (for free), they now accept java programs as long as there's a pom.xml and a proc file.







Title: Re: Webpage to paste raw tx for broadcast?
Post by: etotheipi on November 02, 2011, 02:53:29 PM
If we could get a bunch of users to setup such forwarders on webpages with SSL, then technically users won't need Tor for the anonymity they seek. 

The user accesses the tx-forwarding webpage which connects via SSL.  The tx-to-be-broadcast is uploaded, sometimes it broadcast, sometimes forwarded to one of the other tx-forwarding webpages (also via SSL).  The final IP address that broadcasts the tx is different than the IP of the originator, and as long as tx-requests are pooled and not sent immediately, then it would be tough to correlate the originator of the tx with any particular SSL connection in the logs  (but of course, the webservers probably wouldn't be saving logs of the SSL connections anyway, so that's probably not relevant).

While this is great for anonymity, you as the webserver host should be aware that it does open up far-fetched-but-non-zero risk for you.  If you allow people to upload arbitrary transactions, and those transactions are for illegal activity, the investigation might end up at your IP address, and you might be in a frustrating position. 

I think the chances of this are extraordinarily slim.  Additionally, theoretically, they shouldn't be able to do anything to if they can't prove you own the private key, but the legal system isn't always rational like this, especially when complicated technology/protocols are involved.  It's just a warning -- I would do it anyway because I really think the risk is virtually non-existent (at least until countries start explicitly trying to outlaw BTC), but it's something worth noting.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: nibor on November 02, 2011, 10:02:21 PM
The benefit with that is then you could then host the code on Heroku (for free), they now accept java programs as long as there's a pom.xml and a proc file.

Does Heroku allow outgoing long standing IP connection for free? I have used Google Apps before and they do not allow that (only http). And also you can not have long running processes that keep IP connections open.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: riush on November 03, 2011, 02:10:54 AM
It looks like the site that used the patch to accept transactions entered on a webpage no longer exists:
https://bitcointalk.org/index.php?topic=28278.msg384518#msg384518

oh hey you meant my site! yeah, i've basically given up on it for now, i don't really have the time, and there didn't seem to be lots of interest.
however the code is still there, and even though i wouldn't advise using it in its current state, the tx broadcast feature might be fine..
https://github.com/mhanne/webtc/tree/broadcast_transactions


Title: Re: Webpage to paste raw tx for broadcast?
Post by: nibor on November 07, 2011, 10:12:34 PM
http://bitsend.rowit.co.uk/

Now you just have to create the transactions by hand!


Title: Re: Webpage to paste raw tx for broadcast?
Post by: btc_artist on November 07, 2011, 10:32:19 PM
http://bitsend.rowit.co.uk/

Now you just have to create the transactions by hand!
Nice. I haven't had time to work on this. I'm glad to see you have a working tx broadcaster.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: etotheipi on November 07, 2011, 10:52:03 PM
Thanks nibor!  Gonna be sending you a donation soon.  You will receive it if your webpage works!  Btw, it's really an aesthetic suggestion, but I think the input box should be multi-line.  I want to be able to see the full tx I copied into the page.

On a philosophical note, I want to reiterate the possibility of this kind of tx-forwarder enabling a simpler method of anonymity in the BTC network.  Right now, Tor is the best solution for the ultra-paranoid, but it's complicated/inconvenient for the user.  The developer could try to integrate Tor protocols in the client, but that's quite complicated too.

On the other hand, if we got a bunch of folks to voluntarily host tx-forwarders like nibor's, with SSL, then we've got a much easier solution for both developers and users.  The client software could come with a list of tx-forwarders, which only needs to be partially complete, because it can update from any of the forwarders.  When the client wants to send a tx, it makes an SSL connection to one of the forwarders at random, and uploads the tx data over the encrypted connection.  That forwarder will then randomly either broadcast, or forward to another forwarder, which will do the same.  Eventually, the tx will be emitted from a completely different IP address than the originator.  This would be fairly straightforward to implement in client software by linking in the OpenSSL library.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: etotheipi on November 09, 2011, 05:35:03 AM
I finally got my code together to select coins, construct the tx, and then sign with private key.  I created a tx for 1.09 BTC to your address, and submitted it to your webpage.  However, there was no explicit statement that it succeeded, only a restatement of the tx in a somewhat human-readable form.  I didn't see it in either of the next two blocks, so I question whether it actually made it to the blockchain. 

Here's the full, serialized tx that I submitted, in case you want to check on it yourself:

Code:
0100000002f658dbc28e703d86ee17c9a2d3b167a8508b082fa0745f55be5144a4369873aa010000008c493046022100d4b006a55d91d3b62a040089febc12bc4ec88e570ed34ccc3286938e622e31090221007351f84554ab1c1fe4b091ed1905e261660a9863f02c0f9036aae195e3ff6b400141048d103d81ac9691cf13f3fc94e44968ef67b27f58b27372c13108552d24a6ee04785838f34624b294afee83749b64478bb8480c20b242c376e77eea2b3dc48b4bffffffff26f5e5ab244ce8d56e47b282ee2f6cba2c511a538386c86acd72279e9e557290010000008c493046022100ae301914b8070cab6584b292976ca06a05f4dd7959b14112e4ce25533d315d64022100a419f8e6f66adae096f188b69774524d78e75b2b22a06e052e0848cfbf3c122a0141048d103d81ac9691cf13f3fc94e44968ef67b27f58b27372c13108552d24a6ee04785838f34624b294afee83749b64478bb8480c20b242c376e77eea2b3dc48b4bffffffff0240357f06000000001976a9141b00a2f6899335366f04b277e19d777559c35bc888ac804a5d05000000001976a9140e0aec36fe2545fb31a41164fb6954adcd96b34288ac00000000


Title: Re: Webpage to paste raw tx for broadcast?
Post by: finway on November 09, 2011, 05:46:23 AM
Nice!  :)


Title: Re: Webpage to paste raw tx for broadcast?
Post by: nibor on November 09, 2011, 07:49:20 AM
yes i got it and transmitted, but you are right it is not in the block chain. Will do some debugging later!


Title: Re: Webpage to paste raw tx for broadcast?
Post by: etotheipi on November 09, 2011, 02:34:04 PM
Ack!  This is my problem.  Somehow my code picked a TxOut that had already been spent...?  I guess I've got my own debugging to do...  Will try again tonight.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: etotheipi on November 09, 2011, 10:34:45 PM
I just found my bug, and constructed a new Tx with actually-unspent outputs.  I'm ready to plug it into your webpage, but it looks like you took it down :(.

Let me know when it's back up and I'll toss you a couple BTC.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: nibor on November 09, 2011, 10:55:17 PM
Great! I thought it might be as I was sure it was transmitted.
Thanks for letting me know as might have wasted some time otherwise.

I have added outputting the hashes of the transactions that were inputs so is now easy to see if they are already used.
http://blockexplorer.com/tx/aa739836a44451be555f74a02f088b50a867b1d3a2c917ee863d708ec2db58f6
was already spent.

One day will make them links to BE so is quick to check. For now you can just paste them in though.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: nibor on November 09, 2011, 10:56:14 PM
Web site is up now! Was just adding the extra debugging mentioned in post above.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: etotheipi on November 09, 2011, 11:33:37 PM
It worked this time!   Here it is on BlockExplorer (http://blockexplorer.com/tx/7dc484a8a963899db6da72ba65d0e8adb26ef29e4b1cfdfe8815f2b4f61d0618)
I'll be sure to throw in more donations as I use it more! 


Title: Re: Webpage to paste raw tx for broadcast?
Post by: Jaagu on November 10, 2011, 01:10:14 PM
Nibor,
I am just a layman, therefore my question might seem stupid, but:
for your webpage to operate your server has to download all the blockchain beforehand?
What are requirements for your java programs to work?


Title: Re: Webpage to paste raw tx for broadcast?
Post by: dogisland on November 10, 2011, 01:46:54 PM
Nibor,
I am just a layman, therefore my question might seem stupid, but:
for your webpage to operate your server has to download all the blockchain beforehand?
What are requirements for your java programs to work?

You need information from the blockchain to create the transaction. But once it's created you don't need the blockchain to send it.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: etotheipi on November 12, 2011, 02:07:26 AM
This one (http://blockexplorer.com/tx/de36ab1925152a41e512d44c14ec6ee29bd37d5e58b93355678619c10e644036) is for you, Nibor!  I decided to have fun with high-anonymity transactions and used your webpage to make sure I did it right.  One of those outputs is yours :)  I just gotta figure out how to get my SelectCoins to do that automatically...


Title: Re: Webpage to paste raw tx for broadcast?
Post by: nibor on November 13, 2011, 04:59:51 PM
Nibor,
I am just a layman, therefore my question might seem stupid, but:
for your webpage to operate your server has to download all the blockchain beforehand?
What are requirements for your java programs to work?

it does  ;).

There is no need to download any of the blockchain. All you have to do is have a server that maintains a connection to a number of other bitcoin nodes. Then when it receives the transaction it then forwards to all those nodes.

The program is written using the bitcoinj library. Further up this thread is the source in a raw form.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: nibor on November 13, 2011, 05:05:56 PM
This one (http://blockexplorer.com/tx/de36ab1925152a41e512d44c14ec6ee29bd37d5e58b93355678619c10e644036) is for you, Nibor!  I decided to have fun with high-anonymity transactions and used your webpage to make sure I did it right.  One of those outputs is yours :)  I just gotta figure out how to get my SelectCoins to do that automatically...

Thanks.. What are you trying to achieve with high anonymity transactions?
What is SelectCoins?

Also I was trying to think of a way to get bitsend to make a bit of money to keep it going (donations are not a long term solution!). One idea I had was to add a bit of code to forward instantly if the transaction included a 0.005 payment to my address and otherwise only forward after 60mins. Do you think anyone would make the payment?



Title: Re: Webpage to paste raw tx for broadcast?
Post by: etotheipi on November 13, 2011, 05:24:21 PM
Nibor,

First of all: as for the 0.005 payment/bribe (:)) I already thought about something like that in the past, but I just don't see how to make it work.  First of all, if I add an output less than 0.01 BTC to my tx, then it's considered dust and cannot satisfy the AllowFree requirement.  Sure, sometimes it gets propagated without a fee, but there's no guarantee if any of the outputs are less than 0.01.   And most people hate paying transaction fees...

On the other hand, if your fee is >=0.01, the person can do it, as long as they don't mind breaking off some of their change output for you.  But for whatever reason, despite being practically insignificant, people are really averse to paying such fees.  I think it's fair for your service, but admittedly, the Tx construction algorithm has to be modified to include an extra output just for the forwarding node.

SelectCoins is the algorithm that takes all the unspent TxOuts that you can spend, and figures out a "good" subset of them for a desired transaction.  For instance, I have 5 unspent TxOuts to my wallet {10.3, 0.003, 0.148, 29.0, 2.2}.  If I want to send someone 2.5 BTC, what is the best way to do it?  Or 0.002?  Or 31?  etc.   There's actually too many solutions, and a lot of them require fees (if a lot of outputs are used, and/or young, small outputs), or link a lot of addresses together on the input side (since all addresses on the input side are clearly owned by the same person, you want to limit how many are used).

One of the criteria for anonymity of the transaction is the outputs -- usually there's two outputs: reicipient, and change-back-to-self.  The sender usually picks a new address for the change part, which means, if both outputs are the same, then it's not actually clear which is the recipient and which is change.  If you're concerned about someone tracking the flow of your money, having two outputs, one of 10.00 and change of 1.93283, it's pretty obvious which is which.  However, in the case of the tx I sent you, it's got 20 outputs of exactly 0.5 BTC.  An investigator who really wants to know who I'm sending money to, would now have to investigate the pool of 20 different addresses to find the actual recipient since there's no information to distinguish them in the tx itself.    Most SelectCoins algs could not come up with this Tx on their own, but I wouldn't mind figuring out how to get mine to do it :)



Title: Re: Webpage to paste raw tx for broadcast?
Post by: Jaagu on November 15, 2011, 03:57:53 PM
Your page is down? ???


Title: Re: Webpage to paste raw tx for broadcast?
Post by: btc_artist on November 15, 2011, 04:08:30 PM
Your page is down? ???
Yes, it does appear to be down.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: nibor on November 16, 2011, 07:49:53 AM
Will be up again at weekend.
Was overloading the server and need to move it all to another.
This will be done at weekend.

Thanks


Title: Re: Webpage to paste raw tx for broadcast?
Post by: nibor on November 18, 2011, 10:51:47 PM
Page is up again and should be now for good.

Might go down for few mins on occasion as I update the look of it.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: TT on November 20, 2011, 10:17:52 PM
nibor,

Your web app is extremely useful for testing a transaction signing module I'm working on.
(Pretty soon, I will have developed full transaction broadcast capabilities myself.)

It seems to be crashing on a particular input, though:
Quote
0100000001b1195dbf2f80ada2b6de7001de4199b286eec8d90896be93fd6311589c32ecdd01000 0008b473045022058e08abd09852421d32597942e7813d698b23df03831f5c7b305f04f8805ef32 0221009d27134a7aef289080ca44fc710f2287a18569dae33f7a932cdaa62a4b6a41db014104085 fc258cbbcc6fdea0acfef5578b7e8f13b70e7a400de3ba988b346886f54083f55b2dcebeb2de545 d2aad03affa4f76a58b68bb0ce0d64898b04adf0a98dfeffffffff0180969800000000001976a91 4703e53ae0059c70345ee3f18c36806f1c63fa03888ac00000000

Could you please tell me why it's crashing? I believe I've formatted the transaction correctly.

Thanks.

(Note: I entered the transaction in with no whitespace characters at all)


Title: Re: Webpage to paste raw tx for broadcast?
Post by: TT on November 20, 2011, 10:33:56 PM
Or here, try this one instead:

Quote
0100000001b1195dbf2f80ada2b6de7001de4199b286eec8d90896be93fd6311589c32ecdd01000 0008b473045022100979bb252e6137a7a42fb15f8dfc54f813b334911ee1443271bbd64fe277c22 47022009a5e0bf8d8dc5dd6c658a1c543f4a17617227f259675bb5a0267ea5930c33a4014104085 fc258cbbcc6fdea0acfef5578b7e8f13b70e7a400de3ba988b346886f54083f55b2dcebeb2de545 d2aad03affa4f76a58b68bb0ce0d64898b04adf0a98dfeffffffff0130d39700000000001976a91 41b00a2f6899335366f04b277e19d777559c35bc888ac00000000

It's .0995 btc for you!


Title: Re: Webpage to paste raw tx for broadcast?
Post by: TT on November 20, 2011, 11:51:55 PM
OK,

I think I figured out what caused your app to crash.

The initial byte of the scriptSig should be 48, not 47...since
the number of bytes pushed on the stack includes the hash type code byte.

The input was:
Quote
0100000001b1195dbf2f80ada2b6de7001de4199b286eec8d90896be93fd6311589c32ecdd01000 0008b483045022100979bb252e6137a7a42fb15f8dfc54f813b334911ee1443271bbd64fe277c224702200 9a5e0bf8d8dc5dd6c658a1c543f4a17617227f259675bb5a0267ea5930c33a4014104085fc258cb bcc6fdea0acfef5578b7e8f13b70e7a400de3ba988b346886f54083f55b2dcebeb2de545d2aad03 affa4f76a58b68bb0ce0d64898b04adf0a98dfeffffffff0130d39700000000001976a9141b00a2 f6899335366f04b277e19d777559c35bc888ac00000000

It gave me the following output:
Quote
Tx Hash:bf90f6453e991aded9949541b76cc96b3cf93fbbf841efe7483c75c135b8cd98

from:1GiHRDbYLZLrbp8dUd7i6enbK5hysf8MC1

[72]3045022100979bb252e6137a7a42fb15f8dfc54f813b334911ee1443271bbd64fe277c224702200 9a5e0bf8d8dc5dd6c658a1c543f4a17617227f259675bb5a0267ea5930c33a401 [65]04085fc258cbbcc6fdea0acfef5578b7e8f13b70e7a400de3ba988b346886f54083f55b2dcebeb2 de545d2aad03affa4f76a58b68bb0ce0d64898b04adf0a98dfe

outpoint 1:ddec329c581163fd93be9608d9c8ee86b29941de0170deb6a2ad802fbf5d19b1

to:13Tn1QkAcqnQvGA7kBiCBH7NbijNcr6GMs

0.09950000 BTC

DUP HASH160 [20]1b00a2f6899335366f04b277e19d777559c35bc8 EQUALVERIFY CHECKSIG

Our ID:d2fbb712-1a73-423a-bfa4-52ba2f1eb716


Title: Re: Webpage to paste raw tx for broadcast?
Post by: nibor on November 21, 2011, 08:53:40 PM
Thanks, looks like it worked: http://blockexplorer.com/t/8G3y5ANENm

I will think about providing better feedback to help people debug.
Not sure how to do it though. Any ideas?


Title: Re: Webpage to paste raw tx for broadcast?
Post by: TT on November 24, 2011, 06:07:06 AM
A few suggestions:

1) What about parsing out the transaction and showing a hex offset byte dump, one field per line?

2) You can show if there are any parsing errors (i.e. a variable length field has different size than indicated by the size field or fixed length field has inappropriate content or is of wrong size). I recommend writing such errors in red in the byte dump.

3) You can also check the scriptSig and scriptPubKey fields for whether they correspond to standard transaction types.

4) If all the above checks out, you can then verify the signatures...and indicate which, if any, fail.

5) If you want to get a little fancier, you can look for typical errors (wrong endianness, i.e.)...heuristically trying to figure out where the user might have screwed up.

6) If you do manage to figure out the user's error, you can fix it and suggest a valid transaction.

-TT


Title: Re: Webpage to paste raw tx for broadcast?
Post by: ErebusBat on August 01, 2012, 10:34:48 PM
http://bitsend.rowit.co.uk/

Now you just have to create the transactions by hand!
Sorry to bump an old topic, but this site is gone now, and was wondering if there were any still in operation.

Just got electrum working and though that would be a great way to do super-anon TXs.  You could send a pre-signed TX from any internet cafe or library.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: piuk on August 01, 2012, 11:20:16 PM
http://blockchain.info/pushtx

Ignore the bit about the fees.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: ErebusBat on August 02, 2012, 12:05:18 PM
http://blockchain.info/pushtx

Ignore the bit about the fees.
Thanks piuk!  I knew I had saw one on your site but couldn't find it.

I will use it to send a donation when I get to work.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: jgarzik on August 02, 2012, 02:10:31 PM
Right now, the Satoshi client has no tx-forwarding capability. 

This is certainly not true.  If the Satoshi client did not forward transactions, nothing would get relayed on the network.

But I'm guessing you meant new transactions?

If so, you want the recently added sendrawtransaction RPC from the 'raw transactions' API.



Title: Re: Webpage to paste raw tx for broadcast?
Post by: mskwik on August 03, 2012, 07:51:21 PM
I've been using something like this to dump raw transactions into the network, feel free to adapt to your language of choice if you want something that runs locally.  I don't have anything like it running on a public web server but it shouldn't be too hard to do.

Code:
#!/usr/bin/perl

use IO::Socket;use IO::Select;use Digest::SHA;

$tx=shift(@ARGV);
$btc=IO::Socket::INET->new(PeerAddr=>"localhost",PeerPort=>'8333',Proto=>'tcp') or die "Socket";
$port="\x20\x8d";$magic="\xf9\xbe\xb4\xd9";$mmatch="f9.be.b4.d9";
$sel=IO::Select->new();$sel->add($btc);

$p="\x2c\x7e\x00\x00"; # Version
$p.="\x01\x00\x00\x00\x00\x00\x00\x00"; # Services
$h=sprintf('%x',time());while(length($h)<16){$h="0".$h;}
$h=reverse($h);$p.=pack('h*',$h); # Unix Timestamp
$p.="\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF"; # To IP
$p.="\x7f\x00\x00\x01".$port; # 127.0.0.1:port
$p.="\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF"; # From IP
$p.="\x00\x00\x00\x00".$port; # 0.0.0.0:port
@chars=('a'..'f', 0..9);$rr=join '',map {$chars[rand @chars]} 1..16;
$p.=pack('H*',$rr); # Random Unique ID
$p.="\x00"; # No User Agent
$p.="\x00\x00\x00\x00"; # No Blocks

sendpacket('version',$p);
while($gotver==0){
  ($c,$p)=readpacket();
  if($c eq 'version'){$gotver=1;}
sleep(1);}
sendpacket('verack','');

$tt=pack('H*',$tx);
$h=Digest::SHA::sha256(Digest::SHA::sha256($tt));
$p="\x01\x01\x00\x00\x00".pack('H*',reverse(unpack('h*',$h)));

sendpacket('inv',$p);$gotreq=0;
while($gotreq==0){
  ($c,$pp)=readpacket();
  if($c eq 'getdata' && $p eq $pp){$gotreq=1;}
sleep(1);}

sendpacket('tx',$tt);
print "Sent transaction ".unpack('H*',$h)."\n";
close($btc);

sub sendpacket{my $c=shift(@_);my $p=shift(@_);
  my $o=$magic;while(length($c)<12){$c.="\x00";}$o.=$c; #Command
  my $h=sprintf('%x',length($p));while(length($h)<8){$h="0".$h;}
  $h=reverse($h);$o.=pack('h*',$h); # Payload length
  $h=Digest::SHA::sha256(Digest::SHA::sha256($p));
  $h=unpack('H*',$h);$o.=pack('H*',substr($h,0,8)); # Checksum
  $o.=$p; # Payload
  print $btc $o;print STDERR "Sent $c (".length($p)." byte payload)\n";
}
sub readpacket{
  if(!$sel->can_read(1)){return 0;}
  my @x;my $x;while(1){read($btc,$x,1);$x=unpack('H*',$x);
    push(@x,$x);if($#x>3){shift(@x);}
    if(join('.',@x) eq $mmatch){
      my $cmd;my $len;
      read($btc,$cmd,12);read($btc,$len,4);read($btc,$x,4);
      $x=unpack('h*',$len);$x=reverse($x);$len=hex($x);
      $x=chop($cmd);while($x eq "\x00"){$x=chop($cmd);}$cmd.=$x;
      print STDERR "Read $cmd ($len byte payload)\n";
      if($len>0){read($btc,$x,$len);return ($cmd,$x);}
      else{return ($cmd,'');}
    }
  }
}


Title: Re: Webpage to paste raw tx for broadcast?
Post by: ErebusBat on August 03, 2012, 08:03:30 PM
I've been using something like this to dump raw transactions into the network, feel free to adapt to your language of choice if you want something that runs locally.  I don't have anything like it running on a public web server but it shouldn't be too hard to do.

Code:
#!/usr/bin/perl

use IO::Socket;use IO::Select;use Digest::SHA;

$tx=shift(@ARGV);
$btc=IO::Socket::INET->new(PeerAddr=>"localhost",PeerPort=>'8333',Proto=>'tcp') or die "Socket";
$port="\x20\x8d";$magic="\xf9\xbe\xb4\xd9";$mmatch="f9.be.b4.d9";
$sel=IO::Select->new();$sel->add($btc);

$p="\x2c\x7e\x00\x00"; # Version
$p.="\x01\x00\x00\x00\x00\x00\x00\x00"; # Services
$h=sprintf('%x',time());while(length($h)<16){$h="0".$h;}
$h=reverse($h);$p.=pack('h*',$h); # Unix Timestamp
$p.="\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF"; # To IP
$p.="\x7f\x00\x00\x01".$port; # 127.0.0.1:port
$p.="\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF"; # From IP
$p.="\x00\x00\x00\x00".$port; # 0.0.0.0:port
@chars=('a'..'f', 0..9);$rr=join '',map {$chars[rand @chars]} 1..16;
$p.=pack('H*',$rr); # Random Unique ID
$p.="\x00"; # No User Agent
$p.="\x00\x00\x00\x00"; # No Blocks

sendpacket('version',$p);
while($gotver==0){
  ($c,$p)=readpacket();
  if($c eq 'version'){$gotver=1;}
sleep(1);}
sendpacket('verack','');

$tt=pack('H*',$tx);
$h=Digest::SHA::sha256(Digest::SHA::sha256($tt));
$p="\x01\x01\x00\x00\x00".pack('H*',reverse(unpack('h*',$h)));

sendpacket('inv',$p);$gotreq=0;
while($gotreq==0){
  ($c,$pp)=readpacket();
  if($c eq 'getdata' && $p eq $pp){$gotreq=1;}
sleep(1);}

sendpacket('tx',$tt);
print "Sent transaction ".unpack('H*',$h)."\n";
close($btc);

sub sendpacket{my $c=shift(@_);my $p=shift(@_);
  my $o=$magic;while(length($c)<12){$c.="\x00";}$o.=$c; #Command
  my $h=sprintf('%x',length($p));while(length($h)<8){$h="0".$h;}
  $h=reverse($h);$o.=pack('h*',$h); # Payload length
  $h=Digest::SHA::sha256(Digest::SHA::sha256($p));
  $h=unpack('H*',$h);$o.=pack('H*',substr($h,0,8)); # Checksum
  $o.=$p; # Payload
  print $btc $o;print STDERR "Sent $c (".length($p)." byte payload)\n";
}
sub readpacket{
  if(!$sel->can_read(1)){return 0;}
  my @x;my $x;while(1){read($btc,$x,1);$x=unpack('H*',$x);
    push(@x,$x);if($#x>3){shift(@x);}
    if(join('.',@x) eq $mmatch){
      my $cmd;my $len;
      read($btc,$cmd,12);read($btc,$len,4);read($btc,$x,4);
      $x=unpack('h*',$len);$x=reverse($x);$len=hex($x);
      $x=chop($cmd);while($x eq "\x00"){$x=chop($cmd);}$cmd.=$x;
      print STDERR "Read $cmd ($len byte payload)\n";
      if($len>0){read($btc,$x,$len);return ($cmd,$x);}
      else{return ($cmd,'');}
    }
  }
}

I assume this connects to bitcoind?  Thanks for the code, shouldn't be too hard to hack up, thanks.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: mskwik on August 03, 2012, 08:25:56 PM
Yeah, it just connects to a bitcoind (through the p2p connection, not RPC), does the handshake, and offers up that single tx hash and then the tx itself when it is requested.  Basically the same as 'mktx send' is supposed to do in the subvertx package, I just found it far easier to rewrite as a script rather than to try and get all the dependencies for that to compile on the systems I was working on.


Title: Re: Webpage to paste raw tx for broadcast?
Post by: ErebusBat on August 03, 2012, 08:29:37 PM
Yeah, it just connects to a bitcoind (through the p2p connection, not RPC), does the handshake, and offers up that single tx hash and then the tx itself when it is requested.  Basically the same as 'mktx send' is supposed to do in the subvertx package, I just found it far easier to rewrite as a script rather than to try and get all the dependencies for that to compile on the systems I was working on.
Agreed; however I am attempting to setup an electrum server so I don't have that option :/


Title: Re: Webpage to paste raw tx for broadcast?
Post by: hamdi on March 12, 2013, 10:30:54 PM
I've been using something like this to dump raw transactions into the network, feel free to adapt to your language of choice if you want something that runs locally.  I don't have anything like it running on a public web server but it shouldn't be too hard to do.

Code:
#!/usr/bin/perl

use IO::Socket;use IO::Select;use Digest::SHA;

$tx=shift(@ARGV);
$btc=IO::Socket::INET->new(PeerAddr=>"localhost",PeerPort=>'8333',Proto=>'tcp') or die "Socket";
$port="\x20\x8d";$magic="\xf9\xbe\xb4\xd9";$mmatch="f9.be.b4.d9";
$sel=IO::Select->new();$sel->add($btc);

$p="\x2c\x7e\x00\x00"; # Version
$p.="\x01\x00\x00\x00\x00\x00\x00\x00"; # Services
$h=sprintf('%x',time());while(length($h)<16){$h="0".$h;}
$h=reverse($h);$p.=pack('h*',$h); # Unix Timestamp
$p.="\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF"; # To IP
$p.="\x7f\x00\x00\x01".$port; # 127.0.0.1:port
$p.="\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xFF\xFF"; # From IP
$p.="\x00\x00\x00\x00".$port; # 0.0.0.0:port
@chars=('a'..'f', 0..9);$rr=join '',map {$chars[rand @chars]} 1..16;
$p.=pack('H*',$rr); # Random Unique ID
$p.="\x00"; # No User Agent
$p.="\x00\x00\x00\x00"; # No Blocks

sendpacket('version',$p);
while($gotver==0){
  ($c,$p)=readpacket();
  if($c eq 'version'){$gotver=1;}
sleep(1);}
sendpacket('verack','');

$tt=pack('H*',$tx);
$h=Digest::SHA::sha256(Digest::SHA::sha256($tt));
$p="\x01\x01\x00\x00\x00".pack('H*',reverse(unpack('h*',$h)));

sendpacket('inv',$p);$gotreq=0;
while($gotreq==0){
  ($c,$pp)=readpacket();
  if($c eq 'getdata' && $p eq $pp){$gotreq=1;}
sleep(1);}

sendpacket('tx',$tt);
print "Sent transaction ".unpack('H*',$h)."\n";
close($btc);

sub sendpacket{my $c=shift(@_);my $p=shift(@_);
  my $o=$magic;while(length($c)<12){$c.="\x00";}$o.=$c; #Command
  my $h=sprintf('%x',length($p));while(length($h)<8){$h="0".$h;}
  $h=reverse($h);$o.=pack('h*',$h); # Payload length
  $h=Digest::SHA::sha256(Digest::SHA::sha256($p));
  $h=unpack('H*',$h);$o.=pack('H*',substr($h,0,8)); # Checksum
  $o.=$p; # Payload
  print $btc $o;print STDERR "Sent $c (".length($p)." byte payload)\n";
}
sub readpacket{
  if(!$sel->can_read(1)){return 0;}
  my @x;my $x;while(1){read($btc,$x,1);$x=unpack('H*',$x);
    push(@x,$x);if($#x>3){shift(@x);}
    if(join('.',@x) eq $mmatch){
      my $cmd;my $len;
      read($btc,$cmd,12);read($btc,$len,4);read($btc,$x,4);
      $x=unpack('h*',$len);$x=reverse($x);$len=hex($x);
      $x=chop($cmd);while($x eq "\x00"){$x=chop($cmd);}$cmd.=$x;
      print STDERR "Read $cmd ($len byte payload)\n";
      if($len>0){read($btc,$x,$len);return ($cmd,$x);}
      else{return ($cmd,'');}
    }
  }
}


nice one! i wish more such simple approaches were there instead of tweaking the full bitcoind to do minor stuff!!


Title: Re: Webpage to paste raw tx for broadcast?
Post by: ErebusBat on April 02, 2013, 07:24:14 PM
You can use use the Raw Transaction (https://en.bitcoin.it/wiki/Raw_Transactions) API now in bitcoind to do this.  Something like:
Code:
bitcoind sendrawtransaction 0011223344....


Title: Re: Webpage to paste raw tx for broadcast?
Post by: tehace on April 02, 2013, 08:06:47 PM
https://blockchain.info/pushtx


is that what you
were looking for?