Can I use a BLS12-381 private key to sign Ethereum transactions?

433 Views Asked by At

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?

1

There are 1 best solutions below

0
Mikko Ohtamaa On

Can I use a BLS12-381 private key to sign Ethereum transactions?

No. Ethereum transactions do not use BLS12-381.

Digital signatures in the blockchain world are usually based on elliptic curve groups. For signing users' transactions, Ethereum uses ECDSA signatures with the secp256k1 elliptic curve

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.