This plugin enables seamless integration between Hardhat projects and Shib Alpha Layer Rollups, providing wallet management, deployment tools, and configuration helpers.
Overview
The@shibaone/alpha-layer-hardhat package extends your Hardhat development environment with Shib Alpha Layer capabilities:
- Wallet Management: Import, delete, and manage private keys for rollup transactions
- Elder Wrap Integration: Deploy smart contracts using the Elder Wrap node
- Network Configuration: Automatically inject rollup networks into your Hardhat config
- CLI Tools: Command-line interface for Elder Wrap operations
Installation
Prerequisites
Before installing the plugin, ensure you have:- Node.js v20 or higher
- A package manager (npm, pnpm, or yarn)
- An existing Hardhat project
Setup
1
Create npm configuration
Create a
.npmrc file in your project root to access the ShibaOne registry:.npmrc
2
Install the plugin
Install the latest version of the Alpha Layer Hardhat plugin:
The plugin is successfully installed when you see it listed in your
package.json dependencies.Configuration
Generate keystore for contract deployments and onchain transactions using elder-wrap. This will create evm and elder address for private key you import.elder.config.yaml file in your project root to configure the plugin:
elder.config.yaml
https://shib.io/rollups/browse visit here to get rollup config details
Configuration Parameters
Hardhat Integration
Basic Setup
Wrap your existing Hardhat configuration with thewithElder function:
hardhat.config.js
Advanced Configuration
For more control over the integration, you can use a function-based configuration:hardhat.config.js
Wrap Server
You can run a wrap service to enable transactions via alpha layer.You will see server starting at 8546.
Make sure to change network in
hardhat.config.ts to http://localhost:8546/<Roll_App_Name>API Reference
Hardhat Integration Functions
withElder(hhConfig, keyAlias?)
Wraps your Hardhat configuration to inject Alpha Layer rollup networks and accounts.
getNetwork({ name, keyAlias? })
Returns a Hardhat network configuration for a specific rollup.
Keystore Management
The plugin provides several functions for managing wallet keys:getKey(alias)
Retrieve a specific key by its alias.
keyMap()
Get a mapping of all key aliases to their corresponding key objects.
listKeys()
Retrieve an array of all available key objects.
Key Object Structure
Ethereum-compatible address derived from the private key.
Alpha Layer Elder address format for the same private key.
Hex-encoded private key for signing transactions.
Configuration Helpers
getConfig()
Parse and validate the configuration from elder.config.yaml.
wrap_url()
Get the local Elder Wrap service URL.
Deployment
Using Hardhat Tasks
The plugin registers a custom Hardhat task for deploying contracts:Deployment with ethers
The plugin works seamlessly with HRE too for complex deployments:scripts/TokenDeployment.ts
CLI Usage
The plugin provides a CLI wrapper for theelder-wrap binary:
Troubleshooting
Connection Issues
Connection Issues
Problem: Cannot connect to Elder Wrap serviceSolutions:
- Verify Elder Wrap is running on the configured port
- Check firewall settings for port 8546
- Ensure
elder_grpc_endpointis accessible - Restart the Elder Wrap service
Key Management Errors
Key Management Errors
Problem: Keys not found or invalidSolutions:
- Verify keys are properly imported to the keystore directory
- Check key file permissions (should be 600)
- Ensure key aliases match exactly in configuration
- Re-import keys if corruption is suspected
Deployment Failures
Deployment Failures
Problem: Contract deployment failsSolutions:
- Check account balance on the target rollup
- Verify contract bytecode compilation
- Ensure proper network configuration
- Check Elder Wrap logs for detailed error messages