Building up Blockchains: Tezos Proxy Redirect

Smart Contract for Managing User Redirects

Teckhua Chiang
The Cryptonomic Aperiodical
3 min readJul 23, 2019

--

The Tezos Proxy Redirect is an open-source project.

Smart Contracts on the Tezos Blockchain

One of the major innovations of the Tezos blockchain is the ability to easily create formally-verified smart contracts. These secure programs allow users to access the various benefits of the blockchain, including transparency, traceability and trustlessness. Building a comprehensive smart contract ecosystem that provides expansive functionality to its users is imperative to the growth of a thriving Tezos community.

The Tezos Proxy Redirect

Due to the immutable nature of on-chain operations, each time a developer wishes to release an updated contract, a new instance of the contract with a different address has to be deployed to the chain. However, if users were directly referencing the original smart contract and are unaware of the new address, they could continue using the older, unsupported, and potentially buggy release. As a result, users must constantly remain alert for updates while developers must stress over minor logic improvements and efficiency upgrades.

The Tezos Proxy Redirect is a smart contract that serves as an on-chain intermediary between users and executable code. The contract’s storage contains the owner address and a destination address. When users wish to invoke a certain contract, they first check a fixed proxy contract for the address of the latest version. With this system, users can ensure that they are always using up-to-date products.

From the developer standpoint, whenever a new version of a smart contract is deployed, the owner of the proxy contract can update the destination address to point toward the amended smart contract without interruption to service. Thus, the Tezos Proxy Redirect provides peace of mind to both parties.

Technical Highlights

The Tezos Proxy Redirect is written in Liquidity, a high-level fully-typed functional smart contract language that compiles to Michelson.

The storage of the Tezos Proxy Redirect is declared as type storage = { owner : address; destination : address }. It contains the address of the owner and the address of the destination smart contract served by the proxy.

The Tezos Proxy Redirect has one entry point, setDestination, which allows the owner address to change the redirect address.

Here is a sample code block from the setDestination entry point:

ConseilJS Deployment

The Tezos Proxy Redirect can be easily deployed using ConseilJS with TezosNodeWriter.sendContractOriginationOperation(…). By specifying the owner address and destination address in the initial storage argument, this ConseilJS function allows users to create their own personalized instance of the Tezos Proxy Redirect to service their smart contracts.

Below is a sample code block from the ConseilJS smart contract deployment interface for the Tezos Proxy Redirect. For code you can run look at the tutorial on GitHub.

Future Development

The Tezos Proxy Redirect can be used by developers to guarantee that users remain connected with the latest versions of smart contracts. Our upcoming contracts will use this as the publication mechanism.

--

--