Phonon Alpha: Getting Started

Daniel Veenstra
Phonon DAO
Published in
4 min readJan 3, 2022

For those unfamiliar, Phonon is a peer to peer, private, infinitely scalable, and zero transaction fee system for the cash-like transfer of any crypto asset made possible by utilizing hardware enforced security.

With the release of the Phonon Alpha, we’re making available the code to build applications on top of that system, as well as opening it up to the public to give feedback and make contributions.

With the great flexibility of the Phonon design, we envision applications like payments, privacy pools, and crosschain DEXes. And I’m sure that brilliant individuals in the crypto community will come up with novel uses which have yet to be imagined.

Alpha Anatomy

The phonon alpha consists of three parts, the phonon-network specification, the phonon-card applet, and the phonon-client. Together these provide the tools to provision and operate a Phonon applet running on a smart card, along with some key utilities for building applications to interact with Phonon cards.

The phonon-network repo provides an overview of the design of the phonon system, along with a full specification for the interface which a Phonon card must support to function correctly within the network. Reading through these documents is the best place to learn about the concepts underpinning the Phonon design and gain an understanding of how to build on top of it.

The phonon-card repo contains the source code for an implementation of the card specification described in phonon-network.

The phonon-client is the repository likely to be of the most interest to developers looking to build applications on top of Phonon. This repository contains the following components.

(EDIT: light changes made to the below to reflect recent changes)

  • A low level library for directly operating the Phonon card in card/phononCommandSet.go
  • A high level library for operating the card and handling one continuous user session, mainly by managing client side caching of card state in the session package. The orchestrator package goes along with this to manage multiple card sessions and the interactions that go on between them.
  • An (obviously) insecure software implementation of the card spec used for testing in card/mockCard.go
  • Two basic user interface implementations, the cmd package and the repl package, for one off operations and interactive use respectively. These are built off of the session API mentioned above.
  • A basic jump server implementation in the remote package, capable of bridging two remote phonon cards over the internet to complete a phonon transfer
  • A validator package, for validating that a counterparty’s phonons actually correspond to real blockchain assets. Currently contains an implementation for BTC, but provides the interface for validating any arbitrary crypto asset.
  • Utility code, including the cert package for parsing and validation of certificates to prove card provenance, the orchestrator package to manage state for multiple connected cards, the tlv package for encoding and decoding messages exchanged with the phonon card, and the util package, for, you know, utilities.

The best way to get familiar with a Phonon card’s operations is probably to play around in the REPL (Read-Evaluate-Print-Loop) interface. Once you’ve cloned the project you can get it running straight from source with the commandgo run phonon/main.go repl Once there you can execute help to see the full list of available commands.

I’d suggest walking through another of our blog posts, World’s First Phonon Transfer to see the steps required to create and send a phonon. In the REPL, You can use the localCounterParty interface along with pairLocalto connect two cards connected to the same machine or instantiate a mock card with mockto fill in for either or both physical cards. The mocks are by default initialized with a pin of 111111 .

The best API to use for external applications is going be Session, which will allow you to execute operations on the phonon card while caching and exposing its state so that the frontend can provide a friendly user experience while minimizing extraneous card commands.

As a quick disclaimer, it should of course be noted that this is an alpha quality release intended for developers to get started with and is not ready for production use. While the basic functionality of Phonon is all there, it has not yet been thoroughly tested for security and there are sure to be some rough edges to polish off as well as additional features to include. A best effort at backwards compatibility with this alpha will be attempted for future versions, but it is possible that breaking changes may need to be made for the long term improvement of the system.

Additional Resources

In addition to the repositories listed above, we invite you to stop by the Phonon Governance Forum, especially the Technical Discussion Category to ask technical questions and give feedback. Myself and the other engineers are eager to hear from you.

For more general information on phonon and an up to date list of resources check out the site at https://phonon.network/

Links to the source code repositories are included below for convenience.

--

--

Daniel Veenstra
Phonon DAO

Breadth first software engineer interested in data, distributed systems, crypto, and building a better world. @danveens