<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: EzathDEV</title>
    <description>The latest articles on DEV Community by EzathDEV (@ezath).</description>
    <link>https://dev.to/ezath</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3983745%2F8eccae28-c21f-472c-99dc-1c44fc979c83.jpg</url>
      <title>DEV Community: EzathDEV</title>
      <link>https://dev.to/ezath</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ezath"/>
    <language>en</language>
    <item>
      <title>How we made our trading-signal track record tamper-evident with a SHA-256 hash chain</title>
      <dc:creator>EzathDEV</dc:creator>
      <pubDate>Sun, 14 Jun 2026 10:51:18 +0000</pubDate>
      <link>https://dev.to/ezath/how-we-made-our-trading-signal-track-record-tamper-evident-with-a-sha-256-hash-chain-1f00</link>
      <guid>https://dev.to/ezath/how-we-made-our-trading-signal-track-record-tamper-evident-with-a-sha-256-hash-chain-1f00</guid>
      <description>&lt;p&gt;A trading-signal service has an obvious trust problem: anyone can screenshot their winners and quietly delete their losers. "We're up 240% this year" is unfalsifiable marketing. We wanted our published track record to be something a skeptical stranger could &lt;em&gt;verify&lt;/em&gt; rather than take on faith — so we built it as an append-only, hash-chained log. Here's the design and why it works.&lt;/p&gt;

&lt;h2&gt;
  
  
  The threat model
&lt;/h2&gt;

&lt;p&gt;The thing we're defending against is &lt;strong&gt;us&lt;/strong&gt; — the operator editing history after the fact:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deleting a losing trade after it closes.&lt;/li&gt;
&lt;li&gt;Back-dating a winner we "would have" called.&lt;/li&gt;
&lt;li&gt;Quietly changing an entry or exit price once the real one looks bad.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A plain database table defends against none of that, because the operator owns the database. So the integrity guarantee has to live in something the operator can't silently rewrite.&lt;/p&gt;

&lt;h2&gt;
  
  
  The hash chain
&lt;/h2&gt;

&lt;p&gt;Every signal, when it's published, becomes a record:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"seq"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1184&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"symbol"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"BTCUSDT"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"side"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"long"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"entry"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;64120.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"stop"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;62800.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"target"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;67000.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"published_at"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2026-06-12T09:31:00Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"prev_hash"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"9f2c..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"hash"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1a7e..."&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;hash&lt;/code&gt; of each record is &lt;code&gt;SHA-256(prev_hash + canonical_json(payload))&lt;/code&gt;. Because every record commits to the one before it, you can't change record 1000 without recomputing 1001, 1002, ... all the way to the head. It's the same primitive a blockchain uses, minus the distributed consensus we don't need.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prev_hash&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;canonical_json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;        &lt;span class="c1"&gt;# sorted keys, no whitespace
&lt;/span&gt;    &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;prev_hash&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;prev_hash&lt;/span&gt;
    &lt;span class="n"&gt;digest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;sha256&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;prev_hash&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;()).&lt;/span&gt;&lt;span class="nf"&gt;hexdigest&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;record&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hash&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;digest&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Making it externally checkable
&lt;/h2&gt;

&lt;p&gt;A hash chain only the operator can see is just a fancy internal log. Two things make it actually falsifiable by an outsider:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The whole chain is public.&lt;/strong&gt; Anyone can fetch every record and recompute the chain themselves — pull the JSON, recompute each &lt;code&gt;hash&lt;/code&gt;, assert it matches the next record's &lt;code&gt;prev_hash&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The head is committed at the time of the call.&lt;/strong&gt; Each signal is timestamped and pushed to subscribers the moment it opens, &lt;em&gt;before&lt;/em&gt; the outcome is known. The entry, stop and target are locked in before price moves — so you can't retro-fit a winner.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If we ever edited a past trade, the recomputed chain would diverge from any copy someone saved earlier, and the tamper would be obvious.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it does and doesn't prove
&lt;/h2&gt;

&lt;p&gt;It does &lt;strong&gt;not&lt;/strong&gt; prove we're profitable — a hash chain will faithfully record a terrible strategy. What it proves is narrower and, I'd argue, more important for trust: &lt;strong&gt;the record you're looking at is the same record we committed to at the time, losses included.&lt;/strong&gt; No survivorship editing.&lt;/p&gt;

&lt;p&gt;One gotcha worth flagging if you build something similar: &lt;strong&gt;float formatting in the canonical form.&lt;/strong&gt; &lt;code&gt;64120.0&lt;/code&gt; vs &lt;code&gt;64120&lt;/code&gt; vs &lt;code&gt;6.412e4&lt;/code&gt; all hash differently, so you have to pin a single serialization (we normalize to fixed decimals before hashing) or the chain breaks for innocent reasons.&lt;/p&gt;

&lt;p&gt;The live, recomputable version is here: &lt;a href="https://ezath.com/track-record" rel="noopener noreferrer"&gt;ezath.com/track-record&lt;/a&gt; — the verify button runs the recomputation client-side, so you're not trusting our word for the result.&lt;/p&gt;

&lt;p&gt;Happy to dig into the canonicalization edge cases in the comments.&lt;/p&gt;

</description>
      <category>cryptography</category>
      <category>webdev</category>
      <category>showdev</category>
      <category>security</category>
    </item>
  </channel>
</rss>
