Transcription: OpenAgents Episode 042 - Agent Bitcoin Balance
June 9, 2026 ยท View on GitHub
Source: https://twitter.com/OpenAgentsInc/status/1742952006166225330 Wiki source: https://raw.githubusercontent.com/wiki/OpenAgentsInc/openagents/Video-Series.md Media title: OpenAgents - Episode 042: Agent Bitcoin Balance We review our flow of funds doc an... Upload date: 20240104 Transcription model: mlx-whisper/mlx-community/whisper-tiny Generated at: 2026-06-01T20:23:24Z
Machine-generated transcript. Review speaker labels and wording before using this as quote-grade source material.
[00:00] Christopher David: Alright, that feels nice. We can tick a few boxes off our roadmap. We've deployed the chat with
[00:07] Christopher David: Concierge agent on the homepage, where we're just linking to it from the homepage. We might
[00:13] Christopher David: replace the homepage entirely with it. But that works as demonstrated in the last video
[00:18] Christopher David: and there's the brain. And now I want to get some money flowing through here so we can
[00:26] Christopher David: start paying people to build up knowledge bases. So we have down here, we'll do a little
[00:31] Christopher David: bit of work on this one, users pay agents. And this will also be agents paying users,
[00:40] Christopher David: agents paying agents. Many interesting configurations here. So we want to do a rev share
[00:46] Christopher David: split between the editors of the brain, computer providers, or forers, agent owners,
[00:52] Christopher David: as well as any contributors to the knowledge bases. So let's review our flow funds here.
[01:03] Christopher David: And then we'll walk through this little component I made offline here. So we want to get
[01:09] Christopher David: Bitcoin out as many people as possible, making it as easy as possible for end users to pay
[01:14] Christopher David: for agent usage. We're paying the contributors. Computer providers, model authors, data
[01:21] Christopher David: providers, and curators, algorithm authors, app developers, or forers, educators. Users
[01:26] Christopher David: are maintaining a balance and can top up with Bitcoin Lightning or credit card. Contributors
[01:30] Christopher David: earns sastic at the balance. Contributors can withdraw their balance via Bitcoin or Lightning.
[01:36] Christopher David: Each agent can have to unwrap and you split. Example. So what's our building this out?
[01:49] Christopher David: Kind of continuing with our component driven development approach. I built one component, just
[01:53] Christopher David: thinking about how do we want to represent a Bitcoin wallet or a Bitcoin balance. And so when
[02:01] Christopher David: in the storybook and I actually created a whole new folder in here called wallet. And there's
[02:06] Christopher David: one component in there called Bitcoin balance. And so you can see it there showing a hundred
[02:12] Christopher David: thousand sats. And it's got this little control down here. If you can see what it looks like
[02:16] Christopher David: five thousand sats. And then later on, we can support cases like if you've got a billions of sats,
[02:23] Christopher David: we're going to abbreviate that. But we can iterate on that later. But that's a nice little thing.
[02:29] Christopher David: And then I also added it to the top of the agent node. Right now it only shows if there's any
[02:36] Christopher David: balance of the balance of zero, it does not show. This is deployed. But if you go to agent one,
[02:43] Christopher David: the concierge does not have a balance. But I'd love to get it a balance.
[02:51] Christopher David: Maybe by the end of this video. So we can see it's having a balance there.
[02:55] Christopher David: So you can envision users paying agents for a variety of reasons.
[03:05] Christopher David: The agent is, I mean, the simplest could be just your tipping the agent as a thank you. So,
[03:10] Christopher David: you know, the author of the agent can withdraw the sats. But maybe that agent is empowered to pay other people.
[03:21] Christopher David: So let's do some unit tests feature tests and such to implement the actual functionality. So we'll do this in a branch.
[03:31] Christopher David: I'll call this agent pay. And I think we already have one test related to payments.
[03:42] Christopher David: Let's take a little tour and see what we have done already. So in our feature tests,
[03:51] Christopher David: we do have payment test. And this is system can pay a user. So let's run this.
[04:01] Christopher David: So the test filter payment test.
[04:09] Christopher David: Okay. So system can pay a user passes. And then we have referral payment test.
[04:17] Christopher David: And I just have that skipped over. Some of that simple meant it. But we don't have this payment fully implemented.
[04:26] Christopher David: But yeah, that's also the idea is if a person pays sats to an agent or whatever, whoever referred, whoever referred the paying user or in a little piece of that.
[04:37] Christopher David: So be a nice little network growth incentive. So it's step through what's happening here. We're creating a demo user via the user factory.
[04:48] Christopher David: We're certain that they start off with a balance of zero. We're doing user pay a method on the user model a thousand that sats.
[04:59] Christopher David: And then we're asserting that the balance is a thousand extremely simple. Yes.
[05:06] Christopher David: And then let's take a look at our user model.
[05:08] Christopher David: Yeah. It's we are incrementing the balance.
[05:22] Christopher David: So because we are doing user balances as database entries,
[05:28] Christopher David: there's pros and cons with that. Prozos we can move faster. We can assign people sats. Like if we want to pay
[05:35] Christopher David: like 10,000 users, 100 sats all at once, we can just make that as one SQL query.
[05:43] Christopher David: And then they can just withdraw at their leisure. And that's one lesson that we learned the last time we implemented this payment stuff with GP Utopia where people were being paid every few seconds.
[05:53] Christopher David: And initially we were doing like actual lightning withdrawals every few seconds. And we like crashed our.
[06:00] Christopher David: I don't know if we crossed the voltage node of the Ellen bits instance of it, but yeah, that was problematic.
[06:06] Christopher David: So we switched that over to just give you balance of people looking withdraw.
[06:11] Christopher David: That's fine for now. We may evolve that to be more like non-custody would ever obtain.
[06:17] Christopher David: Okay. So this is system paying user.
[06:21] Christopher David: So done we have basic system pays user. That's just like some code can just increment some of its balance.
[06:35] Christopher David: And pay is a little vague because pay might maybe should mean users paying someone else.
[06:42] Christopher David: And we also need to think about, you know, the receiver of a payment could be a user or could be an agent.
[06:52] Christopher David: So let's take a look at some feature tests maybe.
[06:59] Christopher David: At least design out what the feature tests we want to write. And we'll do this in payment tests until we split it off.
[07:05] Christopher David: So we've got system can pay a user. We want agent can pay user.
[07:12] Christopher David: Think first we'll do user can pay agent.
[07:18] Christopher David: Eventually we want agent can pay agents.
[07:22] Christopher David: And then we'll want this we can say this is in
[07:29] Christopher David: referral payment test.
[07:35] Christopher David: When a further user pays, refer it to pay.
[07:48] Christopher David: Okay. And then we will separately maybe in like a
[07:53] Christopher David: wallet test.
[08:03] Christopher David: Implement the withdrawal functions.
[08:11] Christopher David: Let's see. User can
[08:14] Christopher David: we'll do kind of with GPU chip where you can generate a lightning invoice.
[08:25] Christopher David: Our user can submit lightning invoice where we'll pay out to.
[08:30] Christopher David: Or user can sweep all funds to a lightning address. We'll be able to need to evolve that.
[08:40] Christopher David: Let's take a quick look. I don't even know we haven't even used this in one time.
[08:44] Christopher David: We'll go website.
[08:55] Christopher David: So yeah we may make it look a little bit like this.
[09:00] Christopher David: Those are your stats balance. That's just a database entry on our end.
[09:05] Christopher David: This is tied to I think one or more albe a count. So we have
[09:10] Christopher David: how many stats you've earned total and then you can click a button to withdraw
[09:14] Christopher David: that all to your connected albe account.
[09:18] Christopher David: I don't know where at least not going to be having all of our users using albe accounts.
[09:22] Christopher David: That might be a little different flow. When we might change our language with draw via invoice,
[09:27] Christopher David: with draw via like to lightning address.
[09:29] Christopher David: If it detects that you have an albe account and maybe it'll show that.
[09:33] Christopher David: Okay so that'll be like the wallet.
[09:40] Christopher David: What I want to do, I can do some of this stuff offline. Again all of this stuff will be open source
[09:48] Christopher David: in the usual repo. All of this code will be 100% open source at all times.
[09:55] Christopher David: And let's just implement one piece of this.
[10:00] Christopher David: I want to like give myself a balance and then pay.
[10:08] Christopher David: Let's do this.
[10:10] Christopher David: I'm going to just do this locally.
[10:21] Christopher David: All right so there we have our agent.
[10:24] Christopher David: And first let me just do it test.
[10:27] Christopher David: If I go to the local.
[10:31] Christopher David: And then I'm going to go to the local.
[10:37] Christopher David: Okay so right now.
[10:39] Christopher David: I've implemented the agent type on the client but not in the back end.
[10:43] Christopher David: So that's a good thing to do first.
[10:49] Christopher David: So before we can do this,
[10:51] Christopher David: we're missing a unit test called agent has a balance.
[10:56] Christopher David: Let me just put this in agent test.
[10:57] Christopher David: So let's do let's see our agent test run.
[11:03] Christopher David: Okay let's say it has a balance.
[11:17] Christopher David: People do it like balance underscore SAS.
[11:22] Christopher David: Because the conceivably there could be a balance of fiat although we're probably not going to implement that.
[11:28] Christopher David: All right this is what we want.
[11:32] Christopher David: Let me create an agent with the balance.
[11:35] Christopher David: The sats the balance of sats is a thousand.
[11:41] Christopher David: All right we have a properly failing test.
[11:44] Christopher David: The balance get a possible.
[11:45] Christopher David: Call them balance sats of religions agents does not exist now.
[11:50] Christopher David: If we were going to be expecting to re-wipe the database, I would go and make that.
[11:55] Christopher David: Edit to the main agents migration to keep everything in the same place.
[12:00] Christopher David: But because we already have a live database, I'm going to do this as a
[12:05] Christopher David: additional migration.
[12:06] Christopher David: Let's just take a look at our agents table for now.
[12:09] Christopher David: Agent has an aim.
[12:11] Christopher David: Agent has a foreign ID.
[12:13] Christopher David: Anything else we've added?
[12:14] Christopher David: Looks like no.
[12:15] Christopher David: Okay so we're going to do a new migration.
[12:18] Christopher David: And I'm going to call this.
[12:19] Christopher David: Add sats balance field or column.
[12:30] Christopher David: Two agents table.
[12:32] Christopher David: Sometimes, the layer of elk can kind of figure out what you're trying to do and set you up.
[12:35] Christopher David: Okay so I'll try to do agents.
[12:39] Christopher David: Oh up here we added.
[12:42] Christopher David: You add balance to users table.
[12:46] Christopher David: There we just called balance.
[12:48] Christopher David: I'm going to add a balance.
[12:54] Christopher David: I'm going to update that to balance sats.
[13:01] Christopher David: Well you know what I'm just going to keep things all the same.
[13:05] Christopher David: If it's balanced we're just going to do this Bitcoin and then maybe append the USD for
[13:11] Christopher David: the default expectations should be the we're using Bitcoin because
[13:15] Christopher David: Bitcoin is the native currency of the internet.
[13:17] Christopher David: Okay.
[13:19] Christopher David: Oh it ran both the agent test and the user test.
[13:24] Christopher David: All right then I'll pass this.
[13:26] Christopher David: Let's also say that if we create a dummy like a if we don't specify the balance
[13:36] Christopher David: and we just create an agent it should default the zero.
[13:44] Christopher David: Okay.
[13:50] Christopher David: And that fails.
[13:54] Christopher David: It's just null.
[14:01] Christopher David: I'm going to rename this to just add balance.
[14:07] Christopher David: Well no we're talking about.
[14:09] Christopher David: Now that's interesting it says default zero.
[14:14] Christopher David: But then it says asserting that null is identical to zero.
[14:20] Christopher David: Why is that?
[14:30] Christopher David: Is it some weird factory behavior?
[14:32] Christopher David: All right.
[14:33] Christopher David: Well I'm just going to put that in the factory.
[14:38] Christopher David: I'm not going to take it into that.
[14:40] Christopher David: Okay.
[14:40] Christopher David: So an agent can now have a balance.
[14:45] Christopher David: So let's run our test make sure the all pass.
[14:49] Christopher David: We can commit this as
[15:03] Christopher David: agent has a balance.
[15:14] Christopher David: And we're commit error will commit our stubed comments.
[15:25] Christopher David: Okay so now if I run my my gradients locally.
[15:31] Christopher David: And I check our local database.
[15:34] Christopher David: Oh I didn't run the cedar.
[15:51] Christopher David: Okay.
[15:53] Christopher David: We have the consequences of the balance of zero and let's go over here.
[15:56] Christopher David: And if I add a balance of
[15:59] Christopher David: 232 and save.
[16:04] Christopher David: All right.
[16:05] Christopher David: Let's get went up.
[16:08] Christopher David: Let's run our storybook and just confirm that
[16:14] Christopher David: agent node is working.
[16:22] Christopher David: Yep that looks like we expect
[16:25] Christopher David: with SATs being oh I'm calling it SATs in the client side.
[16:32] Christopher David: Um let's rename that to just save balance.
[16:41] Christopher David: We can edit that to make it clearer if we need to another time.
[16:48] Christopher David: But balance equals SATs.
[16:54] Christopher David: The balance is denomated in SATs.
[17:18] Christopher David: Okay let's run our build to make sure our
[17:22] Christopher David: types are all good.
[17:28] Christopher David: And then let's come back over to here.
[17:31] Christopher David: There we go.
[17:32] Christopher David: Concierge now is 232 SATs.
[17:42] Christopher David: Okay um
[17:45] Christopher David: we have the basic idea of users and agents being able to have
[17:50] Christopher David: SATs.
[17:51] Christopher David: We don't have the visualization yet for the
[17:54] Christopher David: user balance but we'll add a little wall of paper.
[17:56] Christopher David: Okay um I had mentioned in the previous video that
[18:01] Christopher David: or you know previous videos that we would be playing with the idea of
[18:05] Christopher David: allowing people to like collaboratively build up knowledge-based
[18:08] Christopher David: and get paid SATs for.
[18:10] Christopher David: And uh I'm now got a really good idea for
[18:14] Christopher David: how I want to build that out and test that.
[18:18] Christopher David: So we'll do that in the next video.
[18:20] Christopher David: Let's see as in.