CLI for the OPNet plugin ecosystem - scaffolding, compilation, signing, and registry interaction
npm install @btc-vision/cli!Bitcoin
!TypeScript
!NodeJS
!MongoDB
!NPM
!Gulp
!ESLint

Official command-line interface for the OPNet plugin ecosystem. Build, sign, verify, and publish plugins with
quantum-resistant MLDSA signatures.
``bash`
npm install -g @btc-vision/cli
Or use npx:
`bash`
npx @btc-vision/cli
`bashInitialize a new plugin project
opnet init my-plugin
Commands
$3
####
opnet configManage CLI configuration.
`bash
Show all configuration
opnet config listGet a specific value
opnet config get defaultNetwork
opnet config get rpcUrls.mainnetSet a value
opnet config set defaultNetwork testnet
opnet config set ipfsPinningApiKey "your-api-key"Reset to defaults
opnet config reset --yesShow config file path
opnet config path
`$3
####
opnet loginConfigure wallet credentials for signing and publishing.
`bash
Interactive mode
opnet loginWith mnemonic phrase
opnet login --mnemonic "your 24 word phrase..."With specific network and MLDSA level
opnet login --network testnet --mldsa-level 65Advanced: WIF + standalone MLDSA key
opnet login --wif "KwDiBf..." --mldsa "hex-key..."
`Options:
-
-m, --mnemonic - BIP-39 mnemonic phrase (24 words)
- --wif - Bitcoin WIF private key (advanced)
- --mldsa - MLDSA private key hex (advanced, requires --wif)
- -l, --mldsa-level - MLDSA security level (44, 65, 87) [default: 44]
- -n, --network - Network (mainnet, testnet, regtest) [default: mainnet]
- -y, --yes - Skip confirmation prompts####
opnet logoutRemove stored wallet credentials.
`bash
opnet logout
opnet logout --yes
`####
opnet whoamiDisplay current wallet identity and configuration.
`bash
opnet whoami
opnet whoami --verbose
opnet whoami --public-key
`$3
####
opnet keygenGenerate cryptographic keys.
`bash
Generate a new mnemonic phrase
opnet keygen mnemonic
opnet keygen mnemonic --output my-mnemonic.txtGenerate standalone MLDSA keypair
opnet keygen mldsa
opnet keygen mldsa --level 65
opnet keygen mldsa --output my-key --jsonShow MLDSA key size information
opnet keygen info
`$3
####
opnet initInitialize a new OPNet plugin project.
`bash
Interactive mode
opnet initWith name
opnet init my-pluginWith options
opnet init my-plugin --template library --yesForce overwrite
opnet init --force
`Options:
-
-t, --template - Template type (standalone, library) [default: standalone]
- -y, --yes - Skip prompts and use defaults
- --force - Overwrite existing files####
opnet compileCompile plugin to .opnet binary format.
`bash
Compile current directory
opnet compileCompile specific directory
opnet compile --dir ./my-pluginCustom output path
opnet compile --output ./dist/plugin.opnetSkip signing (for testing)
opnet compile --no-sign
`Options:
-
-o, --output - Output file path
- -d, --dir - Plugin directory [default: current]
- --no-sign - Skip signing (produce unsigned binary)
- --minify - Minify the bundled code [default: true]
- --sourcemap - Generate source maps####
opnet verifyVerify a .opnet binary signature and integrity.
`bash
opnet verify plugin.opnet
opnet verify plugin.opnet --verbose
opnet verify plugin.opnet --json
`Options:
-
-v, --verbose - Show detailed information
- --json - Output as JSON####
opnet infoDisplay information about a plugin or .opnet file.
`bash
Show project info
opnet infoShow binary info
opnet info plugin.opnetJSON output
opnet info --json
`####
opnet signSign or re-sign a .opnet binary with your MLDSA key.
`bash
opnet sign plugin.opnet
opnet sign plugin.opnet --output signed.opnet
opnet sign plugin.opnet --force # Re-sign with different key
`Options:
-
-o, --output - Output file path [default: overwrites input]
- --force - Force re-signing even if already signed by different key$3
####
opnet publishPublish a plugin to the OPNet registry.
`bash
Publish from current directory
opnet publishPublish specific file
opnet publish plugin.opnetDry run
opnet publish --dry-runSpecific network
opnet publish --network testnet
`Options:
-
-n, --network - Network to publish to [default: mainnet]
- --dry-run - Show what would be published without publishing
- -y, --yes - Skip confirmation prompts####
opnet deprecateMark a package version as deprecated.
`bash
opnet deprecate @scope/plugin
opnet deprecate @scope/plugin 1.0.0
opnet deprecate @scope/plugin 1.0.0 --message "Security vulnerability"
`Options:
-
-m, --message - Deprecation reason/message
- -n, --network - Network [default: mainnet]
- -y, --yes - Skip confirmation####
opnet undeprecateRemove deprecation from a package version.
`bash
opnet undeprecate @scope/plugin 1.0.0
`####
opnet transferInitiate ownership transfer of a package or scope.
`bash
Transfer a package
opnet transfer my-plugin bc1q...Transfer a scope
opnet transfer @myscope bc1q...Cancel pending transfer
opnet transfer my-plugin --cancel
`Options:
-
-n, --network - Network [default: mainnet]
- -y, --yes - Skip confirmation
- --cancel - Cancel pending transfer####
opnet acceptAccept pending ownership transfer.
`bash
opnet accept my-plugin
opnet accept @myscope
`####
opnet installDownload and verify a plugin from the registry.
`bash
Install latest version
opnet install @scope/pluginInstall specific version
opnet install @scope/plugin@1.0.0Install from IPFS CID
opnet install QmXyz...Custom output directory
opnet install @scope/plugin --output ./my-plugins
`Options:
-
-o, --output - Output directory [default: ./plugins/]
- -n, --network - Network [default: mainnet]
- --skip-verify - Skip signature verification####
opnet updateUpdate installed plugins to latest versions.
`bash
Update all plugins
opnet updateUpdate specific plugin
opnet update @scope/pluginCustom plugins directory
opnet update --dir ./my-plugins
`Options:
-
-d, --dir - Plugins directory [default: ./plugins/]
- -n, --network - Network [default: mainnet]
- --skip-verify - Skip signature verification####
opnet listList installed plugins.
`bash
opnet list
opnet ls
opnet list --verbose
opnet list --json
opnet list --dir ./my-plugins
`Options:
-
-d, --dir - Plugins directory [default: ./plugins/]
- --json - Output as JSON
- -v, --verbose - Show detailed information####
opnet searchSearch for plugins in the registry.
`bash
opnet search plugin-name
opnet search @scope/plugin
opnet search plugin-name --json
`Options:
-
-n, --network - Network [default: mainnet]
- --json - Output as JSONConfiguration
Configuration is stored in
~/.opnet/config.json:`json
{
"defaultNetwork": "mainnet",
"rpcUrls": {
"mainnet": "https://api.opnet.org",
"testnet": "https://testnet.opnet.org",
"regtest": "https://regtest.opnet.org"
},
"ipfsGateway": "https://ipfs.opnet.org/ipfs/",
"ipfsGateways": [
"https://ipfs.opnet.org/ipfs/",
"https://ipfs.io/ipfs/"
],
"ipfsPinningEndpoint": "https://ipfs.opnet.org/api/v0/add",
"ipfsPinningApiKey": "",
"registryAddresses": {
"mainnet": "",
"testnet": "",
"regtest": ""
},
"defaultMldsaLevel": 44,
"indexerUrl": "https://indexer.opnet.org"
}
`Environment Variables
| Variable | Description |
|-------------------------------|-------------------------------------|
|
OPNET_MNEMONIC | BIP-39 mnemonic phrase |
| OPNET_PRIVATE_KEY | Bitcoin WIF private key |
| OPNET_MLDSA_KEY | MLDSA private key (hex) |
| OPNET_MLDSA_LEVEL | MLDSA security level (44, 65, 87) |
| OPNET_NETWORK | Network (mainnet, testnet, regtest) |
| OPNET_RPC_URL | RPC endpoint URL |
| OPNET_IPFS_GATEWAY | IPFS gateway URL |
| OPNET_IPFS_PINNING_ENDPOINT | IPFS pinning service endpoint |
| OPNET_IPFS_PINNING_KEY | IPFS pinning API key |
| OPNET_REGISTRY_ADDRESS | Registry contract address |
| OPNET_INDEXER_URL | Indexer API URL |MLDSA Security Levels
| Level | Public Key | Signature | Security |
|----------|-------------|-------------|----------|
| MLDSA-44 | 1,312 bytes | 2,420 bytes | ~128-bit |
| MLDSA-65 | 1,952 bytes | 3,309 bytes | ~192-bit |
| MLDSA-87 | 2,592 bytes | 4,627 bytes | ~256-bit |
.opnet Binary Format (OIP-0003)
The
.opnet binary format consists of:1. Magic bytes (8 bytes):
OPNETPLG
2. Format version (4 bytes): uint32 LE
3. MLDSA level (1 byte): 0=44, 1=65, 2=87
4. Public key (variable): Based on MLDSA level
5. Signature (variable): Based on MLDSA level
6. Metadata length (4 bytes): uint32 LE
7. Metadata (variable): JSON bytes
8. Bytecode length (4 bytes): uint32 LE
9. Bytecode (variable): V8 bytecode
10. Proto length (4 bytes): uint32 LE
11. Proto (variable): Protobuf definitions
12. Checksum (32 bytes): SHA-256 of metadata + bytecode + protoPlugin Manifest (plugin.json)
`json
{
"name": "my-plugin",
"version": "1.0.0",
"opnetVersion": "^1.0.0",
"main": "dist/index.jsc",
"target": "bytenode",
"type": "plugin",
"author": {
"name": "Developer Name",
"email": "dev@example.com"
},
"description": "My OPNet plugin",
"pluginType": "standalone",
"permissions": {
"database": {
"enabled": false,
"collections": []
},
"blocks": {
"preProcess": false,
"postProcess": false,
"onChange": false
},
"epochs": {
"onChange": false,
"onFinalized": false
},
"mempool": {
"txFeed": false
},
"api": {
"addEndpoints": false,
"addWebsocket": false
},
"filesystem": {
"configDir": false,
"tempDir": false
}
},
"resources": {
"maxMemoryMB": 256,
"maxCpuPercent": 25,
"maxStorageMB": 100
},
"dependencies": {},
"lifecycle": {
"autoStart": true,
"restartOnCrash": true,
"maxRestarts": 3
}
}
``- Credentials are stored with restricted permissions (0600)
- All binaries are signed with quantum-resistant MLDSA signatures
- Checksums verify binary integrity
- IPFS CIDs provide content-addressed storage
Apache-2.0