Back to All Episodes
Season 1Episode 42

Data Unions

October 28, 2022
29m

Listen Now

About This Episode

This episode of DevNTell features Nico Burkart from Data Unions, who discusses the project's aim to enable on-chain micro-transactions and power data union use cases. The session explores how Data Unions can help monetize user-generated data by grouping it and selling it to interested parties, with the revenue distributed among contributors via smart contracts. Key concepts like reducing transaction costs through batch processing and the role of the Data Union DAO are also covered, along with practical examples like Swash and DIMO.

Key Takeaways

1

Data Unions allow individuals to monetize their data by contributing it to grouped datasets.

2

Smart contracts enable efficient micro-transactions, reducing costs when distributing earnings to multiple participants.

3

The Data Union framework is chain-agnostic and supports major networks like Polygon and Gnosis.

4

The SDK simplifies building applications on top of the Data Union infrastructure, allowing developers to manage unions without extensive Solidity knowledge.

Episode Transcript

Narb

All right. GM, GA, GE everybody. Welcome to what's going to be another great DevNTell. So if you didn't know, DevNTell is a 30-minute window for members of the DAO to showcase something they are passionate about or have been working on. This can be an awesome project they've been working on, demonstrating new testing best practices, automation goodies, smart contracts, how to structure a project, etc. Basically, if you've got a passion for something, this is your opportunity to share it with the community. And today, I am happy to introduce to you Nico, who will be giving us a overview of Data Unions. Oh yeah. Take it away, Nico.

Nico Burkart

Yes. Very cool. Hi guys, I'm Nico. I'm DevRel for Data Union DAO and Streamr, and yeah, as Narb already told you guys, I'm going to talk about Data Unions, what are Data Unions, how we utilize micro-transactions, and how we kind of work with our smart contract to enable that. Um, yeah, I think I'm just going to dive in. Hang on, let me share my screen. Oh, it didn't... it doesn't let me just show you Chrome, so I'm going to show you everything. Right. Um, can you guys see everything?

Narb

So right now we see, uh, Discord. Yep, now we see Chrome.

Nico Burkart

Okay. Cool. Right, so enabling on-chain micro-transactions and how this powers Data Union use cases. That's essentially what's going to be... what I'm going to talk about today. So, yeah, let's just dive right in. So first of all, what's kind of the problem, right? You have Vitalik here on the left side and you have a bunch of developers on the right side. And if Vitalik wants to send just a few, like a fraction of... of like a big sum, for example, you have a hundred Shiba token and you want to send one Shiba token to each developer on the right side, then this becomes very expensive, a lot of transaction have to happen, and we are kind of... have to find a solution for that problem. And we are solving this, um, with a smart contract.

Nico Burkart

And here you can see like if... if he wants to send like multiple batches of Shiba token, like he wants to send 100 token and another 100 token and another 100 token, this becomes like a lot of transactions over time, right? Um, so let's see what... what kind of our solution for this problem is. So what we have is a smart contract that when Vitalik sends this batch of Shiba token, it actually stays in the smart contract. So when I speak about token, by the way, I speak about ERC-20 token. Um, so he sends a few token into the smart contract and in our solution, it actually stays there and kind of keeps track, um, what member is eligible for what amount of token, right? So in this case we have this whole different calculation from 1 times 6 to 1 plus 6, which is 7 transactions.

Nico Burkart

So now, actually, it gets a bit worse, right? So we have more transactions. So this only makes sense if we have multiple transactions to the same batch of people.

Nico Burkart

So if we go back, right? This is a batch of token that gets sent to the same amount of people and to the same addresses as well. It only makes sense in that case. So what you can see here is we have three batches of token now, they go into the contract and they stay in here, so we only have three transactions from Vitalik and then six transactions from these guys. And what are these transactions from the developers here or from their wallet addresses? They are just withdraw functions, so they say, hey, I want to get my token out of the contract, please send them to me, and that's what the contract does. Um, and they can get their token at any point of time, um, but you know, like only makes sense if the token actually accumulate because we are talking about micro-transactions, right? Like we don't want to spend a fraction of a cent to get a fraction of a cent, like it doesn't make sense, it... you don't want to have a null sum at the end, right?

Nico Burkart

So this is like kind of the idea we are having there, um, and now I'm diving more into how we actually solving this and how we are programming this. And this is by the way, we already programmed the contract, so it's, uh, anyone can use it. Um, I'm going to go into that later. Okay. Cool. So I'm not going to show you the whole smart contract code because that's like a lot, um, but I'll show you the GitHub repository later so you can, um, go through it yourself step by step. Um, but this is like the main concepts in there.

Nico Burkart

So essentially we have a map, right? Up here, can you guys see my mouse? I'm never sure with these PowerPoints.

Narb

Yes, yep.

Nico Burkart

Awesome. Okay. Cool. So we have a map in the smart contract that maps to the member info. So the members are in this case these guys, right? So the member info is just a struct with an active status. So this one says is the member active or inactive at the moment? So for example, um, the smart contract handles like if this guy is not... should not receive any token at the moment, he can, uh, be set as or get set as inactive and then if Vitalik sends a token in here, only these guys would get receive token essentially.

Nico Burkart

And this guy could still receive his token but he... he would not like get a share of this. Um, more about this use case later.

Nico Burkart

Um, yeah, and what also our smart contract enables is this add member function. So, um, only... oh sorry, only the admin or the join part agent here, this is a modifier that just checks okay, so can this address actually add any members or should it you know not be allowed? Because we are not... because if anyone could join the smart contract, um, this would not be ideal, right? Because then anyone could receive token which is not ideal. So you have to have like one central instance, um, or at least one address that kind of manages, um, if you're eligible to receive some token or not. Um, and these variables are just there to kind of calculate okay how many tokens has the member already received, how many have they withdrawn, and you know how many can they still withdraw.

Nico Burkart

Exactly. Yeah. And the remove member function, anyone can call this. Um, for... so messenger dot sender, uh, you as the member, you can leave the Data Union, it's just you can't join it, um, yourself. And the join part agent which is essentially the admin or the owner of the contract, um, because it's an ownable contract, um, you can just um remove or kick members out of the Data Union which then states them as inactive and then they won't receive more token.

Nico Burkart

Cool. Um, yeah, and now we go into like why or how this whole thing like works. Like how does this revenue calculation work and uh, yeah, how... how does the smart contract work in that sense so we save the transaction fee.

Nico Burkart

Can you guys hear me properly and everything? Um, is it all good because I only can see my presentation at the moment, so it's a bit hard to tell.

Narb

Oh, yeah, you're coming in clear. Voice and... yeah, voice and all.

Nico Burkart

Awesome. Okay. Are there any questions um on the way? Because I'm like just ranting down.

Narb

Uh, so I... I guess the... um, if I understood the main concept behind this smart contract is to enable batch transactions in a more efficient way.

Nico Burkart

Yeah, exactly. So we want to... we want to save on transactions because it doesn't make sense to send like a thousand... 36 transactions, right? Um, for three batch transactions. We just want to kind of um reduce that and we can reduce that by quite a bit. Like the more batches of transactions go to the same people, uh, the more transactions you can save essentially. Gotcha. So that's like kind of the core idea behind it.

Nico Burkart

Cool. Yeah. Right, so let's... let's just assume Vitalik just sent um a hundred Shiba token into the smart contract. Now the smart contract needs to kind of calculate okay how and where are we going to send the token and this is going to happen in refresh revenue. So token get in, refresh revenue gets called, um, and then all the smart contract does really is go to the token here which can be any token. Let's just assume it's the Shiba token but you can also set um I don't know the Narb token, right? Like any... any token will work. And then you can check okay, sorry, any ERC-20 token will work, and then you can check the balance of um the address, so of the smart contract address because Vitalik sent instead of sending it to all these members, he only sends it to this one smart contract which is this one.

Nico Burkart

So you can check okay how many token do I have, um, and then kind of calculate okay how many new token do I have, so balance minus the total withdrawable which is um the total withdrawable is just what's already in the smart contract, um, sorry what can... can already be withdrawn which is then this stash, right? These little... bills of money. So yeah, okay. And then we have three variables that I haven't talked about. Um, we've got the admin fee, we've got the protocol fee, and the new earnings. But these two are the interesting ones.

Nico Burkart

So if you want, as the owner, you can set yourself um an admin fee where you say okay I want for example 20 percent um of the whole revenue that comes in and then it gets sent to your address. So essentially what happens is that there's going to be another party here that will have um a little stash of... of cash as well, um, and that's like kind of the incentive mechanism for... for the admin to take care of this payment contract. Um, yeah, so if you want you can... you can set it here, you can also leave it to zero, it's really up to the person that deploys the contract.

Nico Burkart

And then we've got the protocol fee which is... which goes to the Data Union DAO. I talk more about the Data Union DAO in a minute, but essentially it's there, it's 1 percent. Um, so 99 percent you can do whatever you want with it but 1 percent goes to the Data Union DAO where we then fund new Data Unions and... and help new products to build, um, build with... with Data Unions essentially. Um, and with this particular smart contract for example. Um, right, and then we have the new earnings. So we have new token um that we have calculated up here, and then we subtract admin fee and the protocol fee and that's essentially the rest goes then into here, into the total, um, in the earnings per member.

Nico Burkart

So now we have to calculate okay how many token does each member gets because this smart contract um only does equal um equal division so you... every member gets the same amount of token. Um, right, and then you kind of just... this is just total earnings so the smart contract knows how many token have been earned.

Nico Burkart

Right. Um, so and then the members, they can just withdraw their token at any time. The revenue gets refreshed and this is like kind of how this mechanism works.

Nico Burkart

Right. Um, let's... let's talk more about the use cases and what this micro-payment is for because it's very specific, right? Because we've got this um this batch, these batch transactions and these transactions only really makes sense if it always always gets sent to the same people or sorry the same wallet addresses. It doesn't make sense if um Vitalik starts with this stash to this bunch of people and then this stash goes to another bunch of people, it doesn't make sense then because then you don't really save on any transactions. So this is really um what I'm talking about, the same amount of token, the token go to the same people addresses. That makes sense. Um, okay, and what what kind of use case? So what is a Data Union? Let's start let's start with that.

Nico Burkart

So a Data Union is essentially an organization, you could even say it's a DAO in a way, um, but really let's just stick with an organization. So you have a bunch of people and they want to share their data or they have valuable data. Let's say you have a phone, um, and your health data is stored on it and now you want to kind of earn with it. So now in Web2 what happens is that they just sell it, you know, you can't really do anything about it, they just will use that data and you know give it away and and get money for it and you won't really get anything out of it other than using the app for free for example. So the Web3 solution or our solution is forming Data Unions where you um publish your health data for example from your phone and earn with it.

Nico Burkart

So this health data gets summoned into one dataset and then this dataset gets purchased by someone, right? So in that case Vitalik would for example purchase health data or what's more likely is that a hospital comes in and says hey cool this health data is super interesting, um what can I do with it? Train my machine learning model and and all that kind of stuff. So it's crowdsourced data and you earn with that. Um, and our smart contract enables this, right? So um the hospital pays us in the smart contract money, and then it gets distributed, you... your money accumulates because maybe there's another hospital buying that data or maybe the hospitals are subscribing to the data which means for example they send um X amount of token every month um to the same bunch of people, um, and then your balance increases, your balance increases, and at some point you can say okay cool I earned a decent amount of money and now I don't know I buy a burger with it. Whatever.

Nico Burkart

And and you know you can you could do whatever you want. Um, and the Data Union DAO is kind of the organization behind this whole thing like we are pushing this um initiative, um, and you know programmed the smart contracts for that and an SDK as well which I'm going to go into I think now, oh no we're going to talk about Swash first. So um an example of a Data Union is Swash. So Swash is a browser extension that you can install into your browser, who would have thought, um, and you can you can earn with your data with your browsing data. So that's that's really cool by the way, so I highly recommend to check it out. So you install it and and then you you just you take some boxes like this is what I want to share, this is what I don't want to share and then you earn with your with your data.

Nico Burkart

And how that happens is Swash creates a wallet address, so you click a button say okay I want to share my data and earn with it. Click, and then Swash creates a wallet address and adds you to their Data Union, right? For to this Data Union contract I showed you, to this micro-transaction contract. And then they get all these addresses and get all the data from these different addresses, put them in a dataset, and then someone comes and says hey cool this is this is a cool dataset I want this. Um, I want to subscribe to it, I pay you money to this smart contract and then all the members get rewarded in Swash token in this in this case. Um, there's another Data Union called DIMO. And DIMO is a car app essentially where you can... you see this device here, you plug it into your car, um and you can earn with your car data. So it's drive to earn essentially. So you share your your car data, you earn token um by doing that.

Narb

Uh, sorry. Uh, if you're not asking a question could you please mute?

Nico Burkart

And right. And then we have... so yeah this is what happens, right? Okay. So these are the two two examples. So pretty cool projects. I highly recommend checking them out. Um, and then a short recap so how this whole thing works because this was a lot of information. Um, so the admin, that's your project for example, deploys the smart contract, then you add the members over time, so these members would be your users that publish data. And then you can set an admin fee if you want, it can be 30 percent, can be 20 percent, it's up to you, maybe you have a different business model so you don't need this percentage cut, um, but yeah, you know like whatever you want to do. And then your members, they publish data, so that's for example this health data, could be the browsing data, it could be the car data, whatever.

Nico Burkart

And then um some in if you're lucky enough, there's someone that actually wants to buy your data as well, so you Data Union set and pays you ERC-20 token to get sent to the contract, and then you know your members can withdraw their token over time um as the their token balance kind of increases within the contract. Um, yeah. Okay. So yeah. We also have an SDK. Uh, by the way Narb, how much time have I got left?

Narb

Uh, you have about 8 minutes ish left.

Nico Burkart

Okay cool. Cool. Cool. Cool. Okay we also have an SDK. Um, which is really cool, so you you don't really need to program any Solidity or anything, like you can just work with this in the smart contract. Like all the things that I talked about and you might went over your head or something like that because it was maybe not well enough explained or not enough context, it doesn't matter, you can just use this SDK and you'll be fine. Um, so how this works is that you just have you set up your client right here, um, and this is a script, so this is where you have to put in your private key but you can also put in a provider, so for example you can put in MetaMask. And MetaMask will then you know do all the transactions.

Nico Burkart

But in this script we kind of deploy a Data Union and then set the admin fee, add members, so it's uh it doesn't make sense to have MetaMask here. So here here you then just uh declare a Data Union, so you Data Union deploy Data Union and then that's really it. Like your Data Union is then deployed, you get you will get an address back and this is like the smart contract you can use for your micro-transactions, and this private key um will be then the owner of the smart contract, so you can do like all the admin functions with it. Um, I also forgot to mention actually that you can deploy on Polygon and Gnosis, so these two chains are supported by us. Um, right. And then you can also get Data Union um the Data Union by just getting it by the contract address. Right, so this is what I'm talking about, right? You can just say okay Data Union set admin fee and then you can set the admin fee 0.3 so 30 percent or you can add members, you can remove members, by the way they have to be you know your admin private key otherwise it won't work.

Nico Burkart

Um, and and then Data Union dot withdraw all can can do anyone can be the admin can be um a member so this 0x1234. Uh so yeah you don't you don't need to do any Solidity you could just use this contract. We have documentation for this so feel free to check it out. I think this is going to be uploaded on YouTube so you can just press pause um and get this, but you can also find it on our website DataUnions.org and then go start building and then you'll you'll find it there too. There's some guides um how you you can create your Data Union and maybe more context where you can read what it actually is our framework.

Nico Burkart

Um, right. Okay. How much time have I? Six minutes. Okay right. We also have the Streamr marketplace. For the people that don't know Streamr, Streamr is a offers a toolkit that enables you to publish and subscribe to JSON based real-time messages, um, and that's powered by the Streamr network. So you can like send notifications, wallet to wallet communication, and IoT connectivity. So your health data let's say from your phone you publish that out, um and then someone can subscribe to to this to this data stream. Um, and they offer a marketplace, maybe I'll just show you this uh maybe I'll just show you this here.

Nico Burkart

So they have a marketplace and you can like integrate your data right into their marketplace already. There's not a lot of lot of products shown here because we republished it a few weeks ago, so it's like a new version. Um, and you can actually integrate the Data Union not only with code but you can also use the Streamr network's core which is a front end where you can just create a Data Union with the front end which is super handy. Um, so you can like say okay this will can get published on the marketplace as well so you can like say hey this is the DevNTell Data Union, um you can add a cover image, you can write a product description, um add this stream so this would be the health data stream for example where you publish it.

Nico Burkart

Um, I think it's this is maybe a bit too far away but um I'm going to talk about this in February more um this Streamr thing so it might be better to just like check it out on their website if you're interested. Um, anyway you can then select the chain and say okay Data Token or you know whatever token you want to use to sell your data. Um, and you can select an admin fee. This I just want to briefly show that we've got a front end so if you want to use that it's up to you. Um, but you can also use just this code. Um, and again there's more about this in the Data Union DAO docs.

Nico Burkart

Um, yeah, cool. I think I'm I'm done. Uh, didn't get to show the smart contract because I was too slow but here are some links. Sorry I had the transactions here on Polygon but next time. The documentation you can find here, the website you can find here and our GitHub smart contract so if you're interested, uh we actually have the smart contracts here in this repository. It's public so anyone can check it out. Uh, just press pause on YouTube if you're watching this afterwards. Um, it's really cool, I highly recommend to check it out if you if you know a little bit of Solidity, it's really clever, we have really cool developers in our team that build this.

Nico Burkart

Um, and then this is a thank you for listening to my DevNTell, check out our website, um and yeah this is it. Are there any questions? I think we've got two minutes for questions.

Narb

Awesome, awesome. Yeah this was wonderful, Nico, thank you so much for for taking the time to show us all this cool stuff. Um, one question on top of my mind is is Streamr the only way to basically publish the data that the the Data Union's smart contract um will consume?

Nico Burkart

Oh that's an excellent question. Um no, actually not. So Streamr was is just an example so we actually a spinoff um of Streamr but they programmed it in a way that anyone can use uh this smart contract. So it's just the micro-transactions, the smart contract is handling, so it's really like it like if you don't want to build a Data Union with it you can even just reuse it for different purposes. So you can like if you want to send your data through um AWS you're happy to do that, but you can also do it in a decentralized way which is Streamr which Streamr is offering. Dope, dope. Excellent.

Narb

Um, we got a question in the chat. Um, Reshu asked can the batch transactions be done for ERC-721 token or just ERC-20?

Nico Burkart

Uh good question. I think um I'm not sure but I think it's I don't think so, no. No. I guess that's a feature request. I think that's a feature request, yeah. Yeah no I don't think so.

Narb

Dope. Yeah. No I don't think so. All right, any final questions from the crowd here? Feel free to type or or ask. Hehe yeah, cool stuff anyways.

Nico Burkart

Thanks. Oh wow there's like a lot of chat. Oh okay but that's not from today.

Narb

All right going once. Going twice. Sold. Oh Kemps is typing. Oh Kemp all right we'll give Kemp a couple minutes. Uh but in the meantime, uh thank you so much again Nico for coming on.

Nico Burkart

Miss you after Dev... great sesh. Thank you. Miss you at Devcon, yeah great sesh.

Narb

Uh, so, the best way to follow um all the great stuff you shared here today is through Twitter, those two Twitter handles. And if anybody's actually interested in helping out creating or helping out pushing Data Unions forward or maybe helping out with Streamr, what's the best way for them to get in contact and get the ball rolling there?

Nico Burkart

I think that the Discord is the best way to do it. So if you go on the website DataUnions.org, hang on DataUnions.org, um you'll be able to find there's like a join Discord, so that's the best way to get in contact with us and the community. Um the same for Streamr as well. Um and we are always always interested in new projects building with Data Unions, so if you can think of an X-to-Earn case that you think like oh this could really work with this micro-payment thing, uh feel free to reach out to me on Twitter, on Discord, on Telegram. My Telegram handle is like this, so the same um as my Twitter handle. Uh so yeah, feel free to reach out, um I'm happy to have a call with you as well or even like if it's not about Data Unions, just reach out to me, I'm happy to talk, um and yeah, so whatever you guys want, I'm here to talk about it.

Narb

Excellent, love to hear it. Well, uh with that, uh it's a great way to end things off, so I want to wish everybody a very happy Friday or weekend wherever you may be. And uh be on the lookout, I'll drop the link for the POAPs in the chat here and in the general chat, and we will catch you back here next week. And uh don't want to miss out, we got a Halloween meme contest on Twitter, so drop your best spooky Halloween meme for a chance to win 400 CODE tokens. Oh yeah. And yeah, catch you all. Bye guys, thanks thanks for listening. For sure, see you gang, have a good one. Bye.

Listen On

Share This Episode

Share on X

Watch Episodes Live!

Subscribe to our event calendar and never miss a live episode.

View Event Calendar