Skip to content

Opinionated Framework for Building Hyper-Scalable Blockchains on Avalanche

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
license-header.txt
Notifications You must be signed in to change notification settings

ava-labs/hypersdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.