-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optional Field: Author Proof #2
Comments
Dropping some notes from some earlier conversations and after a Discord conversation with @pradel - some good ideas here! BIP322 Proof of UTXO and related signing ideas:BIP322 text: Electrum and Sparrow implement signatures, and this page had some resources with a timeline: This wiki gets into the details for signing with different address types, but not sure if it's following BIP322 or an alternative to it: These were some use case explorations that show some good ideas toward what's possible Here was a pull request related to two different implementations between Trezor and Electrum with some good discussion on supported formats and links to the sign message methods in bitcoinjs-message. Looks like BlueWallet adopted it as well. ...and a JS library! 🔎 Also some talk here if the library should continue to be maintained or archived, the PR included an update to TypeScript: Trezor's resources here as well: https://trezor.io/learn/a/sign-verify sign_message.py verify_message.py Address Ownership Proof ProtocolThere were a few mentions of AOPP but not much information following that, resources are below and may be another way to prove ownership. https://aopp.group/ From the website:
This was the GitHub discussion about the implementation but haven't seen much more. Other ImplementationsNostrocket: micro-dao funding for projectsUsing BIP-322 to prove funds: https://nostrocket.org/ Mirror format for signatures:
There is also a
Arweave tx example: https://viewblock.io/arweave/tx/YUOCMG1EJW3vfbYYpIUcJbn0BBhL6yC2bFuSZo-CDNI |
Let's start simple and iterate! Initially the signature could just be a signed message of all the other fields in the payload. Credit to @pradel for that idea and the first signed news item on the standard: |
Also adding Paul Miller's library for noble curves here, which was recently audited by Trail of Bits: https://github.com/paulmillr/noble-curves
import { schnorr } from '@noble/curves/secp256k1';
const priv = schnorr.utils.randomPrivateKey();
const pub = schnorr.getPublicKey(priv);
const msg = new TextEncoder().encode('hello');
const sig = schnorr.sign(msg, priv);
const isValid = schnorr.verify(sig, msg, pub);
console.log(isValid); |
Following up on this, Sigle has a working implementation for proving the authorship of a single post. :clapping: Fields Usedconst parsedData = {
p: 'ons',
op: 'post',
id: data.id,
author: user?.username,
authorAddress: user?.profile?.stxAddress?.mainnet,
title: data.title,
body: data.content,
url: `${appConfig.appDomain}/${user?.username}/${storyId}`,
signature: signedData ?? undefined,
}; Signing MethodUsing the const handleSign = async () => {
await sign({
network: new StacksMainnet(),
message: JSON.stringify(parsedData),
onFinish: async ({ signature }) => {
setSignedData(signature);
},
});
}; Verification MethodUsing stacks/transactions to:
Using the // Call the api to get the inscription data
let data = await fetch(
`https://inscribe.news/api/content/${inscriptionId}`
);
if (!data.ok) {
return toast.error('Invalid response from api');
}
let json = await data.json();
if (json.p !== 'ons' || json.op !== 'post' || !json.signature) {
return toast.error('Invalid data');
}
const message = JSON.stringify({ ...json, signature: undefined });
// We verify the signature is valid
const recoveredPublicKey = publicKeyFromSignatureRsv(
bytesToHex(hashMessage(message)),
createMessageSignature(json.signature)
);
const recoveredAddress = getAddressFromPublicKey(recoveredPublicKey);
if (json.authorAddress !== recoveredAddress) {
console.log(json.authorAddress, recoveredAddress);
return toast.error(`address does not belong to publicKey`);
}
if (
!verifyMessageSignatureRsv({
message,
publicKey: recoveredPublicKey,
signature: json.signature,
})
) {
return toast.error(`Signature does not belong to issuer`);
} |
Looking at the logic above it does prove that the @pradel am I correct that this would just prove the On that note, it'd be great to define something that works for both |
This could be helpful on the Bitcoin side! |
Curious if the more recently supported BIP0322 signing works for this out of the box? https://hirowallet.gitbook.io/developers/bitcoin/sign-messages |
How can we prove the author is the author?
For .sats names, it'd be interesting to explore a BIP-322 or some kind of structured data signed by the wallet.
For .btc names, we could implement a similar structure using SIP-018.
The text was updated successfully, but these errors were encountered: