Didn't expect this today: The bitcoin kernel API is now in Bitcoin Core's master branch! A decade of effort for various contributors and three years from myself: https://github.com/bitcoin/bitcoin/pull/30595

Looking forward to an ecosystem of implementations, full nodes, and tools being developed around it!

Reply to this note

Please Login to reply.

Discussion

congrats!

Amazing! YUGE! congrats dude!

Very cool. Looking at the chainstate stuff, do you think it'll make it easier for me to do this task: a db query on the current utxo set to grab (scriptpubkey, amount) pairs that fit a certain filter on amount. I would have guessed not, but some of the existing uses you described were similar.

Mmh, I'm planning on adding coin lookups, then you can program that yourself.

I think it was your utxo dump tool that I was using before, I'm just wondering mainly if I can reduce the amount of data I have to dump to disk.. well, nbd, don't let it distract you :)

No it was theStack, sorry

Congratulations!!! This is bullish!

👍🏻👍🏻

Congrats 🥳

congrats!💐

I know a few Java developers who are very excited about this…

Would be cool if you guys could work with it too! I think even if you have little interest in it as a replacement for your own consensus code, it might still be interesting as a tool to improve robustness.

I’m including myself in the list of “a few Java developers” 😁

There are many things we can do with it. And the new FFM (aka “Panama”) stuff is really nice. Have you looked at secp2565k1-jdk?

let x = (x - 5) / 10

I haven't used java in a very long time, so can't say I have :P

Do you use Nix?

Not as a daily driver, but we've been testing it out in Bitcoin Core to make CI and dev environments more reproducible. A few tools were migrated to nix recently.

I’m a big fan of using Nix as a package manger (and via Home Manager) on Debian and macOS (aka Darwin) You don’t need to use NixOS — although I do that, too.

Does that 💯 mean that you can easily run `nix shell` with the latest `nixpkgs-unstable`?

Yes :)

Cool. I will post some instructions for you soon.

To run the Schnorr Signature example with JVM:

nix run github:msgilligan/secp256k1-jdk-flake#secp256k1-jdk

To run it the natively-compiled version:

nix run github:msgilligan/secp256k1-jdk-flake#secp256k1-jdk-native

If you want to play with source, do:

nix shell nixpkgs#jbang

enter the below code into a file named SecpEcdsa.java and then `jbang SecpEcdsa.java`.

(Schnorr sig is little trickier to run in JBang because you need libsecp256k installed, but the flakes above handle it.)

——

///usr/bin/env jbang "$0" "$@" ; exit $?

//JAVA 17+

//REPOS mavencentral, secpjdk=https://gitlab.com/api/v4/projects/55956336/packages/maven

//DEPS org.bitcoinj.secp:secp-bouncy:0.2

import org.bitcoinj.secp.*;

byte[] message = sha256("Hello World!");

void main() {

IO.println("secp256k1-jdk ECDSA Sample");

try (Secp256k1 secp = Secp256k1.getById("bouncy-castle")) {

var pair = secp.ecKeyPairCreate();

var sig = secp.ecdsaSign(message, pair).get();

var isValid = secp.ecdsaVerify(sig, message, pair.publicKey()).get();

IO.println("Valid ECDSA signature = " + isValid);

}

}

byte[] sha256(String message) {

try {

return MessageDigest.getInstance("SHA-256").digest(message.getBytes());

} catch (NoSuchAlgorithmException e) {

throw new RuntimeException(e); // Can't happen.

}

}

——

That's some nice tooling, had to slightly tweak your example to include the correct imports, but ran all of them. Nix is magic in the sense that this would have been really annoying to setup by myself and now it just works .

What did you have to tweak? I thought I had tested everything.

Adjust the java version and add imports for the java crypto stuff.

In the JBang script? You change from Java 17 to what version? And I wouldn’t think the `import` statement would have to change? I must be missing something.

Oh, I see one mistake 🤦‍♂️. Yeah, that script requires JDK 25+.

And you must mean MessageDigest and NoSuchAlgorithmException. Ai yai, I thought I tested that.

Yes, that's it :)

can't imagine not using nixos. it's completely changed the way I manage software on all my machines. no more system instability.

The warning that nostr:npub185h9z5yxn8uc7retm0n6gkm88358lejzparxms5kmy9epr236k2qcswrdp wrote on some of the bitcoinj consensus code is one of the most frightening warning comments I have ever seen! There is nothing remotely comparable to libbitcoinkernel to replace.

I knew that 10 years ago when I was messing around with this:

https://github.com/msgilligan/java-libbitcoinconsensus

This is a turning point in bitcoin's future. Kudos nostr:nprofile1qqszavp6ruckc08eeyqw0afkac5w2jrrfyr8hcqc49j60372td8h70qpzamhxue69uhhyetvv9ujumn0wd68ytnzv9hxgtc6y5xc5 and other contributors!

On Fire!