<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD Journal Publishing DTD v2.3 20070202//EN" "journalpublishing.dtd">
<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" article-type="research-article">
<front>
<journal-meta>
<journal-id journal-id-type="publisher-id">Front. Blockchain</journal-id>
<journal-title>Frontiers in Blockchain</journal-title>
<abbrev-journal-title abbrev-type="pubmed">Front. Blockchain</abbrev-journal-title>
<issn pub-type="epub">2624-7852</issn>
<publisher>
<publisher-name>Frontiers Media S.A.</publisher-name>
</publisher>
</journal-meta>
<article-meta>
<article-id pub-id-type="doi">10.3389/fbloc.2019.00007</article-id>
<article-categories>
<subj-group subj-group-type="heading">
<subject>Blockchain</subject>
<subj-group>
<subject>Original Research</subject>
</subj-group>
</subj-group>
</article-categories>
<title-group>
<article-title>An Analysis of Non-standard Transactions</article-title>
</title-group>
<contrib-group>
<contrib contrib-type="author" corresp="yes">
<name><surname>Bistarelli</surname> <given-names>Stefano</given-names></name>
<xref ref-type="aff" rid="aff1"><sup>1</sup></xref>
<xref ref-type="corresp" rid="c001"><sup>&#x0002A;</sup></xref>
<uri xlink:href="http://loop.frontiersin.org/people/356138/overview"/>
</contrib>
<contrib contrib-type="author" corresp="yes">
<name><surname>Mercanti</surname> <given-names>Ivan</given-names></name>
<xref ref-type="aff" rid="aff2"><sup>2</sup></xref>
<xref ref-type="corresp" rid="c002"><sup>&#x0002A;</sup></xref>
<uri xlink:href="http://loop.frontiersin.org/people/624135/overview"/>
</contrib>
<contrib contrib-type="author" corresp="yes">
<name><surname>Santini</surname> <given-names>Francesco</given-names></name>
<xref ref-type="aff" rid="aff1"><sup>1</sup></xref>
<xref ref-type="corresp" rid="c003"><sup>&#x0002A;</sup></xref>
<uri xlink:href="http://loop.frontiersin.org/people/580334/overview"/>
</contrib>
</contrib-group>
<aff id="aff1"><sup>1</sup><institution>Department of Mathematics and Computer Science, University of Perugia</institution>, <addr-line>Perugia</addr-line>, <country>Italy</country></aff>
<aff id="aff2"><sup>2</sup><institution>IMT School for Advanced Studies</institution>, <addr-line>Lucca</addr-line>, <country>Italy</country></aff>
<author-notes>
<fn fn-type="edited-by"><p>Edited by: Massimo Bartoletti, University of Cagliari, Italy</p></fn>
<fn fn-type="edited-by"><p>Reviewed by: Roman Matzutt, RWTH Aachen Universit&#x000E4;t, Germany; Chen Feng, University of British Columbia Okanagan, Canada</p></fn>
<corresp id="c001">&#x0002A;Correspondence: Stefano Bistarelli <email>stefano.bistarelli&#x00040;unipg.it</email></corresp>
<corresp id="c002">Ivan Mercanti <email>ivan.mercanti&#x00040;imtlucca.it</email></corresp>
<corresp id="c003">Francesco Santini <email>francesco.santini&#x00040;unipg.it</email></corresp>
<fn fn-type="other" id="fn001"><p>This article was submitted to Non-Financial Blockchain, a section of the journal Frontiers in Blockchain</p></fn></author-notes>
<pub-date pub-type="epub">
<day>13</day>
<month>08</month>
<year>2019</year>
</pub-date>
<pub-date pub-type="collection">
<year>2019</year>
</pub-date>
<volume>2</volume>
<elocation-id>7</elocation-id>
<history>
<date date-type="received">
<day>15</day>
<month>03</month>
<year>2019</year>
</date>
<date date-type="accepted">
<day>26</day>
<month>07</month>
<year>2019</year>
</date>
</history>
<permissions>
<copyright-statement>Copyright &#x000A9; 2019 Bistarelli, Mercanti and Santini.</copyright-statement>
<copyright-year>2019</copyright-year>
<copyright-holder>Bistarelli, Mercanti and Santini</copyright-holder>
<license xlink:href="http://creativecommons.org/licenses/by/4.0/"><p>This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY). The use, distribution or reproduction in other forums is permitted, provided the original author(s) and the copyright owner(s) are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is permitted which does not comply with these terms.</p></license>
</permissions>
<abstract><p>In Bitcoin, the most common kind of transactions is in the form &#x0201C;Bob pays Alice,&#x0201D; and it is based on the <italic>Pay to-Public Key Hash</italic> (<italic>P2PKH</italic>) script, which are resolved by sending the public key and a digital signature created by the corresponding private key. P2PKH transactions are just one among many <italic>standard</italic> classes: a transaction is standard if it passes <italic>Bitcoin Core IsStandard()</italic> and <italic>IsStandardTx()</italic> tests. However, the creation of <italic>ad-hoc</italic> scripts to lock (and unlock) transactions allows for also generating <italic>non-standard</italic> transactions, which can be nevertheless broadcast and mined as well. In this work, we explore the Bitcoin block-chain with the purpose to analyze and classify standard and non-standard transactions, understanding how much the standard behavior is respected.</p></abstract>
<kwd-group>
<kwd>Bitcoin</kwd>
<kwd>standard transaction</kwd>
<kwd>non-standard transaction</kwd>
<kwd>Bitcoin script</kwd>
<kwd>P2SH</kwd>
<kwd>OP_RETURN</kwd>
</kwd-group>
<counts>
<fig-count count="15"/>
<table-count count="0"/>
<equation-count count="0"/>
<ref-count count="16"/>
<page-count count="16"/>
<word-count count="9047"/>
</counts>
</article-meta> 
</front>
<body>
<sec sec-type="intro" id="s1">
<title>1. Introduction</title>
<p>The white-paper on Bitcoin appeared in November 2008 (Nakamoto, <xref ref-type="bibr" rid="B14">2008</xref>), written by a computer programmer(s) using the pseudonym &#x0201C;Satoshi Nakamoto.&#x0201D; His invention is an open-source, peer-to-peer digital currency. Money transactions do not require a third-party intermediary, with no traditional financial-institution involved in transactions. Therefore, the Bitcoin network is completely decentralized, with all the transaction components performed by the users of the system.</p>
<p>In this paper we investigate <italic>standard</italic> and <italic>non-standard</italic> transactions in the block-chain of Bitcoin. Transactions are standard if they pass the controls implemented in the reference Bitcoin-node software, i.e., <italic>Bitcoin Core</italic><xref ref-type="fn" rid="fn0001"><sup>1</sup></xref>. Our interest is mainly focused on non-standard ones, of which we provide a classification in nine different types, extending some previous analysis for bitcoin<xref ref-type="fn" rid="fn0002"><sup>2</sup></xref> (Bistarelli et al., <xref ref-type="bibr" rid="B8">2018a</xref>) and in a manner similar to what done for ethreum (Bistarelli et al., <xref ref-type="bibr" rid="B6">2019a</xref>).</p>
<p>The main motivation behind the paper is to provide an updated and comprehensive screen-shot of standard and non-standard transactions from Bitcoin origins until today. In particular, the goal consists in understanding what and how partial adherence to the Bitcoin protocol or flaws have been exploited so far, accidentally or not. Hence, we can evaluate the errors and misuses accepted by some of the miners in the network. The main result is that only the 0,02% of transactions is non-standard (2009&#x02013;November 2018). In addition, this study addresses further general questions. For example, there is no particular miner pool that validates only some specific classes of non-standard transactions: all pools that deviate from the standard behavior accept these classes. We also saw that only 2,615 bitcoins (out of more then 17 million in circulation) were definitely &#x0201C;burned&#x0201D; (i.e., made no longer spendable) due to non-standard transactions.</p>
<p>The paper, which extends Bistarelli et al. (<xref ref-type="bibr" rid="B8">2018a</xref>), is organized as follows: section 2 describes how Bitcoin transactions work, the Bitcoin scripting language, and what the standard transactions are; section 3 shows the non-standard transactions that we found in the block-chain, and related statistics; section 4 shows the statistics of standard and non-classical Bitcoin transactions nested in <italic>P2SH</italic> transactions, focusing on non-standard ones reported in the literature; section 5 classifies OP_RETURN transactions by their byte size, and it also presents related statistics; section 6 shows related works. Finally, section 7 draws the final conclusions and proposes ideas about future work.</p></sec>
<sec id="s2">
<title>2. Background</title>
<sec>
<title>2.1. Transactions</title>
<p>A Bitcoin <italic>wallet</italic> stores a collection of public/private key-pairs of a user, and not directly bitcoins. A Bitcoin address is an identifier of 26&#x02013;35 alphanumeric characters, and it strictly derives from the hash of a generated public key (<italic>pubkey</italic> in the following; Antonopoulos, <xref ref-type="bibr" rid="B2">2017</xref>). A private key is a random 256 bit number, and the corresponding pubkey is generated through an <italic>Elliptic Curve Digital Signature Algorithm</italic> (<italic>ECDSA</italic>). A transaction <italic>input</italic> must store the proof it belongs to who wants to reuse the money received in a previous transaction. The <italic>output</italic> of a transaction instead describes the destination of bitcoins by providing a challenge to users. Hence, the ownership of the coins is expressed and verified through links to previous transactions. For example, in order to send 3 bitcoins (BTC) to Bob, Alice needs to refer to other transactions she has previously received, whose amount is 3 BTC at least. To lock the coin, a script called <italic>scriptPubKey</italic> is used, while to prove the ownership of a coin, a script called <italic>scriptSig</italic> is used instead. In the following, we will refer to them as &#x0201C;locking script&#x0201D; and &#x0201C;unlocking script.&#x0201D;</p></sec>
<sec>
<title>2.2. UTXO and Memory Pool</title>
<p>A UTXO is an <italic>Unspent Transaction Output</italic> that can be spent as an input in a new transaction. To assemble the candidate block, a Bitcoin miner selects transactions from the memory pool (<italic>mempool</italic> for short): as its name suggests, it is a pool of memorized transactions collected by a miner. The data that is stored in the mempool consists of unconfirmed transactions which still needs to be processed by the Bitcoin Network, by applying a priority metric to each transaction and by adding the highest priority transactions in the next block first than lower priority ones. Today&#x00027;s miners choose which transactions to mine only based on fee-rate, thus prioritizing the transactions with highest fees per kilobyte of transaction size. Any transaction left in the mempool, after the block is filled, will remain in the pool for inclusion in the next block. As transactions remain in the mempool, their inputs &#x0201C;age,&#x0201D; as the UTXO they spend get deeper into the block-chain with new blocks added on top. Eventually, a transaction without fees might reach a high enough priority to be included in the block for free (Antonopoulos, <xref ref-type="bibr" rid="B2">2017</xref>).</p></sec>
<sec>
<title>2.3. Scripting Language</title>
<p>The Bitcoin transactions language <italic>Script</italic> is a Forth-like (Rather et al., <xref ref-type="bibr" rid="B15">1993</xref>) stack-based execution language. Script requires minimal processing and it is intentionally not Turing-complete (no loops) to lighten and secure the verification process of transactions. An interpreter executes a script by processing each item from left to right in the script. Script is a stack-based language: data is pushed onto the stack, instead the operations can push or pop one or more parameters onto/from the execution stack, operate on them, and possibly push their result back in the stack.</p>
<p>For example, the operator <sc>op_add</sc> pops two items from the stack, add them, and finally push the resulting sum onto the stack. There are also conditional operators such as <sc>op_equal</sc>: it pops two items from the stack and pushes <sc>true</sc> (represented by number 1) if the operands are equal, or <sc>false</sc> (represented by 0) if they are not equal. In Bitcoin, transaction scripts usually contain a final conditional operator, so that they can produce the result <sc>true</sc>, which points to a valid transaction.</p>
<p>Most locking scripts refer to a public key address: they require the proof of ownership of the address in order to spend money. However, this is not mandatory (Andrychowicz et al., <xref ref-type="bibr" rid="B1">2014</xref>): any combination of locking and unlocking scripts that result in a final <sc>true</sc> value is valid. <xref ref-type="fig" rid="F1">Figure 1</xref> we show the step-by-step validation procedure of this locking plus unlocking script. We have this locking script: &#x0201C;<sc>2 op_add 8 op_equal</sc>,&#x0201D; which can be satisfied by the unlocking script: &#x0201C;<sc>6</sc>&#x00027;.&#x0201D; The validation software combines the locking and unlocking scripts and produces the following script: &#x0201C;<sc>6 2 op_add 8 op_equal</sc>.&#x0201D; This script is interpreted left-to-right as: first <sc>8</sc> is pushed onto an empty stack, then <sc>2</sc>, and then the operation <sc>op_add</sc> is performed between the two last operands in the stack, which are also popped from it. The result, i.e., <sc>8</sc>, is pushed onto the stack, and then the <sc>8</sc> in the script is pushed as well. Finally, <sc>op_equal</sc> is performed, thus removing the two <sc>8</sc> and pushing <sc>true</sc> as result.</p>
<fig id="F1" position="float">
<label>Figure 1</label>
<caption><p>Bitcoin script validation.</p></caption>
<graphic xlink:href="fbloc-02-00007-g0001.tif"/>
</fig></sec>
<sec>
<title>2.4. Opcodes</title>
<p>Opcodes are the operators of the scripting language. Now we describe some operators that we will refer to in the next sections:</p>
<list list-type="order">
<list-item><p>The <sc>op_hash</sc>160 operator hashes twice the top stack element: first with <sc>sha-</sc>256 and then with <sc>ripemd-</sc>160.</p></list-item>
<list-item><p>The <sc>op_checksig</sc>: the entire transaction outputs, inputs, and script are hashed. The signature used by <sc>op_checksig</sc> must be a valid signature for this hash and public key. If it is, 1 is returned, 0 otherwise.</p></list-item>
<list-item><p>The <sc>op_min</sc> operator returns the smaller of the two top elements into the stack.</p></list-item>
<list-item><p>The <sc>op_drop</sc> operator removes the top stack element.</p></list-item>
<list-item><p>The <sc>op_depth</sc> operator puts the number of stack elements onto the stack.</p></list-item>
<list-item><p>The <sc>op_2dup</sc> operator duplicates the two elements on top of the stack.</p></list-item>
<list-item><p>The <sc>op_if</sc> operator executes the statements only if the top stack value is not False. The top stack value is removed.</p></list-item>
<list-item><p>The <sc>op_else</sc> operator executes its statements if the preceding <sc>op_if</sc> or <sc>op_else</sc> was not executed.</p></list-item>
<list-item><p>The <sc>op_endif</sc> operator ends an if/else block. All blocks must end, or the transaction is invalid. An <sc>op_endif</sc> without an <sc>op_if</sc> before is also invalid<xref ref-type="fn" rid="fn0003"><sup>3</sup></xref>.</p></list-item>
</list></sec>
<sec>
<title>2.5. Standard Transactions in Block-Chain</title>
<p>In the first few years of Bitcoin history, the developers introduced some limitations in the scripts that could be processed by the reference client. In fact, transactions can be accepted by the network if their locking and unlocking scripts match a small set of believed-to-be-safe templates. This is the <italic>isStandard()</italic> and <italic>isStandardTx()</italic> test, and transactions passing it are called standard transactions<xref ref-type="fn" rid="fn0004"><sup>4</sup></xref>. More accurately, the <italic>isStandard()</italic> function gives TRUE if all the outputs (locking script) use only standard transaction forms. On the other hand, the <italic>isStandardTx()</italic> function gives TRUE if all the inputs (unlocking script) use only standard transaction forms according to the output that they are spending. The main reason behind defining and checking standard transactions is to prevent someone from attacking Bitcoin by broadcasting harmful transactions. Moreover, these checks also keep users from creating transactions that would make adding new transaction features in the future more difficult. There are seven standard types of transactions.</p>
<p><bold>Pay to Public Key Hash (P2PKH):</bold> The transaction <italic>Pay to public key hash</italic> is the most used in the network. This is because it is the default transaction in a Bitcoin client. These transactions contain a locking script that encumbers the output with a public key hash: &#x0201C;<sc>op_dup op_hash</sc>160 <sc>&#x0003C;public key a hash&#x0003E; op_equal op_checksig</sc>.&#x0201D; <xref ref-type="fig" rid="F2">Figure 2</xref> shows an example of P2PKH script validation. A P2PKH output can be unlocked (spent) by a public key and a digital signature created with the corresponding private key: &#x0201C; <sc>&#x0003C;signature a&#x0003E; &#x0003C;public key a&#x0003E;</sc>.&#x0201D;</p>
<fig id="F2" position="float">
<label>Figure 2</label>
<caption><p>P2PKH script validation.</p></caption>
<graphic xlink:href="fbloc-02-00007-g0002.tif"/>
</fig>
<p><bold>Pay to Public Key (P2PK):</bold> The <italic>Pay to Public Key</italic> scheme is simpler than P2PKH; it was used in coinbase transactions, i.e., the one with the miners are paid for their job, until July 2012, then they started use the P2PKH (see <xref ref-type="fig" rid="F3">Figure 3</xref>). P2PK, as the name suggests, has in its locking script directly the pubkey, instead of its hash: &#x0201C; <sc>&#x0003C;public key a&#x0003E; op_checksig</sc>.&#x0201D; Since 2017 the most used output in a coinbase transaction is the OP_RETURN, which is a provably unspendable (see section 5). This coinbase transactions have some P2PKH outputs in order to pay the miners and more OP_RETURN outputs, which do not carry bitcoin (the value of the outputs is 0 BTC). The number OP_RETURN outputs Is greater than the number of P2PKH ones. These OP_RETURN outputs are related to Segregated Witness<xref ref-type="fn" rid="fn0005"><sup>5</sup></xref> (SegWit) implemented soft fork: They are linked to the Merkle root of the witness tree. The SegWit needs an extended blockheader, but the blockheader cannot be extended without a hardfork, so segwit blocks commit to this witness tree by including the root in an OP_RETURN in the coinbase transaction<xref ref-type="fn" rid="fn0006"><sup>6</sup></xref>. <xref ref-type="fig" rid="F4">Figure 4</xref> shows the P2PK script validation process. To unlock this transaction, only the corresponding signature of pubkey in the locking script is needed: &#x0201C; <sc>&#x0003C;signature a&#x0003E;</sc>.&#x0201D;</p>
<fig id="F3" position="float">
<label>Figure 3</label>
<caption><p>Evolution over time of the output type used in coinbase transactions.</p></caption>
<graphic xlink:href="fbloc-02-00007-g0003.tif"/>
</fig>
<fig id="F4" position="float">
<label>Figure 4</label>
<caption><p>P2PK script validation.</p></caption>
<graphic xlink:href="fbloc-02-00007-g0004.tif"/>
</fig>
<p><bold>Multi-signature:</bold> <italic>Multi-signature</italic> scripts set a condition where <italic>N</italic> public keys are recorded in the script, and at least <italic>M</italic> of those signatures must be used to unlock a transaction. This is also known as an <italic>M-of-N</italic> scheme, where <italic>N</italic> is the total number of keys and <italic>M</italic> is the lower threshold of signatures required for a validation. The maximum <italic>M</italic> for the current Bitcoin Core implementation is 15. The general form of a locking script setting an <italic>M-of-N</italic> multi-signature condition is: &#x0201C;<sc>m &#x0003C;public key 1&#x0003E; &#x0003C;public key 2&#x0003E; &#x02026; &#x0003C;public key n&#x0003E; n op_checkmultisig</sc>.&#x0201D; In <xref ref-type="fig" rid="F5">Figure 5</xref> the validation steps of this script is visually represented. The locking script can be satisfied with an unlocking script containing: &#x0201C;<sc>op_0 &#x0003C;signature 1&#x0003E; &#x0003C;signature 2&#x0003E; &#x02026; &#x0003C;signature M&#x0003E;</sc>.&#x0201D; Notice that the prefix <sc>op_0</sc> is required because of a bug in the original implementation of <sc>checkmultisig</sc>: due to this bug, one more argument on the stack is required. <sc>checkmultisig</sc> simply considers it as a placeholder.</p>
<fig id="F5" position="float">
<label>Figure 5</label>
<caption><p>Multi-signature script validation.</p></caption>
<graphic xlink:href="fbloc-02-00007-g0005.tif"/>
</fig>
<p><bold>Data output (<sc>op_return</sc>):</bold> The <italic>Data output</italic> transactions are used to store data not related to Bitcoin payments. Their form is &#x0201C;<sc>op_return &#x0003C;data&#x0003E;</sc>.&#x0201D; Since any output with <sc>op_return</sc> is provably un-spendable. Thus, the output can be immediately pruned from the UTXO<xref ref-type="fn" rid="fn0007"><sup>7</sup></xref> set even if it has not been spent. These transactions can be used to save different kinds of information on the block-chain, which is in this way used as an immutable distributed ledger by applications, as e-voting ones (Bistarelli et al., <xref ref-type="bibr" rid="B5">2017</xref>, <xref ref-type="bibr" rid="B7">2019b</xref>), for example. Such transactions are unlockable. Many members of the Bitcoin community believe that use of OP_RETURN is irresponsible in part because Bitcoin was intended to provide a record for financial transactions, not a record for arbitrary data. Additionally, it is trivially obvious that the demand for external, massively-replicated data store is essentially infinite. Despite this, OP_RETURN has the advantage of not creating bogus UTXO entries, compared to some other ways of storing data in the block-chain. This helps miners to be faster in calculating the priority transactions function.</p>
<p><bold>Pay to Script Hash (P2SH):</bold> A <italic>Pay to Script Hash</italic> transactions contain the hash of a script of a different transaction (called <italic>redeem script</italic>) in their locking script. For example, we can hash a <italic>2-of-5</italic> multi-signature transaction. Instead of &#x0201C;pay to this 5-key multi-signature script,&#x0201D; the P2SH equivalent transaction is &#x0201C;pay to a script with this hash.&#x0201D; Hence, the script only stores a 20-byte hash instead of five pubkeys (around 180 byte using the compressed form). <xref ref-type="fig" rid="F6">Figure 6</xref> shown an example of locking script: &#x0201C;<sc>op_hash</sc>160 <sc>&#x0003C;2-of-5 multi-signature script hash&#x0003E; op_equal</sc>,&#x0201D; with the unlocking script as: &#x0201C; <sc>&#x0003C;sig1&#x0003E; &#x0003C;sig2&#x0003E; &#x0003C;2-of-5 multi-signature script&#x0003E;</sc>.&#x0201D; See <xref ref-type="fig" rid="F6">Figure 6</xref> for an example of P2SH script validation. More details about this transaction are given in section 4.</p>
<fig id="F6" position="float">
<label>Figure 6</label>
<caption><p>P2SH script validation.</p></caption>
<graphic xlink:href="fbloc-02-00007-g0006.tif"/>
</fig>
<p><bold>Pay to Witness Public Key Hash (P2WPKH) and Pay to Witness Script Hash (P2WSH):</bold> With the introduction of the Segregated Witness<xref ref-type="fn" rid="fn0008"><sup>8</sup></xref> (<italic>SegWit</italic>) in Bitcoin, the default transaction P2PKH can be also obtained in a different way. The main differences of the Segregated Witness are the locking script shorter and the signature that are moved outside the unlocking script (see <xref ref-type="fig" rid="F7">Figure 7</xref>). In fact, in place of the longer script in P2PKH, the script in P2WPKH is shortened to: &#x0201C;<sc>op_0 &#x0003C;public key a hash&#x0003E;</sc>&#x0201D; A P2WPKH output can be unlocked (spent), as the P2PKH, by a public key and a digital signature created by the corresponding private key: &#x0201C; <sc>&#x0003C;signature s&#x0003E; &#x0003C;public key a&#x0003E;</sc>.&#x0201D; The difference is that these components are no longer in the unlocking script, but in the witness field instead.</p>
<fig id="F7" position="float">
<label>Figure 7</label>
<caption><p>The position of new signatures in witness transactions.</p></caption>
<graphic xlink:href="fbloc-02-00007-g0007.tif"/>
</fig></sec></sec>
<sec id="s3">
<title>3. An Analysis of Bitcoin Transactions</title>
<p>In this section we describe standard and non-standard transactions in the Bitcoin block-chain, by reporting statistics on their number and frequency with the purpose to have a clear view on their &#x0201C;popularity&#x0201D; and acceptance. To accomplish such an analysis we take advantage of a Bitcoin Core node, which we used to fill a PostgreSQL Database<xref ref-type="fn" rid="fn0009"><sup>9</sup></xref> in which we have stored all the block-chain blocks up to number 550, 000: until November the 14th 2018. Such a tool is part of the BlockchainVis Suite (Bistarelli et al., <xref ref-type="bibr" rid="B9">2018b</xref>). We consider Bitcoin Core<xref ref-type="fn" rid="fn0010"><sup>10</sup></xref> as the reference implementation.</p>
<sec>
<title>3.1. Statistics for Standard Transactions</title>
<p>Considering the first 550 000 blocks in the block-chain, there are 356 588 805 transactions that generate a total of 968 098 854 outputs, of which 910 274 680 have been spent (94,03%). These include 967 874 499 standard transaction outputs (99,98% of the total number of outputs). Hence, non-standard transaction outputs are only the 0,02% of the total.</p>
<p>In <xref ref-type="fig" rid="F8">Figure 8</xref> we show the distribution of standard transactions. As introduced before, the most common class is represented by P2PKH transactions, since they are the default ones in the Bitcoin client. The P2SH scheme is the second mostly frequently used class of transactions, with almost 150 million outputs. Interestingly, the number of P2SH and <sc>op_return</sc> transactions has considerably increased if compared to the data from early 2018 (Bistarelli et al., <xref ref-type="bibr" rid="B8">2018a</xref>). In <xref ref-type="fig" rid="F8">Figure 8</xref> we see that the most used <italic>M-of-N</italic> multi-signature class corresponds to the scheme <italic>1-3</italic>, with 58% of all the multi-signature transactions. The second most used scheme is <italic>1-2</italic>, with 41%. We found also: 38 repetitions of <italic>3-3</italic>, 3 repetitions of <italic>0-1</italic>, only one 1 transaction in the form <italic>3-5</italic>, 1 in <italic>1-9</italic>, and, finally, 1 in the <italic>9-9</italic> form.</p>
<fig id="F8" position="float">
<label>Figure 8</label>
<caption><p>Distribution of <underline>standard</underline> transactions (left) and distribution of <underline>Multi-signature</underline> transactions (right).</p></caption>
<graphic xlink:href="fbloc-02-00007-g0008.tif"/>
</fig></sec>
<sec>
<title>3.2. Non-standard Transactions in Block-Chain</title>
<p>Transactions are validated through <italic>isStandard()</italic> and <italic>isStandardTx()</italic> functions in the Bitcoin Core reference implementation. In case they do not pass such tests, they are simply discarded. However, some transactions that deviate from the standard enforced by Bitcoin Core can be mined as well: these transactions can be issued in the block-chain thanks to miners that relax these checks enforced by such control functions, as for example Eligius<xref ref-type="fn" rid="fn0011"><sup>11</sup></xref>. Non-standard transactions use more complex script forms, represent challenges, or just result from bugs. Their singularity comes from non-standard inputs or outputs.</p>
<p>Correctly validating non-standard transactions can make the creation of future transactions harder for two separate reasons:</p>
<list list-type="order">
<list-item><p>Some scripts might cause harm to the network.</p></list-item>
<list-item><p>Some scripts might make future upgrades harder.</p></list-item>
</list>
<p>Concerning the first reason, the non-standard transaction check was first implemented by Nakamoto before P2SH existed, so it could not be so easily circumvented. This gave developers time to better analyze the script language and fix problems with the remaining opcodes: e.g., in some cases<xref ref-type="fn" rid="fn0012"><sup>12</sup></xref> it was possible to create a transaction that took 5 h to be verify. However, even if the scripting language is perfectly safe, each script has to be stored by every full node until it is spent as part of the UTXO database. Since a locking script is limited to 10,000 bytes, this means that an attacker can add up to 10 KB to the UTXO set for every output he creates, potentially quickly adding enough data to degrade performance enough that the rate of stale blocks (orphan blocks) mined increases, which would reduce miner profits and encourage them to centralize further to recover that lost revenue.</p>
<p>Concerning the second reason, there are some opcodes the network does not want people to use. These are opcodes that might be redefined in the future, e.g., the <sc>op_nopX</sc> opcodes that have been used for soft forks in the past (<sc>op_nop1</sc> became <sc>op_checklocktimeverify</sc> and <sc>op_nop2</sc> became <sc>op_checksequenceverify</sc>). Lately, Bitcoin Core 0.16.1 quit the use of <sc>op_codeseparator</sc> in non-segwit in preparation for another potential soft fork that will reduce some lingering problems with expensive verification. In those cases, standard transactions forbid both the scriptPubKey and the redeemScript (P2SH) versions (and, when applicable, the segwit P2WSH version), thus the easy circumvention is not possible in that case<xref ref-type="fn" rid="fn0013"><sup>13</sup></xref>.</p>
<p>One of the reasons to include non-standard transaction in the block-chain could be that miners have a long-term investment in the health of the Bitcoin network. If Bitcoin collapses, then their expensive ASICs are worthless. Miners particularly need bitcoins to remain valuable over the long term because their hardware produces bitcoins over time. If nobody includes transactions in blocks, then bitcoins would be useless and therefore worthless. That would impact on miners long-term investment. If this ever became a problem, transactions would just wind up with higher fees to encourage miners to include them. Right now, enough miners include a transaction with a very small fee and there is no reason in paying more<xref ref-type="fn" rid="fn0014"><sup>14</sup></xref>.</p>
<p>We searched in the block-chain for these particular transactions and we obtained nine patterns of non-standard transactions. We now describe them by also highlighting the interval of years in which they were confirmed in the block-chain.</p>
<p><bold>Pay to Public Key Hash 0 [2011]:</bold> It corresponds to a distortion of P2PKH, with the difference that instead of the hash of a pubkey, there is a 0 value. The locking script is in the form &#x0201C;<sc>op_dup op_hash</sc>160 <sc>0 op_equalverify op_checksig</sc>.&#x0201D; These transactions are unspendable because, as P2PKH ones, in order to verify them a miner needs (i) the pubkey corresponding to the hash in the locking script, and (ii) the private key to generate the corresponding signature. However, we know that <sc>hash</sc>160 returns a 20 byte long hash: therefore, no key passed to the hash function can return 0 <xref ref-type="fn" rid="fn0015"><sup>15</sup></xref>. A Bitcointalk thread<xref ref-type="fn" rid="fn0016"><sup>16</sup></xref> indicates that this deviation was mainly performed by MtGox. The outputs represent a value of 2609.36304319 BTC, around 8, 000$ at that time (around 20 million dollars nowadays).</p>
<p><bold>P2PKH NOP [2011, 2014]:</bold> This transaction is identical to P2PKH with the only difference that a <sc>nop</sc> (an operation that does nothing) is in the locking script: &#x0201C;<sc>op_dup op_hash</sc>160 <sc>&#x0003C;hashpubkey&#x0003E; op_equalverify op_checksig op_nop</sc>.&#x0201D; This transaction was probably used to test the <sc>op_nop</sc> operator. It can be unlocked by a script identical to that of P2PKH <xref ref-type="fn" rid="fn0017"><sup>17</sup></xref>.</p>
<p><bold>OnlyHash [2011-2014]:</bold> The <italic>OnlyHash</italic> transactions are the most numerous non-standard class in the block-chain. These transactions contain a hash in the locking script, which is usually the hash of a file for using the block-chain as a ledger to register documents. Therefore, the security and resilience of the block-chain system can be used by applications such as digital-note services, stock exchange certificates, and smart contracts. The blocking script corresponds to &#x0201C; <sc>&#x0003C;hash-of-something&#x0003E;</sc>.&#x0201D; These transactions were used before the introduction of the <sc>op_return</sc>, which can be used for the same purpose <xref ref-type="fn" rid="fn0018"><sup>18</sup></xref>.</p>
<p><bold>P2Pool Bug [2012]:</bold> These transactions are due to a bug <xref ref-type="fn" rid="fn0019"><sup>19</sup></xref> in the P2Pool<xref ref-type="fn" rid="fn0020"><sup>20</sup></xref> mining tool between February 2nd, 2012 and April 1st, 2012. Instead of a plain P2PKH locking script, the following script was added: &#x0201C;<sc>op_ifdup op_if op_2swap op_verify op_2over op_depth</sc>.&#x0201D; This script does not make any sense and is not even valid as the OP_IF is not closed by a corresponding OP_ENDIF, hence it is consequently unlockable <xref ref-type="fn" rid="fn0021"><sup>21</sup></xref>.</p>
<p><bold><sc>op_checklocktimeveirfy op_drop</sc> (CLTV) [2012]:</bold> In this case the locking script is in the form: &#x0201C; <sc>&#x0003C;data&#x0003E;op_checklocktimeveirfy op_drop</sc>.&#x0201D; The <sc>op_checklocktimeveirfy</sc> operator makes the transaction invalid if the element at the top of the stack is greater than the <italic>nLockTime</italic><xref ref-type="fn" rid="fn0022"><sup>22</sup></xref> field of a transaction. In practice, using OP_CHECKLOCKTIMEVERIFY it is possible to make funds provably un-spendable until a certain point in the future, i.e., it is a way to freeze funds up to certain future day <xref ref-type="fn" rid="fn0023"><sup>23</sup></xref>. Therefore, by checking the <sc>&#x0003C;data&#x0003E;</sc> element against the rules above, we can verify the transaction by using an unlocking script that inserts <sc>true</sc> into the stack <xref ref-type="fn" rid="fn0024"><sup>24</sup></xref>.</p>
<p><bold>OP_MIN OP_EQUAL [2012]:</bold> These transactions are related to a script as &#x0201C;<sc>op_min 3 op_equal</sc>,&#x0201D; which simply needs two numbers corresponding to the equation <italic>x</italic> &#x02264; <italic>y</italic> &#x02227; <italic>x</italic> &#x0003D; 3 to be verified. Hence, to unlock it is possible to prepare an unlocking script as &#x0201C;<sc>3 4</sc>.&#x0201D; We can see this transaction as a proof of how an equation can be used to generate a bitcoin transaction. This means that anyone can easily unlock such a transaction without any private key <xref ref-type="fn" rid="fn0025"><sup>25</sup></xref>.</p>
<p><bold>Pay to Hash (P2H) [2012-2015]:</bold> These transactions are a simplification of plain P2SH ones; we have a blocking script identical to P2SH, with the difference that the internal hash does not refer to a redeem script, but it is the hash of an hexadecimal string: &#x0201C;<sc>op_hash</sc>160 <sc>&#x0003C;hash</sc>160<sc>ofsomething&#x0003E; op_equalverify</sc>.&#x0201D; There are two variants, where only the type of hashing operator changes: one corresponds to <sc>hash</sc>256, while the other one to <sc>sha</sc>256. The two blocking scripts are &#x0201C;<sc>op_hash</sc>256 <sc>&#x0003C;hash</sc>256<sc>ofsomething&#x0003E; op_equal</sc>&#x0201D; and &#x0201C;<sc>op_sha</sc>256 <sc>&#x0003C;sha</sc>256<sc>ofsomething&#x0003E; op_equal</sc>.&#x0201D; We can consider these transactions as &#x0201C;contest&#x0201D; in the network to find the correct value of the hash in the transactions.</p>
<p>A P2H cannot be considered a <italic>Hash Time-locked Contract</italic> (HTLC). A HTLC is essentially a type of payment in which two people agree to a financial arrangement where one party will pay the other party a certain amount of cryptocurrency. However, the receiving party only has a certain amount of time to accept the payment, otherwise money is returned to the sender. Instead a P2H transaction is different from a HTLC because it generates a payment that can be accepted by the receiver without any time-constraint.</p>
<p>These outputs can only be spent by providing data that once hashed (called <italic>hashlock</italic>) by a cryptographic function is equal to a given hash <xref ref-type="fn" rid="fn0026"><sup>26</sup></xref>.</p>
<p>The verification step is simple: the hexadecimal string of the hash in the blocking script is enough to spend the transaction <xref ref-type="fn" rid="fn0027"><sup>27</sup></xref>.</p>
<p><bold>UnLocked (UL) [2015]:</bold> This transaction has an empty locking script: it can be unlocked by simply having <sc>true</sc> as unlocking script. Almost all of these transactions carry an amount of 0 BTC, i.e., they are valueless transactions. Such transactions can be used as a way to donate funds to miners in addition to transaction fees: any miner who mines such a transaction can also include<xref ref-type="fn" rid="fn0028"><sup>28</sup></xref> an additional one after sending funds to an address they control <xref ref-type="fn" rid="fn0029"><sup>29</sup></xref>.</p>
<p><bold>OP_RETURN ERROR [2016-2017]:</bold> These transactions are identical to OP_RETURN, with the difference that there is an error in the script code. The code asks to push onto the stack a number of opcode higher than what is really in the code itself. For example an OP RETURN script could ask to insert in the stack the next 40 bytes in the code, but if there are only 28 bytes, the execution fails. This transaction is apparently due to a programming error. The locking script is: &#x0201C;<sc>op_return error</sc>&#x0201D; (an error is returned)<xref ref-type="fn" rid="fn0030"><sup>30</sup></xref>.</p>
<p><bold>OP_2 OP_3 ERROR [2017-2018]:</bold> These transactions are similar to OP_RETURN ERROR, but they have no OP_RETURN in the script code. As the OP_RETURN ERROR, their code asks to push onto the stack a number of bytes higher than what is really in the code itself. Probably these transactions, like the <sc>op_return error</sc>, are related to an implementation error This is the locking script: &#x0201C;<sc>op_2 op_3 error</sc>&#x0201D; (an error is returned)<xref ref-type="fn" rid="fn0031"><sup>31</sup></xref>.</p>
<p><bold>Statistics for non-standard transactions:</bold> Non-standard transactions are 224 355 (0,02%), even if the majority of them, i.e., 219 174, are unlocked transactions with a 0 BTC value (all of them in year 2015). This means that they are transactions without blocking scripts, and they do not carry any money: in practice they are &#x0201C;fake&#x0201D; transactions. Thus, if we do not consider such transactions, &#x0201C;real&#x0201D; non-standard ones are only 5 181: 0,000 5% of the total number in the block-chain.</p>
<p>In <xref ref-type="fig" rid="F9">Figure 9</xref> we show the distribution of non-standard transactions. Without considering unlocked ones, 2 3 ERROR is the most common class, with more than three thousand transactions. The second class is the OnlyHash, with almost one thousand outputs, while the remaining ones have few outputs. In <xref ref-type="fig" rid="F9">Figure 9</xref> we show the percentage of non-standard transactions associated with each miner. In order to identify the miner of a transaction we looked for the block of this transaction. Then we took the coinbase transaction of the block, in this particular transaction there is a field called just coinbase where the miners put their id. We classified the miners according to these tags <xref ref-type="fn" rid="fn0032"><sup>32</sup></xref>.</p>
<fig id="F9" position="float">
<label>Figure 9</label>
<caption><p>Distribution of <underline>non-standard</underline> transactions <bold>(left)</bold> and distribution of their <underline>miners</underline> <bold>(right)</bold>.</p></caption>
<graphic xlink:href="fbloc-02-00007-g0009.tif"/>
</fig>
<p>In <xref ref-type="fig" rid="F10">Figure 10</xref> we associate the percentage of non-standard transactions: we found that year 2018 has more than 3,200 occurrences of this kind of transactions, all of type <sc>op_2 op_3 error</sc>. Overall, these non-standard transactions contain almost 2,615 bitcoins that are no longer spendable.</p>
<fig id="F10" position="float">
<label>Figure 10</label>
<caption><p>Distribution of <underline>non-standard</underline> transactions over time <bold>(left)</bold> and distribution of non-standard transactions <underline>type</underline> over time <bold>(right)</bold>.</p></caption>
<graphic xlink:href="fbloc-02-00007-g0010.tif"/>
</fig></sec></sec>
<sec id="s4">
<title>4. Pay to Script Hash</title>
<p>As we introduced before, the P2SH transactions contain the hash of a script (called <italic>redeem script</italic>) in their locking script. In the block-chain there are 149 410 668 P2SH transactions of which 140 620 401 are spent (94,12%). Hence, we decided to analyse the content of the redeem script inside the unlocking script of the spent P2SH transactions. In the following of this section we show the results we obtained.</p>
<sec>
<title>4.1. Standard Transactions in P2SH</title>
<p>Like in the block-chain analysis, also inside P2SH transactions the majority of the transactions is standard. In fact there are 140 509 279 standard transactions, which are 99,92% of the total. In <xref ref-type="fig" rid="F11">Figure 11</xref> we show the distribution of standard transactions inside P2SH ones. The most frequent class of transactions is not the P2PKH (only 447), as in section 3, but it is the multi-signature one, with more than 90 million occurrences (65,7%). The second one is the P2WKH with almost 35 million transactions (24,6%).</p>
<fig id="F11" position="float">
<label>Figure 11</label>
<caption><p>Distribution of <underline>standard</underline> <bold>(left)</bold> and <underline>CLVT</underline> transactions inside P2SH <bold>(right)</bold>.</p></caption>
<graphic xlink:href="fbloc-02-00007-g0011.tif"/>
</fig></sec>
<sec>
<title>4.2. Non-standard Transactions in P2SH</title>
<p>Inside P2SH we found 111 122 non standard transactions (0,08% of the total); this amount is four times more than what we obtained when we &#x0201C;simply&#x0201D; analyzed the block-chain (0,02%). We found several new classes of non-standard transactions, which are different from previous ones.</p>
<sec>
<title>4.2.1. OP_CHECKLOCKTIMEVERIFY OP_DROP (CLVT)</title>
<p>We found five different types of transactions that take advantage of the CLVT operator, that, as we have already seen in section 7, makes transaction provably unspendable until a certain date. Essentially, it allows users to create a Bitcoin transaction of which the outputs are spendable only at some point in the future. CLTV is necessary for properly functional payment channels (e.g., lightning network). These channels are effectively a series of &#x0201C;off-chain&#x0201D; transactions, that benefit from all the security of typical on-chain transactions, and with some added benefits <xref ref-type="fn" rid="fn0033"><sup>33</sup></xref>.</p>
<p>One of them is equal to a group of transactions already present in the block-chain: &#x0201C; <sc>&#x0003C;data&#x0003E;op_checklocktimeveirfy op_drop</sc>.&#x0201D; The second is a P2PK locked with the CLVT operator, and this is the locking script: &#x0201C; <sc>&#x0003C;data&#x0003E;op_checklocktimeveirfy op_drop &#x0003C;public key a&#x0003E; op_checksig</sc>.&#x0201D; This script means it is not possible to use the signature (related to the public key) to spend this transaction before the date in the script. The third one is a P2PKH locked with a CLVT operator, this is the script: &#x0201C; <sc>&#x0003C;data&#x0003E;op_checklocktimeveirfy op_drop op_dup op_hash</sc>160 <sc>&#x0003C;public key a hash&#x0003E; op_equal op_checksig</sc>.&#x0201D; Then we have the class &#x0201C; <sc>&#x0003C;data&#x0003E;op_checklocktimeveirfy op_drop 1 op_add 2 op_equal</sc>,&#x0201D; which simply needs the number corresponding to the equation <italic>x</italic>&#x0002B;1 &#x0003D; 2&#x02227;<italic>x</italic> &#x0003D; 1: it consequently waits until the date has expired. The last one is a P2PKH variant that also needs a further hash to be unlocked; the locking script is &#x0201C; <sc>&#x0003C;data&#x0003E;op_checklocktimeveirfy op_drop op_sha</sc>256 <sc>&#x0003C;sha</sc>256<sc>ofsomething&#x0003E; op_dup op_hash</sc>160 <sc>&#x0003C;public key a hash&#x0003E; op_equal op_checksig</sc>.&#x0201D; As we can see in <xref ref-type="fig" rid="F11">Figure 11</xref>, the most frequently type adopted in transaction is the P2PK one, with almost 1 500 outputs.</p></sec>
<sec>
<title>4.2.2. OP_DROP</title>
<p>This transaction allows for storing some data in block-chain without making the transaction unspendable. In fact, all these transaction start with <sc>&#x0003C;data&#x0003E; op_drop</sc> where <sc>&#x0003C;data&#x0003E;</sc> is what we want to put in block-chain and OP_DROP is the operator that removes the data from the stack in order to make the execution same as of a standard transaction.</p>
<p>We found four different types of transactions that use OP_DROP. The first type does not need anything to be unlocked, that is the script is: &#x0201C; <sc>&#x0003C;data&#x0003E; op_drop 1</sc>.&#x0201D; Then there is the 2&#x02212;2 multi-signature type &#x0201C; <sc>&#x0003C;data&#x0003E; op_drop 2 &#x0003C;public key a&#x0003E; &#x0003C;public key b&#x0003E; 2 op_checkmultisig</sc>,&#x0201D; which needs the two signatures to be unlocked, like the normal 2&#x02212;2 multi-signature. The third one is a P2PKH with OP_DROP, identified by the &#x0201C; <sc>&#x0003C;data&#x0003E; op_drop op_dup op_hash</sc>160 <sc>&#x0003C;public key a hash&#x0003E; op_equal op_checksig</sc>.&#x0201D; Also this one needs only the signature, as for P2PKH transactions. The last one is an OP_DROP with a P2PK: &#x0201C; <sc>&#x0003C;data&#x0003E;op_drop &#x0003C;public key a&#x0003E; op_checksig</sc>.&#x0201D; It can be unlocked as a classical P2PK transaction.</p>
<p>In <xref ref-type="fig" rid="F12">Figure 12</xref> we can see that the most used type is the 2 &#x02212; 2 multi-signature one, with almost 25 000 occurrences. We can say that these transactions are just standard outputs in disguise, using the OP_DROP operator to add data that is discarded during verification <xref ref-type="fn" rid="fn0034"><sup>34</sup></xref>.</p>
<fig id="F12" position="float">
<label>Figure 12</label>
<caption><p>Distribution of <underline>OP_DROP</underline> <bold>(left)</bold> and <underline>OP_HASH160 OP_EQUALVERIFY</underline> transactions inside P2SH <bold>(right)</bold>.</p></caption>
<graphic xlink:href="fbloc-02-00007-g0012.tif"/>
</fig></sec>
<sec>
<title>4.2.3. OP_Hash160 OP_Equalverify</title>
<p>We found four different types of transactions that start with OP_HASH160 OP_EQUALVERIFY. The first one has this locking script: &#x0201C;<sc>op_hash</sc>160 <sc>&#x0003C;hash</sc>160<sc>ofsomething&#x0003E; op_equal 1</sc>&#x0201D; or &#x0201C;<sc>op_hash</sc>160 <sc>&#x0003C;hash</sc>160<sc>ofsomething&#x0003E; op_equal 0 1</sc>.&#x0201D; They could be transactions made to have a P2SH that can be unlocked by revealing only the redeem script, in fact these scripts do not need anything to be unlocked because at the end they push 1 in the stack; hence, the transaction is always verified.</p>
<p>Then there is the P2PK that start with a series of OP_HASH160 OP_EQUALVERIFY, with the locking script: &#x0201C;<sc>(op_hash</sc>160 <sc>&#x0003C;hash</sc>160<sc>ofsomething&#x0003E;op_equalverify)*n &#x0003C;public key a&#x0003E; op_checksig</sc>&#x0201D;<xref ref-type="fn" rid="fn0035"><sup>35</sup></xref>. To unlock the script, it is needed to know all the strings of the hashes and the private key corresponding to the public key in the script. We can consider this transaction like a challenge to a specific person (the owner of the private key corresponding to the public key in the script): when he found all the strings of the hashes in the script, he can take the money.</p>
<p>There is also a variant with this script: &#x0201C;<sc>(op_hash</sc>160 <sc>&#x0003C;hash</sc>160<sc>ofsomething&#x0003E;op_equalverify)*n &#x0003C;public key a&#x0003E; op_checksigverify &#x0003C;data&#x0003E; op_drop op_depth 0 op_equal</sc>,&#x0201D; that can be unlocked like the previous one because the new part checks that there is no element in the stack and it is possible only if all the given strings and the signature are correct. Similar to the previous one, this transaction is a challenge to a specific person, which can take the money only if he knows all the strings of the hashes in the script, but in addition there is the <sc>&#x0003C;data&#x0003E; op_drop</sc> sequence, as we saw in section 4.2.2, allows for storing some data in block-chain without making the transaction unspendable.</p>
<p>The last one is only with OP_HASH160 OP_EQUALVERIFY, whose identifying script is &#x0201C;<sc>(op_hash</sc>160 <sc>&#x0003C;hash</sc>160<sc>ofsomething&#x0003E;op_equalverify)*n op_hash</sc>160 <sc>&#x0003C;hash</sc>160<sc>ofsomething&#x0003E;op_equal</sc>.&#x0201D; To unlock it we need to know all the hashing strings. Also this transaction could be a challenge: the first user who finds all the strings of the hashes, can take the money.</p>
<p>In <xref ref-type="fig" rid="F12">Figure 12</xref> we show the distribution of OP_HASH160 OP_EQUALVERIFY transactions. The one with OP_DEPTH is the most common class, with more than 6 500 transactions extracted from the block-chain.</p></sec>
<sec>
<title>4.2.4. OP_IF</title>
<p>These transactions are characterized by the presence of the OP_IF. In fact this operator, as in C or JAVA, generates different execution branches, and the receiver can chose the one he prefers.</p>
<p>We found seven different classes of transactions that start with OP_IF, each of them characterized by the following scripts:</p>
<list list-type="order">
<list-item><p>&#x0201C;<sc>op_if</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>op_size</sc> 32 <sc>op_equalverify op_sha</sc>256</p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>&#x0003C;sha</sc>256<sc>ofsomething&#x0003E;op_equalverify op_dup</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>op_hash</sc>160 <sc>&#x0003C;public key a hash&#x0003E;</sc></p>
<p><sc>op_else</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>&#x0003C;data&#x0003E;op_checklocktimeveirfy op_drop</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>op_dup op_hash</sc>160 <sc>&#x0003C;public key b hash&#x0003E;</sc></p>
<p><sc>op_endif</sc></p>
<p><sc>op_equal op_checksig</sc>&#x0201D;.</p>
<p>This transaction can be unlocked in two ways: the first with a 32-byte string obtained from the SHA256 hash and the signature of A; the second one, after the date in the script, only with the signature of B. We can see this transaction like a challenge between A and B (the owner of the private keys corresponding to the public keys A and B in the script): if A finds the 32-byte string before the date in the script can take the money, otherwise B will take the bitcoins.</p></list-item>
<list-item><p>There is also another type equal to the last one but without the size check:</p>
<p>&#x0201C;<sc>op_if</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>op_sha</sc>256 <sc>&#x0003C;sha</sc>256<sc>ofsomething&#x0003E;op_equalverify</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>op_dup</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>op_hash</sc>160 <sc>&#x0003C;public key a hash&#x0003E;</sc></p>
<p><sc>op_else</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>&#x0003C;data&#x0003E;op_checklocktimeveirfy op_drop</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>op_dup op_hash</sc>160 <sc>&#x0003C;public key b hash&#x0003E;</sc></p>
<p><sc>op_endif</sc></p>
<p><sc>op_equal op_checksig</sc>&#x0201D;.</p>
<p>This transaction presents the same challenge as in the previous one, but the string&#x00027;s length is not fixed, so A has to find the string before the date in the script or B will take the money.</p></list-item>
<list-item><p>We found also a version with the branch reversed and using Hash160 instead of SHA256:</p>
<p>&#x0201C;<sc>op_if</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>&#x0003C;data&#x0003E;op_checklocktimeveirfy op_drop</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>&#x0003C;public key a&#x0003E; op_checksig</sc></p>
<p><sc>op_else</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>op_hash</sc>160 <sc>&#x0003C;hash</sc>160<sc>ofsomething&#x0003E;op_equalverify</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>&#x0003C;public key b&#x0003E; op_checksig</sc></p>
<p><sc>op_endif</sc>&#x0201D;.</p>
<p>This is identical to the second one but with the branch inverted, i.e., now B has to find the strings or A will take the money.</p></list-item>
<list-item><p>One more variant, which needs 15 original strings, is this:</p>
<p>&#x0201C;<sc>op_if</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>(op_ripemd</sc>160 <sc>&#x0003C;ripemd</sc>160<sc>ofsomething&#x0003E;</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>op_equalverify)*15 &#x0003C;public key a&#x0003E; op_checksig</sc></p>
<p><sc>op_else</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>&#x0003C;data&#x0003E;op_checklocktimeveirfy op_drop</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>&#x0003C;public key b&#x0003E; op_checksig</sc></p>
<p><sc>op_endif</sc>&#x0201D;.</p>
<p>Also this transaction can be considered like a challenge very similar to the second one, but A has to find 15 strings of the hashes before the date in the script, otherwise B will take the money.</p></list-item>
<list-item><p>A class that can be spent immediately with two signatures or, after the date inside the script, with one signature only:</p>
<p>&#x0201C;<sc>op_if</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>&#x0003C;public key a&#x0003E; op_checksigverify</sc></p>
<p><sc>op_else</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>&#x0003C;data&#x0003E;op_checklocktimeverify op_drop</sc></p>
<p><sc>op_endif</sc></p>
<p><sc>&#x0003C;public key b&#x0003E; op_checksig</sc>&#x0201D;.</p>
<p>This could be consider a transaction between two people (A and B) who do not trust each other, in fact if everything is well and good and A does not disappear, they can take the bitcoins, otherwise after the date in the script B can take the bitcoins.</p></list-item>
<list-item><p>A class with 2-2 multi-signatures and CLVT:</p>
<p>&#x0201C;<sc>op_if</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>2 &#x0003C;public key a&#x0003E; &#x0003C;public key b&#x0003E; 2</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>op_checkmultisig</sc></p>
<p><sc>op_else</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>&#x0003C;data&#x0003E;op_checklocktimeveirfy op_drop</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>&#x0003C;public key a&#x0003E; op_checksig</sc></p>
<p><sc>op_endif</sc>&#x0201D;.</p>
<p>This transaction can be considered exactly like the previous one, in fact the sequence <sc>2 &#x0003C;public key a&#x0003E; &#x0003C;public key b&#x0003E; 2 op_checkmultisig</sc> is identical to <sc>&#x0003C;public key a&#x0003E; op_checksigverify &#x0003C;public key b&#x0003E; op_checksig</sc>.</p></list-item>
<list-item><p>The last class is represented by transactions that do not need anything to be unlocked: at the end the script pushes 1 in the stack. For example, the script is</p>
<p>&#x0201C;<sc>op_if</sc></p>
<p>&#x000A0;&#x000A0;&#x000A0;<sc>&#x0003C;data&#x0003E; 15 &#x0003C;public key a&#x0003E; op_checkmultisig</sc></p>
<p><sc>op_endif</sc></p>
<p><sc>1</sc>&#x0201D;.</p>
<p>They could be transactions prepared to have a P2SH that can be unlocked by revealing only the redeem script, in order to make easier the unlock.</p></list-item>
</list>
<p>As we can see in <xref ref-type="fig" rid="F13">Figure 13</xref>, the most used transaction is the OP_IF 1, with more than 70 000 results.</p>
<fig id="F13" position="float">
<label>Figure 13</label>
<caption><p>Distribution of <underline>OP_IF</underline>(left) and <underline>non-standard</underline> transactions inside P2SH (right).</p></caption>
<graphic xlink:href="fbloc-02-00007-g0013.tif"/>
</fig></sec>
<sec>
<title>4.2.5. OP_RIGHT</title>
<p>This type of transaction has a script that contains only &#x0201C;<sc>op_right</sc>.&#x0201D; This operator<xref ref-type="fn" rid="fn0036"><sup>36</sup></xref> takes a string and a position and it pushes only the characters on the right w.r.t. that position in the string. To unlock this script, it is enough to assemble an unlocking script with a number and a string in a way that the result of the <sc>op_right</sc> is different from 0. Like the OP_HASH 1 or the OP_IF 1 in the previous sections this transaction could be used to make a P2SH that can be unlocked by revealing only the redeem script.</p></sec>
<sec>
<title>4.2.6. OP_2DUP Multi-signature</title>
<p>These transactions are similar to the multi-signature transactions, but with some noticeable differences: &#x0201C;<sc>op_2dup op_equal op_not op_verify 2 &#x0003C;public key a&#x0003E; op_dup 2 op_checkmultisig</sc>.&#x0201D; To unlock this script, two signatures from the same private key are needed. The reason is that the first operator <sc>op_2dup</sc> duplicates the two signatures, and then <sc>op_equal</sc> checks if they are the same; however, they are different, and then it pushes 0 in the stack. Now, <sc>op_not</sc> changes 0 in 1 and <sc>op_verify</sc> removes 1 from the stack. At the end, the presented scheme corresponds to a plain multi-signature.</p>
<p>This transaction is very dangerous for the receiver, in fact it requires two signature from the same private key. This exposes the private key to the risk of being recovered from the public key, i.e., the risk that anyone can have this private key<xref ref-type="fn" rid="fn0037"><sup>37</sup></xref>.</p></sec>
<sec>
<title>4.2.7. P2PK OP_DROP OP_DEPTH</title>
<p>This transaction looks like a P2PK but at the end of the script it checks whether the stack is empty, this is the script: &#x0201C;<sc>&#x0003C;public key a&#x0003E; op_checksigverify &#x0003C;data&#x0003E; op_drop op op_depth 0 op_equal</sc>.&#x0201D; So to unlock this script, only the signature generated by the private key of A is needed. Like the <sc>op_drop</sc> (see section 4.2.2), this transaction allows for storing some data in block-chain without making the transaction unspendable.</p>
<p>In <xref ref-type="fig" rid="F13">Figure 13</xref> we show the distribution of non-standard transactions inside P2SH transactions. The most used is the OP_IF class, with almost 80 000 outputs. The second one, with almost 25 000 occurrences, is the OP_DROP transaction.</p></sec></sec></sec>
<sec id="s5">
<title>5. OP_RETURN</title>
<p>We analyze the nulldata transaction outputs, also called OP_RETURN, and in this way we update with new data the work by Bartoletti et al. (<xref ref-type="bibr" rid="B4">2019</xref>). As introduced before, this is a particular kind of transaction, since it cannot be spent and it is used only to store data in the block-chain, using it like an immutable distributed ledger. In this case, our goal is to study the use of OP_RETURN over the year.</p>
<sec>
<title>5.1. Data Dimension</title>
<p>The data dimension inside the OP_RETURN transaction is different also because the standard dimension changed during years. In fact, in the Bitcoin Core 0.9.0<xref ref-type="fn" rid="fn0038"><sup>38</sup></xref> the limit was only 40 bytes. Then from the 0.10.0<xref ref-type="fn" rid="fn0039"><sup>39</sup></xref> release on February 16th 2015, Bitcoin nodes could choose whether to accept or not OP_RETURN transactions, and to set a maximum dimension. The 0.11.0<xref ref-type="fn" rid="fn0040"><sup>40</sup></xref> release on July 12th 2015 extended the data limit to 80 bytes. Finally, the 0.12.0<xref ref-type="fn" rid="fn0041"><sup>41</sup></xref> release on February 23th 2015 set the maximum to 83 bytes (80 byte default, plus 3 bytes overhead).</p>
<p>In <xref ref-type="fig" rid="F14">Figure 14</xref> we show the distribution of OP_RETURN data size. The most used size is 20 bytes with more than 4 million occurrences, the second one is 80 bytes with almost 1 million outputs, and the third is the 40 bytes with more than 500 thousands occurrences. There are also other transactions with only one occurrence, which we do not show in <xref ref-type="fig" rid="F14">Figure 14</xref>, exactly with size 95, 114, 134, 190, 449, and 983 bytes. There are also 296 518 output with data size 0, i.e., empty, of which 222 348 were made in September 2015 by compromised addresses<xref ref-type="fn" rid="fn0042"><sup>42</sup></xref>. These transactions were definitely used as stress tests for the Bitcoin network (Baqer et al., <xref ref-type="bibr" rid="B3">2016</xref>).</p>
<fig id="F14" position="float">
<label>Figure 14</label>
<caption><p>Distribution of <underline>OP_RETURN</underline> transactions divided by size.</p></caption>
<graphic xlink:href="fbloc-02-00007-g0014.tif"/>
</fig>
<p>In <xref ref-type="fig" rid="F15">Figure 15</xref> we show the distribution of OP_RETURN transactions over time. It seems clear that every year the OP_RETURN occurrences double, and this proves that their use is increasing at a high rate.</p>
<fig id="F15" position="float">
<label>Figure 15</label>
<caption><p>Distribution of <underline>OP_RETURN</underline> transactions over time <bold>(left)</bold> and Distribution of <underline>miners</underline> in &#x0201C;non-standard&#x0201D; OP_RETURN transactions <bold>(right)</bold>.</p></caption>
<graphic xlink:href="fbloc-02-00007-g0015.tif"/>
</fig>
<sec>
<title>5.1.1. &#x0201C;Non-standard&#x0201D; OP_RETURN</title>
<p>We analyzed transactions according to the aforementioned Bitcoin Core update, with the purpose to find those that did not respect size rules, thus we can call that &#x0201C;non-standard.&#x0201D; We found 797 results, of which 784 were registered before the release of Bitcoin Core 0.9.0 (on average they have a size of 38 bytes) and 13 registered during the 0.9.0 release, but with more than 40 bytes (on average they have a size of 61 bytes). In <xref ref-type="fig" rid="F15">Figure 15</xref> we show the distribution of miners that accepted transactions with &#x0201C;non-standard&#x0201D; OP_RETURN transactions. P2Pool is the miner pool that mined the largest number of them.</p>
<p>The last analysis that we did is the amount of Bitcoin &#x0201C;lost&#x0201D; in these transactions. We see that only 57 038 (0,68% of all OP_RETURN transactions) spent bitcoins with a total amount of 3,715 725 52 BTC. The maximum spent for a transaction is 0,018 454 BTC, the minimum is 1 Satoshi (10<sup>&#x02212;8</sup> BTC).</p></sec></sec></sec>
<sec id="s6">
<title>6. Related Work</title>
<p>Analyzing and understanding the Bitcoin block-chain is as complicated (due to the amount of data) as interesting. Several analysis can be found in the literature.</p>
<p>In 2014 Ken Shirriff&#x00027;s blog<xref ref-type="fn" rid="fn0043"><sup>43</sup></xref> studied some methods for inserting arbitrary data into Bitcoin block-chain and also what kind of data can be (or is already) stored.</p>
<p>A few months later QuantaBytes<xref ref-type="fn" rid="fn0044"><sup>44</sup></xref> surveyed Bitcoin transactions in block-chain and found three classes of non-standard transaction.</p>
<p>In 2018 Sward et al. (<xref ref-type="bibr" rid="B16">2018</xref>) improved the study on inserting arbitrary data into Bitcoin&#x00027;s block-chain.</p>
<p>Then Matzutt et al. (<xref ref-type="bibr" rid="B12">2018a</xref>) describes the problem of inserting harmful content into a block-chain; in particular they propose conceptual countermeasures to heuristically reject transactions holding unintended content with high probability. They find that mandatory minimum fees and mitigation of transaction manipulability significantly raise the bar for inserting malicious content into a block-chain.</p>
<p>In the same period, Matzutt et al. (<xref ref-type="bibr" rid="B13">2018b</xref>) the authors provide a systematic analysis of the benefits and threats of arbitrary block-chain content. They show that certain illegal content can render the mere possession of a block-chain illegal. Their analysis reveals more than 1,600 files on the block-chain, e.g., links to child pornography. This analysis highlights the importance for future block-chain to be designed to address the possibility of unintended data insertion and protect users.</p>
<p>In 2019 Bartoletti et al. (<xref ref-type="bibr" rid="B4">2019</xref>) empirical study the usage of <sc>op_return</sc> over the years and they identify several protocols based on <sc>op_return</sc>, which they classify by the application domain and their space consumption.</p></sec>
<sec id="s7">
<title>7. Discussion and Conclusions</title>
<p>In this paper we have presented a report on the statistics concerning standard (seven classes) and non-standard (nine classes) transactions in the Bitcoin block-chain, by considering up to block number 550 000, i.e., until November 14th 2018. The most populated class of transactions is P2PKH; the reason is that they represent the default transaction in Bitcoin clients. The second most used class is P2SH, which had a massive growth of over 40% transactions from Bistarelli et al. (<xref ref-type="bibr" rid="B8">2018a</xref>).</p>
<p>The presented study can help to understand the adherence of the Bitcoin protocol to the intended purposes, by quantifying past and present deviations. As a result we have obtained that only 0,02% (224 355 out of 968 098 854) of transactions outputs corresponds to non-standard ones: this shows that most of miners and users behave in a standard way. We noticed that only the 0,015% (2 615 out of more than 17 million) of all the circulating bitcoins was burned by non-standard transactions. We saw that the most used transaction inside P2SH transactions is the multi-signature one. We also show that the most used size in bytes of an OP_RETURN transaction is 20 bytes.</p>
<p>In the future, we plan to study the distribution of non-standard classes along time, and to relate them with amounts of involved bitcoins (also for standard classes). We will also analyze OnlyHash transactions, which we surveyed in section 7. The aim is to see if they could be treated as &#x0201C;colored coin&#x0201D; transactions. Finally, we also plan to use analysis and visualization tools (Bistarelli and Santini, <xref ref-type="bibr" rid="B11">2017</xref>; Bistarelli et al., <xref ref-type="bibr" rid="B10">2018c</xref>) to relate transaction types and topologies together.</p></sec>
<sec sec-type="data-availability" id="s8">
<title>Data Availability</title>
<p>The datasets generated for this study are available on request to the corresponding author.</p></sec>
<sec id="s9">
<title>Author Contributions</title>
<p>All authors listed have made a substantial, direct and intellectual contribution to the work, and approved it for publication.</p>
<sec>
<title>Conflict of Interest Statement</title>
<p>The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.</p></sec></sec>
</body>
<back>
<ack><p>The paper extends Bistarelli et al. (<xref ref-type="bibr" rid="B8">2018a</xref>) published in Crypto Valley Conference on Blockchain Technology CVCBT 2018, Zug, Switzerland.</p>
</ack>
<ref-list>
<title>References</title>
<ref id="B1">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Andrychowicz</surname> <given-names>M.</given-names></name> <name><surname>Dziembowski</surname> <given-names>S.</given-names></name> <name><surname>Malinowski</surname> <given-names>D.</given-names></name> <name><surname>Mazurek</surname> <given-names>L.</given-names></name></person-group> (<year>2014</year>). <article-title>Secure multiparty computations on bitcoin</article-title>, in <source>2014 IEEE Symposium on Security and Privacy</source> (<publisher-loc>Berkeley, CA</publisher-loc>), <fpage>443</fpage>&#x02013;<lpage>458</lpage>.</citation></ref>
<ref id="B2">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Antonopoulos</surname> <given-names>A. M.</given-names></name></person-group> (<year>2017</year>). <source>Mastering Bitcoin: Programming the Open Blockchain, 2nd Edn.</source> <publisher-loc>Champaign, IL</publisher-loc>: <publisher-name>O&#x00027;Reilly Media, Inc.</publisher-name></citation></ref>
<ref id="B3">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Baqer</surname> <given-names>K.</given-names></name> <name><surname>Huang</surname> <given-names>D. Y.</given-names></name> <name><surname>McCoy</surname> <given-names>D.</given-names></name> <name><surname>Weaver</surname> <given-names>N.</given-names></name></person-group> (<year>2016</year>). <article-title>Stressing out: Bitcoin &#x0201C;stress testing&#x0201D;</article-title>, in <source>Financial Cryptography and Data Security</source>, eds <person-group person-group-type="editor"><name><surname>Clark</surname> <given-names>J.</given-names></name> <name><surname>Meiklejohn</surname> <given-names>S.</given-names></name> <name><surname>Ryan</surname> <given-names>P. Y.</given-names></name> <name><surname>Wallach</surname> <given-names>D.</given-names></name> <name><surname>Brenner</surname> <given-names>M.</given-names></name> <name><surname>Rohloff</surname> <given-names>K.</given-names></name></person-group> (<publisher-loc>Berlin; Heidelberg</publisher-loc>: <publisher-name>Springer</publisher-name>), <fpage>3</fpage>&#x02013;<lpage>18</lpage>.</citation></ref>
<ref id="B4">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Bartoletti</surname> <given-names>M.</given-names></name> <name><surname>Bellomy</surname> <given-names>B.</given-names></name> <name><surname>Pompianu</surname> <given-names>L.</given-names></name></person-group> (<year>2019</year>). <article-title>A journey into bitcoin metadata</article-title>. <source>J. Grid Comput.</source> <volume>17</volume>, <fpage>3</fpage>&#x02013;<lpage>22</lpage>. <pub-id pub-id-type="doi">10.1007/s10723-019-09473-3</pub-id></citation></ref>
<ref id="B5">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Bistarelli</surname> <given-names>S.</given-names></name> <name><surname>Mantilacci</surname> <given-names>M.</given-names></name> <name><surname>Santancini</surname> <given-names>P.</given-names></name> <name><surname>Santini</surname> <given-names>F.</given-names></name></person-group> (<year>2017</year>). <article-title>An end-to-end voting-system based on bitcoin</article-title>, in <source>Proceedings of the Symposium on Applied Computing, SAC 2017, Marrakech, Morocco, April 3-7, 2017</source>, eds <person-group person-group-type="editor"><name><surname>Seffah</surname> <given-names>A.</given-names></name> <name><surname>Penzenstadler</surname> <given-names>B.</given-names></name> <name><surname>Alves</surname> <given-names>C.</given-names></name> <name><surname>Peng</surname> <given-names>X.</given-names></name></person-group> (<publisher-loc>Marrakesh</publisher-loc>: <publisher-name>ACM</publisher-name>), <fpage>1836</fpage>&#x02013;<lpage>1841</lpage>.</citation></ref>
<ref id="B6">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Bistarelli</surname> <given-names>S.</given-names></name> <name><surname>Mazzante</surname> <given-names>G.</given-names></name> <name><surname>Micheletti</surname> <given-names>M.</given-names></name> <name><surname>Mostarda</surname> <given-names>L.</given-names></name> <name><surname>Tiezzi</surname> <given-names>F.</given-names></name></person-group> (<year>2019a</year>). <article-title>Analysis of ethereum smart contracts and opcodes</article-title>, in <source>Advanced Information Networking and Applications - Proceedings of the 33rd International Conference on Advanced Information Networking and Applications, AINA 2019, Matsue, Japan, March 27-29, 2019, Vol. 926 of Advances in Intelligent Systems and Computing</source>, eds <person-group person-group-type="editor"><name><surname>Barolli</surname> <given-names>L.</given-names></name> <name><surname>Takizawa</surname> <given-names>M.</given-names></name> <name><surname>Xhafa</surname> <given-names>F.</given-names></name> <name><surname>Enokido</surname> <given-names>T.</given-names></name></person-group> (<publisher-loc>Matsue</publisher-loc>: <publisher-name>Springer</publisher-name>), <fpage>546</fpage>&#x02013;<lpage>558</lpage>.</citation></ref>
<ref id="B7">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Bistarelli</surname> <given-names>S.</given-names></name> <name><surname>Mercanti</surname> <given-names>I.</given-names></name> <name><surname>Santancini</surname> <given-names>P.</given-names></name> <name><surname>Santini</surname> <given-names>F.</given-names></name></person-group> (<year>2019b</year>). <article-title>End-to-end voting with non-permissioned and permissioned ledgers</article-title>. <source>J. Grid Comput.</source> <volume>17</volume>, <fpage>97</fpage>&#x02013;<lpage>118</lpage>. <pub-id pub-id-type="doi">10.1007/s10723-019-09478-y</pub-id></citation></ref>
<ref id="B8">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Bistarelli</surname> <given-names>S.</given-names></name> <name><surname>Mercanti</surname> <given-names>I.</given-names></name> <name><surname>Santini</surname> <given-names>F.</given-names></name></person-group> (<year>2018a</year>). <article-title>An analysis of non-standard bitcoin transactions</article-title>, in <source>Crypto Valley Conference on Blockchain Technology, CVCBT 2018, Zug, Switzerland, June 20-22, 2018</source> (<publisher-loc>Zug</publisher-loc>: <publisher-name>IEEE</publisher-name>), <fpage>93</fpage>&#x02013;<lpage>96</lpage>.</citation></ref>
<ref id="B9">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Bistarelli</surname> <given-names>S.</given-names></name> <name><surname>Mercanti</surname> <given-names>I.</given-names></name> <name><surname>Santini</surname> <given-names>F.</given-names></name></person-group> (<year>2018b</year>). <article-title>A suite of tools for the forensic analysis of bitcoin transactions: preliminary report</article-title>, in <source>Euro-Par 2018: Parallel Processing Workshops - Euro-Par 2018 International Workshops, Turin, Italy, August 27-28, 2018</source> (<publisher-loc>Turin</publisher-loc>: <publisher-name>Springer</publisher-name>), <fpage>329</fpage>&#x02013;<lpage>341</lpage>.</citation></ref>
<ref id="B10">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Bistarelli</surname> <given-names>S.</given-names></name> <name><surname>Parroccini</surname> <given-names>M.</given-names></name> <name><surname>Santini</surname> <given-names>F.</given-names></name></person-group> (<year>2018c</year>). <article-title>Visualizing bitcoin flows of ransomware: Wannacry one week later</article-title>, in <source>Proceedings of the Second Italian Conference on Cyber Security (ItaSEC), volume 2058 of CEUR Workshop Proceedings</source>, <fpage>33</fpage>. Available online at: CEUR-WS.org.</citation></ref>
<ref id="B11">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Bistarelli</surname> <given-names>S.</given-names></name> <name><surname>Santini</surname> <given-names>F.</given-names></name></person-group> (<year>2017</year>). <article-title>Go with the -bitcoin- flow, with visual analytics</article-title>, in <source>Proceedings of the 12th International Conference on Availability, Reliability and Security, Reggio Calabria, Italy, August 29 - September 01, 2017</source> (<publisher-loc>Reggio Calabria</publisher-loc>: <publisher-name>ACM</publisher-name>), <volume>38</volume>:<fpage>1</fpage>&#x02013;<lpage>38:6</lpage>.</citation></ref>
<ref id="B12">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Matzutt</surname> <given-names>R.</given-names></name> <name><surname>Henze</surname> <given-names>M.</given-names></name> <name><surname>Ziegeldorf</surname> <given-names>J. H.</given-names></name> <name><surname>Hiller</surname> <given-names>J.</given-names></name> <name><surname>Wehrle</surname> <given-names>K.</given-names></name></person-group> (<year>2018a</year>). <article-title>Thwarting unwanted blockchain content insertion</article-title>, in 2018 <source>IEEE International Conference on Cloud Engineering, IC2E 2018, Orlando, FL, USA, April 17-20</source> (<publisher-loc>Orlando, FL</publisher-loc>: <publisher-name>IEEE Computer Society</publisher-name>), <fpage>364</fpage>&#x02013;<lpage>370</lpage>.</citation></ref>
<ref id="B13">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Matzutt</surname> <given-names>R.</given-names></name> <name><surname>Hiller</surname> <given-names>J.</given-names></name> <name><surname>Henze</surname> <given-names>M.</given-names></name> <name><surname>Ziegeldorf</surname> <given-names>J. H.</given-names></name> <name><surname>M&#x000FC;llmann</surname> <given-names>D.</given-names></name> <name><surname>Hohlfeld</surname> <given-names>O.</given-names></name> <etal/></person-group>. (<year>2018b</year>). <article-title>A quantitative analysis of the impact of arbitrary blockchain content on bitcoin</article-title>, in <source>Proceedings of the 22nd International Conference on Financial Cryptography and Data Security (FC)</source> (<publisher-loc>Nieuwpoort</publisher-loc>: <publisher-name>Springer</publisher-name>).</citation></ref>
<ref id="B14">
<citation citation-type="other"><person-group person-group-type="author"><name><surname>Nakamoto</surname> <given-names>S.</given-names></name></person-group> (<year>2008</year>). <source>Bitcoin: A Peer-to-Peer Electronic Cash System</source>.</citation></ref>
<ref id="B15">
<citation citation-type="book"><person-group person-group-type="author"><name><surname>Rather</surname> <given-names>E. D.</given-names></name> <name><surname>Colburn</surname> <given-names>D. R.</given-names></name> <name><surname>Moore</surname> <given-names>C. H.</given-names></name></person-group> (<year>1993</year>). <article-title>The evolution of forth</article-title>, in <source>History of Pro-gramming Languages Conference (HOPL-II), Preprints, Cambridge, Massachusetts, USA, April 20-23, 1993</source>, eds <person-group person-group-type="editor"><name><surname>Lee</surname> <given-names>J. A. N.</given-names></name> <name><surname>Sammet</surname> <given-names>J. E.</given-names></name></person-group> (<publisher-loc>Cambridge, MA</publisher-loc>: <publisher-name>ACM</publisher-name>), <fpage>177</fpage>&#x02013;<lpage>199</lpage>.</citation></ref>
<ref id="B16">
<citation citation-type="journal"><person-group person-group-type="author"><name><surname>Sward</surname> <given-names>A.</given-names></name> <name><surname>Vecna</surname> <given-names>I.</given-names></name> <name><surname>Stonedahl</surname> <given-names>F.</given-names></name></person-group> (<year>2018</year>). <article-title>Data insertion in bitcoin&#x00027;s blockchain</article-title>. <source>Ledger</source>, 3.</citation></ref>
</ref-list>
<fn-group>
<fn id="fn0001"><p><sup>1</sup><ext-link ext-link-type="uri" xlink:href="https://bitcoin.org/">https://bitcoin.org/</ext-link></p></fn>
<fn id="fn0002"><p><sup>2</sup><ext-link ext-link-type="uri" xlink:href="http://www.quantabytes.com/articles/a-survey-of-bitcoin-transaction-types">http://www.quantabytes.com/articles/a-survey-of-bitcoin-transaction-types</ext-link></p></fn>
<fn id="fn0003"><p><sup>3</sup><ext-link ext-link-type="uri" xlink:href="https://en.bitcoin.it/wiki/Script">https://en.bitcoin.it/wiki/Script</ext-link></p></fn>
<fn id="fn0004"><p><sup>4</sup>To see which transactions are valid, it is possible to check the reference source code of <italic>Bitcoin Core</italic>: <ext-link ext-link-type="uri" xlink:href="https://github.com/bitcoin/bitcoin">https://github.com/bitcoin/bitcoin</ext-link></p></fn>
<fn id="fn0005"><p><sup>5</sup><ext-link ext-link-type="uri" xlink:href="https://en.bitcoin.it/wiki/Segregated_Witness">https://en.bitcoin.it/wiki/Segregated_Witness</ext-link></p></fn>
<fn id="fn0006"><p><sup>6</sup><ext-link ext-link-type="uri" xlink:href="https://bitcoin.stackexchange.com/questions/74162/op-return-in-a-coinbase-transaction">https://bitcoin.stackexchange.com/questions/74162/op-return-in-a-</ext-link><ext-link ext-link-type="uri" xlink:href="https://bitcoin.stackexchange.com/questions/74162/op-return-in-a-coinbase-transaction">coinbase-transaction</ext-link></p></fn>
<fn id="fn0007"><p><sup>7</sup>Unspent Transaction Output, i.e., the transactions that can be spent as an input in a new transaction.</p></fn>
<fn id="fn0008"><p><sup>8</sup><ext-link ext-link-type="uri" xlink:href="https://bitcoincore.org/en/2016/01/26/segwit-benefits/">https://bitcoincore.org/en/2016/01/26/segwit-benefits/</ext-link></p></fn>
<fn id="fn0009"><p><sup>9</sup>PostGreSQL: <ext-link ext-link-type="uri" xlink:href="https://www.postgresql.org">https://www.postgresql.org</ext-link></p></fn>
<fn id="fn0010"><p><sup>10</sup><ext-link ext-link-type="uri" xlink:href="https://bitcoincore.org">https://bitcoincore.org</ext-link></p></fn>
<fn id="fn0011"><p><sup>11</sup><ext-link ext-link-type="uri" xlink:href="https://btc.com/stats/pool/Eligius">https://btc.com/stats/pool/Eligius</ext-link></p></fn>
<fn id="fn0012"><p><sup>12</sup><ext-link ext-link-type="uri" xlink:href="https://bitslog.com/2017/01/08/a-bitcoin-transaction-that-takes-5-hours-to-verify/">https://bitslog.com/2017/01/08/a-bitcoin-transaction-that-takes-5-hours-to-verify/</ext-link></p></fn>
<fn id="fn0013"><p><sup>13</sup><ext-link ext-link-type="uri" xlink:href="https://bitcoin.stackexchange.com/questions/76541/whats-the-use-of-not-relaying-non-standard-transactions-if-anyone-can-still-use">https://bitcoin.stackexchange.com/questions/76541/whats-the-use-of-not-relaying-non-standard-transactions-if-anyone-can-still-use</ext-link></p></fn>
<fn id="fn0014"><p><sup>14</sup><ext-link ext-link-type="uri" xlink:href="https://bitcoin.stackexchange.com/questions/11557/what-is-the-motivation-for-miners-to-include-all-recent-transactions-in-a-block">https://bitcoin.stackexchange.com/questions/11557/what-is-the-motivation-for-miners-to-include-all-recent-transactions-in-a-block</ext-link></p></fn>
<fn id="fn0015"><p><sup>15</sup>An example is in the first output of the transaction in <ext-link ext-link-type="uri" xlink:href="https://blockchain.info/it/tx-index/1793329/1">https://blockchain.info/it/tx-index/1793329/1</ext-link></p></fn>
<fn id="fn0016"><p><sup>16</sup><ext-link ext-link-type="uri" xlink:href="https://bitcointalk.org/index.php?topic=50206.0">https://bitcointalk.org/index.php?topic=50206.0</ext-link></p></fn>
<fn id="fn0017"><p><sup>17</sup>An example is in output 2 in <ext-link ext-link-type="uri" xlink:href="https://blockchain.info/it/tx-index/629343/2">https://blockchain.info/it/tx-index/629343/2</ext-link>. The unlocking script is in the second input in <ext-link ext-link-type="uri" xlink:href="https://blockchain.info/it/tx-index/781227">https://blockchain.info/it/tx-index/781227</ext-link></p></fn>
<fn id="fn0018"><p><sup>18</sup>See for instance output 0 in <ext-link ext-link-type="uri" xlink:href="https://blockchain.info/it/tx-index/2557393/0">https://blockchain.info/it/tx-index/2557393/0</ext-link></p></fn>
<fn id="fn0019"><p><sup>19</sup><ext-link ext-link-type="uri" xlink:href="https://bitcointalk.org/index.php?topic=140097.5;imode">https://bitcointalk.org/index.php?topic=140097.5;imode</ext-link></p></fn>
<fn id="fn0020"><p><sup>20</sup><ext-link ext-link-type="uri" xlink:href="http://p2pool.in/">http://p2pool.in/</ext-link></p></fn>
<fn id="fn0021"><p><sup>21</sup>We can see an example in output 1 of <ext-link ext-link-type="uri" xlink:href="https://blockchain.info/it/tx&#x02212;index/2915138/1">https://blockchain.info/it/tx&#x02212;index/2915138/1</ext-link></p></fn>
<fn id="fn0022"><p><sup>22</sup><ext-link ext-link-type="uri" xlink:href="https://en.bitcoin.it/wiki/NLockTime">https://en.bitcoin.it/wiki/NLockTime</ext-link></p></fn>
<fn id="fn0023"><p><sup>23</sup><ext-link ext-link-type="uri" xlink:href="https://en.bitcoin.it/wiki/Script&#x00023;Freezing_funds_until_a_time_in_the_future">https://en.bitcoin.it/wiki/Script&#x00023;Freezing_funds_until_a_time_in_the_future</ext-link></p></fn>
<fn id="fn0024"><p><sup>24</sup>An example of this transaction involves output 1 in <ext-link ext-link-type="uri" xlink:href="https://blockchain.info/it/tx-index/3000496/1">https://blockchain.info/it/tx-index/3000496/1</ext-link>, and input 1 in <ext-link ext-link-type="uri" xlink:href="https://blockchain.info/it/tx-index/3000536">https://blockchain.info/it/tx-index/3000536</ext-link></p></fn>
<fn id="fn0025"><p><sup>25</sup>An example is in output 1 of the transaction in <ext-link ext-link-type="uri" xlink:href="https://blockchain.info/it/tx-index/3118220/1">https://blockchain.info/it/tx-index/3118220/1</ext-link>, and how it has been verified in input 1 in <ext-link ext-link-type="uri" xlink:href="https://blockchain.info/it/tx-index/3126754/0">https://blockchain.info/it/tx-index/3126754/0</ext-link></p></fn>
<fn id="fn0026"><p><sup>26</sup><ext-link ext-link-type="uri" xlink:href="https://medium.com/&#x00040;alcio/a-look-at-bitcoin-non-standard-outputs-c97f65cccbb6">https://medium.com/&#x00040;alcio/a-look-at-bitcoin-non-standard-outputs-c97f65cccbb6</ext-link></p></fn>
<fn id="fn0027"><p><sup>27</sup>An example is in the output 0 in <ext-link ext-link-type="uri" xlink:href="https://blockchain.info/it/tx-index/12864193/0">https://blockchain.info/it/tx-index/12864193/0</ext-link>, and how it is verified in the input 0 of the transaction in <ext-link ext-link-type="uri" xlink:href="https://blockchain.info/it/tx-index/12874719">https://blockchain.info/it/tx-index/12874719</ext-link></p></fn>
<fn id="fn0028"><p><sup>28</sup><ext-link ext-link-type="uri" xlink:href="https://en.bitcoin.it/wiki/Script&#x00023;Anyone-Can-Spend_Outputs">https://en.bitcoin.it/wiki/Script&#x00023;Anyone-Can-Spend_Outputs</ext-link></p></fn>
<fn id="fn0029"><p><sup>29</sup>An example is in output 0 in <ext-link ext-link-type="uri" xlink:href="https://blockchain.info/it/tx-index/56730867/0">https://blockchain.info/it/tx-index/56730867/0</ext-link>. How it is spent is instead represented by input 0 in <ext-link ext-link-type="uri" xlink:href="https://blockchain.info/it/tx-index/60118930">https://blockchain.info/it/tx-index/60118930</ext-link></p></fn>
<fn id="fn0030"><p><sup>30</sup>An example of it is in output 1 in <ext-link ext-link-type="uri" xlink:href="https://blockchain.info/it/tx-index/134023577/1">https://blockchain.info/it/tx-index/</ext-link><ext-link ext-link-type="uri" xlink:href="https://blockchain.info/it/tx-index/134023577/1">134023577/1</ext-link></p></fn>
<fn id="fn0031"><p><sup>31</sup>An example is represented in output 2 in <ext-link ext-link-type="uri" xlink:href="https://www.blockchain.com/btc/tx/c2cf3a1c3752304803661121edd044bbce7d70e2a43d73a46302ea5c5a868f16">https://www.blockchain.com/btc/tx/c2cf3a1c3752304803661121edd044bbce7d70e2a43d73a46302ea5c5a868f16</ext-link></p></fn>
<fn id="fn0032"><p><sup>32</sup><ext-link ext-link-type="uri" xlink:href="https://github.com/blockchain/Blockchain-Known-Pools/blob/master/pools.json">https://github.com/blockchain/Blockchain-Known-Pools/blob/master/pools.json</ext-link></p></fn>
<fn id="fn0033"><p><sup>33</sup><ext-link ext-link-type="uri" xlink:href="https://bitcoinmagazine.com/articles/checklocktimeverify-or-how-a-time-lock-patch-will-boost-bitcoin-s-potential-1446658530">https://bitcoinmagazine.com/articles/checklocktimeverify-or-how-a-time-lock-patch-will-boost-bitcoin-s-potential-1446658530</ext-link></p></fn>
<fn id="fn0034"><p><sup>34</sup><ext-link ext-link-type="uri" xlink:href="https://medium.com/&#x00040;alcio/a-look-at-bitcoin-non-standard-outputs-c97f65cccbb6">https://medium.com/&#x00040;alcio/a-look-at-bitcoin-non-standard-outputs-c97f65cccbb6</ext-link></p></fn>
<fn id="fn0035"><p><sup>35</sup>In this script, <sc>n</sc> is a integer number greater than 0 and it represents the number of times that a particular part of code is repeated.</p></fn>
<fn id="fn0036"><p><sup>36</sup><ext-link ext-link-type="uri" xlink:href="https://en.bitcoin.it/wiki/Script">https://en.bitcoin.it/wiki/Script</ext-link></p></fn>
<fn id="fn0037"><p><sup>37</sup><ext-link ext-link-type="uri" xlink:href="https://allprivatekeys.com/random-vulnerability.php">https://allprivatekeys.com/random-vulnerability.php</ext-link></p></fn>
<fn id="fn0038"><p><sup>38</sup><ext-link ext-link-type="uri" xlink:href="https://bitcoin.org/en/release/v0.9.0">https://bitcoin.org/en/release/v0.9.0</ext-link></p></fn>
<fn id="fn0039"><p><sup>39</sup><ext-link ext-link-type="uri" xlink:href="https://bitcoin.org/en/release/v0.10.0">https://bitcoin.org/en/release/v0.10.0</ext-link></p></fn>
<fn id="fn0040"><p><sup>40</sup><ext-link ext-link-type="uri" xlink:href="https://bitcoin.org/en/release/v0.11.0">https://bitcoin.org/en/release/v0.11.0</ext-link></p></fn>
<fn id="fn0041"><p><sup>41</sup><ext-link ext-link-type="uri" xlink:href="https://bitcoin.org/en/release/v0.12.0">https://bitcoin.org/en/release/v0.12.0</ext-link></p></fn>
<fn id="fn0042"><p><sup>42</sup><ext-link ext-link-type="uri" xlink:href="https://allprivatekeys.com/random-vulnerability.php">https://allprivatekeys.com/random-vulnerability.php</ext-link></p></fn>
<fn id="fn0043"><p><sup>43</sup><ext-link ext-link-type="uri" xlink:href="http://www.righto.com/2014/02/ascii-bernanke-wikileaks-photographs.html">http://www.righto.com/2014/02/ascii-bernanke-wikileaks-photographs.html</ext-link></p></fn>
<fn id="fn0044"><p><sup>44</sup><ext-link ext-link-type="uri" xlink:href="https://www.quantabytes.com/articles/a-survey-of-bitcoin-transaction-types">https://www.quantabytes.com/articles/a-survey-of-bitcoin-transaction-types</ext-link></p></fn>
</fn-group>
<fn-group>
<fn fn-type="financial-disclosure"><p><bold>Funding</bold>. This work was supported by project Agrichain (funded by Fondazione Cassa di Risparmio di Perugia 2018-2020), project ASIA (funded by INDAM-GNCS) and RACRA18 (Knowledge Representation and Automated Reasoning 2018) Fondi ricerca di Base 2018 (Mathematics and Computer Science Department).</p>
</fn>
</fn-group>
</back>
</article>