Damus

Recent Notes

BITKARROT · 3w
Write it!
balas · 3w
NIP-65
M. Sean Gilligan profile picture
On Nostr, for a public key that I subscribe to, how can I verify that my relays aren’t filtering out messages from that key? Is there a merkle hash on your latest note that I can use to verify that your previous notes were all received?
52❤️2👀1
🇵🇸 whoever loves Digit · 3w
No but that sounds a good idea Simpler than the solution I've kept suggesting, which is p2p data verification over Tor (although the extra complexity with mine also helps with other stuff) As far as I know, no nostr app has really solved data verification for all the posts from an npub or all the ...
balas · 3w
You ask their relays for their content, not your relays. Relays don't have to keep everything from everyone and can't have what they don't know about. If your followers don't post to your relays, then your relays won't have it. That's why nostr uses the outbox model, so you know where to find your ...
M. Sean Gilligan · 3w
Now I’m tempted to write a NIP…
note16fxjf...
M. Sean Gilligan profile picture
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.
}
}
——
M. Sean Gilligan profile picture
secp256k1-jdk is a modern, functional-style Java API with two implementations for Java, JDK, GraalVM native-image, Kotlin, Scala, etc.

It aims to be the standard library for secp256k1 in the greater JDK/JVM Bitcoin ecosystem.

Thanks to Andreas Schildbach and @craigraw for their help!

Version 0.2 is now available for early integration testing.

Binaries are available in a GitLab Maven repo, but remember: "Don't trust. Verify." This is an experimental pre-release.

https://github.com/bitcoinj/secp256k1-jdk/releases/tag/v0.2
2❤️3👀1💖1🤙1