Used to check for browser translation.
用于检测浏览器翻译。
ブラウザの翻訳を検出する
Server Management

Initialize Server


The blocklet server init command is the essential first step for setting up a new Blocklet Server instance. It creates the necessary configuration directory (.blocklet-server) and files, including config.yml and an encryption key file (.k).

Usage#

To begin, navigate to your desired directory and run the command:

blocklet server init

This command can be run in two modes: interactive (default) or non-interactive (using flags).

Interactive Mode#

This is the recommended method for first-time setup. The command launches an interactive wizard that guides you through the configuration process. You will be prompted for key information such as:

  • Server name and description.
  • The primary port for the server daemon.
  • The routing engine to use (e.g., Nginx).
  • The URL for your preferred web wallet.
  • Whether to enable HTTPS.
  • Memory limits for the server and individual blocklets.


Non-Interactive Mode#

For automated deployments and scripting, you can provide all configuration options as flags. The --force (or -f) flag is useful for accepting all default values without prompting for confirmation.

Here is an example of a non-interactive setup:

blocklet server init \
--force \
--mode production \
--no-https \
--http-port 8080 \
--https-port 8443 \
--sk 'your-custom-secret-key' \
--web-wallet-url 'https://your-wallet.com'

Command Options#

The init command supports various options to customize the initial setup. These are sourced from the command's definition file.

Option

Description

Default

-f, --force

Initialize without asking any questions.

false

-i, --interactive

Run in interactive mode. This is ignored if --force is used.

false

--mode <mode>

Set the initial server mode. Can be production or debug.

production

--https / --no-https

Enable or disable default HTTPS support.

Enabled by default

--sk <custom-sk>

Provide a custom secret key for the server's wallet.

A new key is generated.

--web-wallet-url <url>

Specify the URL for the web wallet.

https://web.abtwalle.io

--http-port <httpPort>

Set the HTTP port for the service gateway.

80

--https-port <httpsPort>

Set the HTTPS port for the service gateway.

443

--owner-nft-holder <did>

The DID that holds the ownership NFT.

''

--owner-nft-issuer <did>

The DID that issued the ownership NFT.

''

--trusted-passport-issuer <did>

A trusted passport issuer DID for the node.

''

--disable-passport-issuance

Disable the node's ability to issue passports.

false

Generated Configuration File#

After a successful initialization, a config.yml file is created. This file contains all the server's configuration and can be manually edited later. Below is a sample structure of the generated file, based on the logic in the init.js script:

node:
name: My ABT Node
description: A new Blocklet Server instance
mode: production
version: 1.16.29 # The CLI version at the time of init
sk: encrypted-secret-key...
pk: public-key...
did: z...
port: 3030 # The daemon port
secret: session-secret...
owner: { pk: '', did: '' }
ownerNft:
holder: ''
issuer: ''
routing:
provider: nginx
adminPath: /admin
headers: { 'X-Powered-By': '"Blocklet Server/1.16.29"' }
maxUploadFileSize: 100
https: true
httpPort: 80
httpsPort: 443
wildcardCertHost: 'https://cert.arcblock.io'
ipWildcardDomain: .ip.abtnet.io
enableDefaultServer: false
enableIpServer: false
runtimeConfig:
daemonMaxMemoryLimit: 2048 # in MB
blockletMaxMemoryLimit: 1024 # in MB
didRegistry: 'https://did-registry.arcblock.io'
didDomain: did.abtnet.io
slpDomain: slp.abtnet.io
enablePassportIssuance: true
trustedPassports: []
webWalletUrl: 'https://web.abtwalle.io'
database:
engine: sqlite
blocklet:
port: 3030
initialize:
blocklets: []

With the server initialized, you are now ready to launch it.


Next, learn how to start the server daemon process.