1"use strict";(globalThis.webpackChunkdocs_oasis_io=globalThis.webpackChunkdocs_oasis_io||[]).push([[6202],{23857:(e,n,i)=>{i.r(n),i.d(n,{assets:()=>a,contentTitle:()=>d,default:()=>p,frontMatter:()=>r,metadata:()=>t,toc:()=>l});const t=JSON.parse('{"id":"core/development-setup/single-validator-node-network","title":"Single Validator Node Network","description":"It is possible to provision a local \\"network\\" consisting of a single validator","source":"@site/docs/core/development-setup/single-validator-node-network.md","sourceDirName":"core/development-setup","slug":"/core/development-setup/single-validator-node-network","permalink":"/core/development-setup/single-validator-node-network","draft":false,"unlisted":false,"editUrl":"https://github.com/oasisprotocol/oasis-core/edit/stable/24.2.x/docs/development-setup/single-validator-node-network.md","tags":[],"version":"current","lastUpdatedAt":1645812090000,"frontMatter":{"sidebar_custom_props":{}},"sidebar":"oasisCore","previous":{"title":"Local Network Runner","permalink":"/core/development-setup/oasis-net-runner"},"next":{"title":"Deploying a Runtime","permalink":"/core/development-setup/deploying-a-runtime"}}');var s=i(74848),o=i(28453);const r={sidebar_custom_props:{tags:void 0}},d="Single Validator Node Network",a={},l=[{value:"Provisioning an Entity",id:"provisioning-an-entity",level:2},{value:"Provisioning a Node",id:"provisioning-a-node",level:2},{value:"Creating a Test Genesis Document",id:"creating-a-test-genesis-document",level:2},{value:"Running the Node",id:"running-the-node",level:2},{value:"Using the Node CLI",id:"using-the-node-cli",level:2}];function c(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,o.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.header,{children:(0,s.jsx)(n.h1,{id:"single-validator-node-network",children:"Single Validator Node Network"})}),"\n",(0,s.jsx)(n.p,{children:'It is possible to provision a local "network" consisting of a single validator\nnode. This may be useful for specific development use cases.'}),"\n",(0,s.jsxs)(n.p,{children:["Before proceeding, make sure to look at the ",(0,s.jsx)(n.a,{href:"/core/development-setup/prerequisites",children:"prerequisites"})," required for running\nan Oasis Core environment followed by ",(0,s.jsx)(n.a,{href:"/core/development-setup/building",children:"build instructions"})," for the respective\nenvironment (non-SGX or SGX). The following sections assume that you have\nsuccessfully completed the required build steps."]}),"\n",(0,s.jsx)(n.admonition,{type:"danger",children:(0,s.jsx)(n.p,{children:"These instructions are for a development-only instance, do not use them\nfor setting up any kind of production instances as they are unsafe and will\nresult in insecure configurations leading to node compromise."})}),"\n",(0,s.jsx)(n.h2,{id:"provisioning-an-entity",children:"Provisioning an Entity"}),"\n",(0,s.jsxs)(n.p,{children:["To provision an ",(0,s.jsx)(n.a,{href:"/core/consensus/services/registry#entities-and-nodes",children:"entity"})," we first prepare an empty directory under\n",(0,s.jsx)(n.code,{children:"/path/to/entity"})," and then initialize the entity:"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"mkdir -p /path/to/entity\ncd /path/to/entity\noasis-node registry entity init --signer.backend file --signer.dir .\n"})}),"\n",(0,s.jsx)(n.h2,{id:"provisioning-a-node",children:"Provisioning a Node"}),"\n",(0,s.jsxs)(n.p,{children:["To provision a ",(0,s.jsx)(n.a,{href:"/core/consensus/services/registry#entities-and-nodes",children:"node"})," we first prepare an empty directory under ",(0,s.jsx)(n.code,{children:"/path/to/node"}),"\nand the initialize the node. The node is provisioned as a validator."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"mkdir -p /path/to/node\ncd /path/to/node\noasis-node registry node init \\\n --signer.backend file \\\n --signer.dir /path/to/entity \\\n --node.consensus_address 127.0.0.1:26656 \\\n --node.is_self_signed \\\n --node.role validator\n"})}),"\n",(0,s.jsxs)(n.p,{children:["After the node is provisioned we proceed with updating the ",(0,s.jsx)(n.a,{href:"/core/consensus/services/registry#register-node",children:"entity whitelist"}),"\nso that the node will be able to register itself:"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"oasis-node registry entity update \\\n --signer.backend file \\\n --signer.dir /path/to/entity \\\n --entity.node.descriptor /path/to/node/node_genesis.json\n"})}),"\n",(0,s.jsx)(n.h2,{id:"creating-a-test-genesis-document",children:"Creating a Test Genesis Document"}),"\n",(0,s.jsx)(n.p,{children:'To create a test genesis document for your development "network" use the\nfollowing commands:'}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"mkdir -p /path/to/genesis\ncd /path/to/genesis\noasis-node genesis init \\\n --chain.id test \\\n --entity /path/to/entity/entity_genesis.json \\\n --node /path/to/node/node_genesis.json \\\n --debug.dont_blame_oasis \\\n --debug.test_entity \\\n --debug.allow_test_keys \\\n --registry.debug.allow_unroutable_addresses \\\n --staking.token_symbol TEST\n"})}),"\n",(0,s.jsx)(n.admonition,{type:"danger",children:(0,s.jsx)(n.p,{children:"This enables unsafe debug-only flags which must never be used in a\nproduction setting as they may result in node compromise."})}),"\n",(0,s.jsx)(n.h2,{id:"running-the-node",children:"Running the Node"}),"\n",(0,s.jsx)(n.p,{children:"To run the single validator node, use the following command:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"oasis-node \\\n --datadir /path/to/node \\\n --genesis.file /path/to/genesis/genesis.json \\\n --worker.registration.entity /path/to/entity/entity.json \\\n --consensus.validator \\\n --debug.dont_blame_oasis \\\n --debug.allow_test_keys \\\n --log.level debug\n"})}),"\n",(0,s.jsx)(n.admonition,{type:"danger",children:(0,s.jsx)(n.p,{children:"This enables unsafe debug-only flags which must never be used in a\nproduction setting as they may result in node compromise."})}),"\n",(0,s.jsx)(n.h2,{id:"using-the-node-cli",children:"Using the Node CLI"}),"\n",(0,s.jsxs)(n.p,{children:["The ",(0,s.jsx)(n.code,{children:"oasis-node"})," exposes ",(0,s.jsx)(n.a,{href:"/core/oasis-node/rpc",children:"an RPC interface"})," via a UNIX socket located in its\ndata directory (e.g., under ",(0,s.jsx)(n.code,{children:"/path/to/node/internal.sock"}),"). To simplify the\nfollowing instructions set up an ",(0,s.jsx)(n.code,{children:"ADDR"})," environment variable pointing to it:"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"export ADDR=unix:/path/to/node/internal.sock\n"})}),"\n",(0,s.jsx)(n.p,{children:"This can then be used to execute CLI commands against the running node (in a\nseparate terminal). For example to show all registered entities:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"oasis-node registry entity list -a $ADDR -v\n"})}),"\n",(0,s.jsx)(n.p,{children:"Giving output similar to:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:'{"v":1,"id":"UcxpyD0kSo/5keRqv8pLypM/Mg5S5iULRbt7Uf73vKQ=","nodes":["jo+quvaFYAP4Chyf1PRqCZZObqpDeJCxfBzTyghiXxs="]}\n{"v":1,"id":"TqUyj5Q+9vZtqu10yw6Zw7HEX3Ywe0JQA9vHyzY47TU=","allow_entity_signed_nodes":true}\n'})}),"\n",(0,s.jsx)(n.p,{children:"Or getting a list of all staking accounts:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"oasis-node stake list -a $ADDR\n"})}),"\n",(0,s.jsx)(n.p,{children:"Giving output similar to:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"oasis1qzzd6khm3acqskpxlk9vd5044cmmcce78y5l6000\noasis1qz3xllj0kktskjzlk0qacadgwpfe8v7sy5kztvly\noasis1qrh4wqfknrlvv7whjm7mjsjlvka2h35ply289pp2\n"})})]})}function p(e={}){const{wrapper:n}={...(0,o.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(c,{...e})}):c(e)}},28453:(e,n,i)=>{i.d(n,{R:()=>r,x:()=>d});var t=i(96540);const s={},o=t.createContext(s);function r(e){const n=t.useContext(o);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:r(e.components),t.createElement(o.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.