Easily Calling Arbitrary Smart Contract Functions on Ethereum Part 1 - The Why?
Although the vision around bringing real assets onto the blockchain picks up increased interest, the technical implementations, however, are still in their infancy. Upvest aims to enable organizations seeking to bring real assets to the blockchain by providing the essential building blocks to simplify the process from start to finish, enabling an end-to-end customer journey. In a common asset tokenization process, the following core tasks need to be performed:
A critical section of the above workflow is the whitelisting of investor account addresses and the distribution of tokens, which was largely a manual process up until now. Upvest recently released a “complex” transaction (CxTx) API endpoint. Using CxTx, this previously manual process can now be fully automated. This endpoint allows any application to execute any smart contract function on the Ethereum blockchain.
In Part 1 of this blog series, we’ll explain why we developed the CxTx endpoint, the benefits that come with using it, in conjunction with a practical use case for a fairly standard token sale: address whitelisting and token distribution.
A Whitelisting & Token Distribution Workflow
The ‘ownership’ of tokens is a state that is maintained within the on-chain smart contract for that token, and it is common to whitelist which addresses are permitted to hold those tokens (and occasionally the amount thereof) at a given point in time. The whitelisting and distribution process can be summarised with the following workflow:
- Upvest’s customer (hereby referred to simply as “customer”) formulates a prospectus for the real estate asset, the security token offering & retrieves legal authorization (within their jurisdiction) to mint security tokens compatible with ERC-20 (or any other ERC) token standard.
- Upvest provides compatibility with ERC-20. The ERC-20 standard is a fungible token standard but any standard can be used with CxTx in essence, as long as it's in regulatory compliance.
- Real estate assets are then tokenized on the Ethereum blockchain by the customer. Once minted, the tokens are now ready to be distributed to investors (whitelisted Ethereum addresses).
- Potential investors register and sign up on the customer’s platform with a username and password (and other security features the customer’s platform enables like 2FA etc).
- KYC data of the investor (end-user) owning the wallet, is kept on file with the customer issuing the security tokens, in line with regulatory requirements. Once the KYC/AML passes, these wallets can be created using the Upvest create wallet APIs.
- Upon successful registration and KYC, an Ethereum wallet is automatically created via the Upvest APIs.
- Using the Upvest APIs, end users (the customer’s clients) are able to manage their digital assets with a username and password, abstracting the complexity of storing private keys and or remembering seed phrases. In the background, private keys are securely stored in the cloud (with the help of Hardware) and all operations involving private keys are performed within the Upvest Enclave.
- CxTx then allows you to whitelist all the investor’s Ethereum addresses to receive tokens (one-by-one in interaction with a smart contract, but in a finite loop).
- As a next step, the tokens are now distributed to the addresses of the whitelisted investors using CxTx.
- After the successful distribution, Upvest Webhooks allow the customer to receive information on token transfer events, to and from investor wallets.
- Eventually, a secondary market can be opened up for the trading of these particular security tokens in accordance with the issuer’s needs and regulations.
Reduced costs associated with Compliance, Regulations & Custody
Customers using the CxTx are able to define and call custom smart contracts functionalities, based on the predefined level of control legally bound by their prospectus (for an asset they want to tokenize). Leveraging Ethereum is thereby a medium of a permanent record that adds value, as this data itself does not have to be maintained by the customer platform. The customer’s client is able to hold the assets in self custody if so required, which brings down costs of traditional custodians (banks). As a consequence, neither Upvest nor Upvest’s customers (tokenizing the real estate assets) are able to initiate transactions without the involvement of the end user who holds the wallet.
Upvest also provides functionality to completely offboard the customer’s end-users in the future, if need be. This greatly eases the effort on the customer’s end, when compared to the necessity of maintaining a paper trail of the assets and a digital representation of the same, both of which are required to be maintained by law. CxTx further adds benefits, such as the transaction is broadcasted by Upvest and funding of the transaction (Gas) fees is internally managed, which means a signing wallet is not required to have Ether in it. In addition, Upvest is also able to track this transaction from broadcast to confirmation (or failure) and report accordingly.
Moreover, smart contracts automatically enforce regulations concerning these securities. Thus freeing up the customer platform from having to ensure that every investor abides by these regulations. In essence, the Ethereum wallet generated by Upvest is owned by an accredited investor (with a given address). The investor has an amount of security tokens representing ownership of the real estate assets at a particular location, at this particular time (or block height), in this wallet. This can also be referred to as a “snapshot”. The snapshot then gives the customer an idea of the assets held by the individual investor at any given time in the present and the past to calculate payouts or dividends.
This process also does not include storing KYC/AML data (except on the customer’s platform), and any personally identifiable information (PII), on the Ethereum blockchain, thereby complying with GDPR (General Data Protection Regulations). These added benefits help in bringing down overall costs by up to 80%, compared to traditional processes involved for retail investment in real estate.
An Initial Solution: General Purpose Signing
Previously, anyone who would have liked to call a smart contract function could in principle also have done the same with the assistance of the Upvest’s General Purpose Signing Interface. The lowest level of Ethereum functionality is made accessible via the Upvest GPSI. Hence GPSI is the most versatile in function since it can be used to sign any arbitrary binary payload. However, it is also the most involved on the customer’s end, requiring basic knowledge of public-key cryptography and adherence to Ethereum standards (EIP-155). The following customer workflow could have been used, in principle, with GPSI to comply with the above use case:
- Register for webhook callbacks with the Upvest platform
- Assemble the binary representation of the transaction
- Hash the resulting transaction
- Call the Upvest GPSI endpoint to sign the hash of the transaction with the desired wallet’s private key
- Incorporate the newly generated signature into the transaction
- Broadcast the signed transaction to the Ethereum blockchain
- Wait for the transaction to get mined into a block (confirmation) and receive callbacks from the Upvest platform
- Confirm the transaction as valid
The process, in summary, boils down to quite a very quirky request format for an Upvest customer that would just like to call a smart contract function in the easiest way possible. CxTx, however, has been implemented with a flexible interface and an end-user workflow, so that any company, leveraging the Ethereum blockchain can call smart contract functions using it. To explain how this is done, we are discussing CxTx in detail with a code example in Part 2 of this blog.
If Part 1 of this series resonated with you, sign up for a free account, browse our documentation, and start experimenting with the Upvest API. In Part 2, you can learn more about how to use the CxTx endpoint with a code example. Then in Part 3, we will discuss the future developments for the CxTx endpoint.
Any questions? Send us a tweet, or join our Discord channel to engage with the Upvest developer community. Keep up-to-date with Upvest developments here.