Steph Orpilla I Speedrun Nillion's SecretVault I Agentic Ethereum 2025
Agentic Ethereum · 5 Feb 2025 · 25:18
Steph Orpilla, head of developer relations at Nillion, shows how to protect AI agent data with SecretVault, a decentralized store that splits encrypted records into shares across separate nilDB nodes. The speedrun follows the quickstart: creating an organization config and schema, encrypting marked fields with the nql library, writing to three nodes through the SecretVault wrappers, then reading and recombining the records. Use cases include user data and shared agent memory.
Speakers
Topics
From Agentic Ethereum, hosted by ETHGlobal.
Transcript
[Music] hi everyone welcome to this session I'm just going to hide the controls today I'm going to run a session called speedrun secret vault uh and just to introduce myself quickly I'm Steph orilia I'm the head of De developer relations at Millian and I'm excited for you all to kind of like stand secret fault and start building with it during e Global agentic and just because I know you're all curious um we are giving away $5,000 in prizes for this hackathon the first uh set of prizes is for best use of
million secret vault and there's a little star next to that prize because this Workshop is all about million secret vault and I'll get you up and running with million secret vault really fast so you can use it and integrate it into all of your projects for the acon the other prize is uh a prize for building an agent framework integration there's a $1,000 prize for the best framework integration and that's for anyone who happens to create a library or a developer tool that makes it easier for other developers or users to use Nan with um an agent of your choice so maybe that's Eliza maybe that's something on open AI um any type of AI agent
framework integration could could win that prize so this one is kind of a wild card and it's more open-ended um and then the other prize again there's four of them for the best use of secret fault which I'll show you next oh and you can scan this QR code here to learn more about the prizes and understand what you have to do to qualify but now I want to talk about Millian secret vault so secret vault is a decentralized storage solution and it's for keeping sensitive data secret and it works by storing encrypted shares across a decentralized cluster of nil GB nodes the reason that secret vault is so cool is that your data stays secure so
this is really great if you're building anything with your AI agents that's maybe using user data so if your agent is storing user data somewhere it should be stored in a place where user data is kept super secure um this could also be useful if your agents are in a swarm and they're talking to each other and they need to share data with one another but they don't want to leak that data out because that would uh create just like a leak where someone else could take in that data and understand what the Swarm is doing and then your product is not as useful potentially so with Nan secret vault you encrypt data and when you encrypt the data you split it into different shares and each of those
shares is stored in a different million DB node so that any node doesn't see the encrypted data they just see a share that's meaningless so that's how we're using secret vault to secure data uh one of my favorite things about using secret vault is it's very easy in my opinion to integrate because the way you access and interact with secret vault is through easy to use apis uh before web 3 I was in a web 2 development background and I was always using apis so when I came into web 3 and I had to get used to um more complex ways of reading and writing either through clients or through anything else I found myself missing apis a lot because it felt so easy to
understand how to interact with something and secret vault is cool because you can use apis to create schemas and then read and write data to these schema collections um so that storing and retrieving data feels very familiar and easy and then the last reason I really like building with secret vault is because we provide a couple powerful libraries that you can use out of the box the first library is called nil ql that's nil query language and that's for the encryption and decryption of any of that private data that you want to store in secret vault the second library is called million SV wrappers that's million secret vault wrappers and that's basically a JavaScript npm package that does a lot
of the API calling for you because you're writing to multiple nodes um if you were using the apis directly you would have to use n number of apis one per node but if you use the wrapper Library it simplifies that so you just tell the library oh I want this node that node and that node these three node URLs and then it handles all of the API calls for you so that's a little bit about secret vault and then the other thing to talk about is nql that was that encryption and decryption secret data library that I was telling you about before so this is an example of um a record that I might want to store inside of secret
vault it looks like a Json uh data payload but there's a couple things to note there are these a lot markers within the data and anywhere that a lot is Will signal to nql the encryption library that that value needs to be encrypted so the first value that I want to encrypt is name that's allotted so my name will be encrypted in the resting data I also want to encrypt the number of years that I've been in web 3 so I also have an A Lot property there showing this number should be encrypted before it's stored for rating of the product imagine that's something that's just in a survey that's not sensitive to
my application so I don't need to aot that that can just be stored in plain text and when nql runs on this record when you uh encrypt it with the library this is what the resulting data could look like so I have three different sets of data and each of these sets has those encrypted properties so you can see name and years in web 3 in all three of these is written with a share and the shares are different between nodes so the first node will receive this payload with different shares than the second node with different shares than the third node so if someone were to um crack the security of one node they would still
have no idea what the name or the number of years in web 3 would be for this record because it's encrypted with a share and the share is completely meaningless but when you um use no ql to decrypt or to recombine this record it will give you this back so you'll be able to see the name the years in web 3 and the rating of the product in plain text um because it's recombining those shares and so these three records are separately uploaded to one node each of secret vault and that's how uh the data is stored so to put all of that together the full flow of using secret vault is um to create either an AI agent or an
app so that's down here that AI agent or app takes in data so imagine um if you had an agent you're prompting the user to tell you your their name and how long they've been in web 3 and also the rating of the product so they give you all that information and then the agent says okay I will encrypt those fields so the agent encrypts the private data fields with the no ql library that results in the three different encrypted records and then each of those records is uploaded to a separate nil DB node and then when you need to decrypt the data or read it the agent can call the nodes the nodes give the pieces of the
data and then you can recombine the three pieces to decrypt the data again with no ql and that that all happens in a really easy flow through the wrappers okay so now let's actually speedrun this flow so by speedrun I mean we're going to go through the quick start really fast oh I can hear somebody does somebody have a question Okay cool so we're going to go through the Quick Start really fast I'm you can code along with me if you want uh but if you miss anything you can send a message in partner Nilan on Discord and I'll look at it afterwards um or just let me know if anything's unclear and I can stop and address the question
but I'm just going to run through the quick start straight on my machine okay um there we go so I'm just going to go to docs. nan.com QuickStart and you can see there's different things that you can start building so I'm going to click the secret vault quick start because I want to run through this one so in this quick start it'll take a little bit about about excuse me 15 minutes and we're going to build a privacy preserving data collection for a web 3 experience survey So within that survey we're going to have the name and years in web 3 properties which we will
encrypt and then we'll leave the um experience ratings out uh we'll we'll just store them in plain text so that anyone can read them if they wanted to and this is going to be a nodejs project that I create completely from scratch as it says in the quick start so let's start building the the project I'm just going to minimize this and I'll keep this on the left side of my screen and then I have a terminal over here that I'll leave on the right and I'll also pull up a code editor so the first thing that we need to do is create a directory for our project so I'm going to make a directory and I'll CD into that directory next we need to initialize the
project so it's going to be initialized um as a module so I'll npm in it es6 and that will just set the type as module inside of the package Json the next thing I have to do is install the SV wrappers package this is the package that manages um secret keys and all of the oops oh wrappers so this is the package that uh manages all of the keys and also creates JWT API tokens based on your organization config for uh secret vault so I have all of that and I'm just going to open up cursor since this is a gentic uh I'm going to use a agent
powered um code editor for my project and I'll just open the terminal at the bottom so that um I can do everything within uh firster okay so we've set up the project the next thing I need to do is create a file that will hold my organization config so now I have this org config file within the quick start I have a demo organization config that I'll copy into or config and now let's quickly talk about the or config so any um if if you are creating an entity to use secret fault you'll create an
organization um I'm just using the demo organization from the quick start but you can actually register your own organization and I recommend that you do this for your projects uh here in the portal so you you would just use this registration portal you could get start a new organization you'd enter whatever you want the name to be and select nodes these are the three demo nodes that will be selected for you and these are actually the nodes that my organization is using as well so I'm skipping that step because I already have my organization credentials uh but along with the organization credentials I have the node config the node config contains the URLs and the decentralized
identifiers for each of the nodes and the nodes are what I will be uploading my data to each of these nodes will get a different piece of that data which is why it's important to have the node information inside of the node config um along with the organization so the organization secret key is actually what is generating API tokens for each of these nodes so that um inside of secret vault you know that the organization is the correct person or the correct entity that's writing to the secret vault um data store Okay so we've got our or credentials the next thing we need to do is actually create a collection schema
so I'll create a file for that schema. Json this is empty for now but I'm going to copy the web 3 experience schema into the schema Json and now we can take a look so all of the schemas for secret vault follow the draft 7 Json schema uh schema and within that you can add a title for your schema and then you start to define the shape of the data that you'll be uploading into secret vault if you've ever used something like mongod DB it's very similar to that where you set all of the properties that you expect um to be uploading so the first thing I'm expecting is an ID this will
always be set for every record and then I will be uploading a person's name the number of years they've been in web 3 and then a collection of responses to questions so each question will have a question number so like question number one question number two and the answer to the question will be a rating between one and five so for my survey that I'm building I want people to be able to um rate their experience their user experience with different things so I'm asking them to rate their experience with solidity uh with the ux wallets things like that so that I can get a general understanding of how um the ux is improving in web 3 this year okay so
previously we were talking about how um secret vault is really cool because you can have secret data inside of the Vault and the way that you mark data inside of the schema to be secret is with share so if something is a share it's not the actual name we're uploading the share of the name so that is that string if I go back to my presentation oops so if this is the original record uh the share is the piece of the encrypted data that's going into the node and so anything that's going to be encrypted we're marking um with the share and the type of a share is a
string so you can see that both name and years in web 3 are shares while uh the array of responses the properties are just in plain text so they're in integers strings dates whatever is going into that response array doesn't need to be encrypted so there's no shares there okay so that's our schema and in order to start uploading data to the collection we actually have to first upload the schema to all three nodes so in order to do that I'm going to create a minic script that will take this schema and actually upload it so I've created a file and with within this file
I'll just paste in the script and I'll explain what it's doing okay so this is the script for posting a schema to all of the different nodes at the top you can see I'm importing the secret vault wrappers um that's just the collection that helps do all of the API calls I'm also importing org config the org config is what we previously created that has the keys um and the identities of all of the nodes so that we know where to upload the schema to so now that I have all of that I can run this to create a wrapper and initialize an organization the org has
been initialized with those nodes and also the credentials and in order to actually create a schema I have to give the wrapper the schema file which is the schema. Json and the collection name which in this case is web 3 experience survey this can be anything you want it's just so that if you're looking at all your schemas you can easily understand oh that's my experience survey so after that you can create the schema and it should upload to all three nodes but let's actually test this out so I'm just going to run node host schema which is this file awesome so this was successful and it created a new collection schema for
all three nodes so this node this node and this node and you'll also see that the ID of the schema is the same for all three nodes and that's really important because you want to be able to write to the same schema and not have to worry about like oh did I use a different ID for one node from the other node it should all be very consistent so that the only difference between nodes is the encrypted Share value um and that's because those need to be different so that when you recombine them you get the True Value all right so now we have schemas across all of the different nodes the next thing we're going to do is create a script to actually interact with the secret vault data so that's writing data
to our schema collection and then reading data from the schema collection so let's create one more script which is index.js and inside of this script I'll copy in some things so the first thing is importing dependencies we actually don't need The UU ID package so I'm going to leave that out oh the AI is trying to autocomplete for me I don't want this um okay so we're gonna import the wrappers package the same one we did before and also the or config the next thing we need to do is um create a a const for the schema ID and we can read this straight from the
console log of the other script this is going to be hardcoded to the schema we just uploaded to um secret vault after that we'll create a data payload and this will just be oops this this will just be uh some data that we want to post to the schema so remember that each of the encrypted fields are marked with a lot ahead of time to show that these will be encrypted and then once they're uploaded to secret fault they'll have transformed into shares so instead of vitalic um let's say satosi Satoshi Nakamoto he's probably
been in web 3 longer than anyone maybe 16 years and I'll just leave his responses to uh the survey Asis so now we have a data payload and we just have to add the main function let's run through this main F function quickly so inside of the main function the first thing we're doing is initializing a collection using the org config nodes and credentials and also the schema ID that we hardcoded above here so now we've initialized a collection um for this schema when we have the collection ready we can start writing data to the nodes so this collection function write to
nodes is coming from that rappers package and it's just going to write that data to all three nodes in the collection and then it will log out the new IDs I'm just going to comment this second part out for now because um after after we write the data we can read the data but I just want us to focus on writing the data to this collection first uh and then we'll read the data okay so we have the function and we can run node index.js this writes data to all three of those nodes so you can see on node one it's created this ID on node two it's created the same ID and on node 3 it's created the
same ID so you can see that it's uploaded this ID to all three of those nodes so the data is successfully in all three nodes in the collection now let's try reading the data so I'll comment this out and we'll just read the data from The Collection I'm going to remove this SCE because we didn't actually upload any any data right now um so this is just saying okay take the collection read from all three nodes and the reason that this bracket is empty is because we're not actually passing in a filter if you wanted to you could filter um for different things in plain text like maybe you would want to filter for a
specific rating to a response you could do that um by passing in a valid filter here but I'm just going to read the the records that are currently inside of the secret vault okay so we see one record this is that most recent record that's just Satoshi Nakamoto um let's add one more record and then we'll write and read so maybe this can be Jacob from eth Global famous I have a feeling he's been in web 3 for like I'm going to say 10 years we'll have to ask him afterwards and we'll say that he gives both questions of five because he finds the
ux awesome so going back down I'm going to comment all of this code back in so that it will read or excuse me it'll write Jacob's record to our data collection and then it'll read all of the decrypted collection data so we should see both satoshi's and Jacob's record uh inside of the logs so coming up here uh the first thing that happened is this wrote to the secret vault so it created one new record 39f blah blah blah and then when it needs to read it reads both records that are inside of the secret vault so the first record down here is Satoshi
which was previously uploaded and then we can also see Jacob which was just uploaded so you can see that with secret vault we were able to encrypt and write data and then read all of the data back because we have that organization secret key that's needed to read and write from secret vault and also create new schemas so that's a little bit on secret vault I think we just speedran all of the quick start in I want to say less than 10 minutes so I think this should give you enough uh to use secret vault in pretty much any flow that you're doing for your AI agents uh if you wanted to do this from scratch yourself
you would just go register a new organization so you would get um your own secret keys for your organization and then you could start creating collection schemas based on whatever data you want your agent to read and write um inside of secret vault so that could be user data Maybe it's um shared State between agents so that they know parts of what each other are doing um maybe it's memory so that if you're creating context for an agent they have tons of different uh things to draw from anything like that would be an awesome application for using million secret vault and oh one more thing to mention
is that um if you come and visit us in Discord we have office hours every single day twice a day so one of the office hours is at uh I believe it's 10: am European Time and the other office hour is at 10:00 a.m. PST so whatever your time zone is you should probably have at least one office hour every weekday that will work for you and we would love to hear what you're building and also help if you have any questions um we're really excited to see what you all build [Music]
Related talks
- Build a Blind AI App on Nillion - ETHGlobal Brussels 2024
- Making AI and Finance Private by Default
- Deploy Docker Apps in TEEs with Phala - ETHGlobal Bangkok 2024
- Oasis | A chat with AI Satoshi, And why LLMs are not your friends - Marko Stokic | ETHDam III - 2025
- [Solo] The Future of Crypto and AI is Confidential
- A Deep Dive into PETs Privacy Enhancing Technology | SheFi Summit Bangkok
- A16z Crypto Raised $2.2 Billion for Fund 5. Here's How They Plan to Deploy It
- AI Agents en DeFi: ¿Como cambiarán las reglas del juego?
- How Blockchains Can Make AI User-Owned
