Fracada il Primo for Developers

~ripnyt-ripnyt
dcSpark
Published in
4 min readMay 18, 2022

First released as an initial proof of concept in November of 2021 and now expanded with community funding via Project Catalyst, dcSpark is proud to release Fracada il Primo.

Fracada demonstrates the potential of new financial primitives for the Cardano blockchain using Plutus. This article will provide a complete demonstration of a testnet deployment, walking the user through the basic functions of Fracada.

These functions include fractionalizing NFTs, locking additional NFTs into the contract, and redemption via the burning of all fractional tokens. In addition to these features, the contract also utilizes a three-party multi-signature (simulated here in our example since the script has control of all three keys).

At a high level, the basic steps are to use nix-shell in the Fracada il Primo root, install the demo, and run it. Beginning the demo requires a fully synchronized testnet node and your favorite development environment. The demo script will build and interact with the smart contracts using fake NFTs created by the script itself.

Preparation

As mentioned, beyond basic dev tools, you’ll need a fully synchronized cardano-node on testnet, cardano-cli, and nix (ideally configured to use IOHK’s cache). No wallet software is required to test the demo since the script will build it.

Clone and build Fracada il Primo

Obtain Fracada il Primo from dcSpark’s GitHub repository by cloning it locally, and be sure to have nix set up to use IOHK’s cache to save time. Run `nix-shell` in the root of Fracada il Primo to build all dependencies required and open the nix-shell.

The nix package manager replicates the same dependencies used to build Fracada il Primo, minimizing the process of troubleshooting errors. This process can take up to a couple of hours with the IOHK cache and quite longer without it. When complete, your shell will now be a nix-shell and appear as such:

Confirm that the build works by running `cabal test`. All 19 tests should pass, meaning that they validated that the contract and test scenario are in proper working order. Next, we’ll deploy the contract and use it on the Cardano testnet.

Fracada Testnet Deployment Script

The `testnet_demo` script deploys Fracada il Primo to testnet and enables using all of the features that Fracada brings to Cardano. To use the script, navigate to `fracada-il-primo/testnet_demo`, install the small typescript app with `npm install`, and then run with `npm start`.

First, the app checks if the Fracada Plutus script is present and builds it if required. Next, a wallet is generated, and if it has at least 50 tADA, it will prepare the wallet with 2 NFTs and UTXOs for use in the Fracada smart contract.

Now that the wallet is bootstrapped, the script will perform the first demo transaction. NFT A is locked in the contract behind three signatures and mints 100 fractional tokens.

The second demonstration illustrates Fracada’s ability to lock additional assets into the contract, which are subject to the same redemption requirements set forth in the original contract. This is useful for creating a bag of assets which the fractional token holders get exposure to. The new accepted NFTs are only allowed to be added by the three signatures that built the contract, which prevents the contract from accepting random assets.

Lastly, the script will burn the fractional tokens in order to return the locked NFTs in the contract via a transaction which is signed by the three keys.

And just like that, we have seen the core functionality of Fracada Il Primo.

In this basic yet full-featured demonstration of the `testnet_demo` we witnessed:

  • NFTs being locked, thereby minting 100 fractional tokens, showing off fractionalization.
  • A second NFT added to the contract by a multisig majority, displaying how more and more assets can be added, increasing the existing value of the fractional token holders.
  • Finally, all fractional tokens were burned in exchange for the two NFTs previously locked.

This provides a solid stepping stone for the Plutus developer community to learn from and understand how to begin transforming the CNFT landscape into something truly novel. Fracada Il Primo has provided dApp developers a new horizon from which to move forward from, and we are excited to see what the community does next with it.

The development of Fracada il Primo was funded by the Cardano Community and is open source with an MIT license for all to use. The proposal that funded this work can be found here. Fracada Il Primo will be undergoing an audit in the near future, thereby solidifying its usefulness for the developer community.

What will you build with tools from dcSpark?

At dcSpark we grow ecosystems and we’re inviting you to build with us.

--

--