Files
chains/schain/plugin/main.go
T
zeekay 0a20786095 schain: M0 storage-chain VM skeleton (manifest → zapdb through a real block)
Fork dexvm's commit discipline into a new storage VM (VMID 'schain'): dual-DB
(durable zapdb base + per-block versiondb), pure-deterministic ProcessBlock, ONE
CommitBatch at Accept (mirrors dexvm/vm.go:1194, block.go:159). M0 op: PutManifest
{bucket,object,fileIds,size,etag} staged in the version layer, durable only after
Accept; GetManifest reads committed state. Proves the on-chain-metadata / off-chain-
blob architecture for an embedded decentralized S3 'S-chain'.

schain_test.go (real on-disk zapdb.New): manifest absent in base DB before Accept,
present after — versiondb→CommitBatch proven end-to-end; +Reject-aborts-staged and
tx-codec round-trip. go vet + -race clean.

M1 notes (in-code): add a manifest STATE ROOT before multi-validator consensus
(dexvm computeStateRoot pattern); keep any future cross-chain blob-ref leg separate
from the manifest commit; add genesis/config. Next: wire the S3 Sig-V4 gateway
(PUT→needle off-chain + PutManifest on-chain; GET→manifest+needle stream).
2026-06-25 12:44:03 -07:00

36 lines
836 B
Go

//go:build grpc
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package main
import (
"context"
"fmt"
"os"
"github.com/luxfi/chains/schain"
"github.com/luxfi/log"
"github.com/luxfi/node/version"
"github.com/luxfi/node/vms/rpcchainvm"
"github.com/luxfi/sys/ulimit"
)
func main() {
versionStr := fmt.Sprintf("S-VM/0.1.0 [node=%s, rpcchainvm=%d]", version.Current, version.RPCChainVMProtocol)
if err := ulimit.Set(ulimit.DefaultFDLimit, log.Root()); err != nil {
fmt.Printf("failed to set fd limit: %s\n", err)
os.Exit(1)
}
vm := schain.NewChainVM(log.Root())
fmt.Printf("Starting %s\n", versionStr)
if err := rpcchainvm.Serve(context.Background(), log.Root(), vm); err != nil {
fmt.Printf("rpcchainvm.Serve error: %s\n", err)
os.Exit(1)
}
}