Interact with the Atoma smart contract
Describes the main steps how to interact with the Atoma smart contract
In order to interact with the Atoma contract, we provide a set of tools which include a custom cli module for Atoma, that allows anyone to submit transactions into Atoma. Furthermore, node operators can leverage a custom daemon that automatizes many of the processes related to operating a node (we will provide a more extensive description of the daemon functionalities in a later section).
Install Sui cli
The first step is to install locally the Sui client software. This can be done as follows:
1. Install the Sui client locally:
The first step in setting up an Atoma node is installing the Sui client locally. Please refer to the Sui installation guide for more information.
Once you have the Sui client installed, locally, you need to connect to a Sui RPC node to be able to interact with the Sui blockchain and therefore the Atoma smart contract. Please refer to the Connect to a Sui Network guide for more information.
You then need to create a wallet and fund it with some testnet SUI. Please refer to the Sui wallet guide for more information. If you are plan to run the Atoma node on Sui's testnet, you can request testnet SUI tokens by following the docs.
Once you finish the steps above, you should have the following files created locally:
~/.sui/sui_config/client.yaml
- the Sui client configuration file.~/.sui/sui_config/sui.keystore
- The Sui keystore file (contains your private key(s)).
You can request Sui testnet funds by running the command:
You can then query your wallet balance through
Atoma testnet parameters
Atoma's package id (on Sui's testnet):
0xc05bae323433740c969d8cf938c48d7559490be5f8dde158792e7a0623787013
Atoma's DB object id:
0x7b8f40e38698deb650519a51f9c1a725bf8cfdc074d1552a4dc85976c2b414be
Atoma's TOMA faucet token package id (testnet):
0xa1b2ce1a52abc52c5d21be9da0f752dbd587018bc666c5298f778f42de26df1d
Set up Atoma's custom cli
In order to interact with the Atoma contract, through our custom cli, one must follow the steps:
Clone the Atoma contract repository:
Request faucet TOMA tokens to your (local) active Sui wallet (it mints 100 tokens, as the token is programmed to have 9 decimal places):
Once the transaction is submitted, you should be able to query the value amount of faucet TOMA tokens you currently hold on your wallet:
Create a Task on Atoma
In order to create a Task
on Atoma, it is important to understand how these are used to specify compute jobs on the network. Each Task
is assigned a role. Roles can be one of those values:
Chat completions - 0
Embeddings - 1
Vision - 2
Image generation - 3
Text to speech - 4
Speech to Text - 5
Fine tuning - 6
Training - 7
To spawn a new Task
on Atoma, one can specify a model (following HuggingFace name convention), for example:
model-name: meta-llama/Llama-3.1-8B-Instruct
It is also possible to specify an optional Security level
for the Task
:
No security - 0 (meaning no additional security requirements like verifiability or privacy are required)
Sampling Consensus - 1 (meaning that the each workload on Atoma for this task is under the
Sampling Consensus
protocol, for verifiable AI)Confidential compute - 2 (meaning that each workload on Atoma for this task requires trusted hardware to be executed, allowing for both verifiability and privacy).
The Task
creator can also specify a minimum node reputation score (minimum 0 and maximum 100).
In order to submit to create a Task, using Atoma's cli, one simply needs to run:
When a transaction for creating a new Task is submitted, the involved wallet receives a new Sui Move object, of the form:
The TaskSmallId
is a wrapper around a u64
number
This number is important to refer to the task in future transactions such as subscribing nodes to tasks, deprecated or remove tasks, buy Stacks on behalf of a user, etc.
Deprecating tasks
It is possible to deprecate tasks that are active, and were created by the current wallet by running:
The TASK_BADGE_ID
value is the id within TaskBadge
that can be accessed by querying the wallet owned objects.
Removing tasks
To remove a task that was already deprecated, one can run the command:
Register a node
In order to register a node on Atoma, one must run:
Subscribe a node to a Task
In order for Atoma nodes to participate in the protocol, these must subscribe to specific tasks:
Unsubscribe node from a Task
Nodes on Atoma can unsubscribe from Tasks that these have subscribed to (even though nodes must claim each active Stacks):
Buy Stacks
Users on Atoma can access nodes, by first buying Stack
s associated to a specific Task
. In order to buy a Stack
, one just needs to run the command:
Once the Stack
is acquired by the wallet, the wallet will hold a StackBadge
object of the form:
This object grants permissions to the wallet to manage the Stack
. The StackSmallId
is a wrapper around a u64
, which can be used to refer to the Stack
later, as we shall see.
Settling Stacks
Once nodes have processed a large number of compute units for a given Stack
, the nodes can try to settle the Stack
and claim the funds for having provided the compute to the holder of the Stack.
The first step to settle a Stack
is by trying to settle the stack:
The values of committed-stack-proof
and stack-merkle-leaf
can be computed as the Merkle tree root and leaf index corresponding to the whole Stack
history. In practice, node operators do not need to compute these values themselves, as this is completed addressed within the Atoma node daemon logic.
Once the transaction goes through, a dispute challenge window for the Stack
execution starts, which lasts for two epochs. Within those epochs anyone can dispute the Stack
settlement, including user holding the original Stack
. Additionally, the Atoma contract can select one or more nodes to attest to the right execution from the original selected node for the Stack
. This is relevant for our Sampling Consensus protocol. If no security or confidential compute security are required, then the contract skips this step.
If a node is selected to attest a Stack
execution, it needs to fetch the Stack's input data, and redo the whole history of execution (that is, running AI inference on the whole stack requests). Once that is done, the node can attest the execution by submitting an on-chain transaction as:
On the other hand, any participant on the network can start a dispute mechanism as:
In this case, a dispute resolution mechanism is put forth by the contract to resolve the dispute. The dishonest part involved in the dispute resolution mechanism will be at risk of slashed collateral.
Claim funds
Once the dispute challenge period has finished for a Stack
, the node can finally claim its funds by running the command:
Last updated