Lagrange Labs develops and maintains the LagrangeJS SDK, a Javascript SDK that enable developers to easily integrate front end applications with Lagrange State Proofs. The LagrangeJS SDK is open source and will be launched concurrently with the public Lagrange Protocol Testnet launch.
npminstall@LagrangeJS
Single-Chain State Proofs:
Using the LagrangeJS SDK, front end applications can easily connect users' browsers to the network of Lagrange Nodes. Once connected, client side applications can receive state proofs from Lagrange Committees for the chains that they are interested in. Once generated, these proofs can be easily verified by any contract integrated with the Lagrange Protocol or within supported cross-chain bridges and messaging protocols.
constproviderUrl= { arbitrum:"https://arbitrum-mainnet.infura.io/v3/PROJECT-ID",};constproofRequests= [ { chain:'Arbitrum', block:10002030401, }];constlagrangeSDK=initializeSDK(providerUrl);constarbitrumStateProofs=awaitlagrangeSDK.getProof(proofRequests); // This will return an array of state proofs
Multi-Chain State Proofs:
The Lagrange SDK also makes it simple to generate state proofs across more than one chain concurrently. These multi-chain proofs enable DApps integrated with the Lagrange Protocol to nest multiple state verifications into a single on-chain transaction.
constproviderUrl= { optimism:"https://optimism-mainnet.infura.io/v3/PROJECT-ID", base:"https://base-testnet.infura.io/v3/PROJECT-ID", arbitrum:"https://arbitrum-mainnet.infura.io/v3/PROJECT-ID"};constproofRequests= [ { chain:'Base', block:4553170, }, { chain:'Optimism', block:98960825, }, { chain:'Arbitrum', block:10000000002, },... { chain:'Arbitrum', block:10000000100, },];constlagrangeSDK=initializeSDK(providerUrl);constmultiStateProofs=awaitlagrangeSDK.getProof(proofRequests); //Integrate a state proof into any existing messaging protocol or bridge with a simple function callconstvalidity=awaitlagrangeSDK.verify({ publicStatement:multiStateProofs.publicStatement, proof:multiStateProofs.proof})//Or verify a state proof on-chain through a simple verifier contract callawaitlagrangeSDK.submitStateProof({ chain:"ethereum", provider: rpc_provider, publicStatement:multiStateProofs.publicStatement, proof:multiStateProofs.proof,})