🚀 Introducing StateRift, a project I built for the NEAR hackathon.
While exploring NEAR smart contracts, something caught my attention: a transaction can appear successful even when an operation it triggered eventually fails.
NEAR uses asynchronous execution, meaning a contract can call another contract and receive the outcome later through a separate receipt.
But what happens when a contract records an operation as completed before confirming the external call succeeded?
If that call fails, the contract's recorded state could contradict what actually happened.
That's the problem I wanted to explore with StateRift.
StateRift is a developer workspace for understanding, investigating, and reproducing asynchronous smart contract failure scenarios on NEAR.
Here's what I've built.
1. Smart Contract Inspection
Upload a compiled ".wasm" contract to inspect its exported methods and NEAR host calls directly in your browser, without sending the file to a server.
2. Live Transaction Inspection
StateRift uses NEAR RPC to retrieve real transaction information, including execution and receipt details, helping developers investigate asynchronous operations beyond the initial transaction.
3. Fault Laboratory
The platform includes browser-based simulations demonstrating how asynchronous failures can affect contract behavior, particularly when a contract assumes an external operation succeeded before receiving confirmation.
4. Vulnerable vs. Protected Contracts
I created two contract implementations to demonstrate what happens when a remote operation fails.
In the vulnerable implementation, the contract marks an operation as completed before confirming the result.
Even when the remote call fails, it can record:
❌ "completed = 1"
The protected implementation handles the result before finalizing its state.
When the operation fails, it preserves:
✅ "completed = 0"
The lesson: initiating an asynchronous operation doesn't mean it succeeded.
5. Verified NEAR Sandbox Tests
Rather than relying entirely on simulations, I tested the vulnerable and protected examples using NEAR Sandbox.
The results were recorded through GitHub Actions, and StateRift displays the published evidence with links to the supporting execution records.
The actual Sandbox tests run through the project's testing workflow, not inside the browser.
6. Test Plans and Reports
StateRift includes a test-plan builder for organizing contract calls, expected outcomes, and assertions, with options to export plans for separate testing workflows.
It also includes a report reviewer for examining supported execution reports.
Why does this matter?
Smart contract security isn't only about exploits or unauthorized access. Reliability matters too.
A contract can have proper access controls and still behave incorrectly because an asynchronous failure wasn't handled as expected.
Sometimes, that problem isn't obvious from the initial transaction result.
StateRift is an early-stage developer tool, not an automatic vulnerability scanner or a replacement for a security audit.
My goal is to make these failures easier to understand, reproduce, and investigate, using practical examples backed by verifiable execution evidence.
I've attached a video walkthrough introducing StateRift and its main features.
Built for the NEAR Hackathon.
🌐 Explore StateRift:
https://t.co/BmIVxXGO9k
💻 Source code:
https://t.co/PaA9qDAKKJ
@NEARProtocol #NEARHackathon
I’m selling ad space on my home screen
→ 10 app spots
→ live leaderboard
→ $5 gets you on
Your apps get seen with a live link to the App Store
Bid for a spot 👇🏻
https://t.co/b9OXAL93nm
You can now gift Crates. 🎁🎧
Turn a song into a gift for someone special.
A little music. A personal touch. Something they’ll remember. ❤️
Try it → https://t.co/54F4HGLTm6
Yesterday I launched Cratey, and I didn’t expect the love.
Thank you to everyone who made a crate, retweeted, sent kind words, shared feedback, bought the unlock, or left a tip.
You made my passion project feel real, and I’m grateful for it. 💚🫶🏻