Mark Karpeles, the former head of what was for a time the world’s largest Bitcoin exchange, could wind up profiting handsomely from the portal’s ignominious 2014 collapse. Those who had owned Bitcoin on the site, on the other hand, stand to lose hundreds of millions of dollars generated by the cryptocurrency’s rising value.
Mt. Gox was one of the first convenient platforms for buying and selling Bitcoin online. Much like a bank, it retained direct control of the Bitcoin that belonged to many of its users. But it shut down in early 2014, claiming that hackers had stolen hundreds of thousands of its customers’ Bitcoins. Karpeles, in addition to being publicly condemned for mismanagement, faces criminal charges of embezzlement in the case.
Nonetheless, according to the Wall Street Journal, Karpeles could make in the neighborhood of $1 billion from the bankruptcy, thanks to Japanese law’s treatment of the Gox Bitcoins.
Get Data Sheet, Fortune’s technology newsletter.
Article 124 of Japan’s bankruptcy codes required that liabilities be registered at market values when proceedings were opened in April of 2014. At that point, one Bitcoin was worth roughly $500, but the price has since risen to more than $6,300. Mt. Gox later recovered some of the allegedly hacked cryptocurrency, and still holds 202,195 Bitcoins, now worth around $1.5 billion.
But at a Sept. 27 hearing, Karpeles’ lawyer argued that those market gains belonged primarily to the collapsed Bitcoin exchange, not to the users who lost them years ago. According to the Journal’s calculations, based on a higher Bitcoin price earlier this week, selling off Mt. Gox’s remaining Bitcoin holdings at today’s prices while paying back creditors at April 2014 prices could leave a $977 million surplus. According to the Journal, Karpeles’ holding company, Tibanne, owns about 88% of Mt. Gox, meaning he could pocket a large portion of those gains.
According to Fortune’s prior reporting,Japan’s bankruptcy code does allow for liabilities in a bankruptcy to be marked to market values, but the Journal reports that the period for creditors to dispute such decisions has ended.