Inspiration
Why would a trucker ask a customer for exactly $180.42 out of a $500 fuel surcharge? In one of our sample loads, that is the smallest early advance that delivers $175 after the customer’s fee and lets both freight invoices pay in full across all six tested fuel budgets. Finding that number takes more than a loan quote. It takes the freight contract, the next fuel stop, and the amount a vault can actually release. We built FreightOS to make that calculation and carry the driver’s decision through to payment.
What it does
FreightOS prices the driver’s available cash, invoice advances, Kamino vault shares, SOL-backed USDC loans, and eligible Orca swaps against the same payment deadline. It can combine sources and leave money available for the next stop. In the $500 surcharge example, taking only $180.42 early costs $8.91 in total modeled fees on the $745 bill. Taking the whole surcharge early costs $17.68. Waiting costs $13.45. The driver sees the amount to request, the fee, the payee, and the balance left for the road.
How we built it
Gemini Prediction Markets supplies evidence for two different decisions. For fuel, we validate WTI contracts against their shared expiry, settlement index, and outcomes. We convert the oil scenarios into trip budgets using gallons and an explicit diesel-price assumption. The protection planner also reads the recorded bids and asks. A $93 oil contract can pay only when the $90 contract pays, so the engine enforces that relationship when bounding the value of a hedge. It counts a payout toward fuel only if the money arrives in time. The planner evaluates these hypothetical positions using recorded books.
Our Python mixed-integer optimizer chooses invoice terms once, before the driver knows the fuel bill. It then sizes reserve and credit draws separately in each of the six budgets. Among the choices that meet every deadline, it minimizes the largest extra fee relative to knowing the outcome in advance. For execution, our Rust program on Solana records the approved vendor, exact USDC amount, maximum vault shares the driver will spend, and a hash of the decision. It inspects the transaction’s token-account initialization, Kamino redemption, and SPL transfer before marking the bill paid.
Challenges we ran into
An apparently sufficient vault position can redeem a cent short after share rounding. We simulate the deposit and withdrawal before quoting a payment. We also tested a $190 stop that preserved $10.58 for a later fill, redeemed $19.44 from Kamino, and borrowed $170.56 through Kamino Lend. In a scaled public Devnet simulation, both sources funded one vendor transfer through an initially empty account. Raising the payment by 0.000001 test USDC made the transaction fail and both funding movements roll back.
Accomplishments that we're proud of
We finalized a separate customer offer on public Solana Devnet. The customer and carrier co-signed one transaction. The customer contributed 1.75 test USDC, Kamino supplied 5.70, and the vendor received exactly 7.45. Each test cent represented $1 of the modeled bill. A second finalized example follows a Kamino loan through vendor payment, repayment, and release of the driver’s collateral. Inspect the finalized customer payment
We also isolated the value of the funding decision. Across 128 synthetic loads, we gave a simpler strategy the same products and let it pick the cheaper of two complete plans. FreightOS could also mix reserve funds with credit. That lowered modeled fees on 41 loads, tied on 87, and saved $738.82 in total.
What we learned
The tightest collateral constraint can occur before payday. We reconstructed nine overlapping 30-day windows from 211 verified Gemini SOL settlement marks. In one replay, a $35.23 loan reached 72.73% loan-to-value on day 25. Collecting just $1.32 more freight early reduced the loan to $33.91 and kept it within the driver’s 70% limit at every tested observation. Changing a customer payment can preserve a collateral cushion weeks later. FreightOS can price that trade because the invoice and the loan share a calendar.
What's next for FreightOS
We want the engine to replan a whole route when a receipt arrives late or a stop changes. It would preserve signed payments and accepted invoice terms, then jointly resize the remaining reserve withdrawals, SOL sales, and loans. Onchain, we want a single authorization to cap new debt, cap SOL spent through Orca, and expire stale quotes. If liquidity changes between review and signature, those limits should make the transaction fail atomically and give the driver a fresh price.