@arcblock/abtnode-docs
Version:
ABT Node Documentation, a help documentation for quickly get started with ABT Node.
1 lines • 48.1 kB
JSON
{"componentChunkName":"component---node-modules-arcblock-gatsby-theme-docs-src-templates-documentation-js","path":"/en/developer/blocklet-spec","result":{"data":{"file":{"changeTime":"5 minutes ago","childMarkdownRemark":{"frontmatter":{"author":"zhenqiang, tigeryu8900","category":"","date":null,"description":"Blocklet Specification","draft":null,"keywords":"abtnode,blocklet,specification","language":"en","layout":"documentation","path":"/en/developer/blocklet-spec","tags":["abtnode","blocklet","specification"],"title":"Blocklet Specification"},"htmlAst":{"type":"root","children":[{"type":"element","tagName":"h2","properties":{"id":"what-is-blocklet","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#what-is-blocklet","ariaLabel":"what is blocklet permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"What is Blocklet?"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Blocklet is an application protocol and software architecture. As a protocol, it describes the way to build the ABT Node platform; as software architecture, an independent blocklet is a reusable software module, which may be an HTTP service or a function library, etc.; when multiple When blocklets run together, they need a platform to combine them to form an independent service, such as ABT Node."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"how-to-define-a-blocklet","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#how-to-define-a-blocklet","ariaLabel":"how to define a blocklet permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"How to define a Blocklet?"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"We use JSON data format to describe the protocol of blocklet."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"define-basic-information","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#define-basic-information","ariaLabel":"define basic information permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Define basic information"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-json"],"\"name\":":"","\"blocklet":"","name,":"","can":"","be":"","same":"","as":"","npm":"","package":"","name\",":""},"children":[{"type":"text","value":"{\n \"name\": \"blocklet name, can be same as npm package name\",\n \"description\": \"blocklet description, can be same as npm package description\",\n \"version\": \"blocklet version, can be same as npm package version\",\n \"group\": \"only `dapp|static` are allowed and supported\"\n}\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"name, description, version, group"}]},{"type":"text","value":" describes the basic information of the blocklet. Among them, "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"group"}]},{"type":"text","value":" is divided into two types of "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"dapp"}]},{"type":"text","value":" and "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"static"}]},{"type":"text","value":". "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"dapp"}]},{"type":"text","value":" is a regular dapp. "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"static"}]},{"type":"text","value":" is a web application that only contains front-end static resources. ABT Node will use an HTTP Server to serve "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"static"}]},{"type":"text","value":" Blocklet."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"define-runtime-configuration","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#define-runtime-configuration","ariaLabel":"define runtime configuration permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Define runtime configuration"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-json"],"\"main\":":"","\"the":"","entrypoint":"","to":"","bundle":"","the":"","blocklet":"","or":"","static":"","folder\",":""},"children":[{"type":"text","value":"{\n \"main\": \"the entrypoint to bundle the blocklet or the static folder\",\n \"requiredEnvironments\": {\n \"name\": \"string, name of the environment\",\n \"description\": \"string, description of the environment\",\n \"required\": \"bool, is required\",\n \"default\": \"Any type, default value\"\n }\n}\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"In addition to the description of the basic information of the blocklet, the blocklet also defines the "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"main"}]},{"type":"text","value":" field to describe how the blocklet starts to run, which is the description of the so-called entry file. This field is closely related to the operation of the blocklet. "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"main"}]},{"type":"text","value":" defines the entry file or static resource directory of dapp or static type blocklet. So for ABT Node, the "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"main"}]},{"type":"text","value":" field is necessary; otherwise, ABT Node has no way to start Blocklet."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"In addition to the "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"main"}]},{"type":"text","value":" field, we also need to define the "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"requiredEnvironments"}]},{"type":"text","value":" field to declare the environment variables that the blocklet needs to run. There are four attributes that describe an environment variable: name, description, required, default. If the variable is set to required, and no default value is provided, the user must set the variable before starting."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"requiredEnvironments"}]},{"type":"text","value":" is not necessary, but a blocklet can use this field to request blocklet users to provide corresponding information through this field. For example, a blocklet that depends on the MongoDB database can use requiredEnvironments to ask users to fill in the MongoDB connection string."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"capabilities"}]},{"type":"text","value":" is used to tell ABT Node what the blocklet is capable of, if your blocklet can not serve on dynamic path prefix, please set it as following:"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-json"],"\"capabilities\":":""},"children":[{"type":"text","value":" \"capabilities\": {\n \"dynamicPathPrefix\": false\n }\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"other-configuration","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#other-configuration","ariaLabel":"other configuration permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Other configuration"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-json"],"\"provider\":":"","\"arcblock|community\",":""},"children":[{"type":"text","value":"{\n \"provider\": \"arcblock|community\",\n \"public_url\": \"public page url, should at least specify one\",\n \"admin_url\": \"administrator page url, default to empty\",\n \"config_url\": \"configuration page url, default to empty\",\n \"doc_url\": \"public document url, if not specified, will use registry detail page\"\n}\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Here are other configuration items. For a blocklet, these fields are optional. Let’s briefly introduce these fields."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"provider: The "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"provider"}]},{"type":"text","value":" is the source of the declared blocklet. There are two optional values: arcblock|community. "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"arcblock"}]},{"type":"text","value":" represents the official development of ArcBlock, and the community develops "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"community"}]},{"type":"text","value":"."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"public"},{"type":"element","tagName":"em","properties":{},"children":[{"type":"text","value":"url: The `public"}]},{"type":"text","value":"url` is the public address of the blocklet."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"admin"},{"type":"element","tagName":"em","properties":{},"children":[{"type":"text","value":"url: The `admin"}]},{"type":"text","value":"url` is the address of the management end of the Blocklet."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"config"},{"type":"element","tagName":"em","properties":{},"children":[{"type":"text","value":"url: The `config"}]},{"type":"text","value":"url` is the address of the blocklet configuration page."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"doc"},{"type":"element","tagName":"em","properties":{},"children":[{"type":"text","value":"url: The `doc"}]},{"type":"text","value":"url` is the document address of the blocklet. If this address does not exist, ABT Node will use the README of the blocklet as the document page."}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"blocklet-life-cycle","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#blocklet-life-cycle","ariaLabel":"blocklet life cycle permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Blocklet life cycle"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"life-cycle","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#life-cycle","ariaLabel":"life cycle permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Life cycle"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"span","properties":{"className":["gatsby-resp-image-wrapper"],"style":"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 121px; "},"children":[{"type":"text","value":"\n "},{"type":"element","tagName":"span","properties":{"className":["gatsby-resp-image-background-image"],"style":"padding-bottom: 579.3388429752066%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,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'); background-size: cover; display: block;"},"children":[]},{"type":"text","value":"\n "},{"type":"element","tagName":"img","properties":{"className":["gatsby-resp-image-image"],"alt":"blocklet lifecycle","title":"blocklet lifecycle","src":"/abtnode/static/8fad49a82313c6d4d8296f704307e909/d15f4/blocklet-lifecycle.png","srcSet":["/abtnode/static/8fad49a82313c6d4d8296f704307e909/d15f4/blocklet-lifecycle.png 121w"],"sizes":["(max-width:","121px)","100vw,","121px"],"style":"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;","loading":"lazy"},"children":[]},{"type":"text","value":"\n "}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"In ABT Node, the complete life cycle of a blocklet includes four stages: installation (or deployment), start, stop, and uninstall. Blocklets can be installed in two ways: one is to download and install it from the marketplace, and the other is to deploy and install it directly with ABT Node CLI. The CLI is mainly for development and testing. Therefore, in the first phase of the life cycle, there are two installation and deployment situations."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"hooks","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#hooks","ariaLabel":"hooks permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Hooks"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"span","properties":{"className":["gatsby-resp-image-wrapper"],"style":"position: relative; display: block; margin-left: auto; margin-right: auto; max-width: 921px; "},"children":[{"type":"text","value":"\n "},{"type":"element","tagName":"span","properties":{"className":["gatsby-resp-image-background-image"],"style":"padding-bottom: 29.599999999999998%; position: relative; bottom: 0; left: 0; background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAGCAYAAADDl76dAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAw0lEQVQY05VRSQqEQBDr/3/NFyio4IqK+75mSMCLOANTUFCx06lONEEQwHVdrOuKYRjgOI56HEdhy7LgeR6WZUGe5wjDUGdN02ju+164KApkWQZzk47jwLZtiKJImDOX2LaNOI51zgV1XWPfd8zzjKqqxGF3XSds8KOu63qdn3Wep8Qoakh863+KfFrm681T4J65tW1bZUSLtHVjxkHLfBG/E3NmruabTWbm+z6SJNFlChGnaYppmlCWpfKmEH8Kecz6A3K60C9uHDCnAAAAAElFTkSuQmCC'); background-size: cover; display: block;"},"children":[]},{"type":"text","value":"\n "},{"type":"element","tagName":"img","properties":{"className":["gatsby-resp-image-image"],"alt":"blocklet lifecycle","title":"blocklet lifecycle","src":"/abtnode/static/4f09aa472359c4f94eb63a178d1e0a6c/6f606/blocklet-lifecycle-hooks.png","srcSet":["/abtnode/static/4f09aa472359c4f94eb63a178d1e0a6c/41b2e/blocklet-lifecycle-hooks.png 250w","/abtnode/static/4f09aa472359c4f94eb63a178d1e0a6c/36a81/blocklet-lifecycle-hooks.png 500w","/abtnode/static/4f09aa472359c4f94eb63a178d1e0a6c/6f606/blocklet-lifecycle-hooks.png 921w"],"sizes":["(max-width:","921px)","100vw,","921px"],"style":"width:100%;height:100%;margin:0;vertical-align:middle;position:absolute;top:0;left:0;","loading":"lazy"},"children":[]},{"type":"text","value":"\n "}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"In these stages, ABT Node provides the hook function, which is used to do something during the execution of the life cycle. Currently includes pre-deploy, post-install, pre-start, pre-stop, pre-install, pre-uninstall hook."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"For example, a blocklet has hardware requirements for the running machine: the memory cannot be lower than 1G, and the available disk capacity cannot be lower than 500 MB. You can use the pre-install hook to check whether the target machine has met the demand. If it meets, install normally, otherwise throw an error message and terminate the installation."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Hooks are Shell scripts, and these scripts may refer to the files in the blocklet. In the process of packaging the blocklet, the ABT Node packaging tool (ABT Node CLI) will package the files used by the hook separately, so developers need to declare which files are referenced by hooks in "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"hookFiles"}]},{"type":"text","value":"."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"creating-a-blocklet","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#creating-a-blocklet","ariaLabel":"creating a blocklet permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Creating a Blocklet"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"After understanding some basic Blocklet concepts and protocols, it's time to learn how to create a blocklet."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"initialize-the-blocklet","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#initialize-the-blocklet","ariaLabel":"initialize the blocklet permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Initialize the blocklet"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"ABT Node CLI provides "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"abtnode blocklet:init"}]},{"type":"text","value":" command to help developers quickly create a blocklet project. This command will help developers create related configuration files and directories."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"blocklet-project-structure","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#blocklet-project-structure","ariaLabel":"blocklet project structure permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Blocklet project structure"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-shell"],"blocklet.json":""},"children":[{"type":"text","value":"├── blocklet.json\n├── blocklet.md\n└── package.json\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"After the project is created, we can see that a Blocklet project mainly contains two parts: blocklet description information and source code.\nABT Node currently only supports the Node.js blocklet projects, so the description of the blocklet will generally contain two parts: Node.js’s package.json and blocklet’s blocklet.json. The content of the blocklet spec we mentioned earlier is in blocklet.json. Of course, blocklet also allow the contents of blocklet.json to be placed in the "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"blocklet"}]},{"type":"text","value":" field of package.json."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"blockletjson","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#blockletjson","ariaLabel":"blockletjson permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"blocklet.json"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"All description information of the blocklet is placed in the blocklet.json file.\nAs stated earlier, a blocklet is a Node.js project. We know that Node.js package.json file also contains information such as name, description, and version. For a blocklet, These fields have the same values, so ABT Node will first read the configuration of blocklet.json. If blocklet.json does not have these values, ABT Node will use package.json's values."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The following is an example of blocklet.json."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"pre","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-json"],"\"name\":":"","\"static-demo-blocklet\",":""},"children":[{"type":"text","value":"{\n \"name\": \"static-demo-blocklet\",\n \"description\": \"Demo blocklet that shows how to serve a static html5 game with ABT Node\",\n \"version\": \"1.0.0\",\n \"group\": \"static\",\n \"color\": \"primary\",\n \"main\": \"app/\",\n \"provider\": \"arcblock\",\n \"requiredEnvironments\": {\n \"name\": \"DEBUG\",\n \"description\": \"Enable test flag\",\n \"required\": false,\n \"default\": \"arcblock*\"\n },\n \"capabilities\": {\n \"dynamicPathPrefix\": true\n }\n}\n"}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"blocklet-environment-variables","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#blocklet-environment-variables","ariaLabel":"blocklet environment variables permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Blocklet Environment variables"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The subsequent development work is a normal Web application development. Because blocklets run on ABT Node, blocklets depend on the environment of ABT Node. ABT Node now provides some environment variables for development."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"private-environment-variables","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#private-environment-variables","ariaLabel":"private environment variables permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Private environment variables"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"BLOCKLET_PORT"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"BLOCKLET"},{"type":"element","tagName":"em","properties":{},"children":[{"type":"text","value":"APP"}]},{"type":"text","value":"DIR"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"BLOCKLET"},{"type":"element","tagName":"em","properties":{},"children":[{"type":"text","value":"DATA"}]},{"type":"text","value":"DIR"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"BLOCKLET"},{"type":"element","tagName":"em","properties":{},"children":[{"type":"text","value":"LOG"}]},{"type":"text","value":"DIR"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"BLOCKLET"},{"type":"element","tagName":"em","properties":{},"children":[{"type":"text","value":"CACHE"}]},{"type":"text","value":"DIR"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"BLOCKLET"},{"type":"element","tagName":"em","properties":{},"children":[{"type":"text","value":"APP"}]},{"type":"text","value":"SK"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"BLOCKLET"},{"type":"element","tagName":"em","properties":{},"children":[{"type":"text","value":"APP"}]},{"type":"text","value":"ID"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"global-environment-variables","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#global-environment-variables","ariaLabel":"global environment variables permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Global environment variables"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"ABT"},{"type":"element","tagName":"em","properties":{},"children":[{"type":"text","value":"NODE"}]},{"type":"text","value":"DID"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"ABT"},{"type":"element","tagName":"em","properties":{},"children":[{"type":"text","value":"NODE"}]},{"type":"text","value":"PK"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"ABT"},{"type":"element","tagName":"em","properties":{},"children":[{"type":"text","value":"NODE"}]},{"type":"text","value":"URL"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"ABT"},{"type":"element","tagName":"em","properties":{},"children":[{"type":"text","value":"NODE"}]},{"type":"text","value":"DOMAIN"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"ABT"},{"type":"element","tagName":"em","properties":{},"children":[{"type":"text","value":"NODE"}]},{"type":"text","value":"PROTOCOL"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"These variables mean what their names indicate. During the development of a blocklet, some values of these variables are environment variables."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"how-to-package-blocklet","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#how-to-package-blocklet","ariaLabel":"how to package blocklet permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"How to package Blocklet?"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"After the blocklet is created, the code needs to be packaged for deployment. The ABT CLI provides the "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"abtnode bundle"}]},{"type":"text","value":" command to package the source code."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"test-in-abt-node","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#test-in-abt-node","ariaLabel":"test in abt node permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Test in ABT Node"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"In the blocklet declaration cycle section, we mentioned the Deploy phase. This phase deploys the packaged project to the local ABT Node node to test the blocklet."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"how-to-release-blocklet","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#how-to-release-blocklet","ariaLabel":"how to release blocklet permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"How to release Blocklet?"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"First, publish the developed Blocklet to NPM. The "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"abtnode bundle"}]},{"type":"text","value":" command will put the packaged code in the "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":".blocklet"}]},{"type":"text","value":" directory of the current directory. When publishing or testing, you need to package and release the code in "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":".blocklet/bundle"}]},{"type":"text","value":"."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Then fork the "},{"type":"element","tagName":"a","properties":{"href":"https://github.com/arcblock/blocklets"},"children":[{"type":"text","value":"https://github.com/arcblock/blocklets"}]},{"type":"text","value":" repository (create Github account first if you don't have one).\nModify the project's registry.yml file and put your blocklet NPM package address in the registry.yml list. Then give a pull request to ArcBlock’s repository: "},{"type":"element","tagName":"a","properties":{"href":"https://github.com/arcblock/blocklets"},"children":[{"type":"text","value":"https://github.com/arcblock/blocklets"}]},{"type":"text","value":"."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"If there are no problems are detected, the PR will be merged into the main branch of the blocklet repository, completing the release."}]}],"data":{"quirksMode":false}}}}},"pageContext":{"site":{"title":"ABT Node","description":"ABT Node Documentation","siteUrl":"https://docs.arcblock.io","logoUrl":"/abtnode/","sidebarWidth":360,"disableI18n":false,"showGetStarted":true,"defaultBanner":"/abtnode/og-banner.png"},"id":"148d0335-074f-5a54-8762-ab46f733ff6e","language":"en","locale":"en","languages":[{"value":"en","text":"English"},{"value":"zh","text":"简体中文"}],"headings":[{"value":"What is Blocklet?","depth":2},{"value":"How to define a Blocklet?","depth":2},{"value":"Define basic information","depth":2},{"value":"Define runtime configuration","depth":2},{"value":"Other configuration","depth":2},{"value":"Blocklet life cycle","depth":2},{"value":"Life cycle","depth":2},{"value":"Hooks","depth":2},{"value":"Creating a Blocklet","depth":2},{"value":"Initialize the blocklet","depth":2},{"value":"Blocklet project structure","depth":3},{"value":"blocklet.json","depth":3},{"value":"Blocklet Environment variables","depth":2},{"value":"Private environment variables","depth":3},{"value":"Global environment variables","depth":2},{"value":"How to package Blocklet?","depth":2},{"value":"Test in ABT Node","depth":3},{"value":"How to release Blocklet?","depth":2}],"navItems":[{"group":"/home/runner/work/abtnode-docs/abtnode-docs/src","title":"ABT Node","priority":999,"link":"/"}],"version":"v0.2.20","official":true,"originalPath":"/en/developer/blocklet-spec","sidebarContent":[{"url":null,"title":null,"pages":[{"title":"ABT Node Docs","path":"/en/"}]},{"url":"/en/introduction","title":"Introduction","pages":[{"title":"ABT Node Overview","path":"/en/introduction/abtnode-overview"},{"title":"ABT Node Setup","path":"/en/introduction/abtnode-setup"},{"title":"ABT Node Access","path":"/en/introduction/abtnode-access"}]},{"url":"/en/marketplace","title":"Marketplace","pages":[{"title":"Find and Install Blocklets","path":"/en/marketplace/find-and-install"},{"title":"Upgrade/downgrade blocklet","path":"/en/marketplace/upgrade-downgrade"}]},{"url":"/en/blocklet","title":"Blocklets","pages":[{"title":"Basic Operations","path":"/en/blocklet/basic-operations"},{"title":"Blocklet Environments","path":"/en/blocklet/environments"},{"title":"Core Blocklets","path":"/en/blocklet/core-blocklets"}]},{"url":"/en/router","title":"Service Gateway","pages":[{"title":"What is Service Gateway?","path":"/en/router/what-is-router"},{"title":"Service Gateway Usage","path":"/en/router/basic-usage"},{"title":"Binding domain names to sites and enabling SSL","path":"/en/router/bind-domain-and-ssl"},{"title":"Certificates for localhost","path":"/en/router/certificates-for-localhost"}]},{"url":"/en/deployment","title":"Deployment","pages":[{"title":"Production Best Practice","path":"/en/deployment/best-practice"},{"title":"Deploy ABT Node Using AWS AMI","path":"/en/deployment/from-aws-ami"},{"title":"Bind domain with reverse proxy server","path":"/en/deployment/behind-reverse-proxy"},{"title":"Run In Docker","path":"/en/deployment/run-in-docker"}]},{"url":"/en/misc","title":"Misc","pages":[{"title":"Node Settings","path":"/en/misc/node-settings"},{"title":"Member Management","path":"/en/misc/member-management"},{"title":"GraphQL Console","path":"/en/misc/graphql-console"}]},{"url":"/en/developer","title":"Developer Guide","pages":[{"title":"Configuring the development environment","path":"/en/developer/config-dev-env"},{"title":"ABT Node CLI","path":"/en/developer/abtnode-cli"},{"title":"Node Configuration","path":"/en/developer/configuration"},{"title":"Storage Structure","path":"/en/developer/storage-structure"},{"title":"Blocklet Specification","path":"/en/developer/blocklet-spec"},{"title":"Create Static Blocklets","path":"/en/developer/static-blocklets"},{"title":"Create DApp Blocklets","path":"/en/developer/dapp-blocklets"},{"title":"Blocklet Hooks","path":"/en/developer/blocklet-hooks"},{"title":"Bundle Blocklets","path":"/en/developer/bundle-blocklets"},{"title":"Publish Blocklets","path":"/en/developer/publish-blocklets"},{"title":"Blocklet Registry","path":"/en/developer/blocklet-registry"},{"title":"Developing Blocklets with Codespaces","path":"/en/developer/blocklet-codespaces"},{"title":"Configure Auth Service for Blocklet","path":"/en/developer/auth-service"},{"title":"Composable blocklet","path":"/en/developer/composable-blocklet"},{"title":"Docker Registry List","path":"/en/developer/docker-registry"}]}],"communityPath":"https://community.arcblockio.cn","githubUrl":"https://github.com/ArcBlock/abtnode-docs/tree/master/src/developer/blocklet-spec/index.md"}},"staticQueryHashes":["1358860651","1619896071","1812186216","2194038815"]}