project screenshot 1
project screenshot 2
project screenshot 3

Crypto PoS

Crypto PoS is a Web3-ready Point of Sale system that uses NFC technology for fast, secure, and contactless cryptocurrency transactions. Supporting multiple blockchains, it simplifies payments for merchants and users, with features like zkVerify for privacy and ENS for trust.

Crypto PoS

Created At

ETHOnline 2024

Project Description

Crypto PoS is a Web3-ready Point of Sale (PoS) system designed to revolutionize the way cryptocurrency transactions are conducted. By leveraging NFC (Near Field Communication) technology, it enables fast, secure, and contactless payments, making the process seamless and user-friendly for both merchants and customers.

Key Features

  1. NFC Contactless Payments
    The core innovation of Crypto PoS is its use of NFC technology, allowing users to tap NFC tags or cards to complete transactions. This eliminates the need for scanning QR codes, offering a more reliable and efficient alternative.

  2. Dual Protocol Modes

    • Card Emulation Mode: In this mode, the PoS shares transaction data (address, chain ID, and amount) with a user's smartphone via NFC. The phone processes the transaction, and the PoS listens for confirmation on-chain using the BlockScout API.
    • NFC Card Mode: Users can load their cryptocurrency balance onto an NFC card. With a simple tap on the PoS, they can transfer funds without needing to interact with a phone. This makes payments fast and convenient, although future improvements will focus on adding more robust security like signing transactions with a smartcard.
  3. Multi-chain Support
    Crypto PoS supports transactions across various blockchains, including Optimism Sepolia, Ethereum Sepolia, Celo Alfajores, Celo cUSD, and Zircuit Testnet. This ensures compatibility with a wide range of ecosystems, giving merchants the flexibility to accept payments from multiple chains.

  4. ENS (Ethereum Name Service) Integration
    Crypto PoS integrates ENS, displaying human-readable domain names associated with wallet addresses to provide trust and transparency during transactions.

  5. Invoice Generation
    Merchants can generate invoices using Request Network, streamlining the payment process and providing a comprehensive system for managing orders and receipts.

  6. Zero-Knowledge Proofs (zkVerify)
    Tax reporting is simplified through zkVerify, which generates zero-knowledge proofs to report only the total amount handled by the merchant without revealing individual transaction details. This ensures both privacy and compliance when reporting to tax authorities.

  7. DBForest Integration for Transaction Storage
    To further enhance privacy and ensure secure transaction storage, Crypto PoS utilizes DBForest, a decentralized storage solution. This ensures that transaction data remains tamper-proof and accessible for audit or reporting purposes.

Problem Solved

Traditional QR-based crypto payments, while useful, often suffer from scanning issues, delays, or potential misreads. Crypto PoS eliminates these problems by introducing NFC technology for contactless payments, ensuring a faster and more dependable user experience. This is particularly beneficial in busy retail environments where quick and seamless payments are essential.

In addition to improving the payment process, Crypto PoS addresses concerns around privacy and regulatory compliance. The integration of zero-knowledge proofs ensures merchants can report their earnings without exposing sensitive transaction details. This offers a balance between transparency and privacy, addressing growing concerns in the crypto space.

Technology Stack

  • Solidity: Smart contract development for secure and programmable transactions.
  • Optimism Sepolia, Ethereum Sepolia, Celo Alfajores, Zircuit Testnet: Supported blockchains for multi-chain compatibility.
  • BlockScout API: Used for real-time transaction confirmation on supported blockchains.
  • DBForest: Decentralized storage of transaction data, ensuring privacy and accessibility.
  • zkVerify: Zero-knowledge proof integration for private reporting.
  • ENS: Provides human-readable wallet addresses for trust and usability.
  • Request Network: Facilitates invoice generation and order management for merchants.
  • Docker: Used to set up zkVerify integration in a development environment.

Future Enhancements

  1. Custom Smartcard: Future iterations of Crypto PoS will include a custom smartcard capable of securely signing transactions, improving the security of contactless payments.
  2. Dual FIAT and Crypto Payments: A planned hardware solution will allow merchants to accept both cryptocurrency and traditional FIAT payments through the same NFC PoS terminal, increasing versatility.

Crypto PoS is designed to be an all-encompassing, scalable, and secure solution for businesses looking to accept cryptocurrency payments while maintaining high levels of privacy and ease of use. It bridges the gap between traditional retail payment systems and the future of decentralized finance, offering a smooth, contactless transaction experience.

How it's Made

How It's Made: Crypto PoS – The Nitty-Gritty

Crypto PoS is the result of combining several cutting-edge Web3 technologies, NFC (Near Field Communication) protocols, and blockchain features to create a contactless Point of Sale system for cryptocurrency payments. The project revolves around integrating smart contracts, NFC readers, zero-knowledge proofs (zkProofs), and privacy-focused data storage solutions.

Core Components and Technologies

  1. Smart Contracts (Solidity) The backbone of Crypto PoS is its smart contracts, written in Solidity, deployed on multiple blockchains: Optimism Sepolia, Ethereum Sepolia, Celo Alfajores, Celo cUSD, and Zircuit Testnet. The contracts manage balances, transfers, and transaction verifications. Each transaction is signed and confirmed through the contract, ensuring transparency and security.

    One interesting challenge was building the contract to handle NFC transactions efficiently. The card emulation mode needed to interact seamlessly with blockchain data to confirm on-chain payments. This was handled using BlockScout’s API, which listens to transactions and triggers events within the PoS terminal.

  2. NFC Technology The project utilizes NFC readers and tags/cards for seamless transactions. The system works in two modes:

    • Card Emulation Mode: Here, the NFC reader serves as a bridge between the PoS terminal and the user's phone, transmitting the required transaction data (address, chain ID, amount). The user’s phone signs and broadcasts the transaction, and the PoS terminal listens for a confirmation.
    • NFC Card Mode: In this mode, users can pre-load balance onto NFC cards, allowing them to tap and pay with a simple transaction. A limitation with this mode was the lack of transaction signing, but this is something that will be addressed with future smartcard improvements.

    Handling communication between the PoS terminal and the blockchain was a tricky challenge. To overcome NFC limitations (such as short data transfer distances and low power availability), a custom Python script was written to handle low-level NFC communication efficiently.

  3. ENS Integration To make payments more trustworthy, the system integrates Ethereum Name Service (ENS), allowing users and merchants to see human-readable wallet names instead of hexadecimal addresses. This integration was challenging due to compatibility issues with the system’s HTML interface and web3.js, which I eventually worked around by using the ENS resolver library.

  4. Zero-Knowledge Proofs (zkVerify) One of the standout features of Crypto PoS is its use of zkVerify for zero-knowledge proofs. This integration allows merchants to report transaction totals without revealing sensitive details. To implement this, I used Docker to containerize zkVerify’s libraries, which had dependencies that were incompatible with my development environment (Ubuntu). Docker ensured a consistent environment for zkProof generation and verification.

    Breaking transaction hashes into smaller chunks (8 parts) to meet zkProof data limits was a particularly hacky solution. I had to split the data at the byte level and process it in pieces, then reconstruct it in the smart contract, ensuring everything aligned correctly.

  5. DBForest for Data Storage For privacy-focused storage, DBForest was integrated into Crypto PoS to store transaction data securely. DBForest uses decentralized storage mechanisms, which was critical to ensure no single point of failure or data leakage. I implemented this for tax reporting, allowing merchants to store transaction data in a decentralized and encrypted way. This enabled zkProof-based privacy when reporting financial data.

  6. BlockScout API To monitor on-chain transactions, Crypto PoS makes use of BlockScout’s API. This API listens for confirmed transactions and triggers updates within the PoS system. I had to carefully manage transaction confirmations, balancing real-time updates with the necessary waiting time for finality on different blockchains.

  7. Request Network for Invoicing Request Network was used to streamline the invoicing process for merchants. With its pre-built invoice templates and API integration, Crypto PoS allows merchants to automatically generate and send invoices for completed transactions. This eliminated the need to build a custom invoicing solution from scratch.

  8. Hacky Solutions Several hacky solutions were implemented during the development:

    • NFC Reader Limitations: Due to hardware limitations in some NFC readers, I had to switch to card emulation mode for phones, while writing a custom script to optimize the interaction between the card and reader in terms of speed and range.
    • Compatibility Between ECDSA in Python and Solidity: While signing and verifying transactions, I encountered incompatibilities between the elliptic curve signature algorithms in Python and Solidity. After several failed attempts, I rewrote portions of the Python signature verification script to mirror Solidity’s exact hashing process, ensuring proper verification on both ends.
    • ENS Integration Without React or TypeScript: One unique hurdle was integrating ENS in a raw HTML environment, as opposed to React or TypeScript, which are more common in Web3 projects. I had to manually load the ENS resolver functions into the PoS interface, which involved low-level DOM manipulation and custom web3.js configurations.

Development Workflow

  1. Smart Contract Development: I started with the design of the smart contract, focusing on mapping balances to addresses and developing a challenge-response verification system for transfers.
  2. Backend Setup: Docker was crucial for setting up zkVerify, DBForest, and other components. It allowed for easy environment setup and avoided compatibility issues with my native OS.
  3. Frontend & NFC Integration: The HTML interface for the PoS terminal was built using vanilla JS and web3.js. Integrating NFC communication required building a custom script that communicates with the backend via NFC readers.
  4. Testing: Testing was a key part of the process, involving testnets like Optimism Sepolia and Celo Alfajores to ensure transaction confirmation, zkProof generation, and data storage worked as expected.

Conclusion

Crypto PoS is built from the ground up with decentralized, privacy-focused solutions in mind. The use of NFC technology combined with multi-chain support and zero-knowledge proofs makes it a cutting-edge system for secure, contactless cryptocurrency payments. The project’s modularity also allows it to be easily extended in the future, particularly with the planned custom smartcard and FIAT integration.

background image mobile

Join the mailing list

Get the latest news and updates