<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jonathan Scialpi on Medium]]></title>
        <description><![CDATA[Stories by Jonathan Scialpi on Medium]]></description>
        <link>https://medium.com/@Jon_Scialpi?source=rss-5aabdf4a57ea------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*C773zTcfZdT0ayWi.jpg</url>
            <title>Stories by Jonathan Scialpi on Medium</title>
            <link>https://medium.com/@Jon_Scialpi?source=rss-5aabdf4a57ea------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 16:48:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Jon_Scialpi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Enhancing SMB Due Diligence with OneDeal DataRooms]]></title>
            <link>https://medium.com/@Jon_Scialpi/enhancing-smb-due-diligence-with-onedeal-datarooms-5e9e3bad72e?source=rss-5aabdf4a57ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e9e3bad72e</guid>
            <category><![CDATA[fintech]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[small-business]]></category>
            <category><![CDATA[business]]></category>
            <dc:creator><![CDATA[Jonathan Scialpi]]></dc:creator>
            <pubDate>Thu, 06 Jul 2023 13:02:16 GMT</pubDate>
            <atom:updated>2023-07-09T11:23:16.394Z</atom:updated>
            <content:encoded><![CDATA[<h4>Enhancing Efficiency and Privacy</h4><h4>Table of Contents</h4><ol><li><strong>Introduction</strong></li><li><strong>Streamlining Access to Financial Documents</strong></li><li><strong>Efficiency at its Finest</strong></li><li><strong>Enhanced Security and Confidentiality</strong></li><li><strong>Building Trust and Collaboration</strong></li><li><strong>Conclusion</strong></li></ol><h3><strong>Introduction</strong></h3><p>In the world of SMB acquisitions, time is of the essence. The traditional process of gaining access to financial documents for due diligence has long been a cumbersome and time-consuming ordeal. Countless emails, back-and-forth scheduling, and waiting for manual responses from brokers have plagued the process, causing frustration and delays.</p><p>However, with the advent of <a href="https://onedeal.biz/">OneDeal</a> DataRooms, a groundbreaking centralized platform, the landscape of SMB due diligence has been forever transformed. In this blog post, we will explore how <a href="https://onedeal.biz/">OneDeal</a> DataRooms revolutionizes the process, making it faster, more efficient, and streamlined for all parties involved.</p><h3>OneDeal on Twitter: &quot;We are thrilled to announce the launch of our groundbreaking feature: DATA ROOMS! 🚀We have streamlined the process for SMB searchers, providing them with a single, centralized platform to obtain NDAs and access necessary documents for due diligence.Meanwhile, sellers and... pic.twitter.com/7J82R24YIU / Twitter&quot;</h3><p>We are thrilled to announce the launch of our groundbreaking feature: DATA ROOMS! 🚀We have streamlined the process for SMB searchers, providing them with a single, centralized platform to obtain NDAs and access necessary documents for due diligence.Meanwhile, sellers and... pic.twitter.com/7J82R24YIU</p><h3><strong>Streamlining Access to Financial Documents</strong></h3><p>In the past, gaining access to financial documents for SMB due diligence was a painstaking process. SMB searchers had to rely on a series of emails, schedule introductory meetings, and wait anxiously for brokers to manually respond to their requests. This manual approach was not only time-consuming but also prone to delays, misplaced emails, and the constant challenge of coordinating schedules.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ir18eha6zaR-4w82" /><figcaption>Photo by <a href="https://unsplash.com/fr/@lance_asper?utm_source=medium&amp;utm_medium=referral">Lance Asper</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>However, with <a href="https://onedeal.biz/">OneDeal </a>DataRooms, everything changes. The process is now simplified into three easy steps:</p><p><strong>Step 1: </strong>Search for a Business Using The Onedeal.biz Platform:<br>SMB searchers can search for businesses that match their criteria. With a few clicks, they can identify potential opportunities that align with their acquisition goals.</p><p><strong>Step 2:</strong> Sign Required NDA &amp; Request Access to Data Room:<br>Once a promising opportunity is identified, SMB searchers can proceed to sign the necessary Non-Disclosure Agreement (NDA) to protect the confidentiality of the financial information. By signing the NDA, the searcher demonstrates their commitment to maintaining the privacy of the seller’s financial documents. Following this, they can request access to the DataRoom where the documents are stored securely.</p><p><strong>Step 3: </strong>Broker Response &amp; Automatic Document Sharing:<br>With <a href="https://onedeal.biz/">OneDeal</a> DataRooms, the process of gaining access to financial documents is as seamless as a friend request on social media. The broker receives the request, similar to a friend request, and can promptly review and respond to it. Once approved, the documents are automatically shared with the authorized party. This eliminates the need for manual responses and speeds up the document sharing process significantly.</p><h3>Efficiency at its Finest</h3><p><a href="https://onedeal.biz/">OneDeal</a> DataRooms leverages cutting-edge technology to automate access to financial documents, making the due diligence process 10 times faster. Now, SMB searchers can request access to the DataRooms, and with programmatically granted access, they can explore the documents they need without unnecessary delays.</p><p>The centralized platform ensures that all documents are organized, categorized, and easily searchable. Gone are the days of digging through cluttered inboxes or trying to locate specific files in a maze of folders. <a href="https://onedeal.biz/">OneDeal</a> DataRooms streamlines the document management process, saving time and effort for both SMB searchers and brokers.</p><h3>Enhanced Security and Confidentiality</h3><p>While speed and efficiency are paramount, the security and confidentiality of sensitive financial information cannot be compromised. <a href="https://onedeal.biz/">OneDeal</a> DataRooms prioritizes data protection, implementing robust security measures to safeguard the confidentiality of financial documents.</p><p>Authorized parties are granted access to specific DataRooms, ensuring that only those with a legitimate interest in the SMB acquisition can view the documents. Additionally, advanced encryption and data protection protocols are employed, adding an extra layer of security to prevent unauthorized access or data breaches.</p><h3>Building Trust and Collaboration</h3><p><a href="https://onedeal.biz/">OneDeal</a> DataRooms not only simplifies the due diligence process but also fosters trust and collaboration between SMB searchers and brokers. By providing a transparent and efficient platform, <a href="https://onedeal.biz/">OneDeal</a> DataRooms eliminates communication barriers, reduces friction, and creates a cohesive environment for information sharing.</p><p>SMB searchers can access the necessary documents instantly, allowing them to evaluate potential opportunities more effectively. Brokers, on the other hand, can focus on providing valuable insights and guidance to SMB searchers, knowing that the administrative burdens of document management are minimized.</p><h3>Conclusion</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*ACV7uTI3VChQ34Fg_Wrk4g.gif" /></figure><p>The traditional process of gaining access to financial documents for SMB due diligence has been revolutionized by <a href="https://onedeal.biz/">OneDeal</a> DataRooms. The centralized platform, with its automated and programmatically granted access, simplifies the entire process, making it faster, more efficient, and secure. By leveraging the power of technology, <a href="https://onedeal.biz/">OneDeal </a>DataRooms streamlines document management, enhances collaboration, and builds trust between SMB searchers and brokers. With<a href="https://onedeal.biz/"> OneDeal</a> DataRooms, SMB acquisitions are propelled into a new era of speed, efficiency, and successful transactions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e9e3bad72e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Machine Learning on Corda]]></title>
            <link>https://medium.com/corda/machine-learning-on-corda-558cadc8ba05?source=rss-5aabdf4a57ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/558cadc8ba05</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[corda]]></category>
            <dc:creator><![CDATA[Jonathan Scialpi]]></dc:creator>
            <pubDate>Fri, 19 Jun 2020 09:08:15 GMT</pubDate>
            <atom:updated>2020-06-19T09:08:15.406Z</atom:updated>
            <content:encoded><![CDATA[<h4>Decentralized Corpus Manager</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*OZvaHJcyONNeuXm5WjT-mA.png" /></figure><h3><strong>Table of Contents</strong></h3><ol><li>Introduction</li><li>The Issues</li><li>The Solution</li><li>Advantages of Corda</li><li>Further Work &amp; Utilization</li><li>Conclusion</li><li>Resources</li></ol><h3>Introduction</h3><p>We often hear about innovative ways that machine learning models are leveraged in applications. What we almost never hear of how painful is the experience that the data scientists who create these models go through. In this article I will discuss (assuming you have a basic understanding of Corda):</p><ul><li><strong>What </strong>common issues data scientists face when trying to build these models</li><li><strong>How </strong>I solved these issues with a CorDapp called Decentralized Corpus Manager.</li><li><strong>Why </strong>Corda is the right choice for decentralized machine learning applications</li></ul><p>Before we dive into the issues, let’s briefly cover some common terms and the overall workflow to produce a machine learning model. Since machine learning is a rather vast subject with many specializations, let’s focus specifically on <em>text classification</em>. The goal of text classification is simply to categorize a piece of text. A few common use cases for text classification are sentiment analysis, spam detectors, and intent detection.</p><p>Teaching a machine how to classify text is analogous to how you would teach a child how to detect objects that are colored “red” and those that are “not red”. You would compile a set of photos which contain red items like an apple or a fire truck and another set of items that are not red like a banana or a tree. Then you would simply show each picture to the child and categorize it aloud.</p><p>To teach a machine how to classify with accuracy, data scientists compile a data set (known as a “corpus”) with various sample texts (called “utterances”) along with their respective classification category (“labels”). This corpus will be fed to a classification algorithm which will tokenize the corpus and produce a model. This model is what the machine references when trying to make predictions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9PpODuAH7wqsCmzxE26Yng.png" /><figcaption>Model creation workflow</figcaption></figure><h3><strong>The Issues</strong></h3><h4><strong>Good, clean data can be hard to find:</strong></h4><p>There are four main ways to acquire training data and each has their own issues:</p><ul><li>Data sharing sites like <a href="https://www.kaggle.com/datasets">Kaggle</a>:</li></ul><p>These sites are great for getting started in machine learning but most of the time will not have the data that you are looking for, since every classification model is unique to its use case. For example, let’s say you are building an intent detection application capable of determining whether someone was asking to reset their password or not (the not label is commonly referred to as the “negative” category) from within a mobile banking application. You go to Kaggle, download the data, train your model and test it out to notice that your model has 60% accuracy score as utterances such as “I can’t get into my USA banking mobile app!” are failing because the data set you downloaded contained generalized utterances such as “I lost my excel document containing all of my credentials…”. Generalizations like this could cause models to <a href="https://machinelearningmastery.com/overfitting-and-underfitting-with-machine-learning-algorithms/">overfit or underfit</a>.</p><ul><li>Client data:</li></ul><p>If you’re [un]lucky (depends how you look at it), the client who you are creating a classification model for will tell you that they have heaps of data that you could use to train the model only to find out that the “heaps of data” are really just unstructured exports of help desk incident tickets where people are trying to access their account. This, of course, means that you must manually sift through these logs. You could make some regex-based script to speed up the process but you will eventually still have to sift and structure the data according to your training needs.</p><ul><li>Manual creation:</li></ul><p>If you want something done right, do it yourself…right? Besides the fact that you’d probably rather be spending your time on something else besides writing utterance after utterance, just writing the corpus yourself can result in a <a href="https://searchenterpriseai.techtarget.com/definition/machine-learning-bias-algorithm-bias-or-AI-bias">biased data set</a> where you have imposed conscious or unconscious preference that may go undetected until your app hits production.</p><ul><li>Crowdsourcing data:</li></ul><p>You can use sites like <a href="https://www.mturk.com/">Mechanical Turk</a> to offer a five-cent bounty for every utterance that is related to an intent you’re classifying. For a low price, this can relieve you of the burden from having to type up your own utterances but there is still no guarantee that people will follow your instructions perfectly and you will be stuck manually reviewing each utterance that was submitted.</p><h4><strong>Data corruption:</strong></h4><p>Besides underfitting, overfitting, structure, bias, and time lost in review, data can also become corrupted. One human error in reviewing a pull request on a corpus can have disastrous effects on a model’s performance. Even <a href="https://en.wikipedia.org/wiki/Online_machine_learning">online training</a> solutions where models are learning from live data or batched data can become corrupted by a bug in data ingestion or filtering can render a model/application useless.</p><h3><strong>The Solution</strong></h3><p>Based on my experience with the above issues, I believe that the crowdsourcing approach is the most practical. It gives the best chance at avoiding bias while also relieving the burden of creating a corpus from scratch. However, the problems of underfitting/overfitting, manual review, and manual corpus maintenance still exist. If only there was an automated way to ensure crowdsourced contributions follow my format and only accept these contributions if they have a positive effect on the model’s performance…</p><p>Introducing the <a href="https://github.com/JonathanScialpi/decentralized_corpus_manager"><strong>D</strong>ecentralized <strong>C</strong>orpus <strong>M</strong>anager</a>! DCM is an application I built to facilitate data crowdsourcing for machine learning models using Corda. Beyond crowdsourcing, <a href="https://docs.corda.net/docs/corda-os/4.4/key-concepts-contracts.html">Corda contracts</a> provide a way to tackle the three remaining problems:</p><ol><li>Enforce a standard way to propose corpus contributions to avoid manual reviews.</li><li>Only commit changes to a corpus if it improves the model’s performance to avoid manual corpus maintenance.</li><li>Accomplish 1 &amp; 2 in an automatic/programmatic way that is cryptographically secure.</li></ol><h4>How to Issue a Corpus:</h4><p><strong>Step 1</strong> — The user issuing the corpus (known as the “owner”) can call the <em>IssueCorpus</em> REST API to create a <a href="https://github.com/JonathanScialpi/decentralized_corpus_manager/blob/master/CorDapp/contracts/src/main/kotlin/com/dcm/states/CorpusState.kt"><em>CorpusState</em></a><em>.</em></p><p><strong>Step 2</strong> — Once the <a href="https://github.com/JonathanScialpi/decentralized_corpus_manager/blob/master/CorDapp/clients/src/main/kotlin/com/dcm/webserver/Controller.kt#L44-L69"><em>issueCorpus </em></a>Spring endpoint is called and starts the <a href="https://github.com/JonathanScialpi/decentralized_corpus_manager/blob/master/CorDapp/workflows/src/main/kotlin/com/dcm/flows/IssueCorpus.kt"><em>IssueCorpusFlow</em></a><em> </em>via RPC<em>.</em></p><p><strong>Step 3</strong> — The flow makes an external POST request to the Flask server which <a href="https://github.com/JonathanScialpi/decentralized_corpus_manager/blob/master/flask/app.py">consumes the corpus</a>. The utterances and their respective labels are then used to build a model and are measured against a test set.</p><p><strong>Step 4 </strong>— The results of the test set are passed back to the <em>IssueCorpusFlow</em> as a JSON response to be included as the <em>classificationReport </em>attribute on the <a href="https://github.com/JonathanScialpi/decentralized_corpus_manager/blob/master/CorDapp/contracts/src/main/kotlin/com/dcm/states/CorpusState.kt"><em>CorpusS</em>tate</a>.</p><p><strong>Step 5</strong> — Lastly, all participants sign and verify the new state and their ledgers are updated with the new <em>CorpusState.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wEU5FJxi1rjbtajq67eKCA.png" /></figure><h4><strong>How to Update a Corpus:</strong></h4><p>Steps 1–5 for the corpus update are like that of the issuance. The major difference is the command used and its associated requirements in the smart contract:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f57f8ff16efbc86c69ae788d8877171b/href">https://medium.com/media/f57f8ff16efbc86c69ae788d8877171b/href</a></iframe><ul><li>Line 7 protects against the removal or addition of any new labels which would ruin the shape of our model.</li><li>Line 14 ensures that an update to a corpus will only be considered a valid transaction if there is a positive delta between the classification report found in the input state (current) and the one found in the output state (proposed).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-PWk2OSoxuMk2rVKIw6vyA.png" /></figure><h3>Advantages of Corda</h3><p>Now that I have proven that blockchain can be used to solve the issues that come with producing machine learning models, let’s examine why Corda is the right blockchain platform for this use case by drawing comparisons from Microsoft’s <a href="https://www.microsoft.com/en-us/research/blog/leveraging-blockchain-to-make-machine-learning-models-more-accessible/">Decentralized &amp; Collaborative AI on Blockchain</a> (I will refer to this framework as DeCA). This framework is built on the Ethereum platform to host and train publicly available machine learning models.</p><h4>Storage Costs</h4><p>While both DCM and DeCA store data and meta-data relative to the model in progress on-chain, it&#39;s important to distinguish how the term “on-chain” affects the cost outcome. Being that DCM uses Corda, said data can be stored for low-cost on a cloud database such as <a href="https://azure.microsoft.com/en-us/pricing/details/postgresql/server/">Azure’s PostgreSQL</a>. DeCA on the other hand stores its data on the Ethereum blockchain which has<a href="https://medium.com/ipdb-blog/forever-isnt-free-the-cost-of-storage-on-a-blockchain-database-59003f63e01"> extremely high costs</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*ar3BHOJzA2tAywhm3bveOw.png" /><figcaption>Based on 17,500 ETH/1GB transaction at a price of $267 ETH/USD</figcaption></figure><p>As demonstrated by the table above, a 1GB write to the ETH blockchain could costs millions making DeCA unusable. To work around the storage cost issue, DeCA only allows contributors to<a href="https://www.youtube.com/watch?v=dVDNahN6iPs&amp;t=191"> propose one data sample at a time</a> to minimize write fees: <a href="https://www.microsoft.com/en-us/research/blog/leveraging-blockchain-to-make-machine-learning-models-more-accessible/">“<em>As of July 2019, it costs about USD0.25 to update the model on Ethereum</em>”</a>. It is further explained that this fee could be removed for contributors through a reimbursement.</p><p>There are four drawbacks with this approach:</p><ol><li>Restricting the contributions to one data sample at a time will increase the number of transactions necessary to complete the crowdsourcing of a model. Whereas in DCM a contribution can contain any number of the data sample (doesn’t have to be just additional data either, it could contain data deletions) potentially completing the model in one transaction.</li><li>Although each individual transaction might be as low as USD0.25 and seem insignificant, if you add up the total fees of each individual transaction, the total cost will still be way higher than the cost of PostgreSQL db. It just <em>seems </em>lower from the individual contributor’s perspective.</li><li>While contribution fees could potentially be reimbursed for the contributor, the individual who is reimbursing the contributor will still have to assume the cost of network computation. This cost can potentially be offset somewhat by fees consumed by bad contributions if using a staking incentive mechanism but would mostly fall on the individual responsible for reimbursements.</li><li>Another drawback of using an Ethereum based solution is on the initial issuance or creation of the model. According to Microsoft’s blog post, “Hosting a model on a public blockchain requires an initial one-time fee for deployment, usually a few dollars.” This is probably true but is only a few dollars because there is almost no data in the initial model as the whole purpose is to crowdsource the model. But what if you already have some data to start with and only see to partially crowdsource the rest of the model? This would require more computation from the Ethereum Virtual Machine and as a result, will have an exponential impact on the cost of initial deployment.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*njWiAN5JHnt44eloKZwQlg.png" /><figcaption><a href="https://medium.com/coinmonks/storing-on-ethereum-analyzing-the-costs-922d41d6b316">Storing on Ethereum. Analyzing the costs.</a></figcaption></figure><h4>Privacy</h4><p>Due to the nature of the gossip protocol, every transaction that is made through DeCA will be seen throughout the network. This includes the proposed corpus contributions, the corpus itself (say goodbye to your “secret sauce”), and any rewards/punishments from its incentive mechanism.</p><p>Whereas transactions through DCM are sent as point-to-point messages and sends them only on a need to know basis (<a href="https://docs.corda.net/docs/corda-os/4.4/key-concepts-ecosystem.html#admission-to-the-network">lazy propagation</a>). Subjective transactions open the door modifications to how DCM currently works:</p><ul><li><strong>Private contributions:</strong> Only the owner and the contributor would be included on a corpus update. The only time the rest of the crowd would see the contribution would be when they received an updated corpus, but they still wouldn’t know who the participant was who made the update.</li><li><strong>Private corpus: </strong>Contributors can still propose corpus updates without having access to the corpus. In this case, the “secret sauce” of the model can be preserved while still crowdsourcing data. This can be accomplished by having two separate states. The first state would be for the contribution (which can be between just the owner and contributor, or the contributor and the rest of the crowd) and the second state would be for the corpus itself (which only the owner would be a participant on).</li></ul><p>These two modifications are especially interesting since the idea of multiple states doesn’t exist on Ethereum being that its blockchain represents one global state. The only way for DeCA to keep the model private while still accepting contributions would be to store the model off-chain. In contrast, <strong>the privacy modifications for DCM would still store both the contribution and the model on-chain!</strong></p><h4>Decentralization</h4><p>Although lazy propagation allows for private transactions, the drawback is obviously in decentralization when compared to the gossip protocol. Being built on Ethereum, DeCA by default will send every transaction to every node on the network allowing any node to participate. Although DCM doesn’t include every node on the network by default in every transaction, my current implementation doesn’t prevent any node from being a contributor. Meaning, any participant included within a corpus state can add any other participant on the network. Furthermore, if you had a list of every participant on the network you could technically include each one of them on a corpus state issuance.</p><p>Thus, participation in DCM is by default semi-decentralized with the potential to be fully decentralized. Contributions are still decentralized between those that are included on the state since any of those participants can propose state changes.</p><h3>Further Work &amp; Utilization</h3><h4>Incentive Mechanisms</h4><p>To ensure participation in a crowdsourcing application, building an incentive mechanism is vital. Although my first goal was to prove that this functionality was possible on Corda, I built it knowing that the incentive mechanism would probably be the next task in the pipeline. With the delta variable mentioned earlier (in the <em>Corpus Contribution Flow </em>section), there is a way to tell if a user’s contribution had a positive/negative effect on the model’s performance and measure how much it improved/degraded by. Using this measurement, a payout scheme can be implemented such as DeCA’s staking approach or something more rudimentary such as: for each positive delta point, the owner of the model pays out X amount of DCM tokens that were used to fund the crowdsourcing project.</p><h4>Model Storage</h4><p>DCM currently stores the corpus that is used to produce a model and its respective metadata but does not actually store the model object.<a href="https://stackabuse.com/scikit-learn-save-and-restore-models/"> I don’t think this would be difficult to accomplish </a>and could add some value to the CorDapp being that it allows for more flexibility. For example, you might have a corpus state which contains data you wish to keep private but would like to sell subscriptions to other participants willing to pay some fee to use your model’s classification.</p><h4>Corpus Trading</h4><p>The storage of a corpus and its respective model on-chain opens the door for the sharing of these data sets for the common good or to make a profit.</p><ul><li><strong>Common good</strong> example: A consortium of banks who pool a data set of fraudulent transactions to make a fraud detection model capable of classifying whether a credit card purchase should be flagged or not.</li><li><strong>Profit </strong>example: Some hedge fund creates a <a href="https://www.investopedia.com/terms/r/regression.asp">regression model</a> which could be sold as a subscription, one-time purchase, or simply traded in exchange for access to some other hedge fund’s model. The data could also be sold or traded separately from the model.</li></ul><h4>Oracles</h4><p>DCM currently uses a <a href="https://github.com/JonathanScialpi/decentralized_corpus_manager/blob/master/CorDapp/workflows/src/main/kotlin/com/dcm/flows/IssueCorpus.kt#L63"><em>FlowExternalOperation</em></a><em> </em>to make a POST request to the Flask server endpoint which responds back with the classification report. Instead, I’d like to examine <a href="https://docs.corda.net/docs/corda-os/4.4/key-concepts-oracles.html">Corda Oracles</a> to see how their usage could benefit the CorDapp. An immediate benefit I can think of is that the Oracle is a permissioned node on your network and therefore you can trust the response you receive back from the classification endpoint if you see the Oracle’s signature on the request/transaction.</p><h4>Training Set Selection</h4><p>Thirty per cent of the training data submitted is <a href="https://github.com/JonathanScialpi/decentralized_corpus_manager/blob/master/flask/app.py#L120-L121">randomly selected</a> and used to test the classification model’s performance and produce a classification report. Being that it is random, the smaller the data set is, the greater the chance that new data added to the corpus might end up in the testing set rather than the training set. The flask API should be altered to only consider data that is outside of the contribution set to guarantee that it is used to train the model rather than test it.</p><h3>Conclusion</h3><p>The power in crowdsourcing is manifested in the development of machine learning models. Whether it’s for classification, regression, or clustering, machine learning models are only as good as the data that supports them. Blockchain technology protects said data with a distributed smart contract which programmatically ensures that crowdsourced data is structured, quality, and immutable, and as public/private as you need it to be.</p><p>As demonstrated through DCM, Corda is the best platform for the job. Microsoft’s DeCA framework focused on “publicly accessible” models because the gossip protocol isn’t built for privacy while the Ethereum platform can only provide anonymity, hashed data, or off-chain solutions. On Corda however, you could instil your own participation rules which are subjective by default. Without any sort of privacy, there would be no way to secure your machine learning assets on-chain which would leave your application to be used only for non-profit or educational purposes.</p><p>Furthermore, storing data on-chain using platforms like Ethereum is extremely expensive and not a great idea for a use case that relies heavily on data sets which could be huge. Machine learning applications on these platforms simply will not scale. Corda states and transactions, on the other hand, can be stored on cloud-hosted databases for a very low cost.</p><p>Thanks for reading and feel free to reach out if you are interested in contributing to DCM.</p><h3>Other References</h3><ul><li><a href="https://github.com/JonathanScialpi/decentralized_corpus_manager">DCM Github Repository</a></li><li><a href="https://www.microsoft.com/en-us/research/blog/leveraging-blockchain-to-make-machine-learning-models-more-accessible/">Leveraging blockchain to make machine learning models more accessible</a></li><li><a href="https://github.com/microsoft/0xDeCA10B">Decentralized &amp; Collaborative AI on Blockchain</a></li><li><a href="https://stackabuse.com/scikit-learn-save-and-restore-models/">Scikit Learn Save and Restore Models</a></li><li><a href="https://docs.corda.net/docs/corda-os/4.4/key-concepts-oracles.html">Corda Oracles</a></li><li><a href="https://medium.com/ipdb-blog/forever-isnt-free-the-cost-of-storage-on-a-blockchain-database-59003f63e01">Forever Isn’t Free: The Cost of Storage on a Blockchain Database</a></li><li><a href="https://ethereum.stackexchange.com/questions/872/what-is-the-cost-to-store-1kb-10kb-100kb-worth-of-data-into-the-ethereum-block">What is the cost to store 1KB, 10KB, 100KB worth of data into the ethereum blockchain?</a></li><li><a href="http://proderivatives.com/blog/2019/5/10/minimizing-data-storage-cost-on-the-ethereum-network">Ethereum: A secure decentralised generalised transaction ledger</a></li><li><a href="https://medium.com/coinmonks/storing-on-ethereum-analyzing-the-costs-922d41d6b316">Storing on Ethereum. Analyzing the costs</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=558cadc8ba05" width="1" height="1" alt=""><hr><p><a href="https://medium.com/corda/machine-learning-on-corda-558cadc8ba05">Machine Learning on Corda</a> was originally published in <a href="https://medium.com/corda">Corda</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Experimenting with Corda Attachments]]></title>
            <link>https://medium.com/corda/experimenting-with-corda-attachments-a95d61d2d372?source=rss-5aabdf4a57ea------2</link>
            <guid isPermaLink="false">https://medium.com/p/a95d61d2d372</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[corda]]></category>
            <category><![CDATA[distributed-ledgers]]></category>
            <category><![CDATA[spring-boot]]></category>
            <dc:creator><![CDATA[Jonathan Scialpi]]></dc:creator>
            <pubDate>Mon, 02 Mar 2020 20:56:39 GMT</pubDate>
            <atom:updated>2020-03-02T20:56:39.593Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*vavHHSc0XVPSQ-EPFy3W0w.jpeg" /></figure><h3>Summary</h3><p><a href="http://www.corda.net/">Corda</a>’s stellar transaction throughput has already been examined and <a href="https://docs.corda.r3.com/sizing-and-performance.html">documented</a>. In this article we discuss a separate experiment that measures Corda’s transaction rate with attachments. I created one CorDapp called <a href="https://github.com/JonathanScialpi/corda-attachment-testing/blob/master/CorDapps/workflows/src/main/kotlin/com/template/flows/GenerateMockAttachments.kt"><em>GenerateMockAttachments</em></a> which would automatically create a set of test files on a source node. Once generated, I used another CorDapp called <a href="https://github.com/JonathanScialpi/corda-attachment-testing/blob/master/CorDapps/workflows/src/main/kotlin/com/template/flows/TriggerAttachmentDownload.kt"><em>TriggerAttachmentDownload</em></a> which sent a transaction containing an attachment hash from the source node to a target node causing the target node to download the attachment. Each of these requests were done using <a href="https://github.com/JonathanScialpi/corda-attachment-testing/blob/master/Python/async-rpc.py">Python coroutines</a> to make asynchronous REST calls to a proxy server which relayed the request as an RPC to a Corda node.</p><p>The results of the experiment revealed:</p><ol><li>I was able to achieve 49~ Tx/s with 1MB attachments and 45 Tx/s for 10MB Txs.</li></ol><p>2. <a href="https://docs.corda.net/tutorial-attachments.html#using-attachments">Caching attachments</a> can greatly improve throughput.</p><p>3. Regarding attachment throughput, Spring is more performant than Braid.</p><p>4. The more memory available, the more threads the node can handle; thus, increasing throughput.</p><h3>The Problem</h3><p>Users including large files within a Corda transaction should consider how those files can affect their application’s throughput. Take the use case of data set sharing for example. When a data set first starts out it could be quite small, let’s say 1MB. But as data is appended over time, the set might grow to a size of 10MB or more one day. The question that inevitably arises is what kind of performance can we expect from transacting with such large files?</p><p>Besides file size, it would also be interesting to compare the results of two different proxy servers. Proxy servers like Spring and Braid are implemented to facilitate the P2P communication between Corda nodes such as sending transactions. Although Spring has been the go-to solution for Corda implementations, there is another solution rising in popularity called <a href="https://gitlab.com/bluebank/braid/tree/master/braid-server">Braid</a>.</p><h3>Analysis</h3><h4>Spring vs Braid:</h4><p>To compare server performance, I conducted four tests that measured the total elapsed time for 100 attachment transactions to complete. Each test used the same source node (Issuer node-US East), an attachment size of 1MB or 10MB, and a domestic (RecipientB-US East) or international (RecipientA-CA Central) target node. To initiate a transaction, I concurrently called the respective server’s <em>TriggerAttachmentDownload </em>flow which would cause the source node to load the (non-cached) attachment from disk so that the target flow can then read and write the data to its disk.</p><p>Being that Braid doesn’t currently have a parameter to adjust the <em>threadPoolSize, </em>my tests were limited to the <a href="https://github.com/eclipse-vertx/vert.x/blob/master/src/main/java/io/vertx/core/VertxOptions.java#L38">eight concurrent threads</a> that Braid’s underlying framework (<a href="https://vertx.io/">Vert.x</a>) uses by default . This also meant that I had to run Spring at an eight thread maximum as well if I wanted to actually measure which performed faster under the same constraints.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*2UbBLHNFWtzL4ht-IdX-xQ.png" /><figcaption>Figure 1: Four test runs comparing the total elapsed time to send 100 domestic/international Txs with different sized attachments.</figcaption></figure><p><strong>Spring Pros:</strong></p><ul><li>Consistently faster than Braid in regard to attachment size and latency due to node proximity.</li><li>Number of threads that can be processed are only limited to your node’s available memory.</li></ul><p><strong>Spring Cons:</strong></p><ul><li>Requires some research to understand how to use Spring annotations.</li><li>Requires development time to create and test your REST endpoints.</li></ul><p><strong>Braid Pros:</strong></p><ul><li>Great for quick POCs since it doesn’t require any setup time or prerequisite knowledge besides downloading the jar file.</li><li>Using Open API, Braid will inspect your CorDapps folder and your flow parameters to automatically create REST endpoints for any application to call your flows so you can focus on CorDapp development.</li></ul><p><strong>Braid Cons:</strong></p><ul><li>Although Braid’s underlying framework can handle a lot of concurrency using a small number of kernel threads, Vert.x’s <a href="https://vertx.io/docs/vertx-core/java/#golden_rule">golden rule</a> says “Don’t block the event loop”. Because each of our requests requires a blocking thread to write our attachment to the target node’s disk, that means all my tests were limited to only <a href="https://github.com/eclipse-vertx/vert.x/blob/master/src/main/java/io/vertx/core/VertxOptions.java#L38">eight threads</a>.</li></ul><h4>Cached vs Non-Cached Attachments</h4><p>Now that I had decisive winner in regard to server performance, it was finally time to take off the governor and test for throughput with no threading restrictions on my Spring server. Going back to our original example use case of data sharing, most of the transactions that would take place involve reusable attachments albeit the occasional update to the data set. Therefore a cached approach where said attachments are pre-loaded is optimal as the source node sending the transaction isn’t required to re-request the attachment from the database.</p><p>To cache my attachments prior to the test, I sent a transaction with each of the attachments to a node I wasn’t going to be testing with. For example, if I was measuring RecipientB, I would send the transactions first to RecipientA.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*clFODt6OZORRR4F91b2pLQ.png" /><figcaption>Figure 2: Four test runs that compare the results of Cached vs Non-Cached attachments from a Spring server with 100 concurrent/multi-threaded transactions.</figcaption></figure><p>Figure 2 above shows the dramatic effect that pre-caching your attachments can achieve. Not only was throughput 50 times faster<strong> </strong>than non-cached transactions, but the comparison of the results from the US-1MB test to that of the US-10MB shows only a 7% drop in performance while transacting with attachments that are ten times larger in size.</p><h3>Further Work</h3><ul><li>Run more tests between 1–10MB as well as 10MB-50MB to find the limit for a node with a Java heap size of 8GBs.</li><li>Scale up my node’s respective VMs in regard to both available cores and RAM. With more memory, my node would be able to handle more threads which would handle more transactions therefore increasing throughput.</li><li>Each of my tests used the <a href="https://docs.corda.net/node-database.html#sqlserver">default H2 database</a> that Corda nodes come with. It would be interesting to see how other databases like PostgreSQL or Microsoft SQL Server can affect throughput for transactions with attachments.</li></ul><h3>Conclusions</h3><ul><li>Although its not obvious from the 1MB test sets, latency’s effect on performance was highlighted in the 10MB tests (Figure 1- Braid US-10MB vs CA-10MB and Figure 2- Spring US-10MB vs Spring CA-10MB) since there are more data packets to transfer that each incur some constant latency.</li><li>Caching is essential for applications that will be transacting with attachments often and developers should look to leverage this approach whenever possible to increase performance.</li><li>Scale up your VMs for more throughput. By increasing the memory available to a node, the more files can be processed concurrently and the larger these files can be. I tried a couple of tests with 100 concurrent transactions containing 50MB attachments and my node crashed with a complaint about the heap size (running at 8GBs max) after sending around 16 transactions.</li></ul><p>My recommendation therefore is to use Spring server for P2P communication between nodes and allocate sufficient memory for the performance you expect when transacting with attachments so that your nodes can handle the amount of concurrent threads your application will be throwing at it. In my case, an 8GB heap size was sufficient to send 100 concurrent transactions with file sizes as big as 10MB. Also if possible, try to reduce the distance between the source and target nodes to avoid latency costs.</p><h3>Appendices</h3><h4>Libraries Used:</h4><ul><li>Python: <a href="https://docs.python.org/3/library/asyncio.html">Asyncio</a> , <a href="https://docs.aiohttp.org/en/stable/">Aiohttp</a>, <a href="https://docs.python.org/2/library/timeit.html">timeit</a></li><li>Java Version: 1.8.0_242</li><li>Corda Enterprise 4.3.jar</li><li><a href="https://repo1.maven.org/maven2/io/bluebank/braid/braid-server/4.1.2-RC13/">Braid-server-4.1.2-RC13.jar</a></li><li>My CorDapp, Spring Server, and Python <a href="https://github.com/JonathanScialpi/corda-attachment-testing">repository</a></li></ul><h4>Network Setup:</h4><p>To setup my test environment, I leveraged the <a href="https://docs.corda.net/network-bootstrapper.html">network bootstrapper</a> with <em>maxMessageSize </em>and <em>maxTransactionSize</em> set to 200,000,000 bytes and created four nodes:</p><ul><li>Notary node deployed in US East</li><li>Issuer node to act as the initiator/source for each transaction — deployed in US East</li><li>RecipientA node to act as a international target node — deployed in CA Central</li><li>RecipientB node to act as a domestic target node — deployed in US East</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*8Il64-2ii9odI9MwSqe_yQ.png" /><figcaption>My server and each of my nodes ran on an Ubuntu Azure Virtual Machine of size D4s_v3</figcaption></figure><h4>How to Reproduce:</h4><ol><li><a href="https://docs.corda.net/deploying-a-node.html">Once you have your nodes deployed</a>, start each of your nodes with:</li></ol><pre>java -Xms8g -Xmx8g -jar corda-4.3.jar</pre><p>2. Start and connect your proxy server to the Issuer node:</p><p>Braid:</p><pre>java -jar .\braid-server-4.1.2-RC13.jar [HOST:YOUR_PORT] [NODE_USERNAME] [NODE_PASSWORD] [YOUR_PORT] [OPEN_API_VERSION] [YOURNODE_CORDAPP_DIRECTORY]</pre><p>Spring:</p><pre>java -jar .\corda-webserver.jar — server.port:PORT — config.rpc.host=HOST — config.rpc.port=RPC_PORT — config.rpc.username=USERNAME — config.rpc.password=PASSWORD</pre><p>3. Generate a test set of attachments by running <a href="https://github.com/JonathanScialpi/corda-attachment-testing/blob/master/Python/generate-test-files.py">generate-test-files.py</a> with your desired parameters.</p><p>4. Use the output from the previous step as the <em>hashed_files_list</em> in the <a href="https://github.com/JonathanScialpi/corda-attachment-testing/blob/master/Python/async-rpc.py">async-rpc.py</a>. These hashes will be sent to the target node in a transaction and used to reference the attachments we want the node to download. Once you edit this, you should then change the name of the <em>receiver </em>in your JSON object to that of the node you are targeting.</p><p>Braid:</p><pre>json ={</pre><pre>&quot;receiver&quot;: {&quot;name&quot;: &quot;O=RecipientB, L=East, C=US&quot;,</pre><pre>&quot;owningKey&quot;:&quot;GfHq2tTVk9z4eXgyREZSNrh9oZRPk9beKuUx7Aeu1sKLTTgqyjAwMyjyNE4D&quot;},</pre><pre>&quot;attachmentHash&quot;: hashedFile}</pre><p>Spring:</p><pre>json ={&quot;receiver&quot;: &quot;O=RecipientB, L=East, C=US&quot;,</pre><pre>&quot;attachmentHash&quot;: hashedFile}</pre><p>5. Once you’ve updated your script, execute it with the following command to save the output to a file:</p><pre>python ./async-rpc.py &gt; ./your_directory/my-test-01.txt .</pre><p>Once completed, you can examine the results of your test in the output file you save it to. There will be a line for each request’s time as well as the total elapsed time for all requests to complete.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a95d61d2d372" width="1" height="1" alt=""><hr><p><a href="https://medium.com/corda/experimenting-with-corda-attachments-a95d61d2d372">Experimenting with Corda Attachments</a> was originally published in <a href="https://medium.com/corda">Corda</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>