<?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 Andrey Galkin on Medium]]></title>
        <description><![CDATA[Stories by Andrey Galkin on Medium]]></description>
        <link>https://medium.com/@andvgal?source=rss-dd09b97f9700------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*lDghdwJHS3_Cf_dkiZHkig.jpeg</url>
            <title>Stories by Andrey Galkin on Medium</title>
            <link>https://medium.com/@andvgal?source=rss-dd09b97f9700------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 00:05:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@andvgal/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[Replace PRs with Intention Declarations and Reviews]]></title>
            <link>https://medium.com/@andvgal/replace-prs-with-intention-declarations-and-reviews-553bb759c027?source=rss-dd09b97f9700------2</link>
            <guid isPermaLink="false">https://medium.com/p/553bb759c027</guid>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Andrey Galkin]]></dc:creator>
            <pubDate>Thu, 23 Jul 2026 14:19:58 GMT</pubDate>
            <atom:updated>2026-07-23T14:19:58.101Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*YWIEi4UjU2U29-0gdR7zKA.jpeg" /><figcaption>Worst-case &amp; best-case delays, and outcomes diagram</figcaption></figure><p>Although Pull Requests (PRs), a.k.a. Merge Requests, have become the standard practice in modern software development, that may turn out to be an anti-pattern for engineering teams, as exposed in the recent heavy AI activities. The original intention of PRs was designed for foreign contributions, widely pioneered in Linux kernel development as patch submission, and later formalized in GitHub’s core concept.</p><p>Intention Declaration and Intention Reviews are an obvious replacement, which ideally fits rapid AI workflows. Instead of looking at the results after intensive work, the control focus shifts to preliminary analysis and endorsement of planned intensive work.</p><h3>What Is an Intention Declaration and Review?</h3><p>Nothing is new under the sun. That is an industrial and leadership practice when team members preliminarily analyze a problem or a task, and declare their intention, so their colleagues and supervisors can promptly respond with known features, issues, gaps, and suggestions. Most importantly, it enables a clear mind and grows abstract vision skills. One way or another, it is included in open source project contribution guidelines.</p><p>The Review part means pre-approval is needed before further work is done. The balance between just declarative and essential approval should be defined in the project risk management policy and the cost of going the wrong way.</p><p>Both declaration and review can be skipped for obvious small changes along with any following PR.</p><h3>Assumed Benefits of PRs Compared to IDs/IRs</h3><p>Grok was kind enough to provide the key benefits of PRs for us to compare below.</p><p><strong>1. Improvement of Code Quality.</strong> Design is improved based on intention review, as the actual code is better controlled by linting, static analysis, and unit tests. Use of PRs for that is pedantic hell.</p><p><strong>2. Knowledge Sharing and Team Learning. </strong>This is absolutely unrelated to PRs, as those do not involve the whole team and only fragment discussions. Proper retrospective meetings in the full group reviewing and discussing exact commits and related issues are much more productive.</p><p><strong>3. Better Collaboration.</strong> No change in that compared to IDs/IRs, but there is much less drama with IRs in case of discarding the work done.</p><p><strong>4. Early Detection of Issues.</strong> PRs are MUCH more delayed in detection of issues compared to IDs/IRs and automated testing.</p><p><strong>5. Enhanced Traceability and Accountability.</strong> That’s what task trackers are for, but not PRs.</p><p><strong>6. Risk Reduction.</strong> Proper prior design plan, automated tests, and actual post-integration code review of factual changes are the real practices of risk reduction. PRs tend to shift accountability to the reviewer due to the common misunderstanding of PRs’ concept.</p><p><strong>7. Documentation and Context.</strong> Absolutely unrelated. Most teams have only source code in PRs. Proper <a href="https://medium.com/design-bootcamp/agile-documentation-cf63e067de3b">Agile Documentation</a> is the answer.</p><p><strong>8. Workflow and Process Enforcement.</strong> This makes sense only when the team is not trusted and is not empowered. Most of the other concerns are implementable by tools and automation.</p><p><strong>9. Psychological and Cultural Benefits.</strong> Review benefits are still present with IDs/IRs, but the drama part of defending significant coding effort done gets eliminated.</p><p><strong>10. Scalability and Maintainability.</strong> AI agents have proven that PRs are not scalable. Delayed design review feedback does not aid maintainability either.</p><p><strong>11. Security and Compliance Advantages.</strong> Security and compliance must be based on actual deliverables, but not on any intermediate state. Many aspects are better handled with tools in CI.</p><p><strong>12. Productivity and Velocity Gains (Long Term).</strong> As exposed by AI agents, neither of the goals is fulfilled by PRs. The same problem exists in biological teams, but less visible. Only top performers, who do not rely on reviewers’ competence, really understand that.</p><h3>Conclusions</h3><p>Intention Declarations cover the purpose of Pull Requests, but eliminate associated roadblocks and bottlenecks of team performance. Declaration of Intentions is basically what Agile Documentation is, with not much extra effort needed for maintaining a living knowledge base.</p><p>It also opens the route to canonical Continuous Integration in a modern AI agentic contribution model, eliminating waste of branching and synchronization during the review period. Post-commit peer reviews eliminate any remaining concern.</p><p>Pre-commit peer code review flow should be considered a punishment and distrust for low-quality work. Of course, new team members and AI agents require prior alignment with the project and are supposed to use PRs/MRs, but only for the onboarding period.</p><p><em>Connect with </em><a href="https://www.linkedin.com/in/andreygalkin/"><em>me on LinkedIn</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=553bb759c027" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Agile became a mis-Agile Disaster]]></title>
            <link>https://medium.com/@andvgal/how-agile-became-a-mis-agile-disaster-1c1905cba329?source=rss-dd09b97f9700------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c1905cba329</guid>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[management]]></category>
            <dc:creator><![CDATA[Andrey Galkin]]></dc:creator>
            <pubDate>Sun, 17 May 2026 11:15:55 GMT</pubDate>
            <atom:updated>2026-05-17T11:15:55.265Z</atom:updated>
            <content:encoded><![CDATA[<p>Back in the end of the 90’s and start of the 00’s, Agile was an approach to cut corners for highly professional activities to improve development performance and delivery times without sacrificing quality. Somehow, the true Agile <strong>bias</strong> of the manifesto and the principles turned into dogmas of complete rejection of less favorable values. Let’s call it mis-Agile.</p><p>Mis-Agile’s main problem used to be and remains project continuity upon staff rotation, including up- and down-scaling. Therefore, even in the early 10’s, large US corporations were not accepting pure Agile as a replacement for project and program management. Advocating for a shift to Agile-only was considered immature and amateurish for professional application. Then something had changed. Certain books and research papers were not the cause, but the consequence of the shift towards flat teal swarms with caveman-level skill sets.</p><h3>Factor: rise of outsourcing companies</h3><p>With no surprise, the world’s leading outsourcing companies have been evangelizing mis-Agile in the first place, also pushing the agenda through universities. The cause is pure business interest. The service can typically be billed either based on an hourly rate or based on the delivery of the project or its milestones. In the former case, outsourcing companies are interested in more hours billed, while in the latter case, they are interested in evading legal accountability by eliminating clarity in statements of work. If pure Agile is so efficient, then it’s like shooting oneself in the foot to cut one’s revenue by decreasing man-hours billed.</p><h3>Factor: the IT boom</h3><p>There was a rapid rise in demand for IT workers in the late 10’s and early 20’s, which caused masses to pursue appealing salaries by storming both university-level and suspicious-level of educational facilities. Unavoidably, the average level of competence has declined over previous periods. Outsourcing companies were the primary “consumers” of new graduates and even pre-graduates.</p><p>However, the main problem was the lack of a sufficient number of competent development managers to handle swarms of juniors and company communication to customers. Promoting unfit team members to managers could not solve the problem. Flat Agile-themed teams of often junior-only team members with little to no role models of engineering excellence were the natural workaround. Original Agile was assuming highly competent specialists instead.</p><h3>Factor: corporate evasion of accountability</h3><p>Top managers tend to create some mid-management subordinates as a buffer for failures to protect their own bases, while keeping direct heavy influence on teams. Mis-Agile methodologies have provided a wonderful excuse for blaming empowered self-organized teams for all project-related issues. There is less need for expendable middle management. In reality, empowered teams are a psychological illusion, while flat anarchical swarms can create natural hot tensions in teams in practice.</p><p>However, such an anti-management structure requires justification. With no surprise, supporting books and research results appeared just when needed. On the other hand, that even contradicts the natural structure in swarms of bees, ants, termites, and other species with strict roles and hierarchy inside colonies.</p><p>Stock corporations and startups targeting IPO are not about their own economics or efficiency, unlike many standalone private capital companies. Without expanding the topic, they are quite different types of entities in a much larger picture, and such a state of affairs can easily take place, therefore.</p><h3>Personal experience</h3><p>In 2006, author started professional career with an excellent manager, Uldis Briedis, who established a variation of eXtreme Programming (XP) practices on tactical level in a team of 10–20 developers, while it was backed by corporate Software Development Life Cycle (SDLC) as a variation of Rational Unified Process (RUP) with proper product requirements management and Quality Assurance in place on strategical level. That was an absolute winning combination back then and remains so nowadays.</p><p>By 2012, some program management had already shifted towards discrete Scrum sprints and late decision on code integration, which had already been in some conflict with XP ideology of natural performance flow. Meanwhile, top management was sticking to a firm SDLC, supporting bandwidth releasing of at least two separate projects every week, 100+ projects per year.</p><p>In around 2013, that led to an interesting conversation with Jim Brodie during an annual meetup at headquarters, who demolished Scrum “fan boys”, including the author, with a simple question of what exact problem Scrum was supposed to solve [in the company’s ways of working]. That’s the key point to understand the overall problem of Agile: it does not really define, analyze, or holistically measure the impact of any problem it is solving. It just dogmatically defines its superiority like any religious sect. Re-read the manifesto and the principles, if in doubt.</p><p>The author interrupted his career in the corporate sector in 2014 and returned in 2020, with quite the feelings exactly demonstrated by the main character of the Idiocracy (2006) movie.</p><p>In 2025, the author asked one of those who was exceptionally good at requirements management 20 years ago why he stopped doing that. He could not justify that with anything other than “because it is not Agile”. That reflects the tragedy of modern software development terrorized by mis-Agile dogmas.</p><p>In parallel, the author has a much longer career as a private consultant, where he is often called to rescue failing projects with good business ideas, but disasters in implementation caused by a simple lack of management, and not by “wrong” development teams.</p><h3>Conclusions</h3><p>Mis-Agile essentially dissolves management accountability. It is the perfect state of affairs for stock corporations nowadays, which often exist, gain certain market share, funding, and government contracts by means and causes unavailable to ordinary private companies. Mis-agile is also ideal for outsourced contractors, which leads to an increase in hours spent and a lack of clarity in contractual deliverables.</p><p>Swarm ideology is about the replication of activities, which indirectly compares team members to insects. Those show quite little innovation over centuries and millennia, only mindless replication of static patterns. That fits the throw-away projects strategy and engagement in pointless activities as an alternative to the bare base income approach. It does not really work well with fundamental innovations in practice.</p><p>On the other hand, mis-Agile can be fatal for private equity companies. Any short initial boost easily backfires with later difficulties when the business loses its momentum. … and that’s the moment the author typically steps in to drive the projects out of crisis.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c1905cba329" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agile Documentation]]></title>
            <link>https://medium.com/design-bootcamp/agile-documentation-cf63e067de3b?source=rss-dd09b97f9700------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf63e067de3b</guid>
            <category><![CDATA[documentation]]></category>
            <category><![CDATA[requirements]]></category>
            <category><![CDATA[agile]]></category>
            <dc:creator><![CDATA[Andrey Galkin]]></dc:creator>
            <pubDate>Sun, 14 Sep 2025 03:51:53 GMT</pubDate>
            <atom:updated>2025-09-17T09:34:25.619Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Shows the flow of requirements from stakeholder communication to documentation, and not task tracking, while developers update the documentation during implementation and further communication." src="https://cdn-images-1.medium.com/max/702/1*22qBoRBZ8_UM1q2tioc8cw.jpeg" /></figure><p>The author periodically meets top-level managers, professors, and team leaders, who claim that the Agile mindset exempts any documentation, except for the content of the task tracking system.</p><p>Luckily, there are also many with the opposite opinion among business owners, certified Agile professionals, and other business-oriented professionals.</p><h3>In short</h3><p>Many are messing up different types of documentation. Initial requirements and living product design are not a waste. Duplicating actual code in words and diagrams as a standalone document, or even in code comments, is a waste, for sure. There is always an exception, like proper documentation of a sketch or temporary demo is a waste. A Product’s public API requires documentation in code to auto-generate a nice manual. However, user documentation is a separate discussion aside from this article.</p><p>In any case, if a product has proper Quality Assurance, it must have consolidated refined requirements and product design materials for UI, public and system protocols, public and system data structure and file formats, etc.<br>Any critical system must have well-defined and validated models for Security, Performance, and Throughput at a minimum.</p><p>Despite acting Agile, a mature business must think about traceability and business continuation in the event of “the team” vanishing for any reason. This directly derives from well-known international standards, which are modern and also Agile by design.</p><h3>Retrospection of Agile deviation</h3><p>Let’s start from the <a href="https://agilemanifesto.org/"><strong>Agile Manifesto</strong></a>, which states “comprehensive documentation”. Its meaning becomes clear from the <a href="https://agilemanifesto.org/principles.html">Twelve Principles</a>:</p><blockquote>The most efficient and effective method of conveying information to and within a development team is face-to-face conversation.</blockquote><p>Yes, “development team”, not QA, not Operations, and not even business people. So, the main pain point was detailed functional specifications of the era when it was really faster and cheaper to write and plan ahead than to implement that iteratively on ancient hardware with a deficit of allocated time for a programmer.</p><p>Before the Manifesto was published in 2001, <strong>“Extreme Programming Explained”</strong> (1999) had already been written, and then the second edition cleared up any questions in 2004 (ISBN: 978–0321278654):</p><blockquote>Extensive internal documentation of software is an example of a practice that violates mutual benefit. I am supposed to slow down my development considerably so some unknown person in a potential future will have an easier time maintaining this code.<br>…<br>Software development is full of the waste of overproduction: fat requirements documents that rapidly grow obsolete; … While all of these activities are important to software development, we need to use their output immediately in order to get the feedback we need to eliminate waste. Requirements gathering, for instance, will not improve by having ever more elaborate requirements-gathering processes but by shortening the path between the production of requirements detail and the deployment of the software specified. Using requirements detail immediately implies that requirements gathering isn’t a phase that produces a static document; but an activity producing detail, just before it is needed, throughout development.<br>…<br>If you just stop writing documentation and use XP as an excuse, you will be called on your behavior by the community. <strong>Belligerently saying, “We don’t have to write documentation because we’re extreme,” shows contempt for communication, not an embracing of communication as a value</strong>.</blockquote><p>This just nails what Kent Beck meant, and confirms the assumption above. To be sure, let’s look at other authors’ opinions in <strong>“Lean Software Development: An Agile Toolkit”</strong> (2003, ISBN: 978–0321150783):</p><blockquote>Do you ever ask, Is all that paperwork really necessary? … Consider writing customer tests instead of requirements. In general, delay documenting the details of desired features until the iteration in which they are implemented.<br>…<br>Let’s assume that at the beginning of the iteration, the customers or customer representatives write down descriptions of features they need on index cards. There are many other ways to document what the customers want, but index cards are a lot like kanban cards, so for now we will assume index cards.</blockquote><p>Here we finally come to the “point of the sabotage”. The Poppendecks actually suggested to optimize and postpone requirements document creation after the fact of related feature implementation, while capturing details in the kanban system as the first step. Apparently, that quickly turned into a “we do not need documentation” movement because a chaotic pile of cards is seen as sufficient.</p><h3>What we are trying to solve</h3><p>With this article, the author shows a different angle to the problem, especially nowadays, when technical features allow simultaneous working on documents and maintaining true live information just-in-time.</p><p><strong>Typical issues:</strong></p><ol><li>Large systems waste the effort of each individual developer to reverse engineer requirements, raising the bar for entry of new team members, and harming shared code practice.</li><li>Incorrect individual reverse engineering of requirements leads to multiple new bugs for a single change.</li><li>Non-developer persons have difficulties participating in product discussions while forcing their inappropriate decisions.</li><li>Quality Assurance cannot properly validate requirements and changes according to the best practices of the industry.</li><li>Lost knowledge due to staff turnover.</li><li>Forgotten knowledge due to the high cost of context switching between projects and in stop-start projects.</li><li>Inability to oversee and assess interference with existing or planned features at communication time.</li><li>Jumping through tickets to acquire a holistic view is inefficient and requires a human-managed index, which would always be outdated.</li></ol><p><strong>The facts:</strong></p><ul><li>Requirements are still written somewhere — this process can be adjusted.</li><li>Despite the exalted values of Agile, there are still many team members who want to work on prepared tasks instead of defining them.</li><li>It is naive and utopic to think in “small teams” and “always available” paradigm.</li></ul><h3>Solution: Agile Documentation</h3><p><strong>Main concepts:</strong></p><ol><li><strong>Define a global reference identifier system for each document, section, and individual items.</strong> Fixed, self-explanatory, comes from standards’ compliance, best practices, and practical considerations.</li><li><strong>Shared access, concurrent editing as feasible.</strong> Any general online document editing or wiki system fits the purpose. Convenient integration with a task tracking system is a huge bonus. A specialized requirements management system with a holistic linear view is a fantastic choice.</li><li><strong>Each item should have:</strong><br> a) unique reference identifier;<br> b) short title — updatable;<br> c) status(es): “<strong>Draft</strong>”, “<strong>Done in</strong> &lt;Version&gt;”, “<strong>Rejected</strong>”, “<strong>Removed</strong> <strong>in</strong> &lt;Version&gt;”, other applicable;<br> d) arbitrary details as applicable;<br> e) author(s);<br> f) references to task items;<br> g) unified color coding of text labels like orange for Drafts, green for Done items, and red for Removed/Rejected items.</li><li><strong>Tasks track activities, but do not serve as a source of requirements.</strong> This is a separation of concerns and elimination of waste of an extra process for maintaining documentation, which would never be actual and up-to-date otherwise.</li></ol><h3>Case of a new feature</h3><p><strong>Normal flow:</strong></p><ol><li>Discuss with stakeholders.</li><li>Capture the requirements and designs in collaboration using real-time editing and/or shared screen inside the live document as <strong>Draft</strong>.</li><li>Create a task for implementation referencing the document items and cross-referencing in the document.</li><li>Create any sub-tasks for dependencies like UI design or architectural spike deliverables.</li><li>Update the documented items with findings and deviations during implementation.</li><li>Before testing by QA, mark as <strong>Done</strong> in a specific release (automate as much as possible).</li></ol><p>If at any stage after creating a requirement it becomes abandoned and/or rejected, still leave that intact, just mark it so. The main text can be grayed and struck out. The team or business may still return to the idea. If the idea is a dead-end, then it still must be documented to prevent going in circles and wasting the effort of other team members.</p><p>The feature requirement description can be as simple as a user or a job story, or quite complex. A Software Architect should help the team to properly split complex features into smaller, more manageable individual requirements. As applicable, it is desired to keep structured discussions and to attach or link their protocol in any form to the requirement. That aids future archeological activities.</p><p>The QA team should be involved as early as possible to validate the requirement itself and its fitness in the holistic scope. Otherwise, the requirement may still need to be further refined during validation of the task. In the worst case, the task may need to be re-worked.</p><p>Unlike tasks, which can easily jump from one planned version to another, the document is updated by the fact of a change.</p><h3>Case of a feature elimination</h3><ol><li>Discuss elimination.</li><li>Create a task, cross-reference in the document.</li><li>Remove functionality.</li><li>Mark <strong>Removed</strong> in specific release in the document.</li><li>QA performs regression testing for other features.</li></ol><h3>Case of a feature update:</h3><ol><li>Discuss with stakeholders.</li><li>Update the requirements in collaboration, keeping both the existing behavior and the new behavior, clearly marking.</li><li>Create a related task and any required sub-tasks.</li><li>Refine as applicable during implementation, as with a new task.</li><li>Before testing by QA, merge the changes in the live document, clearly marking original features, new features since the specific version, and removed parts.</li></ol><p>The format of updated features can vary and depends on the significance of the change. For the entire redesign, it is advised to mark the existing feature as removed and to add new requirements. That would reflect what actually happens. If the requirement is extended, then the extended part can be marked with “<strong>[Since &lt;Version&gt;]”</strong>. Similar for the removed part. In case of minor but significant updates for users, these can be marked in the form of a note.</p><p>A specialized requirements management system should mark changes more conveniently.</p><h3>Capturing of legacy code requirements</h3><p>There are situations when existing code becomes such spaghetti because of mis-Agile development that it either requires a deep refactoring or a complete rewrite from scratch. Sometimes, that may also be required for a technological stack change. Therefore, any existing unit tests may not be helpful at all.</p><p>Reverse engineering of requirements can be done in a rapid manner by team members designated for that. For such items, the authorship can be marked as “AS-IS” to minimize effort needed without digging into historical tasks, if they are traceable and/or available at all. Then, such requirements can be reviewed with stakeholders to identify candidates for elimination or refinement for a new implementation.</p><p>Skipping such a step is a guaranteed disaster for any mature project in production.</p><h3>Conclusion</h3><p>There is no way that Agile processes were meant to remove critical input documents with requirements and other design materials. The information was continued to be captured in tasks, but it became inconvenient for processing context on a holistic level. Agile is meant to view projects at that level, but not as individual tasks or features.</p><p>Therefore, it is essential to return to the benefits of historical requirements management approaches. That does not require new activities, but rather just adjusting what many already do with individual tasks. As soon as the mindset gets shifted, it is easy to add plugins/apps for automation to existing task and document management systems, and even create tailored systems for that.</p><p><strong>Ultimately, collaboration for discussions of new and existing features can have a living requirements document as a metaphor of the existing software in a form that is readable and understandable to all stakeholders.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf63e067de3b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/design-bootcamp/agile-documentation-cf63e067de3b">Agile Documentation</a> was originally published in <a href="https://medium.com/design-bootcamp">Bootcamp</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Boss-ship vs. Management and Math]]></title>
            <link>https://medium.com/@andvgal/boss-ship-vs-management-and-math-196c0a169be1?source=rss-dd09b97f9700------2</link>
            <guid isPermaLink="false">https://medium.com/p/196c0a169be1</guid>
            <category><![CDATA[management]]></category>
            <category><![CDATA[operation-research]]></category>
            <category><![CDATA[leadership]]></category>
            <category><![CDATA[people]]></category>
            <dc:creator><![CDATA[Andrey Galkin]]></dc:creator>
            <pubDate>Tue, 26 Aug 2025 17:11:35 GMT</pubDate>
            <atom:updated>2025-08-26T17:11:35.336Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a light introduction for those at all ranks, who may not realize certain ways organization management can be defined, tuned, and analyzed mathematically. Lack of understanding of such a framework often leads to misunderstanding of good management decisions or mismanagement by persons in charge. We’ll also touch on the difference between bosses and managers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*Ipr6xQY_yoj1ribvH4PFmg.jpeg" /><figcaption>Rework of a well-known graphical metaphor.</figcaption></figure><h3>Logistics as foundation</h3><p>Despite a strong association with the transportation of goods in general, Logistics is an ubiquitous umbrella discipline for any organization. Either it is Corporate Finance, Human Resources, or Engineering — those are just special cases of Operations Research — a crucial part of Management science, and Information Management as the unified core. The modern formalization of the discipline takes its roots in US military, where the question of life and death is not just a metaphor. The author is greatly thankful to Transport and Telecommunication Institute in Riga for the introduction to this from both the Engineering and Business sides many years ago.</p><p>Let readers find their own interest in discovering such a beautiful world of systems modeling and competent, objective decision-making.</p><h3>Operations Research</h3><p>Probably, any scientific program at universities includes this discipline one way or another, but without sufficient attention, which it deserves.</p><p>Any process and characteristic can be quantified and expressed as an equation or a system of equations. Such equations can be defined directly analytically from models, as a result of applying mathematical statistics methods to real data, or even just in an empirical way. Even human emotions or seeded ideas can be easily expressed this way. Various constraints and correlations also become a part of such a system of equations. Add some state variables, and that can be used for dynamic simulation. There are plenty of other aspects and methods.</p><p>Typical optimization’s goal is to reach extremes of functions — either minimal and maximum values, and often across multiple parameters. And, there are plenty of ways to do that.</p><p>The main point is that this becomes scientifically defined for objective analysis and optimization, which can be validated and proven by anyone, unlike some other techniques of decision-making, which are much more subjective.</p><p>Everything ingenious is stupid simple.</p><h3>Boss vs. Manager</h3><p>Both a Boss and a Manager likely have sufficient experience, leadership skills, and ability to control their field of authority and responsibility. They both do their job. The difference appears at the decision-making level.</p><p>Bosses tend to act quite subjectively, opinionated, and based on internal reasoning. They often operate on the basis of the current situation and shallow risk management methods. Therefore, two different bosses can easily come to different conclusions when they operate independently. Hierarchical positions matter a lot. Strategic planning of an organization may become chaotic and unpredictable. Decisions of bosses can be corrected by feedback extremely rarely.</p><p>Managers, on the other hand, tend to act objectively with predictable reasoning. Therefore, it becomes much easier to share duties with either deputies or even ordinary-ranked employees, with predictable results based on guidelines. Managers tend to build such processes around, so those allow eliminating the Managers from daily activities to enable strategic vision. Rather than being an essential gear of a mechanism, Managers become guardians with minimal intervention needed. Even if Managers are lightning fast and even harsh at decision-making, they always accept valid corrections.</p><p>Of course, those are two opposite extremes, and typically the decision maker is somewhere in between… Defined by a coefficient in an equation.</p><h3>Is that real?</h3><p>Large organizations can build sophisticated models of their own operations in any field, and that is essential for supply chain management, efficient advertisements, high-frequency trading, control over the population, and other high-volume fields of operation.</p><p>This can be used by modern bad actors, who can reverse-engineer a model of operation of any business, and painfully hit its fragile places for various purposes. That has military roots after all.</p><p>Of course, doing modeling and Math is not always feasible and/or really needed. However, it is essential to understand the concept for objective reasoning and consistent decision-making.</p><p>A competent manager knows the foundation, directly or indirectly builds system models in that person’s own vision, and continuously optimizes them to reach the goals. Often, approximate calculations are performed by non-conscious intelligence, and it is known as intuition.</p><p>That works, but that does not scale alone. As any mathematical model can be expressed in words, it can be expressed in guidelines, rules, and policies as products of optimizations and analysis.</p><h3>Focusing on People</h3><p>It can be charming to believe that people become a priority when employees are still considered as a resource. The reality is that self-motivated individuals are most productive. A pure business, and no sentiments.</p><p>There is nothing “evil” and no hypocrisy in focusing on people’s emotional state and motivation, but each at any rank must clearly understand the reasoning for that to eliminate any drama.</p><p>Therefore, even such “chaotic” random employee-driven processes can be shaped and steered into the best of an organization, like an air-fuel mixture in an internal combustion engine.</p><h3>Case study: Agile software engineering</h3><p>First of all, software engineering is no different from any other form of engineering and production. Replace “software” with “real estate” or “mechanical equipment”, and it becomes the same process. That is Supply Chain Management (SCM), which has well-known common best practices and patterns. Of course, there are different coefficients for, e.g., the cost between writing code and producing a mechanical part, but that does not change the pattern. And, sometimes, writing code is more expensive than loading up a CNC machine. For mass production of parts, there are different approaches, as well as for generating code from a common model.</p><p>For example, to load up some experimental part-producing machinery, you need to have defined requirements and a design, so CNC machinery can work non-stop. Same with a junior programmer, who is not ready for competent designing. You have to prepare detailed technical instructions as input and possibly do a verbal hand-off if you want to max out that person’s productivity. On the other hand, with a senior-level engineer, the input can be limited to business requirements and instructions for aligning with the overall design of a project or a system. Here comes the agility of cutting corners of rigid processes and shifting duties by adjusting equation coefficients. XP (eXtreme Programming), as the foundation for Agile, is about senior professionals, not rookies.</p><p>Now, let’s look at an Agile process for system architecture. Constant reworking of the architectural foundation is not a sign of being able to adapt, but a sign of poor experience and vision. It is possible to build a general-purpose commercial building where you can freely change the type of business while you keep the foundation and structural elements intact. In a good design, you also minimize reconfiguration of engineering equipment for electricity, telecommunication, water supply, ventilation, and air conditioning. Such a design costs more than one tailored for some initial purpose, like private home architecture, but that maximizes rental profit in the long run.</p><p>This is an easy model to build analytically. It can be proven and validated with a simulation. Once real figures are seen in hours and the cost, that becomes difficult to deny, but Bosses do have such an option.</p><h3>Case study: communication in a team</h3><p>No matter what field of business that is, efficient quality management requires a protocol for all decision-making discussions and proper reporting for informing and archiving purposes. So-called bunker mentality or silos formation is an anti-pattern and really bad practice for the general sustaining and continuation of business. There are cases when secrecy is required not only in the military, but also in business, but it is never built so management gets excluded from the loop.</p><p>Horizontal peer-to-peer communications essentially exclude supervising parties from the loop. So, proper informing would always require creating a protocol or meeting minutes, even for ad-hoc communication, and ensuring all decisions made are properly reflected for archiving purposes. Therefore, team members will tend to skip the bureaucracy, and that is one of the risks to be mitigated.</p><p>How to minimize such waste? Make sure all business-related communications are done in persistent group chats or forums in the official language of the company, where all team members and direct supervisors are present. This way, the communication has an automatic protocol, it is always searchable as an archive, and new team members can get familiar with historical details without begging for peer-to-peer information sharing. Enforce reporting into such groups for any peer-to-peer voice communications. Enforce decision-making statements in task trackers and/or other related systems.</p><p>The example above is not a complete elimination of essential bureaucracy’s cost compared to bunker mentality, but that is an optimization to minimize its cost to as minimal as possible and relax the burden imposed on the teams. The decision can be proven with Math and then validated statistically.</p><p>Such an approach does not restrict any communications between team members on personal matters or for team-building chat purposes. That essentially separates business and personal. However, each party of such interactions should have self-control. Any violation of a policy eventually gets revealed once any decision made becomes traced.</p><h3>Conclusion</h3><p>With proper Management in place, organizations follow rational development and decision-making. Organizations naturally eliminate critical key roles in a uniform operation with high tolerance to the rotation of personnel for any reason. Successful Management is a science, backed by leadership talent.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=196c0a169be1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cryptocurrency of the 3rd Generation: Lessons Learned]]></title>
            <link>https://medium.com/@andvgal/cryptocurrency-of-the-3rd-generation-lessons-learned-2f36d18587f?source=rss-dd09b97f9700------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f36d18587f</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[proof-of-stake]]></category>
            <category><![CDATA[geth]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <dc:creator><![CDATA[Andrey Galkin]]></dc:creator>
            <pubDate>Mon, 13 Apr 2020 22:17:30 GMT</pubDate>
            <atom:updated>2020-07-16T21:26:39.211Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PvL0a7H6lYap8EmmrSw-sA.jpeg" /></figure><blockquote>Disclaimer: <a href="https://www.linkedin.com/in/andreygalkin/">the author</a> has designed and implemented the subject and remained as authorship, copyright and other intellectual property owner, but actual current operator of a coin is a third party company which is not connected to the author anymore. So, it is not a promotion of the coin which <strong>turned out to be another scam</strong>.</blockquote><h3>Intro</h3><p>As once pointed out by Ryan, the President of Energi Core Ltd. (<em>not the same as the “Energi Core” team</em>), Energi Gen 3 is not only a third generation of Energi (NRG) coin, but also a third generation of cryptocurrencies in general:</p><ul><li>the <strong>first</strong> generation was Bitcoin — the basic blockchain model,</li><li>the <strong>second</strong> generation was Ethereum — programmable decentralized logic via smart contracts,</li><li>the <strong>third</strong> generation is Energi Gen 3 — smart contract platform with heavy upgradeable <strong>governance consensus built on top of generic smart contracts</strong>.</li></ul><h3>What is inside the Energi Gen 3 Consesus</h3><p>The features below are listed in comparison to <strong>Ethereum Constantinople</strong> hard fork as Energi Gen 3 is based on <strong>Geth 1.8.27</strong> codebase.</p><ol><li>Secure Gen 2 coin Migration without time limits.</li><li>Upgradeable Governance smart contracts.</li><li>Simple Proof-of-Stake with Denial-of-Service protection and Delegated Proof-of-Stake feature.</li><li>Masternodes to ensure network stability.</li><li>Treasury for decentralized budget.</li><li>Governance voting system for decision making.</li><li>Dynamic Block Rewards.</li><li>Dynamic Checkpoints to recover from network splits.</li><li>Dynamic Blacklists &amp; Coin Recovery (aka EBI features).</li><li>Consensus zero-fee transactions.</li></ol><p>Additionally, there are official Public API endpoints and DApp frontends.</p><h3>A little background history</h3><p>The author’s initial contribution to Energi was its <strong>Gen 2 </strong>with a secure Proof-of-Stake and some other latent features. The features to be described in comparison to Gen 3.</p><p>It must be mentioned that Energi Core had contracted another party in an attempt to create a smart contract platform in period from Nov 2018 till May 2019, but that initial attempt neither had required features nor could handle a production Masternode network. Unfortunately, it was not feasible to quickly “repair” and launch. <strong>That explains why the official roadmap shifted for 3 quarters.</strong></p><p>As the author has invested his time into the coin, he could not let it fail with Gen 3 upgrade. So, the author started everything from <strong>scratch in Jun 2019</strong> and produced a Minimal Viable Product <strong>(MVP) by the end of Aug 2019</strong> with all essential features being ready. That went so fast because the author was the only person on the project to define requirements, design the architecture and implement that in code.</p><p>The <strong>original</strong> author’s Energi Gen 3 source code is available at <strong>GitHub</strong>: <a href="https://github.com/codingfuture/orig-energi3">https://github.com/codingfuture/orig-energi3</a></p><p>The <strong>Software Requirements Specification (SRS) </strong>is also available: <a href="https://github.com/codingfuture/orig-energi3/releases/download/v3.0.2/Energi.Gen.3.SRS.v1.6.pdf">https://github.com/codingfuture/orig-energi3/releases/download/v3.0.2/Energi.Gen.3.SRS.v1.6.pdf</a> . Unfortunately, a Business Requirements Document (BRD) was skipped to compress the timeline as Energi Core had not provided any input until late Dec 2019 when a change for 1,000 collateral Masternodes got requested.</p><blockquote>As a fun fact, the author has also given the name of “Energi Gen 3” and defended that while there was a strong preference to market the product as “Energi v3” instead.</blockquote><p>As a side duty beyond the main goal of Gen 3 development, the author had to act as Director of Technology in the community to build the current Energi Technology department from scratch by hiring, training and setting up processes.</p><p><em>The</em><strong><em> dark side of Energi </em></strong><em>which was publicly revealed in several interviews is that “Xenophon’s Cyrus the Great” is a holy handbook of the community. Internally, it is considered as a serious disrespect of Tommy the King to have own opinion on any subject. All contributors are no match to the King, they cannot negotiate any terms of cooperation, and they must blindly trust the King’s benediction and gratitude. As participation in such state of affairs was beyond good and evil for the author, it was clear that Gen 3 was going to be the last project done for Energi. After a successful Gen 3 launch, the author stepped down from the active position in the community. By a coincidence, the fun with Energi network started the next day, but the “King” refused any assistance as he was interested in network issues for a scam plot to keep deposits closed apparently. That’s just to explain why the author has not continued to maintain the project.</em></p><h3>Feature: Migration</h3><p><em>The base for Migration was the original idea of Energi Core to embed Bitcoin-based Gen 2 snapshot inside the Genesis block. Unfortunately, that would mean that a final software release could be created only once Gen 2 blockchain is stopped, all sorts of logistical and coordination issues would appear and a large bulk data would need to be put inside the source code.</em></p><p>So, the author decided it would be more cool to <strong>deploy Mainnet with Genesis in advance and let the network wait for block #1 with a special migration transaction</strong>.</p><p>Details of the process:</p><ol><li><strong>Gen 2 blockchain got halted</strong> with an invalid dynamic checkpoint at a block announced in advance.</li><li><strong>The tail of Gen 2 blockchain got nailed</strong> by another dynamic checkpoint to ensure the same view across all nodes.</li><li>Then a <strong>snapshot at specific Gen 2 block got created</strong> with a JSON-RPC command. It was published.</li><li><strong>Gen 3 migration miner node got launched</strong> with a special parameter pointing to the snapshot file.</li><li>The <strong>migration transaction</strong> is a one-time smart contract initialization call inside block #1.</li><li><strong>Anyone could repeat</strong> the snapshot in Gen 2 and <strong>verify</strong> the Gen 3 migration transaction with a console or JSON-RPC command.</li><li><strong>Gen 2 private key</strong> has to be used to sign a <strong>special message to proof ownership of the coins</strong> to be able to claim them into Gen 3 account.</li><li>There were many ways to claim coins: via Gen 2 Core Wallet directly, via private key dump and different modes of import inside Gen 3, via a WebIS dApp, etc.</li><li><strong>There is no time limit for claiming</strong>, and any coin owner can do that by self.</li></ol><p>Caveats:</p><ul><li>Ethereum default P2P message limit is 16M while block message limit is 10M. The latter got lifted for the migration block, but there is a high risk of running out of the limit what requires better mitigation techniques. Luckily, Energi Gen 2 snapshot was much smaller.</li><li>Transaction size limits are much less, but the migration transaction is not broadcasted.</li><li>The standard block gas limit is not enough for such large call. A dynamic gas limit was introduced.</li><li>To ensure that it would work in Mainnet, the Gen 3 Testnet launch had both Gen 2 Mainnet and Testnet snapshot data combined.</li><li>The initialization also sets blacklisted addresses from Gen 2.</li><li>Availability of Gen 3 Public API allowed to claim coins directly from Gen 2 software, but a little trick with ephemeral key was necessary to create and sign Ethereum-like Gen 3 zero-fee transactions without re-implementing that in Bitcoin code.</li><li>The Migration smart contract is initialized with the default balance of 100 NRG inside Genesis, but then the balance is set to correct value inside migration block #1 finalization logic based on the total coins available for claiming. The balance is used for initial DPoS staking by a migration miner.</li><li>Unlike a regular miner, the migration miner never creates a block ahead of time and may also delay the block for up to 15 seconds to lower the difficulty. This is what ballast staking is.</li><li>The migration transaction can be done only by a special migration signer address.</li><li>Only P2PKH addresses are supported while Multisig and P2SH cases require a special recovery procedure.</li><li>Obviously, there are very many other fine details.</li></ul><h3>Feature: Genesis smart contracts</h3><p>There is a list of 13 predefined consensus smart contract addresses (SRS SC-13). Those addresses are hardcoded, and they also give immediate understanding of their relation to the Governance system. There are also other predefined addresses used as system faucet and as initial actual implementation of the upgradeable features.</p><p><em>By default, Ethereum assumes a contract creation when no destination account parameter is set while a new contract address is derived to some pseudo-random value in deterministic way. So, the contract creation logic had to be updated to allow specification of a custom address at Genesis time.</em></p><p>All consensus contracts are upgradeable via Governance voting, except for the Migration contract. Therefore, there is a <strong>universal GovernedProxy</strong> contract implementation which manages all <strong>proposals and upgrade procedures</strong> for a specific instance while the default handler forwards calls and amounts to an actual implementation. <em>Such approach is gas hungry, but is quite robust. </em>There is also a <strong>GovernedContract</strong> base for actual implementations to properly manage <strong>upgrade procedure security</strong>. The majority of contracts have a <strong>standalone secure storage</strong> to allow logic upgrades without data copying loops. That also consume gas on calls and blows up EVM memory usage.</p><p>Genesis gas limit is also lifted. So, the normal block gas limit starts only at height 2 after the migration block.</p><p>Caveats:</p><ul><li>Externals tools may get confused by such non-standard creation transactions.</li><li>The upgrade procedure is still quite tricky due to large gas usage, if there is large data inside a contract implementation which cannot be deduced from a dedicated storage contract.</li><li>There is a significant computational overhead for every block which has to be taken into consideration.</li></ul><h3>Feature: Proof-of-Stake</h3><p><strong>Gen 3 Proof-of-Stake (PoS)</strong> is based on the idea of Gen 2/<strong>PIVX</strong> kernel which is based on <strong>Peercoin</strong> in turn. In such idea, there is no accounting, ordering or collaterals. The block mining is very similar to Proof-of-Work, except that <strong>only time</strong> can affect generated hash. Such <strong>PoS hash</strong> is matched against a classical <strong>difficulty target</strong>. Those are compared as 256-bit integers, or more commonly known as “comparing leading zeros”. A special <strong>stake modifier</strong> as a source of entropy and <strong>stake maturity age</strong> are added to make it practically impossible to predict a winning stake in the future. That prevents stake mining attacks.</p><p>The original Gen 2 PIVX-derived stake modifier <strong>had all sorts of flaws</strong> what was described by the author in an article shortly after Gen 2 launch back in 2019: <a href="https://habr.com/ru/post/442862/">https://habr.com/ru/post/442862/</a> (in Russian). A new strategy was created to use <strong>the oldest block root state hash</strong> and <strong>the youngest block coinbase</strong> inside the <strong>stake maturity period of 60 minutes</strong> to make the stake modifier practically unpredictable. It was also tested in <strong>cancelled Gen 2 hardfork</strong> to mitigate stake mining problem. <em>At the end, 50 to 75 percent of stakes were mined due to the </em>shortsighted <em>cancellation.</em></p><p>Another problem appeared in available stake weight<strong> </strong>calculation inside the maturity period as it was desired to <strong>allow to operate an account as usual </strong>without loosing chance to stake. In Gen 2, the stake maturity was applied to individual UTXOs, but Ethereum has an account model. So, an idea appeared to use<strong> the minimal untouched balance during the maturity period</strong>. That required to find out the minimal account balance and subtract all stake weight used by the account for block generation during that period.</p><p>Now, we come to “<strong>stake weight</strong>” — it is the amount used to generate a block or available for such action. The account balance is used to divide the PoS hash 256-bit integer before matching against the difficulty target. So, <strong>more funds — more chance</strong> to generate a block. Very often, only a fraction of that balance is required to go below the target. So, only that fraction is used as a “stake weight”, and that gets recorded in the <strong>original block Nonce</strong> field. So, it is possible to quickly lookup the last blocks to sum up total used weight by the staking account.</p><p>Another important aspect is that every block has to be signed by the staker account to prevent any block forgery flooding the network in Denial-of-Service attacks. The staker account is recorded in Coinbase while the signature is recorded in the additional data.</p><p>There is also <strong>Delegated Proof-of-Stake (DPoS)</strong> for smart contracts which can specify another account which can sign blocks on behalf of them via a conventional method. That opens a wide possibility for applications, but the main purpose was an initial bootstrap of the blockchain. <em>This DPoS is used by a migration signer to create the migration block and the first 60+ minutes of blocks on behalf of the Migration contract. That’s because stakers need to claim their funds first and then wait the maturity period before they have a chance to generate a block.</em></p><p>Another topic is the difficulty algorithm as it needs to be very reactive to a situation — based on Peercoin/PIVX research. In short: <em>the block target is 60 seconds, there is a minimum of 30 second block interval, there is an hour period for block target enforcement — time gap without difficulty change, the difficulty changes at generation time depending on current block time (not the previous), the difficulty may progressively jump up to around 17 times if block is too early or drop down around 17 times if block is too late.</em></p><p><strong>Denial-of-Service (DoS) </strong>protection is another important part compared to Proof-of-Work where chain split attacks are much more difficult due to computational resource demand.</p><p>Staking requires an unlocked account. Therefore, <strong>unlocking for staking only</strong> was implemented. <em>The private key may still be dumped from process memory, but that is much more difficult than just sending funds to another account via unlocked console. </em><strong><em>The most secure way is to use DPoS.</em></strong><em> Although, the DPoS feature is not marketed in fear of staking pool centralization.</em></p><p>There are lots of fine moments partially covered on seven dedicated pages of the SRS. It is definitely difficult to understand without much background knowledge. It would require a separate large article to explain. <em>Check the Gen 2 article.</em></p><h3>Feature: Zero-fee transactions</h3><p>Transaction fees serve both as interest for block miners to include transactions and as a protection against Denial-of-Service flood attacks.</p><p>However, there are <strong>several types of consensus transactions</strong> like initial coin claiming, Masternode heartbeats, invalidations and checkpoint signing. There is an advanced transaction pool feature to check that any given zero fee transaction is valid and can be successfully executed. There is also a rate limit to avoid intentional abuse.</p><p>Altered block miner ensures that <strong>the first half of available block gas limit</strong> can be used by zero-fee transactions as they are critical for consensus operation.</p><h3>Feature: Masternodes</h3><p>Masternode (MN) functionality is based on three main parts: MN Token ERC-20 contract for collaterals, MN Registry contract and MN Service.</p><p>Management of funds is intentionally isolated to reduce risks. The registry had to be implemented a way which can handle at least 10,000 registered nodes. Each MN has a 2 hour window to send a <strong>heartbeat</strong> at a dynamic period relative to the current MN count. If the heartbeat window expires then MN gets inactivated and has to be re-announced at regular transaction fee.</p><p>There is also a <strong>Proof-of-Service</strong> functionality when a deterministically random MN has to verify another MN to check if that serves the network. There is a predefined number of checkers per MN payout cycle. If more than half of checkers invalidate any given MN then its reward goes to the Treasury instead. An invalidation collusion is possible, but there is no practical gains for that.</p><p>Masternode service has to be enabled on a node via configuration. Masternodes serve the network, send zero-fee heartbeats transactions, sign dynamic checkpoints also with zero-fees and perform Proof-of-Service validation of target MNs.</p><p>All MN operations are completely in-chain. That solves original Dash MN implementation issue of MN network state and related governance voting not being reflected in blockchain anyhow.</p><p>One of the latest hysterically requested features was so called <strong>auto-collateralization</strong> for MN collateral amounts which had to be enabled by default. The idea is to automatically add additional coins to MN collateral, if MN owner account is used for staking.</p><p>Caveats:</p><ul><li>Whole functionality needs to avoid loops as much as possible, and it needs control remaining gas, if loops are present.</li><li>This is the most complex smart contract which is worth a couple articles.</li><li>The auto-collateralization features is a major security problem which encourages users to keep MN owner keys unlocked in memory.</li><li>The auto-collateralization enabled by default drains amounts available for staking and leads to network instability overall.</li></ul><h3>Feature: Treasury</h3><p>The Treasury is rewarded at <strong>superblocks </strong>(Dash legacy), and it is a sink for various consensus fees, Migration DPoS block rewards, invalidated MN rewards, etc.</p><p><strong>Anyone can raise a budget proposal</strong> for a specific amount for MN owner voting. Approved proposals get payed out proportionally to their amount until they are fully paid. This functionality is triggered on every block.</p><p><em>The behavior is absolutely different from Gen2 / Dash budget voting, where only approved budget got emitted and paid at superblock in proportional parts, if above the superblock limit.</em></p><h3>Feature: Governance voting</h3><p>In idealistic way, <strong>anyone can rise proposals of various types</strong> at a specific fee. <em>For example: upgrade proposal at 10k coins, budget proposal at 100 coins, blacklist proposal at 1k coins, etc. Then MN owners may vote for accepting or rejecting a proposal. Voting requires fee to cover gas.</em></p><p><strong>MN vote has a weight</strong> equal to MN collateral amount. <strong>Only MNs active at proposal block are eligible for voting.</strong> <em>This is done such way to simplify protection against vote cheating via reusing of the MN collateral. There is a proposal-specific </em><strong><em>quorum</em></strong><em> based on the total active collateral weight. There is also a protection not to allow the total active collateral to go below a half of the ever recorded total collateral weight.</em></p><p>Every proposal also has a <strong>deadline</strong> for voting. Once the deadline is reached and the quorum is met then simple majority is used to decide. Any voting can be <strong>finished ahead of the deadline</strong> if an absolute majority of 51+% percent accepts or rejects the proposal.</p><p>However, the world is not ideal and Energi Core has two <strong>backdoors</strong>: one is an emergency consensus upgrade feature which allows to create immediately approved upgrade proposals, another is zero-fee blacklist proposals designed for rapid blocking of scammers. Both cases are justified though.</p><p>The third “backdoor” is an ability to organize a required MN voting weight for any proposal.</p><p>The above aspects may be considered as a <strong>centralization issue</strong>, but once they are misused any trust to the coin may vanish. <em>Unlike with territory governments, coin owners would be able to switch to any other alternative coin. So, it is not that much of an issue so far.</em></p><h3>Feature: Block rewards</h3><p>Many may wonder what’s so new here, but it is a know-how feature which is based on smart contract execution as a special block finalization logic.</p><p>There is a general <em>IBlockReward</em> interface which has <em>getReward()</em> and <em>reward()</em> methods. Initially, there were five contracts implementing that:</p><ol><li><strong>StakerReward</strong> contract.</li><li><strong>BackboneReward</strong> contract.</li><li><strong>MasternodeRegistry</strong> contract.</li><li><strong>Treasury</strong> contract.</li><li>Overall <strong>BlockReward</strong> contract which acts as registry for all other implementations.</li></ol><p>As a part of the block finalization logic, a call against the fifth contract is performed to collect the <strong>total block reward</strong> amount. Then a consensus transaction is created to execute the <em>reward()</em> method with a given total block reward amount. Internally, that <strong>creates a myriad of internal calls</strong> touching almost all consensus contracts.</p><p>Caveats:</p><ul><li>The consensus gas must not be limited by the block gas limit.</li><li>The consensus transaction needs to be reflected in a block for simpler integration with third-parties.</li></ul><h3>Feature: Dynamic Checkpoints</h3><p>Dynamic Checkpoints is an important feature as <strong>a matter of last resort</strong> to ensure network integrity which may easily run into splits due to low computational difficulty of building Proof-of-Stake chains and interference from a mandatory Denial-of-Service protection. <em>The original implementation was introduced by the author in Gen 2. It helped to ensure that all nodes are getting onto the best chain after a hard fork from Proof-of-Work in Gen 1.</em></p><p>This is a truly a Chicken and Egg problem. Dynamic checkpoints are also in-chain, but they are supposed to affect nodes which potentially run on a side chain. So, the <strong>peer-to-peer network protocol was extended</strong> to support dynamic checkpoint distribution.</p><blockquote><em>Originally, it was planned that checkpoints are proposed at some fee and then Masternodes automatically sign the checkpoint if they are on the correct chain. Then all nodes would be able to decide if enough of known MNs confirmed the checkpoint is valid to enforce that.</em></blockquote><p>That was implemented, but the logic got <strong>changed to allow checkpoint proposal only by a special account under Energi Core control</strong>. At the moment, <strong>all nodes immediately obey any checkpoint</strong> signed by such account.</p><p>Unfortunately, <strong>Energi Core has heavily misused this feature</strong> after the author left the project. The original target was to have no more than 100 checkpoints until the functionality is redesigned, but they decided to create a checkpoint every 20 minutes. That quickly exhausted design limits on various levels.</p><h3>Feature: Dynamic Blacklist &amp; Funds Recovery</h3><p>This is possibly one of the most controversial features, but it has <strong>proven to be useful against scammers</strong>, and it can help to <strong>recover personal funds</strong> when private keys are lost.</p><blockquote>The original feature was introduced by the author for Gen 2. It was a centralized spork-like feature which allowed to issue blacklists for addresses with some expiration time. Gen 2 blacklisted addresses got embedded into the migration snapshot as hardcoded blacklists which can only be recovered, but not claimed.</blockquote><p>In Gen 3, blacklists are proposals made against the <strong>Blacklist Registry</strong> smart contract. It requires MN owner voting to enforce the blacklist. After a blacklist proposal is <strong>enforced</strong>, it is possible to make a <strong>revoking</strong> proposal for the blacklist or to <strong>drain</strong> the blacklisted account into a special treasury-like <strong>compensation fund</strong>. Another proposal against the compensation fund is required to <strong>distribute</strong> any drained amounts.</p><p>Obviously, blacklists make no sense in fight against scammers unless they can be <strong>immediately enforced</strong>. So, blacklist proposal enforcement is in effect even during voting if there is 2:1 or better ratio of approved to rejected votes. However, that is still not enough. So, blacklist proposals made by a <strong>special Energi Bureau of Investigations (EBI) key</strong> get enabled immediately when the proposal transaction is broadcasted and is effective for 1 hour. EBI account is exempt from the proposal fee.</p><blockquote>During the first migration days, this had helped to fight against a known Energi antagonist, so called Bashful, who got quite upset BTW. Spoiler: Bashful identify is also known, and Bashful knows that it is known, but he is curious where he has failed.</blockquote><p>Caveats:</p><ul><li>Even though Bitcoin and Ethereum addresses are created a different way, they both use 20 bytes for identification. That answers how Gen 2 addresses are recovered with Gen 3 blacklist features.</li></ul><h3>Feature: WebIS — Web Information System (aka Nexus)</h3><blockquote>Once Gen 3 MVP got ready, it became obvious that a headless/console node is not something what the majority of end users would like to see. The author in role of Director of Technology had launched a Gen 3 Web Information System project with codename WebIS. Later, Energi Core gave a “Nexus” name to that.</blockquote><p>WebIS supposed to become a dApp which covers all extended features and to take a position of a general system portal. The actual project was developed by a dedicated web team. Unfortunately, the target has not been reached yet.</p><p>WebIS heavily depends on extended JSON-RPC API which are exposed in Energi Core Node through highly available Public API.</p><p>Caveats:</p><ul><li>Blacklisted accounts can still receive funds, but they cannot transfer anything or mine new blocks.</li><li>There is also a whitelist created from predefined consensus smart contract addresses and their current implementations.</li></ul><h3>How the migration has gone</h3><p>Everything went exactly as planned except a small forgotten protection — Mainnet Genesis timestamp was intentionally put too far in the future to protect against accidental launch in the very beginning of the project. That was forgotten as no special comment was added. Everything was tested and code reviewed, but this moment got out of attention. So, a quick v3.0.1 release was necessary.</p><p>After some time, it was noticed that Masternodes start to heavily invalidate each other. There is a complex issue with a known solution. So, another v3.0.2 release was necessary to “temporary” disable the Proof-of-Service functionality.</p><p>After that, the network had successfully operated for one week, and it was clear that there are essential things to cover for v3.1.0 release. However, the author left the project.</p><p>In general, for such complex project, it is really considered a success. It is especially a success in comparison to much simpler, but problematic changes other crypto projects have run into.</p><h3>Lessons learned</h3><ol><li>The first and the major epic was Genesis timestamp. It could be noticed in pre-release code review, it could be even simulated by launching an alternative mainnet with any different parameter (e.g. key), but happened the way it happened.</li><li>The second major issue was failure in Proof-of-Service connectivity on scale due to the max connections limit. It happened that the problem was not uncovered in testnet while unit tests could not reveal the problem. However, it could be foreseen and that is a mistake of the author. The default max connection limit also causes network clusterization with broken interconnection triggered by some chain splits and DoS protection events.</li><li>The third problem was caused by uneven staking weight what led to quite disruptive difficulty. The author has noticed the problem, but it was compensated by Migration contract DPoS staking as a ballast to ensure steady block times. So, the network had been stable for a week. After the author left the project and the ballast staking got disabled, many chain splits started to appear due to a combination of many factors, including too few number of stakers, uneven distribution of staking power, possible multiple nodes staking with the same account, the miner bug which may issue more than one block, DoS protection being triggered and the auto-collateral feature for MN owners which minimized total amount at stake.</li><li>It appeared that the miner may issue more than one block in some race condition when new transactions arrive when miner finds a block. The behavior for miner to continue mining was intentional to continue trying to find the best block even if someone submits a weaker one. That has to be extra protected to avoid DoS triggers.</li><li>Another block miner issue, is that it tends to go into wild split chains on large staking nodes when difficulty significantly drops because blocks get delayed for too long. It is possible to design a miner “blowoff valve” in case of serious difficulty fall and rapid block generation. In general, the miner should stop if network connectivity is lost, but that is not the case with network clusterization.</li><li>In some way, it can be considered a luck that Gen 2 snapshot was enough to fit into Gen 3 block size. The situation had been monitored for the last three months before the release. This approach may not fit other cryptos which may require to change peer-to-peer message handling for the migration block.</li><li>Proof-of-Stake Denial-of-Service protection was taken from Gen 2 almost with no changes. However, the change in difficulty handling and the issue in the miner have led to heavily split chains. The author understands what needs to be improved there, but DoS protection was simply disabled by Energi Core.</li><li>Energi Core have not faced the problem yet, but the author considers it is a good idea to deploy more GovernedProxy instances with predefined address in Genesis to reserve for future extensions in consensus. It was not done solely because of code freeze.</li><li>The Genesis contract creation transactions were not recorded, but that appears to be a problem for third-party systems like block explorers. Again, that was not fixed due to the code freeze.</li><li>The same applies to consensus transactions, but that was fixed before the code freeze.</li><li>Consensus block finalization transaction tracing appears to be a significant problem both for the Geth codebase and for Blockscout block explorer. One of the major problems is that Solidity does not re-use memory in loops and function calls. The memory grows with quadratic use of gas. A special tracing mode had to be implemented which records only meaningful call operations and related parts of stack, memory and storage.</li><li>It appears that lack of transparency in internal transactions and their effect on account balances and state in general can be considered as a nuance of Ethereum. The change in account balance is reflected only in the state. If that is done via some consensus logic then it cannot be detected any other way than via ineffective polling. At the same time, the standard tracing has shown its inability to handle a large gas transaction.</li><li>As anticipated, many exchanges and other third-party service providers were a bit confused by the migration instead of a well-know swap. Perhaps, the situation will change over time.</li></ol><p>The ten months of development have revealed too many internal Ethereum gotchas what possibly has brought the author close to authors of Ethereum itself in understanding of many fine details of its internal operation.</p><h3>Postmortem</h3><p>At the moment, Energi network has many flaws:<br>- Proof-of-Service has not been fixed and allows ghost Masternodes.<br>- The critical Denial-of-Service protection is disabled what opens floodgates. (<strong>UPD 2020–04–30: v3.0.6 just reverted to the original code and called that an accomplishment</strong>)<br>- The network is still unstable and some features like dynamic checkpoints are partially malfunctioning now (<strong>UPD 2020–04–30: a ready solution has been provided much before v3.0.6 release</strong>).<br>- Chain splits continue to happen. (<strong>UPD 2020–04–30: sorry, ballast staking got disabled</strong>)<br>- There seems to be a problem of network propagation because of network inter-connection failures caused by several mentioned aspects (<strong>UPD 2020–04–30: mitigation solution was also provided</strong>).<br>- Masternode owners and stakers have to constantly monitor their nodes.<br>- The account system has revealed a problem of staking power centralization which was hidden in Gen 2 UTXO days.<br>- Energi Core continues to manually “fix” the chain based on what they consider being the main one, what leads to thoughts that the large staking nodes of Energi leaders actually cause issues when they get “disconnected” from the rest of the network. (<strong>UPD 2020–04–30: yeah, looks like an artificial lesson for those exchanges which did not obey closed deposits</strong>).</p><p>At the moment, the author is just an ordinary coin owner <strong>(UPD 2020–04–30: well, Energi Core has blocked author’s coins)</strong> who is irritated by incompetence of Energi Core to handle the situation for more than three weeks already. As a little help to that, the ballast staking infrastructure has been restored. Its work is visible here: <a href="https://explorer.energi.network/address/0x0000000000000000000000000000000000000308/validations">https://explorer.energi.network/address/0x0000000000000000000000000000000000000308/validations</a> (<strong>UPD 2020–04–30: not anymore)</strong></p><p>This situation is quite appealing for Energi Core as it is a great excuse to direct all exchanges to close deposits, but leave withdrawals open to increase the demand by reducing supply on exchanges. Meanwhile, exchanges seem to accept manual deposits from Energi Core for market making purposes. That essentially creates a situation when Energi Core is making large amounts on selling NRG while legit coin owners are denied from such possibility. Can it be called any other way than a scam?</p><p><em>More details can be found in the summary at </em><a href="https://bitcointalk.org/index.php?topic=5244342.msg54348509#msg54348509"><em>BitcoinTalk</em></a><em>.</em></p><h3>Conclusion</h3><p>Energi Gen 3 is the first cryptocurrency to use a secure migration instead of a common very doubtful swap procedure. It also appears to be one of the first cryptocurrencies of the third generation. It has extraordinary complex upgradeable in-chain governance system with relatively simple and robust Proof-of-Stake solution.</p><p>Obviously, not everything went as smooth as it could. There is definitely room for improvements.</p><p>This article has not gone much into technical details. Many aspects are worth a dedicated article as long as this one. Please do not forget to “like” and tell what aspects you would want to get with in-depth details.</p><p><em>P.S. There is a paid troll factory called Energizers who publicly worship and defend the King and the company in social networks, so their appearance won’t be a surprise to the author.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f36d18587f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Technological Extremism]]></title>
            <link>https://medium.com/@andvgal/technological-extremism-d4c19e827154?source=rss-dd09b97f9700------2</link>
            <guid isPermaLink="false">https://medium.com/p/d4c19e827154</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[hype]]></category>
            <category><![CDATA[information-technology]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Andrey Galkin]]></dc:creator>
            <pubDate>Thu, 19 Apr 2018 14:14:44 GMT</pubDate>
            <atom:updated>2019-06-28T06:04:47.626Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*eRxMtL7mz-B244CExKWaDA.jpeg" /></figure><p>Some authors rise the problem of Hype Driven Development (Hype in further text), but the real danger comes from the second step —Technological Extremism.</p><p>By definition, extremism is a state of being in extreme point of some scale. Such position implies denial of any other point of view. That’s common in radical politics and religion. Many countries consider it as a crime when it directly touches human rights or public order.</p><h3>Becoming a technological extremist</h3><p>Very often, a Hype victim is mentally weak and cannot accept own delusion. Actually, it’s the first reason to get trapped.</p><p>The situation turns into blind advocacy of the Hype subject. Often, the victim-extremist understands own mistake, but still has to compensate that by falsely moving to the extreme point.</p><p>Typical sign is inability to withstand calm argumentation and participation in substantive discussion. There are well-known flame war tactics a typical extremist uses, sometimes, being supported by a group of the same kind.</p><h3>The root of problem</h3><p>The society is divided into leaders and followers. And, there are much more followers than leaders in general.</p><p>Leaders have critical thinking capability, but the followers don’t. Leaders study by themselves, but followers need to be tought. As consequence, leaders have chance to get protected by themselves, but followers get trapped in Hype and turn into technological extremists.</p><p>When SW development was not so widespread, it was full of leaders which could neutralize such radicalization. After masses of followers have streamed into the industry, we witness general sociological processes.</p><p>So, most of large software companies and foundations use well established and tested political and marketing technologies. Majority of developers and software houses became ordinary targets for manipulation.</p><p>The problem has significantly raised in software world due to quite low barrier for entrance, degrading maturity of its society in scope of rapid expansion and lack of competent supervision from funding businesses.</p><h3>How a Hype is born?</h3><p>Well, leaders do mistakes as well. Some of such mistakes turn into Hypes due to critical mass of followers or intentional popularization by business which cares only about economical aspect.</p><p>Such leaders become a different type of extremists — they get blinded by success and popularity. They lose ability of self-criticism, unbiased judgment and admitting own mistakes.</p><p>Some Hypes are intentional and cruel. Those are done by another type of leaders who disrespect human rights and treat society as herd to be utilized. <em>Hint: company Hypes-per-year metric.</em></p><h3>Is it really bad?</h3><p>If software company backing the Hype subject manages to seize meaningful market share and sustain the project then ordinary follower gets benefits due to the demand. Smaller software houses also win, if the Hype subject is “free” and there are plenty of adepts.</p><p>Sounds not so bad? Well, when Hitler was coming to power it wasn’t so bad for Germany either. However, it ended with troubles for the World and finally to Germany itself. Similar story happens with large corporations steering standardization bodies nowadays.</p><p>There is nothing bad in voluntary globalization in peace with others, but there is a significant problem with any form of extremism and related hate/disregard to others.</p><p>Unfortunately, many Hypes select a route of technology harassment as it’s more effective for explosive popularization. That’s either done intentionally through community leaders or through non-tolerant followers with psychological issues who need to compensate it somehow.</p><h3>Final words</h3><p>This article was inspired by periodically appearing seriously biased publications and user comments which sow hate and intolerance to alternative solutions and points of view.</p><p>If you do not want to become an extremist in technology then:</p><ol><li>Give any technology some years to settle before start using it for production.</li><li>Refrain from any disputes advocating some technology over any other unless your are the author.</li><li>Always learn some alternatives even if you are not going to use them.</li><li>Identify &amp; admit the issues in your selection, admit aspects which are better in the alternatives.</li></ol><p>Most likely, if you fail on the last one then you have already become a blind extremist.</p><p>Everything above is also true in any other area outside of software world.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d4c19e827154" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What’s wrong with JWT and token based authentication in general?]]></title>
            <link>https://medium.com/@andvgal/whats-wrong-with-jwt-and-token-based-authentication-in-general-c3d2776ea3b2?source=rss-dd09b97f9700------2</link>
            <guid isPermaLink="false">https://medium.com/p/c3d2776ea3b2</guid>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[stateless]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[jwt]]></category>
            <category><![CDATA[single-sign-on]]></category>
            <dc:creator><![CDATA[Andrey Galkin]]></dc:creator>
            <pubDate>Tue, 27 Feb 2018 16:10:47 GMT</pubDate>
            <atom:updated>2018-02-27T16:10:47.376Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*u-Hf7hyNGpwksqxo6PeePQ.png" /></figure><p>This article is inspired by known cases of JWT and tokens in general being misused both against stated designers’ assumptions and against security level tokens can provide. Also, there is intention to raise awareness of thinking people.</p><h3>General problem of communication through untrusted peers</h3><p>There is a very long history of seals, special paper, special ink and other past technology advancements for verification of document authenticity. And it was a constant race against “fraud technology”.</p><p>However, all that ended in online validation of all paper documents in any IT developed country. Finally, most paper documents have been abolished. Physical or electronic documents on hands become only secure handles/pointers to records in centralized databases.</p><h3>Token anatomy</h3><p>Token is an analogue of paper document issued in authority institution and to be accepted in other institution recognizing the authority.</p><p>The only way to control validity of document is expiration time and authority stamps. Some post-use checks can be implemented, but it does not prevent fraudulent document acceptance to happen. So, it does not prevent crime to happen. A typical counter-measure is to delay document processing for additional checks what is not acceptable in authentication case.</p><p>Token expiration time should be no more than 5–10 minutes to workaround logout problem.</p><p>Stamp security is ensured solely by “secure” keys &amp; cryptography technology used. Below is a dedicated section on such “security”.</p><p>In general, much more advanced client software is required:</p><ol><li>It has to manage prompt token renewal every N seconds.</li><li>It should avoid renewal request amplification due to multiple running instances (e.g. open browser tabs).</li><li>Avoid unneeded token refresh in idle.</li><li>Has to deal with refresh failures and “harmful” for processing user actions.</li></ol><h3>What about well-known X.509 PKI then?</h3><p>X.509 public key infrastructure can be seen as a “slow” and “advanced” token based authentication and vice-versa. For example, the following X.509 — JWT mapping is quite obvious:</p><ul><li>Certificate — Token,</li><li>Certification Authority (key) — signing and/or encrypting Key,</li><li>Common Name — Subject,</li><li>Issuer — as is,</li><li>Expiration Time &amp; Not Before — as is,</li><li>Serial Number — JWT ID,</li><li>Purpose — Audience,</li><li>Standardized Extensions — Public Claims,</li><li>Custom Extensions — Private Claims.</li></ul><p>Basically, X.509 PKI has the same known problems:</p><ul><li>CA private key security problem.</li><li>Problem of compromised certificate invalidation.</li><li>General weak cryptography problems.</li></ul><p>The following sub-technologies exist as a proof of X.509 shifting towards online validation:</p><ol><li>OCSP as generic online validation: <a href="https://tools.ietf.org/html/rfc6960">RFC 6960: X.509 Internet PKI — Online Certificate Status Protocol</a>, <a href="https://en.wikipedia.org/wiki/Online_Certificate_Status_Protocol">also on Wikipedia</a></li><li>DNS CAA record: <a href="https://tools.ietf.org/html/rfc6844">RFC 6844: DNS Certification Authority Authorization (CAA) Resource Record</a>, <a href="https://en.wikipedia.org/wiki/DNS_Certification_Authority_Authorization">also on Wikipedia</a></li></ol><p><em>Most likely, the related working group will come with some sort of online JWT/JWS validation as well. It’s only a matter of time.</em></p><h3>How secure the tokens are?</h3><p>You can find many theoretical claims on security of one or another cryptography technology. Let’s avoid theoretical speculations about the time when well-known attacks appear for HMAC/SHA-256, elliptic keys, AES-GCM or other types used in JWT/JWS. It’s just enough to keep in mind that widely used in the past RSA keys below 1024-bit, MD5 and SHA-1 hash functions are known to be weak now. By fact, it takes years to upgrade technology in field. There is also a rich history of token-based authentication and similar “encrypted cookie” epic vulnerability cases.</p><p>There are more serious problems in key management — incompetent and irresponsible personnel. It’s a type of security flaw when personnel does not need to be involved in crime, but unconsciously allows it to happen.</p><p>That’s fatal with symmetric keys. Use of asymmetric keys can improve the situation if third-party authentication provider with proper security practices is used. Implementation of proper <strong>automatic</strong> key rotation can be a good counter-measure as well.</p><p>However, another problem appears in poor security-related design &amp; coding of client and protected service implementations.</p><h3>What is the proper solution then?</h3><p><em>The statement below refer to Single Sign On (SSO) complexity. For a standalone service, it’s more simple.</em></p><ol><li>There must be a direct Service to AuthProvider communication channel.</li><li>Claims should be signed and the signature must be verified before further processing to prevent DoS attacks penetrating into backend infrastructure.</li><li>All claims must be verified online.</li><li>Result caching must be aware of session specifics with proper invalidation driven by AuthProvider.</li><li>Client fingerprints association is essential for token hijacking prevention.</li></ol><p>There is no performance or scalability barriers, if hands and head are in the right place.</p><h3>Conclusion</h3><p><strong>So, what is JWT and related technologies?</strong> It’s just a transport container for claims. It’s not a complete authentication solution. Online JWT/JWS validation protocol is essential.</p><p><strong>So, what is “stateless session”?</strong> Either unintelligent wordplay or simple idiocy. Leaving choice for authors from zero security company.</p><p><strong>So, what is “stateless” Token Based Authentication?</strong></p><ol><li>It’s a regression and replication of past authentication model mistakes.</li><li>It’s an aid for attackers as they need to concentrate only on token forgery as the only barrier for total control.</li><li>It’s just another recurring hype for thoughtless masses.</li></ol><p>The alternative is scalable and implementable “stateful” sessions as the only way to go for high security cases.</p><p>There are always many paths to achieve the same goal. The chosen path depends on competence, past experience and vision.</p><p>Copyright © 2018 Andrey Galkin</p><p><em>Originally published at </em><a href="https://futoin.tumblr.com/post/171346055952/whats-wrong-with-jwt-and-token-based"><em>futoin.tumblr.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c3d2776ea3b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why not to Promise?]]></title>
            <link>https://medium.com/@andvgal/why-not-to-promise-9ea87c1c7bfc?source=rss-dd09b97f9700------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ea87c1c7bfc</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[futoin]]></category>
            <category><![CDATA[software-architecture]]></category>
            <dc:creator><![CDATA[Andrey Galkin]]></dc:creator>
            <pubDate>Fri, 02 Feb 2018 11:19:28 GMT</pubDate>
            <atom:updated>2018-02-02T11:19:28.585Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s look at Futures and Promises in Node.js for example.</p><p>First of all, ECMAScript Promises are much better than plain callbacks. Promises and extra async/await sugar is a great primitive, but do they really fit as replacement of linear processes and threads in old school enterprise systems? No…</p><p>Let’s see another solution: <a href="https://futoin.org/docs/asyncsteps/">FutoIn AsyncSteps</a> — it mimics threads in thread-less async world. The examples are for Node.js, but the concept applies to any technology including C++, JVM, .Net, PHP, Ruby and others.</p><h3>What enterprise-grade Software Architect would want?</h3><h3>1. Linear execution of code</h3><blockquote><em>As a code reviewer, I want to see business logic the way which clearly mimics traditional “synchronous” code without complex unrelated constructs.</em></blockquote><p>The code must be clean and clearly linear in execution unless explicit loops are used.</p><p><strong>Traditional:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d1e0501be3b102d3012909d4917798dc/href">https://medium.com/media/d1e0501be3b102d3012909d4917798dc/href</a></iframe><p><strong>Promise:</strong></p><p>Welcome to “goto” days or poor if (result) { /* next step */ } else { /* error handler */ } style.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/094088a469718ef73adc8e88e056503f/href">https://medium.com/media/094088a469718ef73adc8e88e056503f/href</a></iframe><p><strong>FutoIn AsyncSteps:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/317c224d8eae74eaddd184ccc4f6e6a0/href">https://medium.com/media/317c224d8eae74eaddd184ccc4f6e6a0/href</a></iframe><h3>2. Control of execution thread</h3><blockquote><em>As SW Architect, I want to clearly plan maximum execution time for client requests to have predictable memory and CPU usage.</em></blockquote><p>Request processing must be cancellable from outside: due to timeout, client connection abort, shutdown, etc.</p><p><strong>Traditional:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dfc4b664bfe78451c1414c0b0a297303/href">https://medium.com/media/dfc4b664bfe78451c1414c0b0a297303/href</a></iframe><p><strong>Promise:</strong></p><p>There is no equivalent in Promise. That’s a fundamental issue in any Promise-based Node.js framework.</p><p><strong>FutoIn AsyncSteps:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ddee066eeefbd33839a85726aa51074e/href">https://medium.com/media/ddee066eeefbd33839a85726aa51074e/href</a></iframe><h3>3. Loops</h3><blockquote><em>As developer and code reviewer, I want to see a clean async loop code without dependency on additional libraries.</em></blockquote><p>Different cases of async loops must be supported in step mechanism. The code must depend only on async step interface, but not on its implementation.</p><p><strong>Traditional:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8317458fda8f22ec247aad2843a0dffd/href">https://medium.com/media/8317458fda8f22ec247aad2843a0dffd/href</a></iframe><p><strong>Promise:</strong></p><p>Overkill with Promise, only async/await helps. It gets even worse with break/continue and inner loops.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5277b31c048ebacc28a0b979c5391b27/href">https://medium.com/media/5277b31c048ebacc28a0b979c5391b27/href</a></iframe><p><strong>Integrated into AsyncSteps:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8788b9bd45712f45b86a225e65511c47/href">https://medium.com/media/8788b9bd45712f45b86a225e65511c47/href</a></iframe><h3>4. Thread local storage</h3><blockquote><em>As SW Architect of complex framework, I want to associate data with each request processing flow without global objects.</em></blockquote><p>Justification of its need is omitted here for the sake of the text length.</p><p><strong>Traditional:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5ac894bac6faa8dee2c98288f093027b/href">https://medium.com/media/5ac894bac6faa8dee2c98288f093027b/href</a></iframe><p><strong>Promise:</strong></p><p>Neither Promise nor async/await provides any support for that. Even emulation through WeakMap is not a solution as there is no value to be used as key reference. Each Promise is basically a standalone object.</p><p><strong>FutoIn AsyncSteps:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/36fdf856c52135f82cfed42e3841af08/href">https://medium.com/media/36fdf856c52135f82cfed42e3841af08/href</a></iframe><h3>5. Synchronization</h3><blockquote><em>As SW Architect, I want to use synchronization primitives on semantical level.</em></blockquote><p>It looks like, there is a strong believe among Node.js users that mutexes/semaphores are not applicable as there is no hardware race condition.</p><p>That would be true only if critical section does not involve async operations. Example with caching of expensive to compute value: we need to make sure that only one async program flow calculates the value on cache miss.</p><p><strong>Traditional:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9ece65c6b6af0749c631d6af9bee545d/href">https://medium.com/media/9ece65c6b6af0749c631d6af9bee545d/href</a></iframe><p><strong>Promise:</strong></p><p>It’s doable with a bit of mess, but there is no standard solution.</p><p><strong>FutoIn AsyncSteps:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a86aa9da2aff1ee8c1762d42745b54e1/href">https://medium.com/media/a86aa9da2aff1ee8c1762d42745b54e1/href</a></iframe><h3>Code readability comparison</h3><p>Let’s just compare a simple code which ensures persistent random UUID per value in abstract SQL database.</p><p><strong>Promise:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2b8ca3f99e967550ae484eb69c46f9cd/href">https://medium.com/media/2b8ca3f99e967550ae484eb69c46f9cd/href</a></iframe><p>In both Promise cases the error handlers are on level below than the scope they cover. It’s strictly against try-catch/begin-rescue tradition. Also, there is no clear visual identification of alternative error flow.</p><p><strong>FutoIn way:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2e178fa1452598ec9eecd56000243f40/href">https://medium.com/media/2e178fa1452598ec9eecd56000243f40/href</a></iframe><p>If the first variant is more readable to you then you have professional JS deformation.</p><h3>What about async/await ?</h3><p>Obviously, the code example is a bit cleaner as it’s difficult to compete with specially created language construct. It’s even more cleaner when you need to collect several async variables for later use.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a2f2126aebf9daccdcdbccf45b16d1e9/href">https://medium.com/media/a2f2126aebf9daccdcdbccf45b16d1e9/href</a></iframe><p>However, there are fundamental issues with “await” concept in general:</p><ol><li>It’s NOT visible — it’s easy to miss async operation while looking at code from high level.</li><li>It’s not natural for bare metal CPU processing flow:<br>- usually implemented with threading, context switching and possible synchronization what kills performance,<br>- bare metal coroutines have a long history of known problems.</li><li>Such abstraction moves young developers farther and farther from hardware what further degrades level of competence in the industry.<br>- in a few years, newcomers will not even understand internals of await and will not know anything about Futures and Promises.</li></ol><h3>Conclusion</h3><p>FutoIn AsyncSteps concept was formalized as specification in mid-2014. It has been running in production code for years already. It is stable and backward compatible even after 10 revisions.</p><p>SW development in Enterprise is known for it’s constancy: even JDK or C/C++ compiler version update is an incredible step. Many old school architects cannot see Node.js and mainstream async programming as acceptable solution for critical business logic.</p><p>Unfortunately, that still remains true, but Node.js has obviously lower entry level, it’s much more forgiving for mistakes and generally easier for deployment. Most important, it’s ideal for prototyping and requires less efforts than the traditional Enterprise stack.</p><p>FutoIn AsyncSteps concept may help SW Architects to look a different way at async programming for business logic.</p><p>For more info, please visit the official <a href="https://futoin.org/docs/asyncsteps/">FutoIn Guide</a> and check reference implementation at <a href="https://github.com/futoin/core-js-ri-asyncsteps">GitHub</a>.</p><p>Copyright © 2018 Andrey Galkin</p><p><em>Originally published at </em><a href="https://futoin.tumblr.com/post/170396463022/why-not-to-promise"><em>futoin.tumblr.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ea87c1c7bfc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>