Summiz Post

Have a startup idea? Then get your MVP ready - Fast! (Part 2)

Daml

Thumbnail image for Have a startup idea? Then get your MVP ready - Fast! (Part 2)
Post

Quickly build and deploy an MVP for your startup idea using Demel's smart contracts and tools for seamless asset management.


You can also read:


Rapid MVP Development with Demel and Project De Belem

Demel is revolutionizing rapid application development by focusing solely on business logic, allowing for a functioning demo in just hours. Project De Belem takes care of the infrastructural complexities, managing servers, load balancing, and performance automatically.

APIs are generated automatically from Demel smart contract code, addressing security and authentication concerns seamlessly. The asset management application offers user-specific data visibility and functionality for fetching and transferring assets, with future enhancements planned for fungible assets and asset splitting and merging.

Demel simplifies authorization for asset actions, ensuring ownership verification for operations like giving, splitting, and merging. Archived contracts are non-operational, which boosts developer productivity by preventing redundant operations.

The demo model allows for quick asset creation and user invitations, with functionality for transferring ownership. The open-source demo UI template, written in React, is reusable, facilitating public-facing application launches.

Smart contracts in Demel are portable across different ledgers, supporting deployment on various infrastructures. Project De Belem supports both prototyping and live deployment of blockchain applications while maintaining code portability.

For people who are new to the smart contract world, contracts, as you saw, are just another word for writing classes and objects.

From Concept to Live Demo in Hours

The session kicks off with a bold promise: taking an application from concept to live demo in just a few hours. The focus is on using the Demel smart contract language, which allows developers to concentrate solely on business logic, skipping the usual infrastructure headaches. As they put it, "Demel... allows you to only focus on the business logic and not on all of the scaffolding."

Project De Belem, a cloud-based environment, handles all the backend complexities—servers, load balancing, performance—so developers don’t have to. It even automatically exposes APIs from the Demel smart contract code, making it easier to integrate with front-end applications. No need to worry about security or authentication either; Project De Belem takes care of that too.

Dimitri then jumps into a live coding demo, showing off a simple asset management app. The app is open-source and available on GitHub, so anyone can grab it and start building. After logging in with his Project De Belem account, Dimitri demonstrates how the app lists assets like a TV, car, and laptop, all represented as Demel contracts. Each asset has an issuer and an owner, both identified by party IDs.

To show the app’s functionality, Dimitri invites his friend Manish and transfers ownership of a car. The process is seamless, highlighting how quickly you can go from idea to a working, live application.

Extending the App: Fungible Assets and Permissions

Dimitri continues the demo by transferring a car and a television to Manish, showing how the app handles asset ownership changes. "I have a television and a car from Dmitri," Manish says, before returning them to Dimitri. The app ensures that even though Dimitri is the creator, he can't access Manish's data without permission: "I still can't see things that I'm not permissioned to see."

Next, Dimitri outlines plans to extend the app to handle fungible assets. This means adding quantities to assets, allowing users to split and merge them. "We're going to extend it to add some quantities... to split an asset into smaller parts and merge them back."

The app is open-source, licensed under Apache 2, and available for anyone to use. Dimitri then walks through creating a new project, setting up the environment, and modifying the asset structure to include quantities. "I'm going to add an amount... and use DAML's precondition to ensure the amount always remains positive."

Merging Assets and Simplifying Authorization

Dimitri explains how to merge two assets, ensuring they share the same owner, issuer, and name. "I can't be merging apples with oranges or I can't be merging dollars that I own with dollars that Manish owns." Before merging, the app checks that the owner and name of both assets match. Once verified, the old asset is archived, and a new one is created with the combined amount. "We need to archive the contract that we're bringing in... and create a new one with the amount being equal to the existing amount plus any other assets."

DAML simplifies authorization by automatically handling it. "The owner is the only party who can give and split," and developers don't need to manually check permissions. This keeps the code concise—just 35-40 lines to handle asset creation, authorization, and actions like splitting and merging. "Within 35 or 40 lines of code... you've automatically given the ability for the owner to give the asset to another owner, split the assets, merge the asset."

Next, Dimitri moves to Project Dabble to create a ledger and UI for the new model, followed by a smoke test. "I'm going to go to Project Dabble and start creating a ledger... and smoke test this demo model."

Creating a Ledger and Testing Asset Functionality

Dimitri creates a new ledger, noting that it takes a few minutes for the infrastructure to spin up. While waiting, he smoke tests the application using the demo start command. "I will spin up a local development user interface for me to test my model." The demo compiles into a dar file, and a sandbox is launched locally, along with the front-end tool, Navigator.

He logs in as Alice and creates an asset. "Let's make this United States and we're going to use thousand." After submitting, the asset appears, and he tests the split functionality. "I do see that I have two contracts... the thousand dollars have been archived and now I do have three hundred and seven hundred."

Next, he tests the merge functionality. "I want to invoke merge... I see the archive, the 300 and 700 have been archived and the only one I have is a single one." DAML automatically archives contracts after operations, preventing further actions on the same contract. "You cannot operate on a contract twice... because the contract is automatically archived."

Finally, Dimitri clones the UI template and renames the boilerplate code to match his project. "I'm going to clone this repo... and rename some of the boilerplate code given that my project name is called meet up."

Building and Deploying Assets

Dimitri starts by incorporating logic for two new choices on the report page. He adds the choices and renames fields, changing "give" to "split" and adjusting the amount field. "I had two more choices for the choices I added as well as the amount field."

Next, he explains how to generate TypeScript components from the demo model. "We generate TypeScript components all from your demo model." If the model is custom, users can run a code generator to create the necessary assets. "You could run the code generator... it's going to create those TypeScript assets for you."

After compiling the demo, Dimitri generates the assets and packages them for deployment. "My demo is compiled... it generates those TypeScript assets." He then zips the build folder and prepares it for upload. "What I need to do right now is to package them up and then drag and drop them in my ledger."

Finally, Dimitri uploads the assets to the ledger and verifies their success. "I see that I get two success notifications for my dart file and my zip file." The assets are now ready, and the ledger is set up for further use.

Publishing and Testing the MVP

Dimitri starts by publishing the UI assets. "I haven't published it under my site, so I'm gonna go ahead and do that... I confirm, and now I should see that my assets have moved into the published state." After publishing, he opens the app in a new tab and logs in. The app is empty, but the amount field and split/merge choices are visible.

He creates an asset by issuing $1,000 in US dollars. "I'm going to issue a thousand dollars... I see that a thousand of US dollars showed up here." Next, he tests the split functionality, dividing the amount into $300 and $700. "Let's test the split... 300 and 700 split." He further splits the $300 into $100 and $200, then merges the $100 with the $700. "Let me test my merge functionality... I have a 200 and 800 split."

Dimitri invites Manish to the app and transfers $200 to him. "I'm going to transfer you... the owner has changed here to Manish." Manish then splits the $200 and returns $100 to Dimitri. "I'm going to give him back $100... I do indeed own $100, and the other $100 are owned by Manish."

Finally, Dimitri shows the API documentation and login functionality for further customization. "If you could show them on the docs the APIs that the ledger exposes automatically... and also the login with Dabble button."

Onboarding and Portability

Onboarding users is straightforward with the "login with Dabble button." It’s easy to integrate into any front-end application, redirecting users to a login link and passing in the ledger key. Developers can also use the simple APIs exposed by Dabble to write their own UI and host it on Project SS.

One of the standout features of Daml is its portability. Once you've written your application, it’s "completely portable across a variety of ledgers." Whether you want to deploy on VMware's blockchain, Corda, or even Amazon's QLDB, your code remains intact. The only requirement is to follow the "party provisioning and user provisioning guidelines" of the new ledger. Project Dabble offers a way to go live, but if you need to switch infrastructures, your application is ready to move.

Conclusion

Demel and Project De Belem streamline blockchain application development, enhancing speed, security, and usability while maintaining code portability.


Want to get your own summary?