clawchain/x/privacy/module/depinject.go
caelum0x 53f5135228 feat: implement ClawChain Phase 1 - ZK privacy module and agent registry
- Scaffold Cosmos SDK chain with Ignite CLI (address prefix: claw, token: uclaw)
- Implement x/privacy module with ZK UTXO shielded pool:
  - gnark Groth16 circuits (TransferCircuit: 2-in-2-out, UnshieldCircuit)
  - MiMC-based Merkle tree (depth 32) for commitment storage
  - Shield/Unshield/PrivateTransfer message handlers with proof verification
  - Nullifier double-spend prevention
  - On-chain Merkle tree state management
- Implement x/agent module for AI agent identities:
  - Agent registration with pubkey, endpoint, name
  - Agent action logging with type validation
  - Query handlers for agent lookup
- 26 passing tests covering full ZK proof lifecycle

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 00:27:29 +03:00

64 lines
1.4 KiB
Go

package privacy
import (
"cosmossdk.io/core/address"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/core/store"
"cosmossdk.io/depinject"
"cosmossdk.io/depinject/appconfig"
"github.com/cosmos/cosmos-sdk/codec"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"clawchain/x/privacy/keeper"
"clawchain/x/privacy/types"
)
var _ depinject.OnePerModuleType = AppModule{}
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (AppModule) IsOnePerModuleType() {}
func init() {
appconfig.Register(
&types.Module{},
appconfig.Provide(ProvideModule),
)
}
type ModuleInputs struct {
depinject.In
Config *types.Module
StoreService store.KVStoreService
Cdc codec.Codec
AddressCodec address.Codec
AuthKeeper types.AuthKeeper
BankKeeper types.BankKeeper
}
type ModuleOutputs struct {
depinject.Out
PrivacyKeeper keeper.Keeper
Module appmodule.AppModule
}
func ProvideModule(in ModuleInputs) ModuleOutputs {
// default to governance authority if not provided
authority := authtypes.NewModuleAddress(types.GovModuleName)
if in.Config.Authority != "" {
authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority)
}
k := keeper.NewKeeper(
in.StoreService,
in.Cdc,
in.AddressCodec,
authority,
in.BankKeeper,
)
m := NewAppModule(in.Cdc, k, in.AuthKeeper, in.BankKeeper)
return ModuleOutputs{PrivacyKeeper: k, Module: m}
}