<p>There is absolutely no reason trying to broadcast invalid transaction.
It is wasting your time and your traffic.
Your peer(s) will check it and throw it away. They will not relay it to network.
They also can ban your IP-address for some time (1 day?)</p>

<p>May be you want to send valid but non-standard transaction?
Or may be you want to have a custom tool, which sends transactions to a network?</p>

<pre><code>    // [...]
    void NetSocket::pushTx ( const QByteArray&amp; data )
    {
      const MyKey32 key ( data.constData ( ), data.size ( ) );  // calculate txid
      outTx.insert ( key, data );                               // store data
      write ( "inv", invPacket ( MSG_TX, key ) );               // send inv packet
    }
    //--------------------------------------------------------------
    void NetSocket::write ( const char* type, const QByteArray&amp; data )
    {
      socket -&gt; write ( packet ( type, data ) );
    }
    //--------------------------------------------------------------
    void NetSocket::procGetdataPacket ( const QByteArray&amp; data )
    {
      Stream d ( data ); d.skip24 ( );               // i do not check header now
      const int count ( d.readVar ( ) );
      xassert ( count == 1 );
      const quint8* ss = d.readAdvance ( 36 );
      const quint32 tag ( *(quint32*)ss );
      const MyKey32 key ( ss + 4 );
      xassert ( tag == MSG_TX );
      xassert ( outTx.contains ( key ) );
      write ( "tx", txPacket ( outTx.value ( key ) ) );
    }
    // [...]
</code></pre>

CC BY-SA 3.0
2014-05-27T15:01:18.443Z
I think it could very well be that the various bitcoin implementations have slightly different notions of when  to accept a transaction or not. the only way to find out is to be able to send a transaction unfiltered to lots of different nodes.
Willem Hengeveld
CC BY-SA 3.0
2014-05-28T13:38:36.770Z
Of course, there is a very good reason. You may be spending unconfirmed outputs, which your client doesn't know about, but still exists on the network.
Flavien
CC BY-SA 3.0
2014-05-27T14:15:36.940Z
2014-05-27T14:15:36.940Z
amaclin
<p>Turns out there are many ways to do this:</p>

<ul>
<li><strong>Node.js</strong>: Bitcore lets you broadcast a raw transaction to the network without any kind of validation, see the <a href="http://bitcore.io/" rel="nofollow">"broadcast a transaction through P2P" example</a>.</li>
<li><strong>Python</strong>: <a href="http://protocoin.readthedocs.org/en/v0.1/" rel="nofollow">Protocoin</a> is a library that can do that.</li>
<li><strong>Java</strong>: <a href="http://code.google.com/p/bitcoinj/" rel="nofollow">BitcoinJ</a> can do it.</li>
<li><strong>C#</strong>: <a href="http://code.google.com/p/bitcoinsharp/" rel="nofollow">Bitcoincsharp</a>, which is a port of BitcoinJ can also do it.</li>
</ul>

CC BY-SA 3.0
2014-06-05T10:29:04.447Z
2014-06-05T10:29:04.447Z
Flavien
<p>What tool/software can I use to broadcast a raw transaction, which would not reject a transaction because of invalid or double spend?</p>

<p>Bitcoind with RPC has a validation step which rejects any raw transaction where the inputs are not known, or if the inputs are double spending.</p>

<p>Also, I don't want to rely on a third party service like blockchain.info.</p>

CC BY-SA 3.0
2014-05-27T10:24:21.083Z
AFAIK It does not exist. Looked for this myself as well. You have to develop your own tool.
Emre K.
CC BY-SA 3.0
2014-05-27T14:18:04.277Z
Seems like the easiest way might be to just comment out the validation code in bitcoind and recompile.
Nate Eldredge
CC BY-SA 3.0
2014-05-30T14:49:48.383Z
What tool would do this? No tool, because if it was possible, which it is not, you would be able to break Bitcoin.
T9b
CC BY-SA 3.0
2014-05-30T15:32:55.883Z
Thanks god double spend attempts don't break Bitcoin, that would make it rather useless.
Flavien
CC BY-SA 3.0
2014-05-30T15:38:52.637Z
And yes, it is certainly possible, it happens a few hundred times per day: https://blockchain.info/double-spends.
Flavien
<bitcoind><json-rpc><raw-transaction>
Broadcast raw transaction without input validation
Flavien
# Broadcast raw transaction without input validation

(Asked by: username_0 on 2014-05-27)

What tool/software can I use to broadcast a raw transaction, which would not reject a transaction because of invalid or double spend?

Bitcoind with RPC has a validation step which rejects any raw transaction where the inputs are not known, or if the inputs are double spending.

Also, I don't want to rely on a third party service like blockchain.info.

**Tags:** bitcoind, json-rpc, raw-transaction

> **Comments:**
> **username_1**: AFAIK It does not exist. Looked for this myself as well. You have to develop your own tool.  
> **username_2**: Seems like the easiest way might be to just comment out the validation code in bitcoind and recompile.  
> **username_3**: What tool would do this? No tool, because if it was possible, which it is not, you would be able to break Bitcoin.  
> **username_0**: Thanks god double spend attempts don't break Bitcoin, that would make it rather useless.  
> **username_0**: And yes, it is certainly possible, it happens a few hundred times per day: https://blockchain.info/double-spends.  

---

## 2 answers

### Answer by username_0 on 2014-06-05. Score: 4 | Accepted answer

Turns out there are many ways to do this:

* **Node.js**: Bitcore lets you broadcast a raw transaction to the network without any kind of validation, see the ["broadcast a transaction through P2P" example](http://bitcore.io/).
* **Python**: [Protocoin](http://protocoin.readthedocs.org/en/v0.1/) is a library that can do that.
* **Java**: [BitcoinJ](http://code.google.com/p/bitcoinj/) can do it.
* **C#**: [Bitcoincsharp](http://code.google.com/p/bitcoinsharp/), which is a port of BitcoinJ can also do it.


---

### Answer by username_4 on 2014-05-27. Score: -1

There is absolutely no reason trying to broadcast invalid transaction.
It is wasting your time and your traffic.
Your peer(s) will check it and throw it away. They will not relay it to network.
They also can ban your IP-address for some time (1 day?)
May be you want to send valid but non-standard transaction?
Or may be you want to have a custom tool, which sends transactions to a network?
    // [...]
    void NetSocket::pushTx ( const QByteArray& data )
    {
      const MyKey32 key ( data.constData ( ), data.size ( ) );  // calculate txid
      outTx.insert ( key, data );                               // store data
      write ( "inv", invPacket ( MSG_TX, key ) );               // send inv packet
    }
    //--------------------------------------------------------------
    void NetSocket::write ( const char* type, const QByteArray& data )
    {
      socket -> write ( packet ( type, data ) );
    }
    //--------------------------------------------------------------
    void NetSocket::procGetdataPacket ( const QByteArray& data )
    {
      Stream d ( data ); d.skip24 ( );               // i do not check header now
      const int count ( d.readVar ( ) );
      xassert ( count == 1 );
      const quint8* ss = d.readAdvance ( 36 );
      const quint32 tag ( *(quint32*)ss );
      const MyKey32 key ( ss + 4 );
      xassert ( tag == MSG_TX );
      xassert ( outTx.contains ( key ) );
      write ( "tx", txPacket ( outTx.value ( key ) ) );
    }
    // [...]

> **Comments:**
> **username_5**: I think it could very well be that the various bitcoin implementations have slightly different notions of when  to accept a transaction or not. the only way to find out is to be able to send a transaction unfiltered to lots of different nodes.  
> **username_0**: Of course, there is a very good reason. You may be spending unconfirmed outputs, which your client doesn't know about, but still exists on the network.  

---

