chore: initial commit for v0.0.1
DChain single-node blockchain + React Native messenger client. Core: - PBFT consensus with multi-sig validator admission + equivocation slashing - BadgerDB + schema migration scaffold (CurrentSchemaVersion=0) - libp2p gossipsub (tx/v1, blocks/v1, relay/v1, version/v1) - Native Go contracts (username_registry) alongside WASM (wazero) - WebSocket gateway with topic-based fanout + Ed25519-nonce auth - Relay mailbox with NaCl envelope encryption (X25519 + Ed25519) - Prometheus /metrics, per-IP rate limit, body-size cap Deployment: - Single-node compose (deploy/single/) with Caddy TLS + optional Prometheus - 3-node dev compose (docker-compose.yml) with mocked internet topology - 3-validator prod compose (deploy/prod/) for federation - Auto-update from Gitea via /api/update-check + systemd timer - Build-time version injection (ldflags → node --version) - UI / Swagger toggle flags (DCHAIN_DISABLE_UI, DCHAIN_DISABLE_SWAGGER) Client (client-app/): - Expo / React Native / NativeWind - E2E NaCl encryption, typing indicator, contact requests - Auto-discovery of canonical contracts, chain_id aware, WS reconnect on node switch Documentation: - README.md, CHANGELOG.md, CONTEXT.md - deploy/single/README.md with 6 operator scenarios - deploy/UPDATE_STRATEGY.md with 4-layer forward-compat design - docs/contracts/*.md per contract
This commit is contained in:
53
contracts/sdk/dchain_stub.go
Normal file
53
contracts/sdk/dchain_stub.go
Normal file
@@ -0,0 +1,53 @@
|
||||
//go:build !tinygo
|
||||
|
||||
// Package dchain provides stub implementations for non-TinyGo builds.
|
||||
// These allow go build / IDEs to compile contract code without TinyGo.
|
||||
// The stubs panic at runtime — they are never executed in production.
|
||||
package dchain
|
||||
|
||||
// ArgStr returns the idx-th call argument as a string.
|
||||
func ArgStr(idx int, maxLen int) string { panic("dchain: ArgStr requires TinyGo (tinygo build -target wasip1)") }
|
||||
|
||||
// ArgU64 returns the idx-th call argument as a uint64.
|
||||
func ArgU64(idx int) uint64 { panic("dchain: ArgU64 requires TinyGo") }
|
||||
|
||||
// GetState reads a value from contract state.
|
||||
func GetState(key string) []byte { panic("dchain: GetState requires TinyGo") }
|
||||
|
||||
// GetStateStr reads a contract state value as a string.
|
||||
func GetStateStr(key string) string { panic("dchain: GetStateStr requires TinyGo") }
|
||||
|
||||
// SetState writes a value to contract state.
|
||||
func SetState(key string, value []byte) { panic("dchain: SetState requires TinyGo") }
|
||||
|
||||
// SetStateStr writes a string value to contract state.
|
||||
func SetStateStr(key, value string) { panic("dchain: SetStateStr requires TinyGo") }
|
||||
|
||||
// GetU64 reads a uint64 from contract state.
|
||||
func GetU64(key string) uint64 { panic("dchain: GetU64 requires TinyGo") }
|
||||
|
||||
// PutU64 stores a uint64 in contract state.
|
||||
func PutU64(key string, val uint64) { panic("dchain: PutU64 requires TinyGo") }
|
||||
|
||||
// Caller returns the hex pubkey of the transaction sender.
|
||||
func Caller() string { panic("dchain: Caller requires TinyGo") }
|
||||
|
||||
// BlockHeight returns the current block height.
|
||||
func BlockHeight() uint64 { panic("dchain: BlockHeight requires TinyGo") }
|
||||
|
||||
// Treasury returns the contract's ownerless treasury address.
|
||||
func Treasury() string { panic("dchain: Treasury requires TinyGo") }
|
||||
|
||||
// Balance returns the token balance of a hex pubkey in µT.
|
||||
func Balance(pubKey string) uint64 { panic("dchain: Balance requires TinyGo") }
|
||||
|
||||
// Transfer sends amount µT from one address to another.
|
||||
func Transfer(from, to string, amount uint64) bool { panic("dchain: Transfer requires TinyGo") }
|
||||
|
||||
// CallContract executes a method on another deployed contract.
|
||||
func CallContract(contractID, method, argsJSON string) bool {
|
||||
panic("dchain: CallContract requires TinyGo")
|
||||
}
|
||||
|
||||
// Log writes a message to the contract log.
|
||||
func Log(msg string) { panic("dchain: Log requires TinyGo") }
|
||||
Reference in New Issue
Block a user