Blog #1 established it: coordination gets you to demo. Governance gets you to production. Blog #2 showed you how Prolog rules are deterministic, testable, and composable. But a rule sitting in a file is just philosophy. A Zone is where that rule becomes law.
A Zone is a jurisdictional embodiment — a specific instance of governance with resources, operators, and a Prolog regime that decides everything. This tutorial walks you through building one.
Let's build.
Part 1: What Is a Zone? The 2-of-3 Formation
Zones are defined by three orthogonal dimensions. A Zone exists when you have defined all three explicitly.
Zone-Hub coordinates the setup — it's the single entry point that ensures all three dimensions are consistent before anything goes live. The key insight: you define all three explicitly.
The governance rules that enforce this? That's your Prolog regime, stored on-chain via Law-Stone.
Part 2: Define Your Governance Regime in Prolog
Let's build a concrete zone: Multi-Agent Research Data Sharing.
The scenario: Two research institutes (Institute A and Institute B) share a medical dataset. A third party (Research Consortium) wants to run a federated analysis without centralizing the data. The rules must enforce:
- Institute A can only see queries, not raw data
- Institute B must approve before computation runs
- Consortium pays 60% to institutes (30% each), 40% to orchestration
- Results can only be stored if both institutes consent
Here's the regime:
% --- ENTITIES (Facts) ---
% Institutes
institute(institute_a).
institute(institute_b).
% Datasets they own
owns_dataset(institute_a, dataset_medical_v1).
owns_dataset(institute_b, dataset_medical_v1).
% Operators (who can do what)
operator(consortium, research).
operator(orchestrator, execution_service).
% Permissions
can_read_metadata(institute_a, dataset_medical_v1).
can_read_metadata(institute_b, dataset_medical_v1).
can_execute_query(consortium, research).
can_report_results(consortium, research).
% --- RULES (Governance Logic) ---
% Rule 1: Can access dataset?
can_access(Operator, Dataset) :-
operator(Operator, research),
can_execute_query(Operator, research),
\+ blacklisted(Operator).
% Rule 2: Fee structure
payment_split(Dataset, consortium, 40) :-
owns_dataset(_, Dataset).
payment_split(Dataset, institute_a, 30) :-
owns_dataset(institute_a, Dataset).
payment_split(Dataset, institute_b, 30) :-
owns_dataset(institute_b, Dataset).
% Rule 3: Both institutes must consent to results
can_store_results(Query) :-
consents(institute_a, Query),
consents(institute_b, Query),
\+ disputed(Query).
% Approved consents
consents(institute_a, query_federated_v1).
consents(institute_b, query_federated_v1).
This is your zone's constitutional document. Short, readable, deterministic. Given a query, the Axone blockchain evaluates every rule in <1ms. No 7-day voting rounds. No deadlocks.
Part 3: Deploy Your Law-Stone Contract
Save your Prolog regime to a file: medical_data_zone.pl
Now instantiate a Law-Stone contract on the Axone testnet.
Testnet Setup
# Install okp4d CLI
# https://docs.axone.xyz/tutorials/cli-1
# Create or import a wallet
okp4d keys add my-zone-operator --recover
# Fund it from the faucet
# https://faucet.okp4.network/
Encode Your Prolog to Base64
cat medical_data_zone.pl | base64 | tr -d '\n\r'
Copy the output. You'll use it in the instantiation step.
Instantiate Law-Stone (CODE_ID=5)
Store your rules via objectarium — the immutable data store — then instantiate Law-Stone with CODE_ID=5 on testnet:
okp4d tx wasm instantiate 5 \
--from my-zone-operator \
--label "medical-data-zone-$(date +%s)" \
--no-admin \
--chain-id okp4-nemeton-1 \
--gas 1000000 \
--node https://api.testnet.okp4.network:443/rpc \
"{\"program\":\"$(cat medical_data_zone.pl | base64 | tr -d '\n\r')\", \"storage_address\": \"okp41lppz4x9dtmccek2m6cezjlwwzup6pdqrkvxjpk95806c3dewgrfq602kgx\"}"
The blockchain returns a contract address. Save it — you'll query it constantly. Example response:
{
"logs": [{
"events": [{
"type": "instantiate",
"attributes": [{
"key": "_contract_address",
"value": "okp41dey5a35ssvfulh2xud3nkwk423fp0t40nga4a8xykx9frmhm6jpqne0alf"
}]
}]
}]
}
Your Law-Stone contract is now live, immutable, and ready to evaluate.
Part 4: Test Your Zone Against Sample Proposals
The power of Prolog: test before deployment. Test locally first, then against real blockchain state.
Local SWI-Prolog Unit Tests
% Include your regime + unit tests
:- begin_tests(medical_zone_rules).
test(consortium_can_access) :-
can_access(consortium, dataset_medical_v1).
test(payment_split_correct) :-
payment_split(dataset_medical_v1, consortium, 40),
payment_split(dataset_medical_v1, institute_a, 30),
payment_split(dataset_medical_v1, institute_b, 30).
test(results_require_both_consents) :-
can_store_results(query_federated_v1).
test(blacklisted_operator_blocked) :-
assertz(blacklisted(bad_actor)),
\+ can_access(bad_actor, dataset_medical_v1),
retractall(blacklisted(bad_actor)).
:- end_tests(medical_zone_rules).
swipl -g "run_tests" test_medical_zone.pl
On-Chain Queries (Your Deployed Law-Stone)
LAWSTONE_ADDR="okp41dey5a35ssvfulh2xud3nkwk423fp0t40nga4a8xykx9frmhm6jpqne0alf"
# Test: Can consortium access the dataset?
okp4d query wasm contract-state smart $LAWSTONE_ADDR \
--node https://api.testnet.okp4.network:443/rpc \
"{\"ask\": {\"query\": \"can_access(consortium, dataset_medical_v1).\"}}" \
--output json | jq '.answer.success'
# Test: Payment split for consortium?
okp4d query wasm contract-state smart $LAWSTONE_ADDR \
--node https://api.testnet.okp4.network:443/rpc \
"{\"ask\": {\"query\": \"payment_split(dataset_medical_v1, consortium, X).\"}}" \
--output json | jq '.answer.results[0].substitutions'
# Test: Can results be stored?
okp4d query wasm contract-state smart $LAWSTONE_ADDR \
--node https://api.testnet.okp4.network:443/rpc \
"{\"ask\": {\"query\": \"can_store_results(query_federated_v1).\"}}" \
--output json | jq '.answer.success'
Your rules executed in <1ms on-chain. BFT-validated. No voting rounds. No delays. This is deterministic governance at scale.
Part 5: Connect Your Zone Via IBC (Multi-Chain Governance)
Axone is built on Cosmos. IBC (Inter-Blockchain Communication) means your Zone can interact with other chains — Osmosis, Stargaze, any IBC-enabled chain. Because zones sometimes span multiple chains. Institute A's data might live on Cosmos Hub. Institute B's data on Osmosis. The governance rules? On Axone.
Extend Your Prolog with IBC-Aware Rules
% Data can flow across chains if fee is locked
can_transfer_data_ibc(Source, Destination, Dataset) :-
can_access(Source, Dataset),
ibc_channel_open(Source, Destination),
escrow_locked(Dataset, Source).
% Open IBC channels (established by relayers)
ibc_channel_open(axone, osmosis).
ibc_channel_open(axone, cosmos_hub).
% Check if payment is escrowed on source chain
escrow_locked(Dataset, Chain) :-
bank_balances(escrow_address(Dataset, Chain), [uaxone-Amount]),
compare(>, Amount, 100000000). % >100 AXONE locked
Query From Another Chain
# From Osmosis, ask Axone: can we access this dataset?
osmosisd query wasm contract-state smart \
$(IBC_CONTRACT_ADDRESS) \
"{\"ask\": {\"query\": \"can_transfer_data_ibc(osmosis, axone, dataset_medical_v1).\"}}"
The result: atomic governance across chains. No wrapped tokens. No intermediaries. Just Prolog rules enforced by validators across 3 blockchains in parallel.
This is where single-chain governance hits its limits. Zone-based IBC governance is why Axone exists.
What's Next?
You now have a live governance zone. Here's what teams typically add next:
Add Real Operators
operator(okp416rry8kjuzpxezhf4g4lvjk67mkjc95lterek2u, institute_a).
operator(osmo1abc123..., institute_b).
Implement Dynamic Consent via Cognitarium
% Instead of hardcoded facts, query Cognitarium (RDF store)
consents(Institute, Query) :-
cognitarium_query(consent_fact(Institute, Query)).
Add Appeal Mechanisms
can_override_decision(Governor, Decision) :-
governor_role(Governor),
appeal_filed(Decision),
\+ appeal_deadline_expired(Decision).
Connect Pactum for payments: The Zone defines who can do what. Pactum defines who gets paid for doing it. Together, they form a complete governance + settlement system. See the whitepaper for the full architecture.
Why This Matters
Try It
The full code examples are in the Axone GitHub. The Law-Stone tutorial is at docs.axone.xyz.
Next: Join the governance forum. This is where builders discuss regime design, argue about rules, and coordinate zone launches. Commonwealth Governance Forum (Axone).
Governance at scale means rules that execute, not rules that debate. Build your first zone today.
CLI commands reference the Axone testnet (okp4-nemeton-1). CODE_ID=5 and objectarium address are testnet values. See docs.axone.xyz for current mainnet values.