SDK / CLI Documentation
This guide provides detailed instructions on how to interact with Gridlock's network using both CLI commands and SDK functions. This is intended for developers looking to build on Gridlock's storage network
Organization Setup (orgSetup
)
orgSetup
)Description: Initializes an organization on the Gridlock network and make other nodes aware of the new organization.
Parameters:
name
(string, required): The name of your organization.accessKey
(string, required): An access key to connect to Gridlock's networking stack
Return Value:
orgId
(string): The unique identifier of the organization.
Example Usage:
Additional Guidance:
Gridlock uses NATS, a robust and scalable messaging system, for secure distributed communication. By leveraging NATS instead of open public access, we enhance user privacy, strengthen security, and simplify troubleshooting the distributed signing processes.
List Nodes (listNodes
)
listNodes
)Description: Lists the nodes within the organization's node pool available to every user in the organization or all nodes associated with a specific user, including any social or partner guardians that the user has.
Parameters:
userId
(optional, string): The unique identifier of the user. If provided, lists nodes specific to the user, including social and partner guardians. If not provided, lists all nodes available to the organization.
Return Value:
An array of objects, each containing:
nodeId
(string): The node's unique identifier.name
(string): The name of the node.status
(string): The status of the node (e.g., active, inactive).nodeType
(string): The type of node, either 'gridlock', 'partner', or 'social', representing Gridlock's internal nodes, partner guardian nodes, or social guardians respectively.
Example Usage:
Additional Guidance:
Gridlock Nodes: These are internal nodes operated by Gridlock which perform additional functions like overall network monitoring. All node pools must include Gridlock nodes to ensure that the user always has access to their vault.
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.
Social Nodes (Social Guardians): These nodes represent the user's trusted contacts, acting as guardians for account recovery or added security. Social nodes play a key role in Gridlock's social recovery process.
Run Node (runNode
)
runNode
)Description: Starts a new partner guardian node for the organization using a Docker container. This node will be available to all user storage networks created by the organization.
Parameters:
name
(string, required): The name of the node.nodeKey
(string, required): A key that restricts access to the node and its interactions.
Return Value:
nodeId
(string): The unique identifier for the newly created node.
Example Usage:
Additional Guidance:
The access key restricts interactions with the node, allowing only authorized requests. In future updates, this key will ensure that your node is not overloaded due to unrestricted access from any user.
Create User (createUser
)
createUser
)Description: Creates a new user account and initializes a user-specific node pool. This pool includes global nodes such as Gridlock Guardians, global Partner Guardians, and nodes running in your organization
Parameters:
userName
(string, required): The user's display name.email
(string, required): The email address of the user.
Return Value:
userId
(string): The unique identifier for the new user.userSetupLink
(string): A unique, one-time-use link for the user to connect to the network and set up their Gridlock app.
Example Usage:
Additional Guidance:
The user's node pool will initiate in a pending state, and will remain pending until the user completes the setup on their mobile device.
Add Guardian (addGuardian
)
addGuardian
)Description: Adds a guardian to a user's node pool.
Parameters:
userId
(string, required): The unique identifier of the user.guardianName
(string, required): The guardian's name.guardianEmail
(string, required): The guardian's email address.
Return Value:
guardianId
(string): The unique identifier for the guardian.guardianSetupLink
(string): A unique setup link for the guardian to join the network.
Example Usage:
Additional Guidance:
Guardian setup will be pending until they complete the process via the provided link.
Generate Address (generateAddress
)
generateAddress
)Description: Generates a distributed private key and address for the given user and blockchain.
Parameters:
userId
(string, required): The user's unique identifier.blockchain
(string, required): Blockchain identifier (e.g., 'DOT', 'BTC', 'ETH')
Return Value:
address
(string): The generated blockchain address for the user.
Example Usage:
Additional Guidance:
The private key is generated using Distributed Key Generation (DKG) through communication with all guardians in the node pool. The key doesn’t actually exist as a whole, and to view the full key, you must eject it from the system.
Validate Signature (validateSignature
)
validateSignature
)Description: Confirms that all nodes in the user's node pool can produce a valid signature for a specified address.
Parameters:
userId
(string, required): The user's unique identifier.address
(string, required): The address for signature validation.
Return Value:
An array of objects, each detailing:
nodeId
(string): The node's unique identifier.status
(string): The outcome of the signature validation (success, fail, or missing).
Example Usage:
Additional Guidance:
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.
Sign Transaction (signTransaction
)
signTransaction
)Description: Signs a given transaction for the user.
Parameters:
userId
(string, required): The user's unique identifier.address
(string, required): The related blockchain address.unsignedTxn
(string, required): The serialized unsigned transaction.
Return Value:
signedTxn
(string): The signed transaction.
Example Usage:
Additional Guidance:
The system collects partial signatures from the user's guardians in the node pool. Once a sufficient number of guardians have signed, the system automatically combines them to produce a fully signed transaction.
Here’s the corrected version with the proper parameter and more concise wording:
Eject (eject
)
eject
)Description: Not recommended. This action compiles and reveals the private key for a given blockchain address, bypassing the distributed security model.
Parameters:
userId
(string, required): The user's unique identifier.address
(string, required): The blockchain address for which the private key will be derived.
Return Value:
privateKey
(string): The full private key.
Example Usage:
Additional Guidance:
Ejecting a private key compromises the security of Gridlock's distributed storage model, which keeps the key fragmented across guardians for protection. Once ejected, the private key exists in one place, exposing it to risks. This should only be done when absolutely necessary, as it defeats the purpose of Gridlock’s security model.
Last updated