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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file knitweb_vein-0.1.0-py3-none-any.whl.
File metadata
- Download URL: knitweb_vein-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a229a046e0947fb55d283644db2ae0d06af1eb81fff64f18b74e198ebe4d5d5
|
|
| MD5 |
f3ab1a31e961911d6cbc182dd6160487
|
|
| BLAKE2b-256 |
7e571ca66f8b52b9db5fdfbec47c693340e727ff42425dc9fc41f7046d35122a
|