Password-based bitcoin transactions I have been reading about the role of script in transactions and I gather it should be possible to do a Bitcoin transfer to a receiver who knows a password. Instead of checking an address, the script would check that the hash of an input corresponds to the value given by the sender.

I have a few doubts on how this would work exactly. The script I have in mind, following the notation used in https://en.bitcoin.it/wiki/Script for standard and IP transactions, is:

scriptPubKey: OP_HASH160 &lt;passwordHash&gt; OP_EQUALVERIFY OP_CHECKSIG
scriptSig: &lt;sig&gt;&lt;pubKey&gt;&lt;password&gt;


The transfer would have six steps:

- Stack: Empty  Script: &lt;sig&gt;&lt;pubKey&gt;&lt;password&gt; OP_HASH160 &lt;passwordHash&gt; OP_EQUALVERIFY OP_CHECKSIG
- Stack: &lt;sig&gt;&lt;pubKey&gt;&lt;password&gt;  Script: OP_HASH160 &lt;passwordHash&gt; OP_EQUALVERIFY OP_CHECKSIG
- Stack: &lt;sig&gt;&lt;pubKey&gt;&lt;passwordhashA&gt;  Script: &lt;passwordHash&gt; OP_EQUALVERIFY OP_CHECKSIG
- Stack: &lt;sig&gt;&lt;pubKey&gt;&lt;passwordhashA&gt;&lt;passwordHash&gt;  Script:  OP_EQUALVERIFY OP_CHECKSIG
- Stack: &lt;sig&gt;&lt;pubKey&gt;   Script:  OP_CHECKSIG
- Stack: true   Script:  Empty


I have left OP_HASH160 because it is already being used so no new operation is needed, but the other hashes in script should be possible. The protocol has some nice properties like making the password public when the coins are transferred. 

Is this code correct? Is there something similar in the blockchain? I would like to try it, but I'm not really sure how to connect to the network with such a script. Should I first create a transaction to a "Bitcoin Limbo" and then try to recover it to the final address?
What if somebody sees the password as the transaction is being relayed around, and makes a new version that transfers your bitcoins to them? If they have better network integration/a higher bandwidth connection, then their version might be able to overtake yours.