How to sign non-standard transaction Consider Testnet transaction 7a438...de03e which has vout[0].scriptPubKey =

OP_DUP OP_DROP OP_DUP OP_HASH160 039.....6fe OP_EQUALVERIFY OP_CHECKSIG


The script is equivalent to a standard pay-to-pubkeyhash scriptPubKey. Let's try to spend it:

&gt; bitcoind createrawtransaction '[{"txid":"7a438.....de03e","vout":0}]' '{"mfq.....oDY":1.3}'
01000000013ee0bdf5779c48f42bda36cd740ba297ae071ec7fe3eadae6418602de48d437a0000000000ffffffff0180a4bf07000000001976a914039541a738df12eed1825b866eb5bb5aba6bf6fe88ac00000000

&gt; bitcoind signrawtransaction 01000.....00000
{
  "hex" : "01000000013ee0bdf5779c48f42bda36cd740ba297ae071ec7fe3eadae6418602de48d437a0000000000ffffffff0180a4bf07000000001976a914039541a738df12eed1825b866eb5bb5aba6bf6fe88ac00000000",
  "complete" : false
}


As you can see, bitcoind refuses to sign the transaction (same hex and obviously complete is false) I guess because it can't find a suitable address (since it's a non-standard script). I do indeed control the address and have its private key.

Is there any way to sign this transaction?
You will have to build the transaction yourself instead of relying on wallet software. You can either create it all from scratch and use pushtx or use an online API that accepts explicit input references to previous outputs. For example (check the last paragraph):

http://dev.blockcypher.com/#transaction_skeleton