I'm new to cryptography and I've recently been studying BLS signatures. Please forgive me if I make any mistakes while writing.
I've tried generating a BLS key pair and using the private key to derive an Ethereum account and sign on-chain transactions. I used the 'mattrglobal' library to generate the BLS keys, and then passed the private key to the 'ethereumjs-wallet' library to derive an account.
const {
generateBls12381G2KeyPair,
} = require("@mattrglobal/node-bbs-signatures");
const {
default: { fromPrivateKey },
} = require("ethereumjs-wallet");
const keyPairTest = (async function () {
const keyPair = await generateBls12381G2KeyPair();
const wallet = fromPrivateKey(Buffer.from(keyPair.secretKey));
console.log(`secretKey: ${Buffer.from(keyPair.secretKey).toString("hex")}`);
console.log(`ethereum address: ${wallet.getAddressString()}`);
})();
Even though I was able to derive an Ethereum public key, I didn't expect to be able to sign valid Ethereum transactions, because I thought that the different curve parameters would prevent me from generating valid signatures for the transactions.
However, by directly using the private key on MetaMask (on the Sepolia testnet), I was able to perform a simple fund transfer transaction and deploy a smart contract.
How is this possible? Am I overlooking something?
It seems to me that it is generally not recommended to use the same key for two different types of signatures, is that correct?
No. Ethereum transactions do not use BLS12-381.
A private key is a random 256 bit number. You can use private keys on most curves. When MetaMask imports your private key, it only imports a random number.