Signatures Standards

Signatures in Crypto Bridges

In crypto bridges, signatures are crucial for secure cross-chain interactions, performing essential roles such as:

  • Authenticating Transactions: Verifying that requests across different blockchains are legitimate and from authorized users.

  • Ensuring Data Integrity: Protecting the integrity of data transferred between chains from alterations.

  • Facilitating Interoperability: Enabling trust and security in communication between disparate blockchain networks.

Cryptographic signatures, often utilizing advanced algorithms, ensure the secure operation of crypto bridges, safeguarding assets and data as they move between chains.

EIP-191 (Ethereum)

Uses "\x19Ethereum Signed Message:\n" prefix with keccak256 hash, creating a 65-byte signature (r,s,v) for secure message verification. Perfect for smart contract interactions and user authentication on EVM chains.

  • Can be used with EIP-712 for structured data signing, enabling meta-transactions without ETH

1.Message Struscture

// Message structure
bytes32 messageHash = keccak256(abi.encodePacked(
    "\x19Ethereum Signed Message:\n32",
    originalMessage
));
  1. Signature Components:

  • v: Recovery parameter (27 or 28)

  • r: First 32 bytes of signature

  • s: Second 32 bytes of signature

Implementaion Code:

// Creating signature
const signature = await signer.signMessage(message);

// Recovering signer
const signerAddress = ethers.utils.verifyMessage(message, signature);

// Smart contract verification
function verify(bytes32 message, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
    bytes32 prefixedHash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", message));
    return ecrecover(prefixedHash, v, r, s);
}

ED25519 (TON)

High-performance elliptic curve signature scheme producing 64-byte signatures, offering fast verification and compact keys (32-byte public keys). Ideal for TON blockchain's native cryptographic operations and mobile-friendly implementations.

  • Provides batch verification up to 64x faster than individual verifications

  • Immune to scalar multiplication timing attacks unlike ECDSA,

  1. Technical Specifications:

  • 32-byte public keys

  • 64-byte signatures

  • Curve: edwards25519

  • Hash: SHA-512

2.TON Implementation:

const TonCrypto = {
    // Generate key pair
    async generateKeys() {
        return TonWeb.utils.keyPairFromSeed(
            TonWeb.utils.newSeed()
        );
    },

    // Sign message
    async signMessage(message, keyPair) {
        return TonWeb.utils.sign(
            message,
            keyPair.secretKey
        );
    },

    // Verify signature
    async verifySignature(message, signature, publicKey) {
        return TonWeb.utils.verify(
            message,
            signature,
            publicKey
        );
    }
};

Last updated