<?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 Ido Zilberberg on Medium]]></title>
        <description><![CDATA[Stories by Ido Zilberberg on Medium]]></description>
        <link>https://medium.com/@izilberberg?source=rss-b9edfed8478f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*L-VYcwS0cWtZkzAdzHBewQ.png</url>
            <title>Stories by Ido Zilberberg on Medium</title>
            <link>https://medium.com/@izilberberg?source=rss-b9edfed8478f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 01:53:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@izilberberg/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[Troubleshooting the Orbs Platform | Case Study — Orbs]]></title>
            <link>https://medium.com/orbs-network/troubleshooting-the-orbs-platform-case-study-orbs-73c905de1f00?source=rss-b9edfed8478f------2</link>
            <guid isPermaLink="false">https://medium.com/p/73c905de1f00</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[identity]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Ido Zilberberg]]></dc:creator>
            <pubDate>Mon, 03 Jun 2019 15:03:06 GMT</pubDate>
            <atom:updated>2019-06-05T08:21:14.061Z</atom:updated>
            <content:encoded><![CDATA[<h3>Troubleshooting the Orbs Platform | Case Study</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FCNymVnd2Sz-QxIA9rWjNw.jpeg" /></figure><h3>Case Study</h3><p><strong><em>Target audience:</em></strong> <em>Validator DevOps, Orbs contributors and anyone interested in log analysis of the Orbs platform</em></p><p>As new software meets the real world in production for the first time, unforeseen issues pop up. Anyone in the business long enough knows this for a fact.</p><p>Orbs platform is no different, and while considerable effort was, and still is being expended to retain the highest code quality, post-production incidents do happen, but they provide opportunities to make the software better yet.</p><p>Part of improving software and keep learning from experience is creating case studies such as this one.</p><p>This post includes technical notes to help you, the reader, make sense of the information you are seeing. It is not an exhaustive description of Lean Helix or any other service of the Orbs platform. For that, visit the <a href="https://github.com/orbs-network/orbs-spec">Orbs Spec</a>.</p><p>Such was the case that a few weeks post-launch, the Orbs core team observed less than optimal behavior of the Lean Helix consensus algorithm in production. The <a href="https://medium.com/orbs-network/monitoring-the-orbs-platform-orbs-a555109ce66e">dashboard</a> showed that frequently, a block passes consensus only on the third attempt, instead of the expected first or second attempt. This meant it took longer to reach consensus and consequently transaction requests took longer to return a result to the caller.</p><p><strong><em>Technical note:</em></strong> <em>Before going into more detail, let’s understand a bit how Lean Helix works (with </em><strong><em>gross oversimplification</em></strong><em>):</em></p><ul><li><em>Choose a </em><strong><em>Leader</em></strong><em> node at random</em></li><li><em>The leader collects pending transactions (i.e. transactions sent by clients and still waiting to be included in a block) into a “proposed block”</em></li><li><em>The leader suggests this block to the other non-leader nodes</em></li><li><em>The non-leader nodes try to reach an agreement (a.k.a consensus) by passing around messages of various types (more on that later) relating to the content of the proposed block. There is a time limit as to how long this can take to propose the block and reach an agreement. If the time limit is exceeded and consensus has still </em><strong><em>not</em></strong><em> been reached, a </em><strong><em>new leader</em></strong><em> is chosen among the non-leader nodes (the previous leader itself becomes a non-leader node) and the process </em><strong><em>repeats itself</em></strong><em>.</em></li></ul><p><strong><em>The above flow is called a View.</em></strong><em> The first iteration (view) is denoted V=0, the following iteration (with a new leader) is V=1 and so on. The time limit per View is exponentially increased for every View. For V=0 the leader has 4 seconds to reach consensus (production configuration as of May 2019) before it is replaced. For V=1 the next leader has 8 seconds, for V=2 the next leader has 16 seconds and so on. When consensus on a block is reached, every node commits the proposed (now accepted) block, the View is reset to V=0 and the process repeats itself.</em> <em>Read more about Lean Helix: </em><a href="https://www.orbs.com/orbs-unified-theory-of-randomness-explaining-the-helix-consensus-algorithm/"><em>Orbs’ Unified Theory of Randomness: Explaining the Helix Consensus Algorithm</em></a></p><p>Now, given the production configuration, it was expected that the first leader at V=0 will sometimes be able to reach consensus, but mostly the second leader at V=1 will do that (exactly why is out of scope). There was no apparent reason to reach the third leader at V=2 unless there was some considerable network lag.</p><p>Having said all that, here you can see the problem:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/387/1*vrMpnuihGMxBX8jVmwM3fg.png" /></figure><p>Instead of having all nodes report they are either on V=0 or V=1, the frequency of V=2 was quite high.</p><p>So, we started digging deeper.</p><p>It was clear that a specific node (let’s call it <strong>Node A</strong>, its actual identity is irrelevant to this case study) as exhibiting the majority of V=2 incidents.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/0*1qSpGIhLeokklawx.png" /></figure><p>At this point, the dashboard could not provide further clues. Suffice to say that one of the Orbs core team’s monitoring goals is to improve on what can be easily identified in the context of the dashboard and postpone the following costly log research to more complex issues.</p><p><strong>In this case, logs were the next step.</strong></p><p>From a troubleshooting perspective, we were fortunate to have frequent V=2 incidents so it was easy to obtain fresh logs around the timeframe of such incidents. It can be quite frustrating trying to debug a rare issue for which logs are not readily available.</p><p>The logs use the node’s Orbs address for filtering. In node A’s case, it is <strong>“0123456789abcdef”</strong>, sometimes contracted to <strong>“012345”</strong>.</p><p>Since we did see Node A’s block height advancing we knew it was up to date on the blocks.</p><p>Now, when a node does not commit a block through the consensus algorithm, it can still receive new blocks via <strong>Block Sync</strong>.</p><p><strong><em>Technical note:</em></strong> <em>Block Sync is a service within the node that wakes up after some predetermined time during which no new block was committed. The node assumes that it’s being left behind for whatever reason, so it requests newer blocks from other nodes in the network. This is useful in case the node was down for a while and now needs to sync to the rest of the network. It is also useful in this case, where blocks are not being committed as part of the consensus algorithm.</em> <em>Read more about Block Sync in Orbs Spec: </em><a href="https://github.com/orbs-network/orbs-spec/blob/master/behaviors/services/block-storage.md#inter-node-block-sync-flow"><em>Block Sync in Orbs Spec</em></a></p><p>We suspected that node A was advancing through Block Sync rather than through consensus.</p><p>So, the initial filter was to show blocks being committed as part of the consensus algorithm flow.</p><p>Analyzing logs is like looking at the data with various lenses, one at a time, each of which captures only a subset. For logs over some size, there is simply too much data for a human to grasp in one go.</p><p>Here is the first screenshot from<strong> logz.io</strong>. In it you can see positive filters (in blue), negative filters (in red) and a search string (logz.io uses the Lucene query format):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4cSdPdUEaRrvZjjk.png" /></figure><p>The PHASE COMMITTED message means the block was committed as part of the consensus algorithm.</p><p><strong>We noticed the lack of node=”012345″</strong> (a shortened version of the node address) — it’s not there, nor before or after this time.</p><p>This made us assume that no blocks are committed as part of consensus at all, on node A. To make sure this assumption is correct, we made another search that confirmed that node A <strong>only</strong> receives blocks via Block Sync. It shows that every block of Node A was received via Block Sync, no exceptions. See the messages <strong>“successfully committed block received via sync”:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4hqc3IDJ_X0gi2Y_.png" /></figure><p>As a sanity check, we checked which additional nodes receive this message (that is, don’t commit blocks through consensus algorithm). We found out that other nodes occasionally also receive blocks via Block Sync. It’s ok for this to happen from time to time, but node A showed this for 100% of the blocks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EnEOu8N2ma0JZBwa.png" /></figure><p>At this point, we established that Node A fails to reach consensus 100% of the time, so it was time to dig into Lean Helix consensus algorithm’s logs to follow Node A’s flow through it and understand what goes wrong.</p><p>We now focus only on Lean Helix logs to narrow the investigation. All Lean Helix logs have a property called <em>lhlib</em> which is set to true, so it is easy to filter for only these messages by adding a condition that <em>lhlib</em> property exists — see below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/0*97moCpyvnFxKe6hJ.png" /></figure><p>Let’s focus on a specific block that Node A had to receive from Block Sync, but other nodes managed to commit with consensus: 454927. We obtained this block number from the screenshot with “successfully committed block via sync” messages above. Notice the search string “H=454927” in the screenshot below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nnnaNRiZx35xG-sg.png" /></figure><p>We can see that consensus messages are being ignored (such as the outlined <em>COMMIT</em> message in the screenshot above) by Node A, because <em>“PREPREPARE is not stored”</em> (same as “not received at all” for our purposes). To understand what this log message means, here is another technical note:</p><p><em>When the leader node proposes a block to the other nodes, it does so by broadcasting a PREPREPARE message that contains the block, to the other nodes. Then the other nodes “debate” with one another whether they agree on the proposed block or not, by passing around more message types, such as PREPARE and COMMIT (no need to discuss those here).</em> <em>PREPREPARE is the initial message sent by the leader and contains the proposed block itself. If it was not received by some other node, that other node will refuse to receive any other subsequent consensus messages related to that block, because there is no point in participating in consensus if the node doesn’t have the proposed block, to begin with.</em></p><p>Next, it was time to understand <strong>why</strong> <em>PREPREPARE</em> was not received by Node A.</p><p><strong><em>Yet another technical note:</em></strong> <em>As we said, the leader of the first view (V=0) sends out a PREPREPARE message that contains the proposed block. Now, if the leader fails to reach a consensus within the time limit, it is replaced by another leader, now at V=1. Here is a twist: usually, that new leader of V=1 will utilize </em><strong><em>the same block</em></strong><em> proposed by the previous leader (cheaper than creating a new block itself). It will send the reused block to the other nodes within a NEW_VIEW message. That NEW_VIEW message contains within it the previous leader’s PREPREPARE message along with the reused block (essentially the new leader says: “Hey, the last leader’s proposed block was valid, we just didn’t manage to agree in time so let’s try again”)</em></p><p>Next, it was time to search for where Node A actually received a PREPREPARE (if it did at all) from the leader and find out what went wrong with it.<br> Turns out Node A did receive PREPREPARE from the leader.</p><p>Here it is, let’s break this screenshot down:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LJH4flShGtELMilf.png" /></figure><p>At 16:05:23.988, a NEW_VIEW message is received by Node A from the leader of V=1 (sender=”ff33c7″). As explained in the last technical note, this is expected. The next thing that should happen is for Node A to <strong>unpack the internal PREPREPARE message</strong>, and from it, to <strong>unpack the block</strong> and <strong>validate</strong> it.</p><p>NEW_VIEW was unpacked and its contained PREPREPARE was also unpacked (it’s just not logged), <strong>however</strong> the attempt to validate the contained block <strong>fails, due to the block’s timestamp</strong>. This is weird! no other node failed to validate this block.</p><p>Let’s understand the outlined error message:</p><p><strong>currentTimestamp=159df14e0fab5b36</strong> translates to May 12 2019 13:06:03 (with the help of a hex → decimal calculator and <a href="https://currentmillis.com/">this site</a> that converts millis since Epoch to ISO8601 time string). <strong>prevTimestamp=159df14bde5aed90 </strong>translates to May 12 2019 13:05:54. So far so good — the current block’s timestamp is later than the previous block’s timestamp, which makes sense.</p><p>Next, we see: <strong>now 2019–05–12 13:05:23.989402103</strong>.</p><p>This does not make sense! how can “now” on the machine be <strong>earlier</strong> by 40 seconds than the current block’s time? later on that line, you can see the tolerance between “now” and the block’s timestamp is 30 seconds ( <strong>jitter 30s</strong>) and because the difference is larger (40s), validation fails, and all of the above results from it.</p><p><em>Note: This error message is admittedly confusing and has already been made human-readable as a result of this investigation.</em></p><p>At this point we were nearly convinced this is a machine clock error on Node A as this code works correctly on all other nodes.</p><p>After contacting node A’s IT, they indeed identified a 29 second time drift on the machine’s clock, and promptly fixed it.</p><p>A few minutes after they fixed the machine’s clock time, we took these screenshots:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/0*S1ujV2H09JiR0CBm.png" /></figure><p>The above screenshot shows the V=2 symptom is gone. To be on the safe side, the screenshot below shows node A managed to participate in consensus and commit a block, thus <strong>no longer relying on Block Sync</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*E4i-9vndTpZskBJB.png" /></figure><p>Some conclusions:</p><ol><li>Write case studies such as this one, for the benefit of the community so the Orbs core team thought processes can be shared and discussed.</li><li>Improve dashboard so problems can be understood from graphs and gauges, to postpone costly log analysis</li><li>Specifically to this case study — add graph and alert against node time drift.</li><li>Improve logs as an iterative process</li></ol><p>The purpose of this post was to shed some light on the troubleshooting Orbs platform issues along with technical notes on some internal workings.</p><p>Obviously having detailed knowledge of the system makes this process easier, but reading dashboard graphs and filtering through logs is a generally useful skill that can be applied to any monitored system.</p><p>Thanks to <a href="https://medium.com/u/85551232663">Ron Bresler</a> for helping out in proofing this post!</p><h4>Get involved with Orbs</h4><ul><li>Visit the <a href="https://www.orbs.com/">website</a> to learn more about the Orbs public blockchain</li><li>Orbs is open-source! Review the <a href="https://github.com/orbs-network">code on Github</a> and contribute</li><li>Start developing apps on Orbs, review the <a href="https://orbs.gitbook.io/">documentation</a></li></ul><p><em>Originally published at </em><a href="https://www.orbs.com/troubleshooting-the-orbs-platform-case-study/"><em>https://www.orbs.com</em></a><em> on June 3, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=73c905de1f00" width="1" height="1" alt=""><hr><p><a href="https://medium.com/orbs-network/troubleshooting-the-orbs-platform-case-study-orbs-73c905de1f00">Troubleshooting the Orbs Platform | Case Study — Orbs</a> was originally published in <a href="https://medium.com/orbs-network">The Orbs Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Monitoring the Orbs platform]]></title>
            <link>https://medium.com/orbs-network/monitoring-the-orbs-platform-orbs-a555109ce66e?source=rss-b9edfed8478f------2</link>
            <guid isPermaLink="false">https://medium.com/p/a555109ce66e</guid>
            <category><![CDATA[identity]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[crypto]]></category>
            <dc:creator><![CDATA[Ido Zilberberg]]></dc:creator>
            <pubDate>Mon, 13 May 2019 08:20:28 GMT</pubDate>
            <atom:updated>2019-05-16T14:04:44.322Z</atom:updated>
            <content:encoded><![CDATA[<h3>Monitoring the Orbs Platform</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PYt3vTB_zrRlou-jtPm6qw.jpeg" /></figure><p><em>This post is meant for members of the Orbs Universe; Guardians, Validators, Delagators, and everyone else interested in monitoring the Orbs network.</em></p><p><strong>Hi everyone! </strong>Ido here. One of the important milestones we’ve hit in April, post-launch, was bringing our monitoring system into production. Having an efficient monitoring system is crucial for the optimization of all aspects of the Orbs blockchain. This update will elaborate on pre-production load testing, and post-production performance monitoring. Both use cases employ the Orbs monitoring dashboard as a key component.</p><p>In the weeks leading up to the planned launch of the Orbs network, Orbs core team was running stability tests on various network configurations. The purpose of such testing was twofold: identify bugs that manifest themselves only after a long time the system has been online, and test the load limits of the system.</p><p>We wanted to share the progress of stability tests with the whole team, so we decided to create a Dashboard that would be posted on a TV at the Orbs Ltd. office, where everyone can see real-time metrics of the running tests.</p><p>The requirement was to let everyone have a casual glance once in a while and immediately spot anomalies. Digging deeper into problems is left to other tools.</p><p>As a starting point, we already had a <strong>/metrics</strong> endpoint on the Orbs node, that prints out the node’s metrics in JSON format. For example, see the <a href="http://validator.orbs.com/vchains/1100000/metrics">Orbs Audit node metrics</a>.</p><p>Here you can see sample metrics on a validator node in production — It shows the current block height as 452631:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/0*3bjcAxoRIJmJ-lBI.png" /></figure><p>For the presentation layer, we checked several dashboard solutions: <a href="https://www.geckoboard.com/learn/dashboard-examples/">Geckoboard</a> is a great looking dashboard especially on a TV screen and if your use case is covered by what it supports out of the box, it is highly recommended. In our case we needed some features which were not available, such as displaying a time frame of less than 1 day, and the ability to perform calculations over the data directly in the dashboard.</p><p>Another solution we tried is <a href="https://www.datadoghq.com/">DataDog</a>, which showed initial promise as it supports scraping JSON metrics directly from a URL, and performing calculations over it. However, we were not satisfied with the visual quality when displayed on a TV screen (specifically the lack of a Dark Mode), and decided to keep looking.</p><p>Eventually, we decided to use the <a href="https://grafana.com/cloud#pricing">Standard Plan of Grafana Cloud</a> with a Prometheus backend for these reasons:</p><ol><li>Hosted solution — no need to maintain a Grafana server</li><li>Renders beautifully on a TV screen</li><li>Flexible in performing calculations over incoming data in realtime (together with Prometheus).</li></ol><p>Grafana is a presentation layer only and can receive data from multiple data sources, in our case it was either from Prometheus or Graphite — both of which are industry standards for a Time Series Database (TSDB). Since Prometheus has client libraries for both Go and Javascript we went along with it.</p><p>As for the actually displaying data, we started with a TV monitor attached to an off the shelf Android TV device, but it turned out that several browsers we tested on the Android TV did not render correctly any of our tested dashboards, and it was not possible to disable the screen saver and have it load the dashboard on startup without hacking the device.</p><p>So we decided to go with a Raspberry PI B+ v3 which is a mean little machine, capable of rendering the graphs without a hitch. Since it’s a Linux machine and has a wide community around it, it was easy to find solutions and guides on how to set up Grafana to our liking.</p><p>Here is our real monitoring TV (complete with window-glare):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*v6IHVdMdi_CyovU6.png" /></figure><h3>Dashboard</h3><p>Let’s go over the monitoring architecture we eventually came up with:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/0*iFTS7PF-tUACaXst.png" /></figure><p>In the Orbs test networks, the <strong>Orbs Nodes</strong> are machines on AWS operated by Orbs Ltd. In production, the Orbs nodes are managed by their respective owners. Most of the Orbs nodes in production are on AWS but it doesn’t matter so long as their <strong>/metrics</strong> endpoint is accessible.</p><p>The <a href="https://github.com/orbs-network/metrics-processor">metrics processor</a> is a Node.js server running on an AWS machine. It passively listens on requests on its own <strong>/metrics</strong> endpoint and when called, executes HTTP POST requests to <strong>/metrics</strong> of every node, collects the metrics and converts to Prometheus format and returns the data.</p><p>Conversion to Prometheus format is done with the help of a <a href="https://github.com/siimon/prom-client">Node.js Prometheus client library</a>.</p><p>In the Orbs test network, Orbs Ltd. uses <a href="https://pm2.io/doc/en/runtime/overview/">pm2</a> to make sure the metrics-processor stays up in the event of a machine restart. We use an <a href="https://github.com/orbs-network/metrics-processor/blob/master/pm2/ecosystem.config.js">ecosystem file</a> to configure pm2.</p><p>We initially planned to configure the Hosted Grafana’s Prometheus Database to periodically sample the metrics-processor but unfortunately, it is a passive-only solution, meaning you have to <strong>push data into it</strong> rather than have it actively scrape targets (such as the metrics processor) to <strong>pull data</strong>.</p><p>The solution was to create a <strong>second Prometheus database</strong> to act as a bridge. We do not need to store data on that Prometheus — its only purpose in life is to <strong>periodically pull data</strong> from metrics-processor and <strong>push it to the Hosted Prometheus</strong>.</p><p>For the Prometheus bridge, we use a predefined <a href="https://hub.docker.com/r/prom/prometheus/">Prometheus Docker image</a> with some simple <a href="https://github.com/orbs-network/metrics-processor/blob/master/prometheus/prometheus.yml">configuration</a>. It runs on the same AWS machine as the metrics-processor and has automatic restart configured for it, so if the machine restarts, Prometheus will start automatically. So while it is a somewhat unwanted addition to the architecture, it requires very little maintenance.</p><p>The Hosted Prometheus on the Grafana Cloud is where the <strong>actual metrics data is stored</strong>, so all tests data (and now production data) is easily presentable on Grafana.</p><h4>We created two main dashboards:</h4><p>An “ <strong>Orbs Production</strong> “ dashboard, whose purpose is a high-level view, suitable for TV display, for casual glances once in a while to see everything “looks right”.</p><p>Sample of the Orbs Production dashboard:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XyHnFpj6Y-twGuxe.png" /></figure><p>An “ <strong>Orbs DevOps</strong> “ dashboard which contains a lot more information, useful when starting to go deeper when some problem is suspected.</p><p>Sample of the Orbs DevOps dashboard:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3M3GQdKwmASwCxJK.png" /></figure><p>We plan to introduce a Prometheus Go client library into the Orbs node to allow it to output its metrics directly in Prometheus format in addition to the existing JSON format.</p><h3>Stability tests</h3><p>During the last month before the launch of the Orbs network, the Orbs core team continuously ran long-running tests (“stability tests”) with the sole purpose of spotting bugs which manifest themselves only after some time the system has been running. We suspected some bugs eluded the developers on the otherwise very well tested code — the team has a suite of unit, component and integration tests and the whole system was written with strict adherence to TDD principles.</p><p>Typical stability configuration was a 22-node network (the expected max nodes in production) with about 10 transactions per second (tps) using the Lean Helix consensus algorithm and the proposed <a href="https://github.com/orbs-network/orbs-network-go/blob/master/config/system_factory_presets.go#L17">production configuration</a>. The team did not try to optimize performance, nor hit resource bounds — only detect anomalies resulting from prolonged runtime. The team did discover and fix a memory leak due to some goroutines not terminating, which could not have been otherwise detected.</p><p>The method of testing was to let the test run, track it with the dashboards described above, and if some anomaly came up, enable logs on one or more machines and investigate using <a href="https://logz.io/">logz.io</a>. Error logs are written to logz.io by default but the Info logs are not, as they are very verbose.</p><p>Logz.io takes a logline and extracts properties in addition to the basic message. This lets you filter over properties, for example, show messages only from node “fca820”, or messages for block-height 1 and so forth. When debugging a flow of activity, enabling various filters on properties such as those is essential for making sense of the large number of logs generated.</p><p>Here is a sample log line with properties:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ekHSZ3Hx_jCyTB1h.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/0*GbKn9OOB-DiTBWrH.png" /></figure><h3>Load tests</h3><p>The purpose of load testing is to identify the load limitations of specific network configurations. This takes place after stability tests are completed. The monitoring of load tests is identical to that described above. The <strong>Orbs Load Generator</strong> is a <a href="https://github.com/orbs-network/performance-benchmark">Go process</a> that uses the <a href="https://github.com/orbs-network/orbs-client-sdk-go">Orbs Client SDK in Go</a> to generate the load.</p><p>The load generator process sends out transactions at some rate (transactions per second — <strong>tps</strong>), split evenly between all machines. Its present implementation is to send out a burst of <strong>n</strong> tps, then sleep for a second, then repeat. This is not exactly how sending at specific tps should work, and the team plans to develop proposed improvements on this implementation.</p><p>The Orbs core team tested 3 different network configurations:</p><ol><li><strong>4-node</strong> network on the <strong>same AWS region</strong> (m4.xlarge in us-east-2)</li><li><strong>8-node</strong> network on the <strong>same AWS region</strong> (m4.xlarge in us-east-2 and us-east-1). Same as #1, only more nodes.</li><li><strong>15-node network</strong> — actual production nodes (m4.xlarge, <strong>multi-region</strong>)These are the <strong>actual production machines</strong>, operated by the Validators. The test ran on a <strong>separate virtual chain</strong> than the production virtual chain. This means it ran on the same AWS EC2 machines as production, but on different Docker containers (each virtual chain runs on <strong>its own Docker container</strong>) so the production virtual chain is not polluted with load test inputs.</li></ol><h3>Results</h3><p>The detailed results can be found below. Based on the results, we have concluded the following:</p><ol><li>The Orbs network’s present load test configuration is <strong>network-bound</strong>. At higher tps rates the Load Generator starts to receive HTTP 503 “Service not available” and other errors. The Orbs core team suspects this is related to limitations inherent to the Docker version we are using, though this is still under investigation. The 4-node network was bound by about 400 tps (100 tps per node). Going above it simply generated multiple errors on the client side and had reduced effect on the nodes (they simply did not process &gt;100 tps).</li><li>During testing, the Orbs core team moved to an 8-node network to reduce the per-machine tps load. This allowed for increased tps (about 500tps almost without errors). Remember that the more nodes, the more traffic goes between nodes due to each node conversing with all other nodes during flows of transaction forwarding, node sync and consensus. This explained why it’s impossible to double the tps by doubling node count. The core team plowed through and increased the load, and <strong>eventually managed to reach 912 tps of committed transactions</strong> — that is <strong>transactions in blocks that passed consensus</strong>. If the goal is to stay with a negligible error rate on the client side, it is sufficient to use the 500tps as the upper bound of such a network. Once this network limit is resolved, the expected result is to observe an increase in tps limit, as no other bounds were detected even reaching 912 tps.</li><li><strong>Production configuration (the real 15-node network) showed 200 tps running smoothly</strong>. The Orbs core team did not press it further at that time, so as not to affect the production virtual chain, and because a Validator Election event was due soon after the test was concluded and the Orbs core team did not want to impact this election either.</li><li><strong>CPU and Disk I/O were not limiting factors</strong> in any of these tests — CPU never exceeded 25% even at max tps, and disk I/O was about 200 Kb/s max.</li><li><strong>Blocks per second (as committed by Consensus) was not a limiting factor</strong> during the tests. Initially, when tps went up, the rate of blocks/sec went up as well. However, when tps kept going up, the blocks/sec rate peaked and then <strong>started declining</strong>. We assume the reason for this is the higher load meant new blocks contain more transactions because more transactions wait in the Transaction Pool’s pending pool when a new block collects them, so new blocks are larger and consequently take longer to pass around the network (and consequently by the time the next block needs to be generated, there are even more transactions waiting for it, and so on and so forth).</li><li><strong>When load resumed 100tps, the system resumed normal behavior</strong> — it did not crash or go into some unstable state due to the very high load previously sustained.</li><li>On higher tps the dashboard showed very jittery data (see graph below). We suspect this to be an artifact of the monitoring architecture, not actual jittery behavior. At times, monitoring data stopped being read (even crawling <strong>/metrics</strong> manually sometimes returns HTTP 500 error) so naturally, the dips in the graph are unreliable):</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6XTE4P2SI-oCR7L9.png" /></figure><p>Detailed results (posted here as raw data from a single load test, take with a grain of salt):</p><p><strong>4-Node Network:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QRF3e6WB2_8jDfPDjOnj9g.png" /></figure><p><strong>8-Node Network:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XugcomDV_SgvX9Zv5b3ing.png" /></figure><p><strong>Going forward</strong>, the Orbs core team plans to integrate Prometheus metrics right from the node itself, thereby omitting the JSON to Prometheus conversion, and allowing for the generation of histograms right in the node itself.</p><h4>Get involved with Orbs</h4><ul><li>Visit the <a href="https://www.orbs.com/">website</a> to learn more about the Orbs public blockchain</li><li>Orbs is open-source! Review the <a href="https://github.com/orbs-network">code on Github</a> and contribute</li><li>Start developing apps on Orbs, review the <a href="https://orbs.gitbook.io/">documentation</a></li></ul><p><em>Originally published at </em><a href="https://www.orbs.com/monitoring-the-orbs-platform/"><em>https://www.orbs.com</em></a><em> on May 13, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a555109ce66e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/orbs-network/monitoring-the-orbs-platform-orbs-a555109ce66e">Monitoring the Orbs platform</a> was originally published in <a href="https://medium.com/orbs-network">The Orbs Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Big integers in Go]]></title>
            <link>https://medium.com/orbs-network/big-integers-in-go-14534d0e490d?source=rss-b9edfed8478f------2</link>
            <guid isPermaLink="false">https://medium.com/p/14534d0e490d</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[golang-tutorial]]></category>
            <category><![CDATA[product]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Ido Zilberberg]]></dc:creator>
            <pubDate>Mon, 06 Aug 2018 06:59:33 GMT</pubDate>
            <atom:updated>2018-08-22T07:57:28.327Z</atom:updated>
            <content:encoded><![CDATA[<h3>Big Integers in Go language: a developer’s Reference for Printing, Converting and Serializing</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A4wcOPg9dVcZPluN6kMGfA.jpeg" /><figcaption>Banner by Marina Rudinsky</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fplay.ht%2Farticles%2F14534d0e490d&amp;src=https%3A%2F%2Fplay.ht%2Fembed%2F%3Farticle_url%3Dhttps%3A%2F%2Fmedium.com%2F_p%2Fbig-integers-in-go-14534d0e490d&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=play" width="700" height="185" frameborder="0" scrolling="no"><a href="https://medium.com/media/aef263be11144557042cdd09579f203e/href">https://medium.com/media/aef263be11144557042cdd09579f203e/href</a></iframe><p>At <a href="https://orbs.com/">Orbs</a>, we are building a blockchain for large-scale consumer apps. An inseparable part of this is dealing with aspects of encryption such as key generation, encryption/decryption, and digital signatures.</p><p>As part of our blockchain solution, we are implementing a Distributed Key Generation scheme. This necessitates dealing with very large numbers (specifically integers) in the Go language — our language of choice.</p><p>While Go has standard library support for dealing with big integers, I found documentation to be lacking when having to deal with conversions, printing, and calculations.</p><p>This post attempts to organize useful operations in one place for the benefit of the reader who needs to deal with big integers in Go.</p><p>Creating secure encryption keys is out of scope and is not a subject to be taken lightly, especially if they are meant to protect significant value. Also handing large floating-point numbers is not covered.</p><p>The package that deals with big integers in Go is “<a href="https://golang.org/pkg/math/big/">math/big</a>”. The type we are dealing with here is big.Int.</p><h3>Converting to and from other types</h3><p>The Go code I needed to write compiles to an executable which is invoked from NodeJS as a utility for crypto-related calculations. This required serializing big integers between JavaScript and Go. The most straightforward method is transferring this data in string format, usually as properties of some JSON object. Here are some examples for converting values to and from big.Int.</p><h4>Converting from int</h4><p>Converting an int to big.Int is simple, but has to pass through int64, like so:</p><p>newBigInt := big.newInt(int64(someInt))</p><h4>Converting to int</h4><p>To convert a big integer to uint64, run this code:</p><pre>var smallnum, _ = new(big.Int).SetString(&quot;2188824200011112223&quot;, 10)<br>num := smallnum.Uint64()</pre><p>Note that Go does not perform bounds checking — if the value of the big integer does not fit inside a uint64 you will not get any warning and <strong>num</strong> will overflow and hold an incorrect value.</p><p>To convert to a signed 64-bit integer use Int64()instead of Uint64().</p><h4>Converting from a string</h4><p>Assuming you hold a big integer as a string, you create a big.Int out of it like so:</p><pre><strong>var </strong>bignum, ok = new(big.Int).SetString(&quot;218882428714186575617&quot;, 0)</pre><p>If the string input tosetString() starts with “0x”, base 16 (hexadecimal) will be used. If the string starts with “0” base 8 (octal) will be used. Otherwise it will use base 10 (decimal). You can also specify the base manually (up to 62). The returned value is of type *big.Int. If Go fails to create the big.Int, <strong>ok</strong> is set to <em>false</em>.</p><h4>Converting to a string</h4><p>Converting to a string lets you serialize as JSON, print to console, and more, so it is very useful.</p><p>To convert a big.Int to a string in hex notation, use:</p><pre>str1 := prime1.Text(16) // or: str1 := fmt.Sprintf(&quot;0x%x&quot;, bigInt)</pre><p>To convert to a decimal notation, use:</p><pre>str1 := prime1.Text(10) // fmt.Sprintf(&quot;%v&quot;, bigInt)</pre><h4>Using JSON</h4><p>JSON format is very useful for passing values between different languages, especially when JavaScript is one of them.</p><p>Adhering to string format in JSON properties that hold big integers can be useful for printing, debugging and in conversions between Go and JavaScript.</p><p>In the following <a href="https://play.golang.org/p/kiM_E7HOVue">snippet</a> notice the difference in output between printing objPt and objStrPt (lines 38–39).</p><p>The object objPt holds big integers <em>without</em> double quotes, whereas objStrPt holds them <em>with</em> double quotes.</p><p>I found the format of objStrPt to be easier to print for debugging, because string properties of objStrPt are printed as-is, whereas number properties of objPt are printed in exponential notation (e.g. 2.345677e⁷⁶) instead of actual digits and in case of keys, you would want to precise value to be printed.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/504d83af7ce1fc4d4d5cfb930f034b8e/href">https://medium.com/media/504d83af7ce1fc4d4d5cfb930f034b8e/href</a></iframe><h3>Interacting with other languages</h3><h4>Go — JavaScript</h4><p>The easiest way I found to pass big integers to and from JavaScript was through JSON serialization to strings, as explained above. This lends itself to easy debugging as you can print out the values. The downside is being very inefficient in terms of space.</p><h4>JavaScript — Solidity</h4><p>While this may be a little off-topic as no Go is involved here, it is still useful to demonstrate passing 256-bit values (very common key length) as big integers using <a href="https://github.com/ethereum/wiki/wiki/JavaScript-API">web3</a> library (in JavaScript) and Solidity, as these play a significant role in crypto.</p><p>Assuming your JavaScript code receives big integers as strings, as explained above, it can then convert them to web3 big integers like so:</p><pre>// Convert string to web3’s big integer<br>const secretKey = <strong>web3.toBigNumber</strong>(secretKeyStr);<br>// Call the smart contract (assuming you use Truffle to generate a contract instance - beyond our scope here)<br>myContract.someMethod(secretKey, {props...}, (err, result)=&gt;{...});</pre><p>This would work if the Solidity code on the other side accepts a uint256 value:</p><pre>contract someContract {</pre><pre>...<br>function someMethod(<strong>uint256</strong> sk} {...}</pre><pre>...<br>}</pre><h3>Generating random numbers</h3><blockquote>Warning: this code is <strong>not</strong> to be used to generate truly random numbers, as used for generating secret keys for protecting cryptocurrency or any other value in general. The numbers generated here are not truly random because the seed used to generate them is not random. You can observe this easily by consecutively running this <a href="https://play.golang.org/p/t7vD9fdyOCl">snippet</a> several times in the Go playground, then observe that you generate the same “random” numbers.</blockquote><p>Generating random numbers (under the above warning) can be done like so:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/66d57e0d067f472a406836126cf63101/href">https://medium.com/media/66d57e0d067f472a406836126cf63101/href</a></iframe><p>Notice the difference between math/rand and crypto/rand packages. Crypto claims to be geared toward protecting sensitive data but you will need to educate yourself further to be certain of that.</p><h3>Performing calculations</h3><p>See this <a href="https://play.golang.org/p/efReTExlOH-">snippet</a> on how to multiply large primes.</p><p>Calling prime1.Mul() will overwrite the value of prime1 with the product of multiplication, so if you want the result to be stored in another variable, use:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/450b79275f791b89859d44921616c200/href">https://medium.com/media/450b79275f791b89859d44921616c200/href</a></iframe><p>This shows the multiplication of 2 large primes and their product. Other arithmetic operations are similar.</p><p>That’s it! I hope this short post about Go conversions was. useful! Of course, all comments are welcome.</p><p><em>Found this interesting? Check out our projects on GitHub:</em></p><ul><li><a href="https://github.com/orbs-network/orbs-network-go">orbs-network/orbs-network-go</a></li><li><a href="https://github.com/orbs-network/orbs-spec">orbs-network/orbs-spec</a></li><li><a href="https://github.com/orbs-network/orbs-network-typescript">orbs-network/orbs-network-typescript</a></li><li><a href="https://github.com/orbs-network/lean-helix-go">orbs-network/lean-helix-go</a></li></ul><p>Join the Orbs community:</p><ul><li><em>GitHub: </em><a href="https://github.com/orbs-network"><em>https://github.com/orbs-network</em></a></li><li><em>Telegram</em>: <a href="https://t.me/orbs_network">https://t.me/orbs_network</a></li><li><em>Twitter</em>: <a href="https://twitter.com/orbs_network">https://twitter.com/orbs_network</a></li><li><em>Reddit</em>: <a href="https://www.reddit.com/r/ORBS_Network/">https://www.reddit.com/r/ORBS_Network/</a></li><li><em>Read the Orbs white papers</em>: <a href="https://www.orbs.com/white-papers">https://www.orbs.com/white-papers</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14534d0e490d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/orbs-network/big-integers-in-go-14534d0e490d">Big integers in Go</a> was originally published in <a href="https://medium.com/orbs-network">The Orbs Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Predictable Fees: The Orbs Blockchain and Orbs Token are Making Transaction Fee Models Usable]]></title>
            <link>https://medium.com/orbs-network/what-everyone-needs-to-know-the-orbs-platform-and-orbs-token-will-change-how-blockchains-operate-8634d39efac1?source=rss-b9edfed8478f------2</link>
            <guid isPermaLink="false">https://medium.com/p/8634d39efac1</guid>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[token]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Ido Zilberberg]]></dc:creator>
            <pubDate>Tue, 12 Jun 2018 09:25:25 GMT</pubDate>
            <atom:updated>2018-12-16T12:09:19.751Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7BVl9MJfdtSwoUQra5Khfg.jpeg" /><figcaption>Image by Marina Rudinsky</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fplay.ht%2Farticles%2F8634d39efac1&amp;src=https%3A%2F%2Fplay.ht%2Fembed%2F%3Farticle_url%3Dhttps%3A%2F%2Fmedium.com%2F_p%2Fwhat-everyone-needs-to-know-the-orbs-platform-and-orbs-token-will-change-how-blockchains-operate-8634d39efac1&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=play" width="700" height="185" frameborder="0" scrolling="no"><a href="https://medium.com/media/6b86b9c9296be408726517921fdb3d2c/href">https://medium.com/media/6b86b9c9296be408726517921fdb3d2c/href</a></iframe><p><em>This post explains the Orbs platform economy from the point of view of the ORBS token. It is based on the </em><a href="http://bit.ly/OrbsPositionv16"><em>position paper</em></a><em>, a long but very enlightening read. Please note that much of this material is a work in progress and subject to change in the coming months.</em></p><h3>Introduction</h3><p>Consumer apps have begun creating token economies in which the end-users, advertisers, and third-party providers all take part. Compared to fiat money (that is, government money— USD, EUR, etc.) tokens are borderless, faster to transact, and incur fewer fees. Also, by placing tokens on a decentralized blockchain, it becomes more difficult to attack the tokens ledger even if an attacker gains access to the company’s servers.</p><p>Transition to the blockchain is not without its own issues, though. As the largest blockchain with smart contracts, Ethereum would be an obvious choice for apps, but Ethereum suffers from unpredictable fees and unpredictable transaction execution times. The price of gas — the toll for transactions on the Ethereum network — can fluctuate greatly in conjunction with volatile prices of Ethereum. Both of these are unacceptable for decentralized apps wishing to perform multiple micro-transactions per second on behalf of their end-users.</p><p>The Orbs platform was created with the mission to allow established consumer brands create large-scale decentralized apps. It is designed to solve the aforementioned unpredictability and provide additional features. <em>For a more thorough discussion see the </em><a href="https://docs.wixstatic.com/ugd/36247c_cb90d7c17c354c10abc91e063054c29c.pdf"><em>position paper</em></a><em>.</em></p><blockquote>This post distinguishes between the <strong>Orbs platform</strong>, and the <strong>ORBS token</strong> (written in all caps) used for paying and receiving fees on the Orbs platform. Also whenever Amazon AWS is mentioned, it can be substituted for every other cloud provider — this is for convenience only.</blockquote><blockquote>The terms <strong>app</strong>, <strong>decentralized app</strong> (“DApp”) and <strong>consumer app </strong>are synonymous.</blockquote><h3>What is the Orbs platform?</h3><p>The Orbs platform is a <em>decentralized</em> infrastructure (or as we say in the industry Infrastructure-as-a-Service — “IaaS”). It is composed of a set of independent <strong>nodes</strong>, each running the Orbs software stack of micro-services. A node is composed of one or more machines, whatever number is necessary to provide a committed level of service.</p><blockquote>Note the distinction between <strong>decentralized</strong> and <strong>distributed</strong>.</blockquote><blockquote>A <strong>distributed system</strong> has multiple physical or virtual machines but is governed by a single entity that can manipulate its data (“source of truth”) at will.</blockquote><blockquote>A <strong>decentralized system</strong> is also distributed but is not governed by a single entity; rather its control is fragmented between several parties such that (ideally) no single party can manipulate its data. Instead, a <strong>consensus</strong> must be reached between all parties as to what is the correct “source of truth” of the system so that its operation can continue.</blockquote><p>Each node is operated by an organization, and all organizations that run nodes are collectively known as the <strong>Orbs Federation</strong>. This federation of nodes holds both the code and the data of the apps. This network is collectively governed by members of the Orbs Federation. When we say an app runs on top of the Orbs platform, this means its code lives in smart contracts and its data is stored on decentralized storage on top of the Orbs platform.</p><p>The organization that develops and deploys this app is responsible for <strong>paying subscription fees</strong> for the various services the app consumes, such as consensus, storage and execution of smart contracts.</p><p>Fees are paid to the Orbs platform and distributed to the federation members who run the nodes.</p><p>An app runs on a <em>virtual chain</em> — a subset of nodes that to the app seems like a completely separate blockchain, but still enjoys the greater security afforded by having the entire nodes network participate in consensus.</p><p>Using a virtual chain gives an app the option to choose which tier it would like to pay for (examples: SLA with up to 100 transactions/second, or 200, etc.).</p><p>An Orbs node would typically run on some cloud virtual machine, although it can also run on your laptop — it’s a matter of computing power and network speed. Running a node costs money (e.g. AWS subscription), so node operators receive fees in ORBS tokens as compensation for their expenses.</p><blockquote>The same organization can both operate nodes and run an app on top of the platform — thus, it can both pay and also receive fees. In fact, this is the common case.</blockquote><h3>So, what is the ORBS token?</h3><p>The ORBS token lives inside an Ethereum smart contract (the “token contract”) as a <strong>mapping of Ethereum addresses to ORBS tokens</strong>.</p><p>For example, if an app called <strong>myApp</strong> holds 1000 ORBS tokens, this is represented as balance[myApp_ethereum_address] = 1000; in the contract’s data.</p><h4>So, the ORBS token is an <strong>Ethereum</strong> contract? What does Ethereum has to do with it?</h4><p>Executing a contract on Ethereum has significant advantages, such as leveraging the existing integrations Ethereum already has to wallets, etc. It is also very secure, thanks for the large number of validators (miners).</p><p>Its disadvantages, such as unpredictable (and possibly high) fees, and long transaction confirmation time are not as pronounced, given the very low transaction rate (monthly subscription payments and distribution) and the relatively high value of every transaction.</p><p>So, can’t apps just launch their token economy over Ethereum? Why create the Orbs platform?</p><p>The motivation to create the Orbs platform appeared when one of our early partner apps tried to launch over Ethereum at the end of November 2017. At the same time, popular blockchain-based game CryptoKitties launched over Ethereum and promptly <a href="https://en.wikipedia.org/wiki/CryptoKitties#Reception">clogged the Ethereum network</a>. Excess demand delayed transaction confirmations and drove up the price of gas.</p><p>For app developers, it presented a tremendous challenge to crafting a stable budget of fee expenses, since the prices of those expenses were subsequently shown to be unpredictable. When it comes to apps with a lot of users, it would be unbearable to sustain those kinds of delays — they are not interested in the complex technical reasons of why that would happen: End-users want fast and consistent response times.</p><h3>Subscriptions: Where Orbs Differs</h3><p>Contrary to Ethereum’s fee-per-transaction model, where each transaction execution incurs an immediate fee whose price fluctuates with the price of gas, the Orbs platform employs <strong>subscriptions, </strong>whose transaction rate is much lower (once per month) and more importantly, does not affect end-users (it is a transaction between the app and the Orbs Federation).</p><p>This works better for the Orbs Federation member (the validator) who receives fees. This makes its income <em>predictable</em> and <em>consistent</em>, in line with its predictable and consistent expenses, such as paying its own infrastructure subscriptions.</p><p>The concept of subscriptions emerged primarily from the need to provide <strong><em>fee predictability</em></strong> to decentralized apps. A subscription also enables programmable fee models <em>per</em> virtual chain, such as tiering — for example different SLAs to different apps, much in the same way as regular IaaS providers.</p><p>Instead of having an app pay a transaction fee immediately with every single transaction, the app pays at the beginning of the month a specific and known subscription fee, based on its SLA needs (e.g. up to 10 transactions per second, 100, etc.), then for the rest of the month it uses the Orbs platform services without having to deal with fees.</p><h3>How do subscriptions work?</h3><p><em>The Subscriptions smart contract</em> over Ethereum holds subscription data (monthly fee, tier properties, etc.) for each virtual chain, and several utility methods for interacting with it.</p><p>To buy a subscription, the app invokes a <strong>pay subscription</strong> method on the Subscriptions smart contract over Ethereum. At that time, the amount paid is deducted from the dApp’s ORBS token balance on the ORBS token contract (also on Ethereum) and added to a <strong>subscription pool</strong> on the Subscriptions smart contract.</p><p>During that month, the subscribed app then uses such services as consensus nodes, decentralized storage, and execution of its own smart contracts over its virtual chain on the Orbs platform.</p><p>Before executing an app’s transaction, the platform checks the subscription data for that app which either approves or rejects the transaction based on the app’s subscription. This is a read-only check (using Ethereum’s call method). It only checks if a subscription is valid or not — <strong>it does not deduct any amount from any account</strong>. Also, reading the subscription data is cached on each node so in reality it is not necessary to actually access Ethereum for every single transaction.</p><p>At the end of the month, the collected fees in the pool are divided between Orbs Federation members (the node operators). This pays the cost of operating nodes, with some profit margin to incentivize perpetuation of this service.</p><h3>ORBS token vs app tokens</h3><p>You’re all probably waiting for this one.</p><p>We haven’t said anything yet about app-specific tokens. The ORBS token is the means of payment in the Orbs platform. An app running on top of the Orbs platform has a collection of smart contracts on top of the Orbs platform. These smart contracts that contain its logic may also manage a supply of its <em>own </em><strong><em>app tokens</em></strong>, along with any other applicative data of its own internal state.</p><p>This is entirely unrelated to ORBS tokens (which again are managed in a smart contract on top of Ethereum). These internal app tokens would likely be used to transfer value between end-users of that app, but again this is entirely up to the app’s own discretion and the Orbs platform does not in any way interfere with management of that token.</p><h3>Token lifecycle — putting it all together</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nn4XfY-WyvbxfX4RXmg4xA.png" /></figure><p><em>On personal note: this is my very first post! I would love to get your comments, insights and a round of applause!</em></p><p><em>Join the Orbs community:</em></p><ul><li><em>GitHub: </em><a href="https://github.com/orbs-network"><em>https://github.com/orbs-network</em></a></li><li><em>Telegram</em>: <a href="https://t.me/orbs_network">https://t.me/orbs_network</a></li><li><em>Twitter</em>: <a href="https://twitter.com/orbs_network">https://twitter.com/orbs_network</a></li><li><em>Reddit</em>: <a href="https://www.reddit.com/r/ORBS_Network/">https://www.reddit.com/r/ORBS_Network/</a></li><li><em>Read the Orbs white papers</em>: <a href="https://www.orbs.com/white-papers">https://www.orbs.com/white-papers</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8634d39efac1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/orbs-network/what-everyone-needs-to-know-the-orbs-platform-and-orbs-token-will-change-how-blockchains-operate-8634d39efac1">Predictable Fees: The Orbs Blockchain and Orbs Token are Making Transaction Fee Models Usable</a> was originally published in <a href="https://medium.com/orbs-network">The Orbs Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>