zkNet API
Overview
zkNet facilitates the management of private accounts linked to external R5 wallets. It allows users to create these internal accounts, deposit funds, transfer balance internally within the network, and manage account life cycles. It essentially works as a subnet with its own internal ledger, working inside the main network in which it is deployed.
Public Deployments
Function Overview
r5_accountCreate
Generates a new internal account for the caller. Each external wallet is permitted only one internal account.
How to Call:
Technical Details:
Validates that the sender has no existing internal account.
Generates a unique internal address using the
userSalt
provided.Maps the internal address to the external wallet's address.
r5_balanceDeposit
Deposits funds into the internal account from the main network. Requires the user to send the specified amount in the transaction.
How to Call:
Technical Details:
Checks if the sender has an internal account.
Validates that the sent value matches the specified amount and that the amount is greater than zero.
Updates the internal account's balance.
r5_balanceTransferInternal
Allows transfer of funds from one internal account to another within the zkNet protocol.
How to Call:
Technical Details:
Validates that both the sender and recipient accounts exist and that the sender has sufficient balance.
Adjusts balances for both accounts accordingly.
Records transaction details for future verification.
r5_balanceTransferExternal
Transfers funds from a zkNet internal account to an external Ethereum wallet.
How to Call:
Technical Details:
Checks for the sender's internal account existence and validates their balance is sufficient.
Deducts the amount from the sender's balance and performs the transfer to the specified recipient.
r5_balanceCheck
Returns the balance of the caller's internal account.
How to Call:
Technical Details:
View Function: Does not modify any state.
Requires the caller to have an internal account and returns the respective balance.
r5_accountDestroy
Destroys the internal account and sends any remaining balance to an external wallet.
How to Call:
Technical Details:
Requires the caller to have an internal account.
Deletes the account from mappings and transfers any existing balance to the provided external wallet address.
r5_accountResolve
Resolves and returns the internal address associated with the caller's wallet.
How to Call:
Technical Details:
View Function: Does not modify any state.
Ensures the caller has an internal account before returning its address.
Last updated