Speed's Workshop
Disclaimer
The content of this page may be updated over time. Therefore, it is more important to understand how kOS functions than to remember the specific steps for using our technology from this page.
Prerequisites
Wallet & Network
Sepolia

Oasis Sapphire testnet
Arbitrum Sepolia
Funds
SepoliaETH token ≈ 0.1 SepoliaETH
Oasis Sapphire testnet token ≈ 0.6 TEST
Arbitrum Sepolia token ≈ 0.1 ETH (or else)
Etherscan API Key & Arbiscan API Key
How to Get Etherscan API Key?How Does kOS Work?
How Does kOS Work?Overview
OverviewGoal
Speed will walk through the overall setup.
This guide focuses on how to secure the bounty reward. *wink wink* 😉😉

Kernel
Information for Remix verification plug-in
API URL
https://api-sepolia.arbiscan.io/
Explorer URL
https://sepolia.arbiscan.io
Kernel A (Exchange Rate)
Exchange.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
contract Exchange {
// From 1st of April 2025
uint256 ethToUsdc = 1834; // static value, the real oracle exchange rate would be dynamic based on time
function getExchangeRate() view external returns (uint256) {
// This is just a mocking code for fetching data from an oracle source.
// The actual production grade code would have more security checks/layers.
// However, in this workshop, we are going to simplify pretty much all the logics of oracle code.
// Things would then be cut-down into just returning the exchange rate.
return ethToUsdc;
}
}
Deploy
In this workshop, we will use Arbitrum Sepolia (chain ID 421614) network.
You may choose to deploy on other networks such as Base Sepolia, Optimism Sepolia, or Sepolia.
Register
Kernel B (Allowlist)
Allowlist.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
contract Allowlist {
// Declare mapping in Solidity
// Some people might call this mapping as:
// dict (Python)
// map (JavaScript)
// hash (Ruby)
mapping (address => bool) private allowMapping;
// "checkAllowlist" will be registered as on-chain kernel
function checkAllowlist(address walletAddressInput) view external returns (bool) {
// Simple logic to check if your wallet address is in Allowlist or not
if (allowMapping[walletAddressInput] == true) {
return true;
} else {
return false;
}
}
// For registering yourself to be in Allowlist
function registerAllowlist() external {
allowMapping[msg.sender] = true;
}
}
Deploy
In this workshop, we will use Arbitrum Sepolia (chain ID 421614) network.
You may choose to deploy on other networks such as Base Sepolia, Optimism Sepolia, or Sepolia.
Register
Add yourself to the Allowlist
https://sepolia.arbiscan.io/address/0x123
Smart Contract
Clone Template
git clone https://github.com/KRNL-Labs/krnl-toolkit.git
Fill .env (especially on KERNEL_ID part)
ETHERSCAN_API_KEY= # REQUIRED
# PRIVATE KEYS; they can be the same private key
PRIVATE_KEY_OASIS= # REQUIRED; no need 0x prefix, can be the same as Sepolia
PRIVATE_KEY_SEPOLIA= # REQUIRED; no need 0x prefix, can be the same as Oasis
# SELECTED KERNEL IDS FOR REGISTERING SMART CONTRACT
# KERNEL_ID=337, 123, 456
KERNEL_ID=337 <<<<<<<<<<<<<< CHANGE THIS TO BE THE ONES THAT YOU REGISTERED
# OPTIONAL
INFURA_PROJECT_ID= # OPTIONAL FOR SEPOLIA
Modify TokenAuthority.sol
Directory: krnl-toolkit/smart-contracts/hardhat/contracts
Modify Sample.sol
Install Dependencies
npm install
Deploy, Verify, and Register
npm run hdvr
Output
...
...
...
======================================
=====SUMMARY=====
Registered Smart Contract ID: 789789
dApp ID: 123456
Please visit this page for Entry ID, Access Token, and Kernel Payload
https://app.platform.lat/dapp/123456
Tips 1: Entry ID and Access Token are similar to x-api-key or Bearer Token of Web2
Tips 2: Kernel Payload is the template of parameter(s) that needs to be sent to kernel ID(s): [ 1111, 2222 ]
======================================
dApp
Result

Bounty
Bounty ProgramOther Resources
Litepaper
LitepaperKernel
For integrating Web API with kOS
Supported OpenAPI (Off-chain Kernel)For other on-chain kernels, the supported blockchain networks (current):
Ethereum (mainnet)
Sepolia
Base
Base Sepolia
Optimism
Optimism Sepolia
Arbitrum
Arbitrum Sepolia
Smart Contract
Decoding different data types (from kernel responses) with Solidity
Decoding Kernel Responses in SolidityAlready have your own Solidity smart contract?
How to Integrate Your Smart Contract with kOS?dApp
UsageHelper *wink wink*
You may use this idea to apply for bounty.
This entire kOS flow is not good because:
Exchange rate kernel (oracle) is static
Allowlist kernel (KYC) does not contain any security check/proof
Token Authority allows all kernels without any restriction
Smart contract (Sample.sol) convert numbers and not ERC-20 token(s)
dApp is very static (fixed amount of Mock ETH to convert)
dApp's interface looks plain
There might be some mistakes/vulnerabilities in some part of the code
Last updated
Was this helpful?