Cayenne Network Beta Release & Lit JS SDK V3

Cayenne Network Beta Release & Lit JS SDK V3

Lit Protocol is a decentralized key management network powered by threshold cryptography. A blockchain-agnostic identity layer, Lit can be used to power encryption, signing, and compute for web applications.

Introducing a new testnet - cayenne🌶️ .

Work on the cayenne network with the Lit JS SDK V3. Now in beta and ready for builders!

Read the SDK V3 developer docs and the API docs to learn more.

Release Highlights

  1. ID Encrypt

The Lit cayenne network uses a version of identity-based encryption scheme to encrypt data. Decryption is only permitted to those who satisfy a certain criteria to decrypt the cyphertext received through encryption. This is a significant upgrade from how Lit previously set access control. Read more.

2. Claimable Keys

What if you could send funds to a Discord user before they've done any set up at all? What about for additional auth methods like Google OAuth, SMS, or E-Mail?

With derived keys, you can have an ID parameter that is used to deterministically derive the key. Stay tuned for more info.

3. Adds support for new ECDSA implementation for

4. New BLS threshold algorithm

Upgraded BLS distributed key generation (DKG) to use the Gennaro protocol. The protocol is more secure, simpler to implement, and generalizable across various curve types. The Lit development team is in the process of upgrading the ECDSA DKG to use the same Gennaro protocol.


Additional updates include general improvements to consensus, resiliency and scaling on the nodes.

Feature matrix

Shown below is a matrix illustrating which features are available with each SDK version and network.

V1 refers to the deprecated lit-js-sdk

V2 refers to 2.x.x versions of js-sdk

V3 refers to 3.x.x versions of js-sdk on the SDK-V3 branch

Feature V1 V2 V3
jalapeno network
serrano network
cayenne network
ACC-based Encryption
ACC-based JWT signing
Updateable ACC
Programmable Key Pairs
Lit Actions
Wallet Signatures
Session Signatures

Supported Lit Networks

cayenne is the only supported network on SDK V3.


Breaking Changes

Removed Methods

The following methods have been removed from LitNodeClientNodeJs and LitNodeClient:

  • getChainDataSigningShare
  • storeSigningConditionWithNode
  • saveSigningCondition
  • getSigningShare
  • getDecryptions
  • getSignedChainDataToken

Updated Methods

The following methods have their interfaces updated in LitNodeClientNodeJs and LitNodeClient:

  • combineSharesAndGetJWT

The following methods have their names updated in @lit-protocol/encryption and @lit-protocol/lit-node-client-nodejs:

  • decryptFile becomes decryptToFile
  • decryptString becomes decryptToString
  • decryptZip becomes decryptToZip

All method interfaces in @lit-protocol/encryption have been updated.

Additional changes

Removal of Twilio as the one time password (OTP) provider, we encourage builders to use Stytch.

Changelog

Changes to the Lit JS SDK V3 will be tracked in the changelog.

Installing & Importing

Lit JS SDK V3

Make sure you’re on the latest package - version 3.0.0 or higher.

The example below shows importing the LitNodeClient library:

npm install @lit-protocol/lit-node-client@^3.0.0

Note: To make sure you are on the latest 3.x.x version, you can check out the Lit npm packages to find the latest (like so - lit-node-client) or use ^ when installing.


Encryption:

Importing and installing has not changed significantly from the Lit JS SDK V2.
You can explicitly specify the network, in this case, cayenne.

import * as LitJsSDK from '@lit-protocol/lit-node-client';

const litNodeClient = new LitNodeClient({
  litNetwork: "cayenne",
});
await litNodeClient.connect();

However the encryption and decryption functions have changed significantly. Read more about ID encrypt.


Lit Actions:

When instantiating the LitNodeClient object, pass in litNetwork: cayenne.

import * as LitJsSdk from '@lit-protocol/lit-node-client';

const runLitAction = async () => {
  // you need an AuthSig to auth with the nodes
  // this will get it from MetaMask or any browser wallet
  const authSig = await LitJsSdk.checkAndSignAuthMessage({ chain: "ethereum" });

  const litNodeClient = new LitJsSdk.LitNodeClient({ litNetwork: "cayenne" });
  await litNodeClient.connect();

  const signatures = await litNodeClient.executeJs({...});
};

runLitAction();

Note: There is one small change on how data should be passed to toSign . Which is used in executeJs and pkpSign.
Data must be hashed to 32 bytes before it is passed to the Lit nodes. It can be hashed to the correct format by calling, ethers.utils.arrayify(ethers.utils.keccak256([...])).

const results = await litNodeClient.executeJs({
    code: litActionCode,
    authSig,
    authMethods: [...],
    jsParams: {
      // this is the string "Hello World" for testing
      toSign: ethers.utils.arrayify(ethers.utils.keccak256([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100])),
      publicKey:
        "0x0404e12210c57f81617918a5b783e51b6133790eb28a79f141df22519fb97977d2a681cc047f9f1a9b533df480eb2d816fb36606bd7c716e71a179efd53d2a55d1",
      sigName: "sig1",
    },
  });

Closing

Though the cayenne network and Lit JS SDK V3 is in beta, we encourage developers to start building with it since it introduces significant improvements in interacting with the Lit nodes. Network performance will be improving as updates are made.

If you have any feedback or questions while building, please reach out on Discord.

The cayenne testnet is one step closer to the Lit network mainnet launch in the coming months.