Getting Started
This guide demonstrates how to generate secure, verifiable random numbers on the blockchain using the client-side SDK. It demonstrates how to get started and generate a random number inside smart contract function & client-side application.
The dcipher network provides two implementation options to handle blocklock encryption in your decentralized applications:
- randomness-solidity - Solidity library for generating on-chain randomness from the dcipher threshold network. Designed for developers who need flexible, verifiable, and secure on-chain randomness solutions.
- randomness-js - JavaScript/TypeScript library designed to simplify interaction with the dcipher network. It allows frontend and backend applications to request and verify randomness via the RandomnessSender smart contract, implemented in the randomness-solidity library.
Choose the implementation that best fits your use case:
-
Choose Solidity Library if you need to:
- Random number directly in your smart contracts
- The generated random number will be used in smart contract
- Integrate with other on-chain protocols
-
Choose JavaScript Library if you need to:
- Do client side integration
- Just generate a random number in your Javascript or Typescript codebase
- Get randomness in your frontend/backend applications
Installation Options
Option 1: Solidity Library
To integrate randomness into your existing smart contract projects, install the Solidity library using one of these methods:
Using Foundry (recommended):
forge install randa-mu/randomness-solidity
Using npm (for Hardhat):
npm install randomness-solidity
→ Continue to Solidity Implementation Guide
Option 2: JavaScript/TypeScript Library
For client-side integration of on-chain randomness, install the JavaScript library:
npm install randomness-js
This provides a client-side SDK to request on-chain randomness from the supported blockchains by interacting with the RandomnessSender contract implemented in randomness-solidity.
The library allows you to:
- Integrate with a deployed RandomnessSender smart contract
- Request and verify on-chain randomness from your dApp frontend/backend
→ Continue to JavaScript Implementation Guide