[{"data":1,"prerenderedAt":126},["ShallowReactive",2],{"\u002Fblog\u002F2026-04-15-changing-a-live-chains-proof-of-work-algorithm":3},{"id":4,"title":5,"archiveType":6,"body":7,"category":110,"contextDate":111,"cover":112,"coverAlt":113,"date":114,"description":115,"extension":116,"featured":117,"historicalDate":114,"historicalLabel":111,"meta":118,"navigation":119,"path":120,"publishedDate":111,"seo":121,"stem":122,"thumbnail":111,"workPeriod":123,"writtenDate":124,"__hash__":125},"blogs\u002Fblog\u002F2026-04-15-changing-a-live-chains-proof-of-work-algorithm.md","Changing a live chain's proof-of-work algorithm","retrospective",{"type":8,"value":9,"toc":104},"minimark",[10,22,25,36,45,48,53,60,66,72,78,82,85,88,91,95,98,101],[11,12,13,14,21],"p",{},"In 2019 Trivechain changed how its blocks are mined. Before the change, a miner proved work by hashing a block header with X11. After it, the network accepted only headers hashed with X16R. I worked on that hard fork as one of the chain's developers, and the code that keys the switch to a timestamp is still public in the ",[15,16,20],"a",{"href":17,"rel":18},"https:\u002F\u002Fgithub.com\u002Ftrivechain\u002Ftrivechain-core\u002Fcommit\u002F07f7f5ca7d6aa58d73b426b9478775d329b08b74",[19],"nofollow","trivechain-core repository",".",[11,23,24],{},"The switch itself is small. In simplified form, the function that hashes a block header reads:",[26,27,33],"pre",{"className":28,"code":30,"language":31,"meta":32},[29],"language-text","if header.time \u003C 1555872222:  hash the header with X11\notherwise:                    hash the header with X16R\n","text","",[34,35,30],"code",{"__ignoreMap":32},[11,37,38,39,44],{},"The number is a Unix timestamp: 18:43:42 UTC on 21 April 2019, or 2:43 in the morning of 22 April in Malaysia. In September 2019 I ",[15,40,43],{"href":41,"rel":42},"https:\u002F\u002Fgithub.com\u002Ftrivechain\u002Ftrivechain-core\u002Fcommit\u002F610f292b3d968e85376facab7d2683f254662d83",[19],"added X16Rv2"," to the client, with the mainnet switch set for 16:00 UTC on 1 October 2019. That is the same instant Ravencoin, where X16R began, moved to X16Rv2.",[11,46,47],{},"A few lines of code, then. Everything else about the change happened outside the repository.",[49,50,52],"h2",{"id":51},"what-the-switch-asks-of-each-party","What the switch asks of each party",[11,54,55,59],{},[56,57,58],"strong",{},"Nodes."," A node still running the old client hashes every new header with X11. After the switch those hashes do not meet the difficulty target, so the old node rejects each new block. If no miner stayed behind, it simply stops advancing. If some did, it follows their chain instead, a separate and far weaker one. Either way, its view of balances is no longer the network's. That applies to every node: wallets, masternodes and the block explorer alike.",[11,61,62,65],{},[56,63,64],{},"Pools."," I had built Trivechain's mining pool, so this is the side I can describe most concretely. A pool checks the shares its miners submit with the hash function the chain will apply to the block being built. With a switch keyed to time, that function depends on the timestamp inside each block template, not on the pool's own clock. Near the boundary, a pool that picks the wrong function either rewards work the chain will refuse or refuses work the chain would accept.",[11,67,68,71],{},[56,69,70],{},"Miners."," Hardware built for X11 cannot compute X16R. Anyone who had pointed X11 machines at the chain lost it as somewhere to point them, and everyone else needed new mining software before the deadline. That loss is the intent: X16R chains sixteen hash functions in an order set by the previous block's hash, to make specialised hardware harder to build. It is still a cost, and it falls on people who were securing the chain the day before.",[11,73,74,77],{},[56,75,76],{},"Exchanges."," An exchange credits deposits from its own node. If that node is not upgraded in time, deposits stop confirming, or are confirmed on a chain the rest of the network has left. This is why exchanges usually pause deposits and withdrawals around a fork, and why the notice they need is a date and a time in their own time zone, not a constant in a source file.",[49,79,81],{"id":80},"time-or-height","Time or height",[11,83,84],{},"Keying a switch to a timestamp has one clear advantage: it is a moment that can be announced, and everyone can put it in a calendar.",[11,86,87],{},"The cost is that a block's timestamp is written by whoever mined it, within limits the consensus rules allow. The algorithm a block must use depends on the time its miner put in the header, not on when the block actually reached the network. Close to the boundary, a block mined just after the announced moment can still be valid under the old algorithm if its timestamp says it came first.",[11,89,90],{},"A block height removes that ambiguity, because the switch happens at a fixed position in the chain whatever any clock says. In exchange, nobody can say in advance exactly when that height will arrive, since it moves with hashrate. Trivechain's later fork, in 2021, was set by height.",[49,92,94],{"id":93},"the-old-algorithm-never-leaves","The old algorithm never leaves",[11,96,97],{},"The part of a change like this that is easiest to miss is that nothing gets removed. A new node syncing from the first block still has to verify every block mined before the switch, so the client keeps X11 beside X16R permanently. After October 2019 it carried three paths. Every change to proof of work adds a rule for new blocks and keeps the old rule for old ones.",[11,99,100],{},"The 2.0 code also targeted one-minute blocks, where the earlier code had targeted two and a half minutes. In June 2019 I committed a fix for \"the problem where older blocks can't sync\". It made the difficulty calculation use the old two-and-a-half-minute spacing again for blocks below a fixed height. A parameter changed for the future had to be fenced off from the past, or a node checking history from the beginning would reject blocks that were valid when they were mined.",[11,102,103],{},"That is the lesson I took from working on these forks. A proof-of-work change is announced as a new algorithm. In the code it is another branch that every later version must carry. In practice it is a deadline that node operators, pool operators, miners and exchanges each have to meet, and most of the work is making sure they can.",{"title":32,"searchDepth":105,"depth":105,"links":106},2,[107,108,109],{"id":51,"depth":105,"text":52},{"id":80,"depth":105,"text":81},{"id":93,"depth":105,"text":94},"Blockchain",null,"\u002Fimg\u002Fblog-covers\u002F2026-04-15-changing-a-live-chains-proof-of-work-algorithm.webp","A chain of glass blocks that changes from cubes to hexagonal prisms at a block topped by a small clock.","2026-04-15","Trivechain moved from X11 to X16R in 2019 and to X16Rv2 that October, each switch keyed to a block's own timestamp. What a scheduled change like that asks of nodes, pools, miners and exchanges, and why the old algorithm never leaves the code.","md",false,{},true,"\u002Fblog\u002F2026-04-15-changing-a-live-chains-proof-of-work-algorithm",{"title":5,"description":115},"blog\u002F2026-04-15-changing-a-live-chains-proof-of-work-algorithm","2019","2026-11-07","uk3aaInVNsq0plasWhmEeLOqwMGhZ-AVMoM4AbuAnd8",1794838285286]