<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/rss/rss.xsl"?>
<rss version="2.0">
  <how_styling_rss_works style="display: none;" xml:lang="en-us" type="html">
# Styling RSS w XLS notes

XML files can include both xml-stylesheets (XSLT) and normal stylesheets (CSS).
XSLT files are transformations, and allow you to process an XML doc into an HTML doc (among other things).
In this case, it doesn't matter if we import the CSS here or via /rss/rss.xsl -- it gets applied either way.
The XSLT will output HTML for us, but the HTML content from the RSS feed (i.e., the bodies of posts) must be unescaped.
There's a special attribute (`disable-output-escaping`) which will do that.
However, we need to run some JS, too, because not every browser supports decoding html like that.

* firefox does not seem to support `disable-output-escaping="yes"`, so it requires the JS in rss.js
* chrome does support `disable-output-escaping="yes"`, so don't remove those attrs

The JS works by testing `#cometestme`, and then (if needed) looping over elements matching `[name=decodable]` and basically `el.innerHTML = el.textContent`.

Note, `disable-output-escaping="yes"` is a legacy feature from XSLT v1.0; the new way to do it is with character maps.
When I tried those, they didn't seem to work in firefox (which is when I tried the original JS).
IDK if chrome support character maps, but if it does, then that is a good update to implement. TODO I guess.

</how_styling_rss_works>
  <channel>
    <title>Broadcast Nonstandard Txs Quickly [Bitcoin]</title>
    <description type="html" xml:lang="en-us">&lt;p&gt;NB: This document is &lt;a href="https://github.com/xk-io/xk-io.github.io/blob/master/_posts/2015-05-10-broadcast-nonstandard-transactions.md"&gt;better read from github&lt;/a&gt;, due to fomatting issues with the code.&lt;/p&gt;

&lt;p&gt;So, I recently wanted to &lt;a href="https://blockchain.info/tx/c058286d078f059eab4231475ad6fc23c4cd1520d603128b900c13582728a961?show_adv=true"&gt;broadcast a nonstandard tx&lt;/a&gt; and didn&amp;#39;t want to wait for full blockchain sync on my dev machine.&lt;/p&gt;

&lt;p&gt;I knew that Eligius supports the &lt;a href="https://en.bitcoin.it/wiki/Free_transaction_relay_policy"&gt;Free Tx Relay Policy&lt;/a&gt;, and that I&amp;#39;d sent them nonstandard txs before, but all the IPs I could find weren&amp;#39;t accepting connections. Finally I found &lt;code&gt;68.168.105.168&lt;/code&gt; and was able to connect and broadcast the message. Later I realised you can &lt;a href="https://getaddr.bitnodes.io/nodes/leaderboard/?q=eligius"&gt;search getaddr.bitnodes.io for &amp;#39;eligius&amp;#39; to find nodes&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This is a great start, but we still need to send the transaction. By default Bitcoin Core does not relay transactions that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Are nonstandard&lt;/li&gt;
&lt;li&gt;Contain outputs not in the &lt;strong&gt;current&lt;/strong&gt; UTXO set&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At this point we are going to need to compile a version of Bitcoin Core. We will need to address the above two problems to broadcast a transaction. The second problem is included so we don&amp;#39;t have to download the whole blockchain, allowing us to relay pretty much anything.&lt;/p&gt;

&lt;p&gt;The first section of code to change is &lt;code&gt;IsStandard()&lt;/code&gt; in &lt;code&gt;script\standard.cpp&lt;/code&gt;. &lt;a href="https://github.com/bitcoin/bitcoin/blob/23254131a3fdaeae9c50dafca6d0addbbf235820/src/script/standard.cpp#L183"&gt;Source Link&lt;/a&gt;. The quickest way to fix this is add a &lt;code&gt;return true;&lt;/code&gt; at the top of the function like so:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bool IsStandard(const CScript&amp;amp; scriptPubKey, txnouttype&amp;amp; whichType)
{
    return true;
    vector&amp;lt;valtype&amp;gt; vSolutions;
    if (!Solver(scriptPubKey, whichType, vSolutions))
    &amp;lt;snip&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Sweet, now all transactions are standard for our node. The next part is to relay transactions even when we can&amp;#39;t validate the outputs they spend. When troubleshooting before I ran into &lt;a href="https://github.com/bitcoin/bitcoin/blob/23254131a3fdaeae9c50dafca6d0addbbf235820/src/rpcrawtransaction.cpp#L796"&gt;this error message&lt;/a&gt; being thrown. To avoid more debugging I figured the best thing to do was just rip the whole block of code out. That is to say this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;snip&amp;gt;
    bool fHaveChain = existingCoins &amp;amp;&amp;amp; existingCoins-&amp;gt;nHeight &amp;lt; 1000000000;
    if (!fHaveMempool &amp;amp;&amp;amp; !fHaveChain) {
        // push to local node and sync with wallets
        CValidationState state;
        bool fMissingInputs;
        if (!AcceptToMemoryPool(mempool, state, tx, false, &amp;amp;fMissingInputs, !fOverrideFees)) {
            if (state.IsInvalid()) {
                throw JSONRPCError(RPC_TRANSACTION_REJECTED, strprintf("%i: %s", state.GetRejectCode(), state.GetRejectReason()));
            } else {
                if (fMissingInputs) {
                    throw JSONRPCError(RPC_TRANSACTION_ERROR, "Missing inputs");
                }
                throw JSONRPCError(RPC_TRANSACTION_ERROR, state.GetRejectReason());
            }
        }
    } else if (fHaveChain) {
        throw JSONRPCError(RPC_TRANSACTION_ALREADY_IN_CHAIN, "transaction already in block chain");
    }
    RelayTransaction(tx);
&amp;lt;snip&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Becomes this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;snip&amp;gt;
    bool fHaveChain = existingCoins &amp;amp;&amp;amp; existingCoins-&amp;gt;nHeight &amp;lt; 1000000000;
    RelayTransaction(tx);
&amp;lt;snip&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;So, all that&amp;#39;s left to do is compile bitcoind, run it with &lt;code&gt;-connect=68.168.105.168&lt;/code&gt;, wait for the connection to initialize (which can be checked with &lt;code&gt;bitcoin-cli getpeerinfo&lt;/code&gt;) and then &lt;code&gt;sendrawtransaction&lt;/code&gt; when you&amp;#39;ve confirmed the connection. If all goes well the tx will appear in the next eligius block! &lt;/p&gt;
</description>
    <categoryTags>
    </categoryTags>
    <link>https://forum.xk.io/n/2013</link>
  </channel>
</rss>
