Skip to main content

Smart contract procedure engine: the vein through which Pulse flows

Project description

vein — Smart Contract Procedure Engine

The vein (Ader) through which Pulse's logic flows. Deterministic, verifiable smart contract stored procedures as Proof-of-Useful-Work (PoUW) jobs.

Architecture

Pulse (Hartslag)  →  triggers, clock, state-machine events
   ↓
Vein (Ader)  →  channels logic & data, executes smart contract procedures
   ↓
Settlement  →  verifiable, deterministic results settle in the ledger

Design

vein provides:

  • SmartContractProcedureJob — specification for calling a stored procedure on a contract
  • ExecutionContext — deterministic sandbox for pure procedure execution
  • Expression evaluator — support for simple logic, arithmetic, conditionals (MVP)
  • Bytecode format — extensible path to EVM/Solidity compatibility
  • Fabric integration — contracts as weaved records in the Knitweb P2P graph
  • PoUW settlement — uniform (deterministic) verification policy for reward settlement

Modules

src/knitweb_vein/
  __init__.py
  contract.py          — SmartContractProcedureJob, ContractProof, execute/verify
  executor.py          — ExecutionContext, expression evaluator, contract resolution
  items.py             — SmartContractRecord, ProcedureSpec (Fabric weaveable)

Example

from knitweb_vein import SmartContractProcedureJob, execute, verify

# Define a contract (stored in Fabric, weaved via Pulse)
contract = {
    "kind": "smart-contract",
    "name": "SettlementVault",
    "originator": pub_key,
    "procedures": {
        "transfer": {
            "name": "transfer",
            "params": {"from": "str", "to": "str", "amount": "int"},
            "body": {
                "type": "dict",
                "fields": {
                    "sender": {"type": "identity", "input": "from"},
                    "recipient": {"type": "identity", "input": "to"},
                    "value": {"type": "identity", "input": "amount"},
                }
            },
            "returns": "dict",
        }
    },
}

# Create a job (spider's work specification)
job = SmartContractProcedureJob(
    contract_asset=contract,
    procedure_name="transfer",
    arguments={"from": "alice", "to": "bob", "amount": 100},
    originator_pub=pub_key,
)

# Execute (Pulse triggers this; spider does the work)
proof = execute(job, private_key)

# Verify (sampled re-execution for settlement)
is_valid = verify(job, proof)
assert is_valid

Integration with Knitweb

  • Pulse: imports vein; registers "smart-contract-procedure" job class in PoUW
  • Molgang: invokes contracts via the P2P settlement layer
  • Ledgerfield: uses contracts for DAO voting, treaty settlement procedures
  • FinField: deterministic on-chain oracle callbacks

Future Extensions

  • EVM bytecode: execute Solidity contracts deterministically
  • Cross-chain oracle: verify on-chain procedure calls
  • Result attestation: swarm-encoded result distribution for large outputs
  • Native gates: ZK-circuit compilation for procedures

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

knitweb_vein-0.1.1.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

knitweb_vein-0.1.1-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file knitweb_vein-0.1.1.tar.gz.

File metadata

  • Download URL: knitweb_vein-0.1.1.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for knitweb_vein-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b0b482887cf22c882368b28f293756af94389c6eb3a775a2ff8221e612969d1d
MD5 71336195a77103532d8ff4041e7af28c
BLAKE2b-256 95d209b47f9832746fbdea31ede4a0d07c0d03bf9722f671241f20106db2f730

See more details on using hashes here.

File details

Details for the file knitweb_vein-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: knitweb_vein-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for knitweb_vein-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d559a8be70509790ea3d4701fd87a943a1d798898664df886de1526d73c42b83
MD5 8e8598a43f5ae8838bfebf49ab1908e5
BLAKE2b-256 7a25dd7120affe1184d60c0fcd967674b5b70a5c4bdb58e5bf655debdd7e9151

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page