Here’s a super simple example:
To AI:
Imagine a function that takes two integers and adds them returns true if the sum is less than 100, else false, propose three tests
——-
AI might respond…
Sure, here are three test cases for such a function:
1. **Test Case 1: Two small numbers**
- Input: 5, 10
- Expected Output: True (because 5 + 10 = 15, which is less than 100)
2. **Test Case 2: Numbers summing up to exactly 100**
- Input: 60, 40
- Expected Output: False (because 60 + 40 = 100, which is not less than 100)
3. **Test Case 3: Large numbers exceeding 100**
- Input: 75, 50
- Expected Output: False (because 75 + 50 = 125, which is more than 100)
You'd want a range of test cases to ensure that the function behaves correctly for different kinds of inputs.
———
Now write the JS function and tests using Jest
—————
Certainly! Here's how you would write the first test for the function using Jest:
First, let's define the function (I'll name it `isSumLessThan100`):
```javascript
function isSumLessThan100(a, b) {
return a + b < 100;
}
```
Now, let's write a Jest test for it:
```javascript
const isSumLessThan100 = require('./path-to-your-function-file'); // Import the function
describe('isSumLessThan100', () => {
test('should return true for numbers summing to less than 100', () => {
const result = isSumLessThan100(5, 10);
expect(result).toBe(true);
});
});
```
More details on drivechains… nostr:note1k4x4nu3h4z38mp0d8ktm5rjkerz3sswl6gh343qu23jarxygvyuswhwgzq
From my personal experience, it’s waaay faster than coding it yourself. Likely 10x. It’s not just the coding, but the bug fixing. Using AIs to write the tests and then write the code generates far higher quality code really quickly.
One of things i find myself doing a lot these days is getting chatgpt to write a function and then using another chat instance to check the code. I’ll do this over and over until all the bugs are caught. Since each chat is like a new code reviewer it often finds all of the bugs after many iterations.
I’ll even give the code review from one of the AIs to the one who wrote the code, it will then give a different implementation based on the ai review. I then give that implementation to the reviewers implementation and ask if its better or not. I can very quickly get to an optimized and less buggy function this way.
This feels very *human*. This is exactly how code review tends to play out in meatspace.
Demo:
https://chat.openai.com/share/a3ac3201-eee8-4d69-9671-e1e8dd9c2917
https://chat.openai.com/share/21c189a6-f29e-4e31-b163-5f009cc48e1b
I do this too.
I’ve changed my process to first start with writing and critiquing the tests and then getting the AI windows to write and critique the functions.
It seems the AIs excel at test driven development. Code coverage far higher than I would do on my own.
To understand Bitcoin, you need a broad understanding of many systems. Technology, economics, game theory, etc.
These folks might be smart coders but that isn’t sufficient.
And they negotiated for no liability. Learned their lesson.
Lying criminals — paid the largest criminal fine in 2009. But they’re telling the truth now, right? 🤔 
Inappropriate toys for children…
Thank you. This was helpful.
Need to think about it more, but my initial impression is that the proposal is complicated and inelegant.
Seems to require a lot of trust in miners to do the right thing. Not clear that the proposal will work as intended and won’t have unintended consequences.
https://www.truthcoin.info/blog/drivechain/
Just read this. Written 8 years ago. Wow. Why not bring sidechains into L1 and let them run on it essentially. Deep stuff.
🤯
I must be missing something. I don’t understand why people are getting upset. I’ve heard this proposal referred to as an attack on bitcoin.
It seems to be a group of private actors using the blockchain to pass messages to each other.
I don’t see any change to network incentives, or risk of transactions being censored, increase in data storage, or any other harm to the base chain.
🤷♂️
I still don’t fully grok the attack. I can imagine you’re sick of the discussion (I saw you credited on the BIP website). Just hoping you’ll help me with more details.
I’ve read the BIP writeup. To me, it sounds like a side protocol like ordinals / inscriptions. Old node software versions would see it as meaningless data that only means something to the participating users.
Like I’m watching a baseball game and I see hand signs but don’t realize what they mean.
Is it really an attack though? Does it improperly change network incentives? Censor transactions? Some other harm to the base chain?
I get Lyn Alden’s point that we want the base chain to be resistant to change, but, unless I’m missing something, nothing appears to be changing from the perspective of old node software.
It’s like a private group of people coordinating to use the blockchain to pass messages to each other.
Again, appreciate any insight you can provide. 🙏
Could you please break that down a bit more for me?
I assume you’re referring to the “silent”, miner coordinated soft fork.
You refer to an attack. Is there a way that this can hurt the base chain? For example, if I ignore that this exists, could it hurt the incentives or my BTC in some way?
Please help me understand the BIP 300 risks better. All I’m hearing at the moment is that people don’t want sidechains to use BTC as a native currency.
Pros:
+ gives miners more revenue
+ allows people to experiment with other functionality using their bitcoin
Cons:
… unclear
How does this negatively impact the base chain?
Totally agree. Free speech, plus frictionless commerce for content has a lot of potential.
More communities will join when they are inevitably censored elsewhere.
I agree with that, but from what I’ve read, that wouldn’t happen. What happens in the drive chains stays in the drivechains?
This was the problem with inscriptions. That they could add data to the base chain. My understanding is that this isn’t a problem with drivechains. If you have a link to how that’s not true, I would love to read it.
Pros:
+ gives miners more revenue
+ allows people to experiment with other functionality using their bitcoin
Cons:
… unclear
How does this negatively impact the base chain?
