Analog Ergo
Analog Ergo is a cross-chain peer-to-peer marketplace project using cryptographic primitives as the basis for private, fungible, and decentralized trading—without intermediaries.
Project Overview
This project aims to use cryptographic primitives (well established, low level algorithms) as the basis for a cross-chain peer-to-peer marketplace. It will enable users to set and agree to listing prices and other parameters in a private and fungible manner, without the involvement of intermediaries.
- Cross-Chain: Peer-to-peer marketplace operating across multiple blockchains
- Cryptographic Primitives: Uses established, low-level algorithms for security
- Private Trading: Enables private and fungible trading without intermediaries
- Decentralized: No central authority or trusted third parties required
ScalarLock
Successfully tested Scalar Lock contract allowing funds to be locked to a scalar value with elliptic curve multiplication verification for atomic swaps.
2-Party Atomic Swap
Working Python example of 2-party atomic swap simulation demonstrating cryptographic secret sharing and cross-chain protocol steps.
Technical Implementation & Code ExamplesClick to expand
ScalarLock Implementation
Successfully tested a Scalar Lock contract. This allows you to lock funds to a scalar value (e.g., a random 256bit number) that you can test by comparing it with an Elliptic curve multiplication operation against the Secp256k1 Generator. This is a key component for atomic swaps and cryptographic signature verification.
val scalarLockScript: String = {
s"""
{
val xBYTES = OUTPUTS(0).R4[Coll[Byte]].get
val x = byteArrayToBigInt(xBYTES)
val G = decodePoint(generator)
sigmaProp(
receiver &&
G.exp(x) == xG
)
}
""".stripMargin
}This script compares a given scalar value (x) to an elliptic curve multiplication operation of Secp256k1 generator (G) and checks if they are equal.
- Decodes the generator point and extracts a scalar value from the transaction output.
- Checks if the point computed from the scalar multiplication of the generator point and the extracted scalar value is equal to a predefined point.
- If the two points are equal, the transaction is valid.
2-Party Atomic Swap
A working python example of a 2-party atomic swap that you can simulate from 2 shell/terminal windows is available at 2pAtomicSwapExample. This might help people reason about the way in which secrets are shared through this protocol and at what steps what data transfer or blockchain interaction is supposed to occur.
- Simulate atomic swaps between two parties using cryptographic secrets.
- Understand the protocol steps and data flow for secure cross-chain swaps.
In a Nutshell
Analog Ergo represents a cutting-edge approach to cross-chain trading, leveraging cryptographic primitives to create a truly decentralized and private marketplace. With its ScalarLock implementation and atomic swap capabilities, it demonstrates the potential for trustless, intermediary-free trading across blockchain networks.