Ōkinoko Escrow – Trust Made Simple on VSC (incl. new Smart Contract Web Interface)

in HiveDevs2 days ago (edited)

TL;DR:
Via Ōkinoko Terminal, you can now lock HIVE or HBD in the Ōkinoko Escrow contract on VSC.

The funds are only released when both sides agree - and if they don't, a third person can step in to decide.

No more "trust me, I'll send it later" moments 😅! This contract takes care of that!

(There's a real example below if that still sounds a bit too abstract for you.)


I've been a bit quiet here lately... Not because I was lazy, but because I got lost in a bunch of fun side quests: Learning Go, digging through the VSC SDK, building a UI for smart contracts (more on that later), organizing HiveOpenDays in Alicante next year, and juggling everyday life. Garden stuff, fixing the camper (finally running again!), and some other things I do not wanna talk about here (yet).

Anyway, today I'm happy to finally show you something real: Ōkinoko Escrow aka vsc1BXMmApNdY2nAPNWTVmTm6Ufi88dtx66ESs on vsc, which is the first production-ready contract I've deployed on the VSC blockchain. (And the first production-ready contract overall on VSC :P ) Today I made a big improvement in gas costs and the contract even got verified now! So you can be sure which source code the contract is actually running 🥳

If you're wondering about the name Ōkinoko: it's the umbrella for all my future VSC/Hive tools and contracts. The name came up in a brainstorming session with @minigunner and @artakush for another project that we had to cancel, but I kept the name. I just liked how it sounded. Short, fun, and easy to remember.


Why Escrow?

Escrow is one of those simple but powerful concepts that actually makes sense in the blockchain world:

  • It locks funds until both sides agree that things are done.
  • It cuts out middlemen and avoids "just trust me" moments.
  • It enables fair peer-to-peer deals, freelance jobs, or services without having to know each other.

Many blockchains have something like this built in, including Hive. But Hive's escrow is not something we documented. So, I thought: why not make a version that's clean, simple, and works right on VSC?

This isn't just a "cool dev thing." By putting Ōkinoko Escrow on-chain, you get:

  • Less trust, more fairness: no middleman, no manual transfers.
  • Built-in dispute resolution: if there's a problem, your arbitrator is already defined.
  • Easy integration: other apps can plug escrow in (for NFTs, services, micro-gigs, etc.).
  • Transparency: everything is verifiable on-chain.
  • Reputation for arbitrators: decisions are public, so good behavior matters.

In short: it makes it easier to trade, collaborate, and get paid safely on VSC.


Quick heads-up

If you want to try the contract yourself, make sure you've got enough HBD in your VSC wallet(s). On VSC, your HBD balance slowly generates RC (resource credits) over 5 days. On the UIs these are shown in thousands by the way.

  • Creating an escrow costs about 5k RC
  • Sending the first decision (without resolution) 1.2k RC
  • The final decision including the release of funds costs around 8k RC

I've tried to make it as light as possible, but right now it’s still a bit pricey in my opinion. The team is busy balancing costs behind the scenes, so this could (hopefully should) improve later on. Or maybe I will release another version that screws all the json and handles updates differently.

If your call fails, it's most likely due to missing RC - your HBD is safe, only the RC gets consumed. And if the transaction fails no deposite will be made at all! So don't worry, feel free to experiment as long as you don't need your RC elsewhere.


How It Works

Let's keep it simple. Each escrow is a small instance that stores a few things:

{
  "id": 42,
  "n": "Design Project",
  "f": {"a": "hive:client1", "ag": null, dTx: "a_decide tx of f"},
  "t": {"a": "hive:freelancer2", "ag": true, dTx: "a_decide tx of t"},
  "arb": {"a": "hive:escrowhub", "ag": true, dTx: "a_decide tx of arb"},
  "am": 100.0,
  "as": "hbd",
  "cl": true,
  "o": "r"
}
FieldAliasMeaning
ID-Unique number of the escrow
nnameShort description (up to 100 chars)
fromfThe sender (who funds it) and their decision
ttoThe receiver and their decision
arbarbitratorThe arbitrator (neutral third party) and their decision
am / asamount / assetFunds locked (currently HIVE or HBD)
clclosedTrue when finished
ooutcomeEither r (release) or r (refund)

Core Actions

Two main actions, aka "exported contract functions", exist:

ActionPurposeInputResult
e_createCreate a new escrow{ name, to, arb } + transfer intentLocks funds, returns escrow ID
e_decideSubmit your decision{ id, d } (true = release, false = refund)Stores your vote, closes when 2 agree

You can also query an escrow:

e_get → returns full details (metadata, decisions, outcome).

Decision Logic

Each party (sender, receiver, arbitrator) can vote and change their vote until the contract closes.

  • 2x true → funds go to receiver.
  • 2x false → funds go back to sender.

That's it. Straightforward majority rule.

Events

To make it easy for UIs or explorers to follow what's going on, the contract sends events in the contract logs.

An escrow got created:

{
  "t": "cr",
  "att": {
    "id": "42",
    "f": "hive:client1",
    "t": "hive:freelancer2",
    "arb": "hive:escrowhub",
    "am": "100.000",
    "as": "hbd"
  },
  "tx":"txId of creation"
}

A decision was made by one of the parties:

{
  "type": "de",
  "att": {
    "id": "42",
    "r": "To",
    "a": "hive:freelancer2",
    "d": "true"
  },
  "tx":"txId of decision"
}

An escrow was closed:

{
  "t": "cl",
  "att": {
    "id": "42",
    "o": "r"
  },
  "tx":"txId of resolving decision"
}

Right now, there is no official VSC indexer, but I know that they have something in the making, so it will be much, much easier for UIs to integrate aggregated data.


Real-Life Example

Let's say Alice hires Bob for a design job. Carol is the arbitrator.

1. Alice creates the escrow

{
  "action": "e_create",
  "payload": "{\"name\":\"Website Design\",\"to\":\"hive:bob\",\"arb\":\"hive:carol\"}",
  "intents": [{
    "type": "transfer.allow",
    "args": { "limit": "100", "token": "HBD" }
  }]
}

This locks 100 HBD and gives an ID (say 123).

2. Bob finishes work and votes "true"

{"action":"e_decide","payload":"{\"id\":123,\"d\":true}"}

He says: "I did my job - release the funds."

The outcome is still "pending" because there is no majority vote.

3. Alice disagrees

{"action":"e_decide","payload":"{\"id\":123,\"d\":false}"}

She says: Nope, make it all purple instead green.

The outcome keeps being "pending" because there is still no majority vote yet.

4. Carol checks and votes "true"

{"action":"e_decide","payload":"{\"id\":123,\"d\":true}"}

She says: Bob fulfilled everything Carol asked for! She asked for green and now wants purple...

Now two people agree. The contract releases 100 HBD to Bob. Done.
If Carol had chosen false, the refund would have gone to Alice.

The outcome is now "r" and closed is now "true".

5. Anyone can check the status at any time

{"action":"e_get","payload":"\"123\""}

Result:

{
  "id": 123,
  "n": "Website Design",
  "f": { "a": "hive:alice", "ag": false, "dTx":"..." },
  "t": { "a": "hive:bob", "ag": true, "dTx":"..." },
  "arb": { "a": "hive:carol", "ag": true, "dTx":"..." },
  "am": 100,
  "as": "hbd",
  "cl": true,
  "o": "r"
}

Don't Want to Mess With JSON?

Yeah, same here. Working with SDK calls directly is not fun. That is why I built the Ōkinoko Terminal. This is a web interface (beta!) that lets you run smart contracts on VSC with proper forms and logs - no manual JSON typing. It's built with Aioha React UI by @techcoderx.

Important note: Right now, it has some issues on mobile with HiveAuth so - if you are on mobile: Use the Keychain Browser for now. If you are on desktop, you can use whatever you want. But always keep your RC in mind as written above.

1. Login & Landing

It looks a bit like a 90s cyberpunk console - guilty as charged, I love Cyberpunk 2077 and I am a 90s kid. You connect your Hive wallet via a Aioha premade popup (needs your active key for running VSC contract functions of course). Once connected, hit Enter ▶.

2. Pick a Contract

Select one of the supported contracts. (pick the one without (legacy) - the screenshots don't match up 100%) You'll see all functions and details listed:

After reading carefully you can continue to the actual form by hitting Next ▶

3. Fill in the Function Parameters

You just fill out the fields (like name, to, amount and arb) and move on.
Note: Hive addresses are prefixed by "hive:" on VSC - the dialog helps you with that tho.

4. Send the Transaction

Click Send ▶, sign it, and wait. Execution on Hive itself is fast, while VSC may take up to a minute right now. The logs update in real time, and a green line means it worked!

In the example, Return: 5 means the escrow with the id 5 was created and now waits for decisions.

The same goes for all the other functions and all upcoming contracts.



6. Remarks & Future

RC Limits: Right now all transactions on Ōkinoko Terminal contain a hard coded RC limit of 10'000. I will change that in future so you can overwrite this default value.

Error Output: If your call did not succeed you can not see the logs right now. This is due to limitations of the graphql endpoint. In that case switch over to the contract page and check the tab "Outputs" over there. there you can find the error message related to your transaction.

Account Balance / RC Display: Right now you need to go to https://altera.vsc.eco or https://vsc.techcoderx.com to check your balances. I will include that in the terminal as well in future and will add additional checks before you run a contract function.


That's it!

Ōkinoko Escrow and Ōkinoko Terminal are both live, simple to use, and a small but important step for fair deals on-chain. Big thanks to @techcoderx for his last-minute help with the contract verifier and for the Aioha package, of course! Also big thanks to @vaultec for his valueable input over the past couple of days.

Now go try it out (preferably with small amounts first and with a proper HBD balance on vsc 😉) and don't forget to leave me some feedback. I would love to improve the terminal or contract in the near future!


Oh and if you've built your own contract on VSC, ping me or drop a comment! I'm happy to add it to Ōkinoko Terminal.


Sort:  

creating an escrow used about 8 RC, and sending a decision around 5 RC.

Every VSC contract call will have a floor cost of 100 RC regardless of gas used and transaction status.

There are plans for calling contracts directly on VSC Blocks frontend as well. The terminal looks really nice though, other than the missing HiveAuth and Ledger icons which I probably need to look into.

Yeah I assumed that contract will be callable on VSC Blocks and even on altera but I was not able to wait any longer haha
So the numbers on altera are not actual RC but kRC? It is all a bit confusing ^^

This is awesome work dude... Quite useful too. I've been thinking for a while of the possibility of a p2p dex existing in Ecuador (where I live) - Something like this would be at the heartbeat of such an idea.

Thank you <3 Yes it is super useful for real-world-applications and kind of a building block in my opinion. I have some other contracts that still need some polishing and at least one of them is super useful for the general public including Hive. But I can't spoil them now :P

This post has been manually curated by @bhattg from Indiaunited community. Join us on our Discord Server.

Do you know that you can earn a passive income by delegating to @indiaunited. We share more than 100 % of the curation rewards with the delegators in the form of IUC tokens. HP delegators and IUC token holders also get upto 20% additional vote weight.

Here are some handy links for delegations: 100HP, 250HP, 500HP, 1000HP.

image.png

100% of the rewards from this comment goes to the curator for their manual curation efforts. Please encourage the curator @bhattg by upvoting this comment and support the community by voting the posts made by @indiaunited.

Great to see that the first use cases of VSC are out there!
Please keep them coming! 🍻