Quickstart
Learn how create, interact with and verify Livy Functions.
Quickstart
Deploy your first verifiable function and generate individual attestations in under 5 minutes. This guide walks you through creating a function in the Livy Console and interacting with it using our SDK.
Prerequisites
- A Livy account (create one here)
- Basic understanding of verifiable applications
- Node.js 18+ for SDK usage (optional)
1. Create a Function
Access the Livy Console
- Log into your Livy Console
- Click "Add new service"
Write Your Rust Code
Note: This step only applies if you selected "Write Inline" or "Upload Files"
You'll need both main.rs
and Cargo.toml
files:
// This function will be verifiably executed
export default function handler(input) {
const { name, numbers } = input;
// Perform some calculation
const sum = numbers ? numbers.reduce((a, b) => a + b, 0) : 0;
const timestamp = new Date().toISOString();
return {
greeting: `Hello ${name}!`,
sum: sum,
timestamp: timestamp,
verified: true
};
}
Deploy
- Click "Deploy Function"
- Wait for deployment to complete (~30 seconds)
- Note your Service ID (e.g.,
f8577eaf-8a57-4c30-b5ed-9e74bd56f964
)
Success
Your function is now live and ready to generate individual attestations!
2. Run Your Function
From Console
Test directly in the Console:
- Go to your function's Test tab
- Enter test input:
{
"name": "Developer",
"numbers": [1, 2, 3, 4, 5]
}
- Click "Run Function"
- View the result and generated attestation
With the Client SDK
npm install @livylabs/sdk
Create and run your client:
import { createClient } from '@livylabs/sdk';
const client = createClient({
apiKey: 'sk-38cd1325c1606aac7ad25fa8ef386d863b4efd56cbd9044a577932a5b19b9b39'
});
async function main() {
const result = await client.run({
serviceId: 'f8577eaf-8a57-4c30-b5ed-9e74bd56f964',
params: {
name: "Developer",
numbers: [1, 2, 3, 4, 5]
},
withAttestation: true
});
console.log(result);
}
main().catch(console.error);
3. Verify Your Attestation
Programmatic Verification
Using the SDK result from above:
async function main() {
const result = await client.run({
serviceId: 'f8577eaf-8a57-4c30-b5ed-9e74bd56f964',
params: {
name: "Developer",
numbers: [1, 2, 3, 4, 5]
},
withAttestation: true
});
console.log(result);
// Verify the individual attestation
const isValid = await result.verifyAttestation();
console.log('isValid:', isValid);
// Output: isValid: true
}
Console Verification
- Go to Functions → my-first-function
- Click the Attestations tab
- Find your execution in the list
- Click "Verify Attestation"
- See the cryptographic proof validation
Manual Verification
You can also verify attestations independently:
import { createClient } from '@livylabs/sdk';
const client = createClient({
apiKey: 'your-api-key'
});
// Verify any attestation by ID
const verification = await client.verifyAttestation('att_abc123xyz');
console.log('Verification result:', verification);
// {
// valid: true,
// attestationId: "att_abc123xyz",
// functionHash: "0x1a2b3c...",
// provenanceVerified: true,
// signatureValid: true
// }
Congratulations! You've deployed your first verifiable function. Every execution is now individually attested and cryptographically verifiable.