MCPcopy Index your code
hub / github.com/ava-labs/hypersdk

github.com/ava-labs/hypersdk @v0.0.18

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.0.18 ↗ · + Follow
2,667 symbols 10,587 edges 310 files 573 documented · 21%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

hypersdk

Framework for Building High-Performance Blockchains on Avalanche


The Go implementation of HyperSDK. HyperSDK provides a high performance, customizable framework for building blockchains.

Understanding the HyperSDK

The HyperSDK aims to provide good defaults, making it simple to build high performance blockchains, while enabling customization at each level of the stack.

Actions

Actions represent the smallest unit of customization in the HyperSDK.

Each action is packaged and signed within a transaction type defined by the HyperSDK, which allows developers to focus exclusively on their application logic.

Actions implement Execute to define their state transition against a mutable key-value store:

Execute(
    ctx context.Context,
    r Rules,
    mu state.Mutable,
    timestamp int64,
    actor codec.Address,
    actionID ids.ID,
) (output codec.Typed, err error)

To provide performance out of the box, the chain.Action interface requires additional functions to provide state prefetching, pessimistic concurrency control, and multi-dimensional fees.

For the full details, see the MorpheusVM tutorial on implementing the Transfer Action here.

Services

The HyperSDK comes with default services here that can be enabled/disabled via config or programmatically.

Services are created by adding an Option to the VM. They can be configured programmatically by constructing your VM directly instead of using the default constructor and selecting which services to opt into. For example, to run with only the Indexer option enabled programmatically, you can construct your VM with:

// NewWithOptions returns a VM with the specified options
func New(options ...vm.Option) (*vm.VM, error) {
    options = append(options, With(), indexer.With()) // Add MorpheusVM API and Indexer
    return vm.New(
        consts.Version,
        genesis.DefaultGenesisFactory{},
        &storage.StateManager{},
        ActionParser,
        AuthParser,
        auth.Engines(),
        options...,
    )
}

To configure your option via config file, see here.

Services are registered as Options to the VM. This allows developers to provide the set of options they want when they instantiate their VM. The options are executed during vm.Initialize, so that the VM has all of the parameters the Service may need populated.

Currently, developers can define their service to register Custom APIs and Event Notifications from the VM.

To learn more about Services and Options in the HyperSDK, see their definition here and the default options available here.

Components

Components will enable swapping out primitives (swap MerkleDB and Firewood) and large-scale components used by the HyperSDK.

For more information, see Customizability and the HyperSDK Roadmap here.

Getting Started

To get started building with the HyperSDK, check out MorpheusVM: the simplest VM you can build with the HyperSDK here.

Contributing

To get started contributing to the HyperSDK, see the Contributing Guidelines.

If you are looking for a place to get started, see Good First Issues and Community Issues.

Status

hypersdk is considered ALPHA software and is not safe to use in production. The framework has not been audited and is under active development. This notice will be removed after the API has stabilized and the repo has completed a full audit.

Extension points exported contracts — how you extend this code

Orchestrator (Interface)
Orchestrator executes the load test by coordinating the issuers to send transactions, in a manner depending on the imple [6 …
load/dependencies.go
SubscriptionFactory (Interface)
SubscriptionFactory returns an instance of a concrete Subscription [7 implementers]
event/event.go
HandlerBlock (Interface)
HandlerBlock is block returned by the handler [4 implementers]
internal/validitywindow/handler.go
Typed (Interface)
(no doc) [26 implementers]
codec/type_parser.go
HandlerFactory (Interface)
(no doc) [7 implementers]
api/handler.go
Auth (Interface)
(no doc) [5 implementers]
chain/dependencies.go
Chain (Interface)
Chain provides a reduced interface for chain / VM developers to implement. The snow package implements the full Avalanch [2 …
snow/vm.go
PrivateKeyFactory (Interface)
(no doc) [4 implementers]
auth/provider.go

Core symbols most depended-on inside this repo

New
called by 482
api/handler.go
Add
called by 225
chain/dependencies.go
Len
called by 128
chain/dependencies.go
GetID
called by 122
internal/eheap/eheap.go
ID
called by 113
snow/block.go
Outf
called by 92
utils/utils.go
Error
called by 83
internal/pebble/pebble.go
Run
called by 79
chain/chaintest/action.go

Shape

Method 1,409
Function 766
Struct 361
Interface 91
TypeAlias 25
FuncType 15

Languages

Go100%

Modules by API surface

chain/dependencies.go71 symbols
snow/vm_test.go62 symbols
snow/vm.go39 symbols
x/dsmr/node_test.go35 symbols
snow/block.go34 symbols
internal/pebble/pebble.go33 symbols
chain/transaction.go31 symbols
x/dsmr/storage.go30 symbols
vm/resolutions.go30 symbols
api/jsonrpc/server.go28 symbols
proto/pb/dsmr/dsmr.pb.go26 symbols
internal/validitywindow/validitywindow.go26 symbols

For agents

$ claude mcp add hypersdk \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact