From 240de99f24e98596aff453211f6578292bb2c77a Mon Sep 17 00:00:00 2001
From: boneyard93501 <boneyard93501@gmail.com>
Date: Fri, 18 Jun 2021 15:26:43 +0000
Subject: [PATCH] GitBook: [builtins] 2 pages modified

---
 .../hll/knowledge_aquamarine_air.md           |  2 +-
 tutorials_tutorials/add-your-own-builtin.md   | 63 +++++++++++++++++++
 2 files changed, 64 insertions(+), 1 deletion(-)

diff --git a/knowledge_knowledge/knowledge_aquamarine/hll/knowledge_aquamarine_air.md b/knowledge_knowledge/knowledge_aquamarine/hll/knowledge_aquamarine_air.md
index d9a1d24..24d8bb8 100644
--- a/knowledge_knowledge/knowledge_aquamarine/hll/knowledge_aquamarine_air.md
+++ b/knowledge_knowledge/knowledge_aquamarine/hll/knowledge_aquamarine_air.md
@@ -23,7 +23,7 @@ AIR instructions are intended to launch the execution of a service method as fol
 4. The arguments specified by the argument list are passed to the method
 5. The result of the method returned under the name output name
 
-**Figure 2: Sequential Instruction** ![Execution](../../../.gitbook/assets/air_sequential_2%20%281%29%20%281%29%20%281%29%20%281%29%20%281%29%20%282%29%20%283%29%20%284%29%20%284%29%20%282%29.png)
+**Figure 2: Sequential Instruction** ![Execution](../../../.gitbook/assets/air_sequential_2%20%281%29%20%281%29%20%281%29%20%281%29%20%281%29%20%282%29%20%283%29%20%284%29%20%282%29.png)
 
 The _**seq**_ instruction takes two instructions at most as its arguments and executes them sequentially, one after the other.
 
diff --git a/tutorials_tutorials/add-your-own-builtin.md b/tutorials_tutorials/add-your-own-builtin.md
index f8afaeb..0e0b839 100644
--- a/tutorials_tutorials/add-your-own-builtin.md
+++ b/tutorials_tutorials/add-your-own-builtin.md
@@ -1,2 +1,65 @@
 # Add Your Own Builtin
 
+
+
+If you want to have a service that available out-of-the-box with startup script and scheduled scripts, you can use `builtins deployer` feature. It will upload modules, deploy service, run init script and schedule others.  
+You should put your service files in the corresponding folder specified in config as `builtins_base_dir`.
+
+### Builtins directory structure
+
+```text
+-- builtins
+    -- {service_alias}
+        -- scheduled
+            -- {script_name}_{interval_in_seconds}.air [optional]
+        -- blueprint.json
+        -- on_start.air [optional]
+        -- on_start.json [optional]
+        -- {module1_name}.wasm
+        -- {module1_name}_config.json
+        -- {module2_name}.wasm
+        -- {module2_name}_config.json
+        ...
+```
+
+In blueprint you can specify dependencies either with name or hashes but .wasm files and config should have corresponding names. `blieprint.json` example:
+
+```javascript
+{
+  "name": "aqua-dht",
+  "dependencies": [
+    "hash:558a483b1c141b66765947cf6a674abe5af2bb5b86244dfca41e5f5eb2a86e9e",
+    "name:aqua-dht"
+  ]
+}
+```
+
+So modules and configs names should look like this:
+
+```text
+-- aqua-dht.wasm
+-- aqua-dht_config.json
+-- 558a483b1c141b66765947cf6a674abe5af2bb5b86244dfca41e5f5eb2a86e9e.wasm
+-- 558a483b1c141b66765947cf6a674abe5af2bb5b86244dfca41e5f5eb2a86e9e_config.json
+```
+
+`on_start.air` is optional and can contain some startup script and you can specify necessary variables in `on_start.json`. It will be executed only once after service deployment or node restart.
+
+`on_start.json` example:
+
+```javascript
+{
+    "variable1" : "some_string",
+    "variable2" : 5,
+}
+```
+
+`on_start.air` example:
+
+```text
+(seq
+    (call relay ("some_service_alias" "some_func1") [variable1] result)
+    (call relay ("some_service_alias" "some_func2") [variable2 result])
+)
+```
+