not really known
Go to file
2024-11-07 20:59:19 +04:00
.github conditional removed in workflow 2024-07-05 15:34:53 -04:00
css Kode Mono 2024-09-17 15:28:48 -04:00
kinode app_store: add pending auto_updates state, /manifest http GET 2024-11-07 20:59:19 +04:00
lib 0.9.7->0.9.8 2024-11-04 09:21:37 -05:00
scripts add script to build windows artifact; fix bugs 2024-10-15 12:39:56 -07:00
src refactor into kinode (core) and lib (currently types & wit stuff) 2024-02-01 20:44:33 -08:00
.dockerignore Dockerize Kinode 2024-04-04 17:42:56 +00:00
.gitignore docs: add initial package & modify build script 2024-08-09 17:03:18 -07:00
Cargo.lock 0.9.7->0.9.8 2024-11-04 09:21:37 -05:00
Cargo.toml 0.9.7->0.9.8 2024-11-04 09:21:37 -05:00
Dockerfile add support for multiarch builds 2024-08-26 22:41:01 +01:00
Dockerfile.buildbase fix images & add runtime image version 2024-09-27 19:05:34 -07:00
Dockerfile.buildruntime remove old Dockerfile comment 2024-10-08 19:29:29 -07:00
entitlements.plist fix entitlements.. magic 2024-09-24 16:44:13 -04:00
LICENSE more css removal, update license 2024-07-24 20:02:59 +03:00
README.md contacts FE 2024-10-16 17:10:03 -04:00

Screenshot 2024-05-08 at 2 38 11 PM

Kinode is a general-purpose sovereign cloud computer, built for crypto.

This repo contains the core runtime and processes. Most developers need not build the runtime. Instead, check out the Kinode book, and in particular the "My First App" tutorial.

If you want to get on the network, you can download a binary, rather than building it yourself, from the releases page. Then follow the instructions to install it and join the network.

If you have questions, join the Kinode discord and drop us a line in #dev-support.

Setup

On certain operating systems, you may need to install these dependencies if they are not already present:

# Clone the repo.

git clone git@github.com:kinode-dao/kinode.git

# Install Rust and some `cargo` tools so we can build the runtime and Wasm.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo install wasm-tools
rustup install nightly
rustup target add wasm32-wasip1 --toolchain nightly
cargo install cargo-wasi

# Install NPM so we can build frontends for "distro" packages.
# https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
# If you want to skip this step, build the packages with `cargo run -p build_packages -- --skip-build-frontend` to neglect building the frontends

# Build the "distro" Wasm modules, then, build the runtime.
# The compiled packages will be at `kinode/target/packages.zip`.
# The compiled binary will be at `kinode/target/debug/kinode`.
# OPTIONAL: --release flag (slower build; faster runtime; binary at `kinode/target/release/kinode`).

cd kinode
cargo run -p build_packages
cargo build -p kinode

To build on Windows

Security Status

No security audits of this crate have ever been performed. This software is under active development and should be used at your own risk.

Boot

Make sure not to use the same home directory for two nodes at once! You can use any name for the home directory: here we just use home. The -- here separates cargo arguments from binary arguments.

# OPTIONAL: --release flag
cargo +nightly run -p kinode -- home

On boot you will be prompted to navigate to localhost:8080 or whatever HTTP port your node bound to: it will try 8080 and go up from there, or use the port passed with the --port boot flag. Make sure your browser wallet matches the network that the node is being booted on. Follow the registration UI -- if you want to register a new ID you will either need Optimism ETH or an invite code.

Boot Flags

Here are all the available boot flags for the Kinode runtime:

  • [home]: (Required) Path to home directory.
  • -p, --port <PORT>: Port to bind for HTTP. Default is the first unbound port at or above 8080.
  • --ws-port <PORT>: Kinode internal WebSockets protocol port. Default is the first unbound port at or above 9000.
  • --tcp-port <PORT>: Kinode internal TCP protocol port. Default is the first unbound port at or above 10000.
  • -v, --verbosity <VERBOSITY>: Verbosity level: higher (up to 3)is more verbose. Default is 0.
  • -l, --logging-off: Run in non-logging mode. Do not write terminal output to file in .terminal_logs directory.
  • -d, --detached: Run in detached mode (don't accept input on terminal).
  • --rpc <RPC>: Add a WebSockets Optimism RPC URL at boot.
  • --password <PASSWORD>: Node password (in double quotes).
  • --max-log-size <MAX_LOG_SIZE_BYTES>: Max size of all terminal logs in bytes. Setting to 0 means no size limit. Default is 16MB.
  • --number-log-files <NUMBER_LOG_FILES>: Number of terminal logs to rotate. Default is 4.
  • --max-peers <MAX_PEERS>: Maximum number of peers to hold active connections with. Default is 32.
  • --max-passthroughs <MAX_PASSTHROUGHS>: Maximum number of passthroughs to serve as a router. Default is 0.
  • --soft-ulimit <SOFT_ULIMIT>: Enforce a static maximum number of file descriptors. Default is fetched from system.

When compiled with the simulation-mode feature, two additional flags are available:

  • --fake-node-name <NAME>: Name of fake node to boot.
  • --fakechain-port <FAKECHAIN_PORT>: Port to bind to for local anvil-run blockchain.

Configuring the ETH RPC Provider

By default, a node will use the hardcoded providers for the network it is booted on. A node can use a WebSockets RPC URL directly, or use another Kinode as a relay point. To adjust the providers a node uses, just create and modify the .eth_providers file in the node's home folder (set at boot). See the Kinode Book for more docs, and see the default providers file here for a template to create .eth_providers.

You may also add a RPC provider or otherwise modify your configuration by sending messages from the terminal to the eth:distro:sys process. You can get one for free at alchemy.com. Use this message format to add a provider -- this will make your node's performance better when accessing a blockchain:

m our@eth:distro:sys '{"AddProvider": {"chain_id": <SOME_CHAIN_ID>, "trusted": true, "provider": {"RpcUrl": "<WS_RPC_URL>"}}}'

You can also do the same thing by using the --rpc boot flag with an Optimism WebSockets RPC URL, or going to the Settings app once booted into a node.

Distro and Runtime processes

The base OS install comes with certain runtime modules. These are interacted with in the same way as userspace processes, but are deeply ingrained to the system and the APIs they present at their Process IDs are assumed to be available by userspace processes. All of these are identified in the distro:sys package.

This distribution of the OS also comes with userspace packages pre-installed. Some of these packages are intimately tied to the runtime: terminal, homepage, and kns_indexer. Modifying, removing or replacing the distro userspace packages should only be done in highly specialized use-cases.

The runtime distro processes are:

  • eth:distro:sys
  • fd_manager:distro:sys
  • http_client:distro:sys
  • http_server:distro:sys
  • kernel:distro:sys
  • kv:distro:sys
  • net:distro:sys
  • state:distro:sys
  • terminal:distro:sys
  • timer:distro:sys
  • sqlite:distro:sys
  • vfs:distro:sys

The distro userspace packages are:

  • app_store:sys
  • chess:sys
  • contacts:sys
  • homepage:sys
  • kino_updates:sys
  • kns_indexer:sys
  • settings:sys
  • terminal:sys
  • tester:sys (used with kit for running test suites, only installed in simulation-mode)

The sys publisher is not a real node ID, but it's also not a special case value. Packages, whether runtime or userspace, installed from disk when a node bootstraps do not have their package ID or publisher node ID validated. Packages installed (not injected locally, as is done during development) after a node has booted will have their publisher field validated.

Terminal syntax

  • CTRL+C or CTRL+D to gracefully shutdown node

  • CTRL+V to toggle through verbose modes (0-3, 0 is default and lowest verbosity)

  • CTRL+J to toggle debug mode

  • CTRL+S to step through events in debug mode

  • CTRL+L to toggle logging mode, which writes all terminal output to the .terminal_log file. On by default, this will write all events and verbose prints with timestamps.

  • CTRL+A to jump to beginning of input

  • CTRL+E to jump to end of input

  • UpArrow/DownArrow or CTRL+P/CTRL+N to move up and down through command history

  • CTRL+R to search history, CTRL+R again to toggle through search results, CTRL+G to cancel search

Built-in terminal scripts

The terminal package contains a number of built-in scripts. Users may also call scripts from other packages in the terminal by entering the (full) ID of the script process followed by any arguments. In order to call a script with shorthand, a user may apply an alias using the terminal alias script, like so:

alias <shorthand> <full_name>

Subsequent use of the shorthand will then be interpolated as the process ID.

A list of the terminal scripts included in this distro:

  • alias <shorthand> <process_id>: create an alias for a script.
    • Example: alias get_block get_block:kns_indexer:sys
    • note: all of these listed commands are just default aliases for terminal scripts.
  • cat <vfs-file-path>: print the contents of a file in the terminal.
    • Example: cat /terminal:sys/pkg/scripts.json
  • echo <text>: print text to the terminal.
    • Example: echo foo
  • help <command>: print the help message for a command. Leave the command blank to print the help message for all commands.
  • hi <name> <string>: send a text message to another node's command line.
    • Example: hi mothu.kino hello world
  • kfetch: print system information a la neofetch. No arguments.
  • kill <process-id>: terminate a running process. This will bypass any restart behavioruse judiciously.
    • Example: kill chess:chess:sys
  • m <address> '<json>': send an inter-process message. is formatted as @<process_id>. <process_id> is formatted as <process_name>:<package_name>:<publisher_node>. JSON containing spaces must be wrapped in single-quotes ('').
    • Example: m our@eth:distro:sys "SetPublic" -a 5
    • the '-a' flag is used to expect a response with a given timeout
    • our will always be interpolated by the system as your node's name
  • net_diagnostics: print some useful networking diagnostic data.
  • peer <name>: print the peer's PKI info, if it exists.
  • peers: print the peers the node currently hold connections with.
  • top <process_id>: display kernel debugging info about a process. Leave the process ID blank to display info about all processes and get the total number of running processes.
    • Example: top net:distro:sys
    • Example: top

Running as a Docker container

This image expects a volume mounted at /kinode-home. This volume may be empty or may contain another Kinode's data. It will be used as the home directory of your Kinode.

The image includes EXPOSE directives for TCP port 8080 and TCP port 9000. Port 8080 is used for serving the Kinode web dashboard over HTTP, and it may be mapped to a different port on the host. Port 9000 is optional and is only required for a direct node.

If you are running a direct node, you must map port 9000 to the same port on the host and on your router. Otherwise, your Kinode will not be able to connect to the rest of the network as connection info is written to the chain, and this information is based on the view from inside the Docker container.

To build a local Docker image, run the following command in this project root.

# The `VERSION` may be replaced with the tag of a GitHub release

# Build for your system's architecture
docker build . -t 0xlynett/kinode --build-arg VERSION=v0.9.1

# Build a multiarch image
docker buildx build . --platform arm64,amd64 --build-arg VERSION=v0.9.1 -t 0xlynett/kinode

For example:

docker volume create kinode-volume

docker run -d -p 8080:8080 -it --name my-kinode \
    --mount type=volume,source=kinode-volume,destination=/kinode-home \
    0xlynett/kinode