For Acki Nacki Developers
Acki Nacki docsFor DevelopersFor Validators
  • About Acki Nacki SDK
  • How to deploy a Multisig Wallet
  • Dapp ID Full Guide: creation, fees, centralized replenishment
  • Quick Starts
    • Quick Start TVM SDK JavaScript
    • GraphQL Quick Start
  • Reference
    • Core Library Reference
      • Modules
      • Module abi
      • Module boc
      • Module client
      • Module crypto
      • Module debot
      • Module net
      • Module processing
      • Module proofs
      • Module tvm
      • Module utils
    • Core Library Error API
    • Error Codes
    • TVM-CLI Reference
  • VM Instructions
    • Acki Nacki VM Instructions
    • Formal Verification
      • Acki Nacki VM Instructions Business-Level Specification
  • GraphQL
    • GraphQL API
    • Schema
    • Blockchain API
    • Query Collections: Query Language
    • Field Descriptions
    • Info API
    • Web Playground
    • Examples
  • ABI
    • ABI Specification
  • Examples
    • Client Libraries JS Examples
    • GraphQL API Examples
      • Connect to GraphQL API
      • Send message
      • Accounts
      • Blocks
      • Messages
      • Block and Transaction Pagination: Best Practice
      • Transactions
  • For Binding Developers
    • How to work with Application Objects in binding generators
    • JSON Interface to TVM Client
  • Links
    • TVM SDK repository
Powered by GitBook
On this page
  • Purpose
  • Introduction
  • Acki Nacki - specific instructions
  • CNVRTSHELLQ
  • MINTECC
  • MINTSHELL
  • CALCBKREWARD
  • CALCMINSTAKE
  • CALCBKREWARDADJ
  • CALCREPCOEF
  • Zero-knowledge instructions
  • VERGRTH16
  • POSEIDON
  1. VM Instructions
  2. Formal Verification

Acki Nacki VM Instructions Business-Level Specification

Prepared by Pruvendo

PreviousFormal VerificationNextGraphQL API

Last updated 1 month ago

Purpose

The purpose of the present document is to create business-level specification (highest-level of specification) for the Acki Nacki - specific VM instructions. This document is intended to:

  • Be thoroughly reviewed by the Customer

  • Act as a base for the high-level specification

Introduction

Acki Nacki - specific instructions

For all the instructions below the current account is taken from c4 register.

CNVRTSHELLQ

Signature : C727 n(−)n ( - )n(−) , where 0≤n<22560 \leq n < 2^{256}0≤n<2256

Input : n mod 264n \bmod 2^{64}nmod264 - amount of nanotokens to exchange

Behavior:

  • If the sender has enough balance of SHELL, the required amount of SHELL’s are transformed into VMSHELL

  • Otherwise, the whole balance of SHELL is transformed into VMSHELL

  • In any case the counter of special operations is increased

MINTECC

Signature : C726 y x(−)y \space x ( - )y x(−), where 0≤x<2560 \leq x < 2560≤x<256, 0≤y<21280 \leq y < 2^{128}0≤y<2128

Brief description : mints the required amount of any ECC tokens, can be called by a special contract only

Input : xxx - index of ECC token, yyy - amount of nanotokens to mint

Behavior:

  • If the contract is not special, NOT_SPECIAL_CONTRACT error happens

  • If the adding of tokens fails, OVERFLOW error happens

  • Otherwise:

    • token balance is increased by the specified amount

    • counter of special actions is increased

MINTSHELL

Signature : C728 n(−)n ( - )n(−), where 0≤n<21280 \leq n < 2^{128}0≤n<2128

Brief description : mints SHELL tokens, up to the specified amount, using the available credit

Input : n - amount of SHELL nanotokens to be minted

Behavior:

  • In case of infinite credit, the specified amount of SHELL tokens is minted

  • Up to the nnn tokens will be minted, but Minted shell value afterwards does not exceed available credit

  • Minted shell value is increased by the amount of the minted value

  • In case of success the counter of special actions is increased

All the values must not exceed 21282^{128}2128.

CALCBKREWARD

Signature : C729 r s τ e Σ n a (ρ)r \space s \space \tau \space e \space \varSigma \space n \space a \space (\rho)r s τ e Σ n a (ρ), where:

  • 0≤r<21280 \leq r < 2^{128}0≤r<2128

  • 0≤s<21280 \leq s < 2^{128}0≤s<2128

  • 0≤τ<21280 \leq \tau < 2^{128}0≤τ<2128

  • 0≤e<21280 \leq e < 2^{128}0≤e<2128

  • 0≤Σ<21280 \leq \varSigma < 2^{128}0≤Σ<2128

  • 0≤n<21280 \leq n < 2^{128}0≤n<2128

  • 0≤a<21280 \leq a < 2^{128}0≤a<2128

Brief description : calculates and returns validator’s reward by the end of each epoch

Input :

  • rrr - reputation coefficient

  • sss - stake

  • τ\tauτ - total stake at the epoch start

  • eee - epoch duration

  • 𝛴- total amount of minted reward tokens

  • nnn - number of active block keepers

  • aaa - last calculated reward adjustment

Output : ρ\rhoρ - assigned reward

  • Σ=0⇒ρ=aer109n\varSigma = 0 \rArr \rho = \frac{aer}{10^9n}Σ=0⇒ρ=109naer​

  • 0<Σ<TOTALSUPPLY⇒ρ=aers109τ0\lt\varSigma \lt TOTALSUPPLY \Rightarrow \rho = \frac{a e r s}{10^9 \tau}0<Σ<TOTALSUPPLY⇒ρ=109τaers​

  • Σ≥TOTALSUPPLY⇒ρ=0\varSigma \ge TOTALSUPPLY \Rightarrow \rho =0Σ≥TOTALSUPPLY⇒ρ=0

CALCMINSTAKE

Signature : C730 v n t s (μ)v \space n \space t \space s \space (\mu)v n t s (μ), where:

  • 0≤v<21280 \leq v < 2^{128}0≤v<2128

  • 0≤n<21280 \leq n < 2^{128}0≤n<2128

  • 0≤t<21280 \leq t < 2^{128}0≤t<2128

  • 0≤s<21280 \leq s < 2^{128}0≤s<2128

Brief description : calculates a minimal deposit for a validator (in nanotokens)

Input:

  • vvv - number of needed active blokkeepers (10000)

  • nnn - number of active blokkeepers

  • ttt - network duration + ⅓ of the preepoch duration

  • sss - total reward amount subtracted by the total slashed amount

Output : μ\muμ - minimally allowed stake

CALCBKREWARDADJ

Signature: C733 t a p r s (𝛼)t \space a \space p \space r \space s \space (𝛼)t a p r s (𝛼)

All the values must not exceed 21282 ^ {128}2128.

Brief description: adjusts reward engine to be aligned with the theoretical curve.

Input:

  • ttt - network time

  • aaa - the previous adjustment factor

  • ppp - reward period

  • rrr- average reputation coefficient

  • sss - total reward amount

Output : aaa - new adjustment factor

CALCREPCOEF

Signature: C734 r(c)r (c)r(c)

All the values must not exceed 21282^{128}2128

Brief description: calculates reputation coefficient based on the reputation time.

Input:

  • rrr - reputation time

Output : ccc - reputation coefficient

Zero-knowledge instructions

The provided solution is intended to support popular off-chain authentication systems in blockchain, thus preventing frequent authentication using seed phrases or off-chain wallets, thus combining a high level of security with great user experience.

  1. Salt is not defined by the user, but simply works as a second password

The changes are to be described in a separate document.

VERGRTH16

Verifies the proofs using Groth16 algorithm

Signature : C731 π ρ i (b)\pi \space \rho \space i \space (b)π ρ i (b), where:

  • ρ∈TvmSlice\rho \isin TvmSliceρ∈TvmSlice

  • d∈TvmSliced \isin TvmSliced∈TvmSlice

  • 0≤i<2320 \leq i < 2^{32}0≤i<232

  • b∈Bb \isin Bb∈B

Input:

  • π\piπ - slice is public inputs

  • ρ\rhoρ - proof (in terms of zk-Snark)

  • iii - algorithm used, where:

    • 0 - unsecure algorithm

    • 1 - secure algorithm

    • anything else - test algorithm

Output:

  • bbb - boolean value that indicates if the verification was correct or not

Behavior is as follows:

  1. π\piπ and ρ\rhoρ are decoded into corresponding arrays of bytes

  2. proofs then decoded into array of Proof<Bn254> structures, using external function

  3. public inputs, in their turn, are decoded into array of Fr (where Fr={0,...,2256−1}Fr = \lbrace 0, ..., 2^{256} -1 \rbraceFr={0,...,2256−1}) using: a. external methods for deserialization to the array of FieldElementWrapper b. wrapping by the first element

  4. Depending on iii, selected the predefined set of verifying keys - unsecure, secure or test

  5. External function with data calculated at steps 2-4 is called to verify the proofs using Groth16 algorithm

POSEIDON

Calculates Poseidon hash.

Signature : C732 i m p μ s h z (π)i \space m \space p \space \mu \space s \space h \space z \space (\pi)i m p μ s h z (π), where:

  • 0≤i<2560 \leq i < 2560≤i<256

  • 0≤m<2640 \leq m < 2^{64}0≤m<264

  • 0≤p<22560 \leq p < 2^{256}0≤p<2256

  • μ∈TvmSlice\mu \isin TvmSliceμ∈TvmSlice

  • s∈TvmSlices \isin TvmSlices∈TvmSlice

  • h∈TvmSliceh \isin TvmSliceh∈TvmSlice

  • z∈TvmSlicez \isin TvmSlicez∈TvmSlice

  • π∈TvmCell\pi \isin TvmCellπ∈TvmCell

Input:

  • hhh - JWT header (base64)

  • sss - iss (provider’s name) (base64)

  • μ\muμ - modulus

  • ppp - ephemeral public key

  • mmm - maximum epoch

  • iii - key index

Output:

  • π\piπ - array of public input as a cell

Behavior:

  1. Initially:

    1. zzz is transformed into a string (z-string)

    2. hhh is transformed into a base64 string (h-string)

    3. sss is transformed into a base64 string (s-string)

    4. μ\muμ is transformed into array of bytes (𝜇-array)

    5. ppp is transformed into a byte array with proper number of bytes, extra bytes are dropped, in case of lack of bytes exception must be raised

    6. mmm is transformed into u64 (m64)

    7. iii is transformed into a base64 string (i-string)

  2. Then:

    1. z−stringz-stringz−string is transformed into big number using an external function

    2. h−stringh-stringh−string is transformed into big number using an external function

    3. s−strings-strings−string is transformed into big number using an external function

    4. μ−array\mu -arrayμ−array is transformed into big number using an external function

    5. p−stringp-stringp−string is split into two big numbers using external function

    6. m64m64m64 is transformed into a string and then, to big number using an external function

    7. i−stringi-stringi−string is transformed into big number using an external function

  3. Then, an array of public inputs is created using a call of external functions

  4. Finally, the list is serialized into a cell and push into a stack

Being a TVM-based blockchain, follows its . However, some additional instructions are required to support some specific features introduced in Acki Nacki. Such instructions are described in the present document.

Brief description: Transforms into the same amount of (using 1:1 ratio)

Behavior: it follows :

Behavior: it follows

Behavior: it follows

Behavior: it follows

One of the common drawbacks of common blockchain systems is a necessity to use seed phrases for authentication. It’s hard to remember them and other (off-chain) approaches such as that commonly are better in terms or user experience than the former one. The popular solution is to use self-custodial wallets such as or . Such wallets are often not so transparent as desired and can be vulnerable to attacks (such as the recent ).

The solution is based on and follows the similar solution implemented in blockchain named zkLogin and described in details, with some important exceptions:

is used as a hash function

The process is completely new

Brief description : checks proof, returning the logical result

zzz -

Acki Nacki
specification and instruction set
SHELL
VMSHELL
Acki Nacki tokenomics
Acki Nacki tokenomics
Acki Nacki tokenomics
Acki Nacki tokenomics
OAuth2
Metamask
TON Wallet
Atomic Wallet case
Zero-knowledge technology
Sui
here
Poseidon
Ceremony
zk-Snark
zk-address