Welcome to the inaugural engineering article on the Prism blog! As Lead Architect and Engineer of Prism, I hope to share my unique perspective on the engineering decisions that have gone into the platform and how it leverages the novel possibilities of decentralized smart contracts.
In this introductory post, I will provide a high-level explanation of how Prisms come to live on the Ethereum network. This will serve as a helpful foundation for understanding how Prism works regardless of your technical knowledge. For those with some technical understanding of Ethereum, this should fit in nicely with your existing knowledge and orient you towards future articles that go into more depth.
So what is a Prism? If you didn’t get it from the Prism announcement, a Prism is a custom-built portfolio of digital assets (aka cryptocurrencies). You do not have access to the actual digital assets, but rather the value of the portfolio reflects the price movements of the underlying assets; the economic effect is similar as owning the assets themselves.
For example, let’s say you wanted exposure to a wide range of Ethereum-based tokens, along with Ether itself. You could create a Prism split evenly between ETH, Augur (REP), Golem (GNT), and Gnosis (GNO). You then send in your collateral to fund this Prism. Assuming you deposited $1000 as your collateral, you’d have exposure to $250 of ETH, REP, GNT, and GNO.
You can sell your portfolio at any time, starting 24 hours after creation. You can also “rebalance” the portfolio, adjusting the individual percentages of each of the coins in order to adapt to market conditions or changing risk profiles.
Unlike a centralized exchange, where your funds are completely under the control of a single company—a company that can misuse funds, can be hacked, etc—Prisms are smart contracts on the Ethereum network where they dutifully respond to requests exactly as written in their source code. A Prism cannot refuse to return your money. You cannot get locked out of your Prism. In fact, other than extreme cases of a portfolio value going to 0 or maxing out 100% profits, only you, the buyer, can sell the Prism. This control is held in the private Ethereum key of the address that was used to buy the Prism. Public key encryption ensures that you have sole authorization to rebalance or settle your Prism even when the public address is openly available and auditable on the public Ethereum network.
In other words, discretion over what happens to the value of your portfolio is dictated by code, not decided by people. So long as the contract code is written correctly, it is impossible for anyone but you to access the funds held in your Prism portfolio. This represents a significant advancement in the state of the art for financial software, and demonstrates the power of open blockchain technology.
So that explains the unique, decentralized nature of Prisms. But how do they come into existence and what is happening under the hood? Here are the basic steps that describe the creation of a Prism.
You choose the assets and percentages you want to make up your Prism through the easy-to-use interface on prism.exchange and provide the Ethereum address from which you will fund your Prism. This part happens “off-chain”—it does not yet require any secured activity on the Ethereum network since you are just designing your portfolio and making a request.
ShapeShift deploys a new Prism smart contract to the Ethereum network with all of the specifications that you provided in step #1. Importantly, ShapeShift specifies you as the buyer (identifying you by the Ethereum key you provided), relinquishing its own control of the Prism. The Prism is now in an “Open” state, meaning it is fully created and ready to accept funds.
You send the requisite funds (the value of your Prism plus the creation fee) from your specified address to the address of the Prism. You can do this with any Ethereum wallet that supports custom gas amounts, as additional gas is required to run the initialization logic. When you send Ether on the Ethereum network, it does not have to just be a value transfer. It can also trigger functionality on smart contracts. Prism was designed to detect sent funds and trigger functionality that acknowledges that you have fully funded your Prism. (Also note that all of the details of the Prism can be reviewed before ever sending any Ether. This ensures that you are only getting the exact portfolio that you designed.)
ShapeShift gets a notification that you have funded the Prism and then sends its own funds which provide the other side of the collateral (needed if the value of the Prism goes up, which the buyer hopes it will). If ShapeShift for some reason did not send funds, the smart contract allows you to withdraw your funds at any time. As a dapp engineer, you have to think of all the edge cases to ensure the expected trust behavior!
Having received funds from both the buyer and the seller (ShapeShift), the Prism smart contract enters the “Accepted” state. This locks in the funds and grants you, the buyer, exclusive control over when to rebalance or settle (sell).
Watch your Prism value fluctuate based on market prices, and sell whenever the time is right! ShapeShift will take a closing fee of 2.4% (except during the current closed beta) and the value of your portfolio in Ether will be immediately sent to your original address. Amazingly, you can still sell your portfolio even if prism.exchange were to become unavailable or closed down—your Prism is permanently part of the Ethereum blockchain and responds only to your buyer address. All of the funds are held securely in the smart contract and will be released when sold.
In summary, a Prism comes into being through the deployment of smart contract code on the public Ethereum blockchain and is activated through funds sent from the buyer and seller. The main takeaway is that at each step, trust is shifted from the counterparty to the smart contract. At no point do you have to trust ShapeShift with your funds. When you know the address of the created Prism to send your funds, you have all the information you need to confirm that the Prism will behave exactly as designed. In the future, third-party tools can be created to validate these Prisms independently from ShapeShift. By taking the role of seller and providing the collateral to cover price movements, ShapeShift earns a small recurring commission and a final closing percentage. The design and control of the portfolio itself is left completely to the buyer.
I hope this article served as a clarifying technical introduction to how a Prism is created on the Ethereum blockchain. We have put a ton of effort into creating a product that leverages the benefits of decentralization, enabling increased transparency and security, and removing custodial risk which is a hallmark of ShapeShift’s product philosophy.
Stay tuned to this blog to read future insights into the design and architecture of the Prism trustless portfolio exchange!
Raine Revere is a cryptocurrency engineer specializing in Ethereum smart contract development. Raine works as a developer, teacher, and counselor, integrating technical knowledge with deep training in contemplative psychology and spirituality.