magic/starknet_luau
v0.1.0 ·
Pure Luau SDK for Starknet blockchain interaction from Roblox games
starknet-luau
Pure Luau SDK for interacting with the Starknet blockchain from Roblox games. Provides cryptographic primitives, account management, transaction building/signing, contract interaction, and RPC connectivity -- all implemented in Luau with no external native dependencies.
Installation
Via Pesde:
[dependencies]
starknet_luau = { name = "magic/starknet_luau", version = "^0.1.0" }
Via Wally:
[dependencies]
starknet-luau = "b-j-roberts/[email protected]"
Manual (.rbxm):
Download the latest .rbxm from Releases and drop it into your project.
Development
Prerequisites
Setup
rokit install # Install rojo, wally, lune, selene, stylua
make install # Install Wally packages + generate types
rojo serve # Start live sync to Roblox Studio
Commands
make install # Install deps via Wally, generate sourcemap + package types
make pesde-install # Install deps via Pesde
make serve # Start Rojo live sync
make build # Build .rbxm model file
make test # Run tests with Lune
make lint # Lint with Selene
make fmt # Format with StyLua
make check # Run lint + fmt check + test
Quick Start
local Starknet = require(game.ReplicatedStorage.Packages.StarknetLuau)
-- Create a provider
local provider = Starknet.provider.RpcProvider.new("https://api.zan.top/public/starknet-sepolia")
-- Get the latest block number
provider:getBlockNumber():andThen(function(blockNumber)
print("Current block:", blockNumber)
end)
-- Read from a contract
local contract = Starknet.contract.Contract.new(provider, contractAddress, abi)
contract:call("balanceOf", { accountAddress }):andThen(function(balance)
print("Balance:", balance)
end)
Documentation
| Guide | Description |
|---|---|
| Getting Started | Installation, basic setup, first transaction |
| Contract Interaction | Reading state, writing transactions, multicall, presets |
| Account Management | Key generation, address derivation, account types, nonce handling |
| Common Patterns | NFT gating, token rewards, onchain leaderboards |
| Roblox Considerations | Rate limits, server-side patterns, security best practices |
| Crypto Deep Dive | Understanding BigInt, StarkField, curves, hashes, ECDSA |
| API Reference | Complete API documentation for all modules |
API Overview
| Module | Description |
|---|---|
crypto | BigInt, StarkField, StarkCurve, Poseidon, Pedersen, Keccak, SHA256, ECDSA |
signer | StarkSigner with RFC 6979 deterministic signing |
provider | JSON-RPC client over HttpService with Promise-based async |
tx | Transaction building, hashing, calldata encoding (V3 INVOKE) |
wallet | Account derivation, nonce management (OZ, Argent) |
contract | ABI-driven contract interface, ERC-20/ERC-721 presets |
Project Structure
starknet-luau/
├── src/
│ ├── init.luau # Main entry point / barrel exports
│ ├── crypto/ # Cryptographic primitives
│ ├── signer/ # Transaction signing
│ ├── provider/ # Starknet RPC client
│ ├── tx/ # Transaction building
│ ├── wallet/ # Account management
│ └── contract/ # Contract interaction + presets
├── tests/ # Lune test specs
├── docs/ # Spec and roadmap
├── .github/workflows/ # CI + Release automation
├── default.project.json # Rojo project (library)
├── dev.project.json # Rojo project (development)
├── rokit.toml # Toolchain versions
├── wally.toml # Package manifest (Wally)
├── pesde.toml # Package manifest (Pesde)
└── Makefile # Build commands
Contributing
- Fork the repo
- Run
rokit installto set up the toolchain - Run
make installto install dependencies - Run
make checkbefore submitting a PR