This guide provides instructions on how to interact with Gridlock's network. It is intended for developers looking to build on Gridlock's storage technology.
Initialize SDK
Start by initializing the Gridlock SDK to use the built-in functions.
Parameters:
apiKey (string): Your API key for authentication into the chosen network.
baseUrl (string): The URL endpoint for the backend orchestration "orch" node(s).
verbose (boolean): Set to true to see additional debug information
logger (object): A logging instance for outputting logs (e.g., console, winston).
email (string): The user's email address, used for authentication.
password (string): The user's password for authentication.
saveCredentials (boolean): Option to save the user's credentials locally for easier management. Use saveStoredCredentialsand clearStoredCredentials functions to switch to another saved user.
Return Value:
user (object): JSON object containing user account details.
You must have sufficient guardians assigned before creating a wallet.
The private key is generated using Distributed Key Generation (DKG) through communication with all guardians in the node pool. The key will never exist as a whole.
Sign Transaction (signTransaction)
Description: Signs a given transaction for the user.
Parameters:
email (string): The user's email address, used for authentication.
password (string): The user's password for authentication.
address (string): The related blockchain address.
message (string): The transaction message to be signed.
Return Value:
signature (object): JSON object containing a signature and other associated data.
The system gathers partial signatures from the user’s guardians within the node pool. Once enough guardians have signed, the system automatically aggregates them to finalize the transaction.
Verify Signature (verifySignature)
Description: Confirms that all nodes in the user's node pool can produce a valid signature for a specified address.
Parameters:
email (string): The user's email address, used for authentication.
password (string): The user's password for authentication.
message (string): The transaction message that you want to verify.
address (string): The address that signed the message
signature (string): The signature you want to verify.
Return Value:
verified (string): A JSON object containing verified as true or false.
Note: Social guardians may not always be online to produce a valid signature, but this does not necessarily mean they are missing from the network or unavailable long-term.
CLI-specific commands
Show Network (showNetwork)
Description: Lists guardians associated with a specific user.
Parameters:
email (required, string): Email is used as the unique identifier of the user.
Return Value:
name (string): The name of the node.
nodeType (string): The type of node, which can be one of the following:
nodeId (string): The unique identifier for the node.
status (string): The current status of the node (e.g., active, inactive).
identityKey (string): The public key associated with the node identity.
encryptionKey (string): The public key used by the node for end-to-end encryption.
ownerGuardian (boolean): Whether the node is designated as the Owner Guardian.
Example Usage:
CLI Example
CLI Command:
gridlock show-network -e gilfoyle@piedpiper.com
Example Output:
$ gridlock show-network -e gilfoyle@piedpiper.com
🌐 Guardians for Bertram Gilfoyle (gilfoyle@piedpiper.com)
-----------------------------------
Name: Oliver
Type: 🌥️ Cloud Guardian
Node ID: 8e198cc0-eace-4b9b-a12c-7a6e6801078e
Status: ACTIVE
---
Name: Gridlock Guardian (Clarence)
Type: 🛡️ Gridlock Guardian
Node ID: 8b642223-b9e7-4cf3-b660-4b8542b77977
Status: ACTIVE
---
👑 Name: James
Type: 🌥️ Cloud Guardian
Node ID: f90f889a-01ea-415f-81fe-ed624c6b0541
Status: ACTIVE
-----------------------------------
Total Guardians: 3 | Threshold: 3 of 3 ✅
Additional Guidance:
Cloud Nodes: Theseare nodes that you run yourself and are generally run on cloud infrastructure like AWS.
Gridlock Nodes: These nodes are run by Gridlock and perform additional functions like advanced network monitoring for extra protection.
Partner Nodes: These nodes belong to partner organizations that help enhance the network's security and distribution without having control over the user’s assets.