Crypto miner Core Scientific (CORZQ) will purchase 27,000 bitcoin (BTC) mining servers from Bitmain, the world’s largest mining rig manufacturer, for $23.1 million in cash and $53.9 million in common stock, according to a press release. The deal comes a month after Core Scientific told a bankruptcy court that Bitmain, and separately Anchorage Digital, was likely to take equity in the struggling company.

Core Scientific, which filed for Chapter 11 bankruptcy protection last December due to declining sales and rising energy costs, is working toward its goal of emerging from bankruptcy as early as September. In a June hearing, the company told a federal judge overseeing the bankruptcy that it could reach a reorganization plan to repay its debt by Sept. 25. Once the industry’s largest miner, Texas-based Core Scientific has fallen precipitously in the current bear market, along with its largest competitors. On Friday, its shares were trading at $.69 cents, a fraction of its all-time high of over $14 a share in mid-2021, six months after it went public.

Bitmain has faced its own severe headwinds in the current climate, cutting prices from already depressed levels. But with bitcoin surging about 60% this year, the mining industry has inched up. Bitmain rigs account for more than three-quarters of computing power on the bitcoin network, a report by Coinmetrics found earlier this year.

Under the agreement, Bitmain will supply 27,000 Bitmain S19J XP 151 TH bitcoin mining servers to Core Scientific for the combination of cash and stock. The per share value of the stock will be determined by the reorganization plan that gets approved by a bankruptcy court during the fourth quarter, which is also when Core Scientific expects to receive the Bitmain machines.

Separate from the financing, Bitmain has executed a new hosting agreement for its mining business with Core Scientific.

“We look forward to deepening our strategic relationship with Core Scientific, our long-standing U.S.-based partner,” said Bitmain CEO Max Hua in the press release. “Their professionalism, integrity, and commitment to the success of their hosting customers and to the growth of the Bitcoin Network is unsurpassed in the industry.”