Updated links for Primus Network Core SDK and added details about zkTLS.
network-core-sdk-mtls-example
About Primus Network-Core-SDK
When integrating data verification solutions into your backend server, you can utilize the Primus Network Core SDK. For integrating Primus network capabilities with DApps for end users, please refer to the DApp Integration guide.
The Network-Core-SDK allows you to verify data through API endpoint responses. An authorized token or other credential is required to request private data if the data source server requires permissioned access. Note that in the backend integration situation, the developer usually proves their off-chain data in their built application, and the Primus extension is not required. Typical scenarios include proof of reserves, in which a configured web page periodically proves that the stablecoin issuer holds sufficient collateral across off-chain platforms.
For more details about Primus zkTLS, please refer to:
- zkTLS technology link: https://docs.primuslabs.xyz/data-verification/tech-intro
- Primus Network: https://docs.primuslabs.xyz/primus-network/understand-primus-network
Install
npm install
Configure
Create a .env file in the project root:
PRIVATE_KEY=0xYOUR_PRIVATE_KEY
Optional: if you want to enable mTLS, uncomment the mTLS block in index.js and provide your client cert/key strings:
const mTLS = {
clientCrt: "YourClientCrtString",
clientKey: "YourClientKeyString",
};
Run
node index.js
You should see logs for:
- submit task result
- attest result
- task result
Customize
Edit these sections in index.js:
address: your wallet addresschainIdandbaseSepoliaRpcUrl: switch to Base mainnet if neededrequests: request params for your mTLS endpointresponseResolves: JSON parse paths for the response fields you want to attest
Notes
- Keep your
.envout of version control. - The example uses a public RPC; for reliability, use your own provider endpoint.