You Don't Need the PAB: Start Building Today
There is a misconception in the Cardanosphere that the Plutus Application Backend (PAB) is required to build dApps.
It is true that building dApps on Cardano is difficult. It is novel technology with many pitfalls. The ecosystem to support smart contracts is still being developed, but PAB is not necessary, nor is it clear that it will be helpful for all users.
As it stands right now, dApps can be built by leveraging, Plutus, Blockfrost, cardano-serialization-lib and Nami. These four technologies are sufficient to make dApps on Cardano.
Getting into the Weeds of Off-Chain Code
You'll often hear Plutus developers talk about on-chain and off-chain code.
On-chain code refers to the Plutus smart contracts. It is the easiest in some sense to understand because there is only one option: Plutus.
However, there are numerous ways to create off-chain code. So what is off-chain code?
Off-chain code refers to any code used to create and submit transactions using smart contracts as inputs or outputs.
Creating a transaction typically involves UTxO and coin selection from a user's wallet. You can query for UTxOs with `cardano-cli query utxo` or you can use an API like Blockfrost. There are many options for querying the blockchain, you just need to find one that supports your environment and is convenient.
Once you have all the inputs, you need a transaction builder to make the CBOR to sign and submit.
Right now, there are few ways to create transactions. You can use `cardano-cli`, `cardano-serialization-lib`, or `cardano-wallet`, to generate the transaction CBOR to submit to a node.
One issue is that these libraries are not necessarily compatible with each other. You cannot create a transaction body with `cardano-cli` and a witness set with `cardano-serialization-lib`. There are several issues in the `cardano-serialization-lib` that explain why this is, here is one: https://github.com/Emurgo/cardano-serialization-lib/issues/259.
Another important issue to be aware of: the script bytes generated by the `cardano-cli` cannot be used directly in `cardano-serialization-lib`. You have to remove the first 6 characters, e.g. the first three bytes, otherwise you will get an integrity check error when submitting the transaction.
There are so many little issues like this, it is hard to list them all. The trick to getting past them is to become comfortable with the cbor cddl and learning how to use `cardano-cli text-view decode-cbor` to read and understand a transaction's CBOR.
The final piece is Nami, which is the only wallet that supports noncustodial purchasing (although Yoroi's nightly has dApp connector support), e.g. mutlisig and smart contracts.
The Nami API is very simple, I don't have much to add here other than ... use it.
The Grass is Always Greener
After listing all these random issues, you might think "this is terrible, I'll just use the PAB". However the PAB doesn't solve the dApp connector problem, which means you will still have to use `cardano-serialization-lib` and Nami to sign the transaction.
Right now, if you want to actually release a dApp, you just have to embrace the suck, learn about these technologies and workaround these issues.
Once you do it once, and understand the technology, it's fine.
No one should be waiting for the PAB. If you want to make a dApp on Cardano, do it now.
As always, if you would like to move faster and not have to learn these and other painful lessons yourself, contact us.