An implementation of Plutus in pure Go.
This package aims to only support Untyped Plutus Core because that is all that is needed for a full node. The other stuff like Typed Plutus Core and Plutus IR is for Plinth.
- Complete Plutus Support: Implements Untyped Plutus Core (UPLC) evaluation
- Multi-Version Support: Compatible with Plutus V1, V2, and V3
- Cost Model Integration: Automatic cost model selection based on Plutus version
- High Performance: Optimized CEK machine implementation in pure Go
- Cryptographic Operations: Full BLS12-381 support using gnark-crypto
- Comprehensive Testing: 52%+ test coverage with fuzz testing and property-based testing
plutigo is optimized for high-performance Plutus script evaluation:
- SHA256: 93 ns/op (~10.75M ops/sec)
- Blake2b-256: 326 ns/op (3M ops/sec)
- Ed25519 Verify: 242 μs/op (4K ops/sec)
- ECDSA Verify: 405 μs/op (2.5K ops/sec)
- BLS12-381 G1 Add: 3.4 μs/op (294K ops/sec)
- BLS12-381 Pairing: 3.4 ms/op (294 ops/sec)
Evaluates complex smart contracts (Uniswap, vesting, etc.) in milliseconds with accurate cost modeling.
- CEK Machine (
cek/): Optimized evaluation engine with object pooling and memory-efficient state management - Syntax Layer (
syn/): Parser, pretty-printer, and AST transformations with De Bruijn conversion - Builtin Functions (
builtin/): Complete Plutus builtin function implementations - Data Layer (
data/): CBOR encoding/decoding for Plutus data types
- Pure Go: No CGO dependencies for better portability and security
- Memory Safety: Comprehensive nil-pointer analysis and bounds checking
- Version Compatibility: Automatic cost model and builtin selection by Plutus version
- Testing First: Property-based testing and fuzzing ensure correctness
go get github.com/blinklabs-io/plutigopackage main
import (
"fmt"
"github.com/blinklabs-io/plutigo/cek"
"github.com/blinklabs-io/plutigo/syn"
)
func main() {
input := `
(program 1.2.0
[
[
(builtin addInteger)
(con integer 1)
]
(con integer 1)
]
)
`
pprogram, _ := syn.Parse(input)
program, _ := syn.NameToDeBruijn(pprogram)
// Create machine with Plutus V3 support
machine := cek.NewMachine[syn.DeBruijn](program.Version, 200)
term, _ := machine.Run(program.Term)
prettyTerm := syn.PrettyTerm[syn.DeBruijn](term)
fmt.Println(prettyTerm) // Output: (con integer 2)
}plutigo supports all major Plutus protocol versions:
- Plutus V1 (1.0.0): Alonzo era - Basic builtin functions
- Plutus V2 (1.1.0): Vasil era - Additional crypto builtins
- Plutus V3 (1.2.0+): Chang+ era - Latest features and optimizations
The library automatically selects appropriate cost models and builtin behavior based on the program version.
- Go 1.24+
- make
git clone https://github.com/blinklabs-io/plutigo.git
cd plutigo
go mod tidy# Run all tests
make test
# Run benchmarks
make bench
# Run fuzz tests
make fuzzThe project maintains high code quality standards:
- Linting: Passes golangci-lint with zero issues
- Nil Safety: Passes nilaway static analysis
- Test Coverage: 52%+ coverage across all packages
- Fuzz Testing: Continuous fuzzing for parsing and evaluation
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Run
make testandmake bench - Submit a pull request
- Follow standard Go formatting (
go fmt) - Add tests for new functionality
- Update documentation as needed
- Ensure benchmarks don't regress