<p>There are two steps you need to follow in order to create a dApp on Cardano.</p>
<ol>
<li>Create the script itself - the on-chain code</li>
<li>Create the transaction which will make use of that script, ideally make it abstract enough so that any user can interact with you app - this is called the off-chain code</li>
</ol>
<h2>OnChain code</h2>
<p>For step 1, your end goal is to have your script compiled into Plutus-core, whose hex representation you can see <a href="https://github.com/Python-Cardano/pycardano/blob/3527aa4644f892e9e9c9969f6e8012a9b60412a5/examples/plutus/forty_two/fortytwo.plutus" rel="nofollow noreferrer">here</a>, for example.</p>
<p>In order to produce this code, you will probably want some kind of high-level language. You don't write assembly every time you want to create an API, instead you usually write it in C or some language that can be compiled to Assembly.</p>
<p>Currently we have three languages, two of which are still in early stages of development (Aiken and Eopsin):</p>
<ol>
<li>PlutusTx</li>
<li><a href="https://github.com/Hyperion-BT/Helios" rel="nofollow noreferrer">Helios</a></li>
<li><a href="https://aiken-lang.org" rel="nofollow noreferrer">Aiken</a></li>
<li><a href="https://github.com/ImperatorLang/eopsin" rel="nofollow noreferrer">Eopsin</a></li>
</ol>
<p>If you are doing the Plutus Pioneers Program, you probably learned PlutusTx. The advantage of PlutusTx is that it was developed by IOG so it will probably always have the most up-to-date code. In the sense that if we have a new feature added to Cardano (like reference inputs were recently), they will most likely be the first to have it implemented.</p>
<p>In the other hand, as you might have found out already, it is a language extremely difficult to understand, develop and test and I still occasionally scream in my sleep when I remember nix-shell and cabal.</p>
<p>Worst of all, it was not very well-designed in the sense that all other languages mentioned above have significant performance and script size improvements (50% above).</p>
<p>So, honestly, I would suggest you to rewrite whatever script you made using PlutusTx in another language (they are quite easy to understand), because it will keep you from turning mad in the long term.</p>
<p>I have used Helios before and it was very easy to use. You can take <a href="https://github.com/Et9797/vesting-example-helios/tree/main/contract" rel="nofollow noreferrer">this repository</a> as a guide to write and compile the script. I think Aiken will be better in the future, but I have not tried it yet and it is very likely to have bugs since it's earlier in its development phase than Helios.</p>
<h2>OffChain code</h2>
<p>Finally, for your off-chain code, you will need to create two transactions. The first is the one which sends some amount of tokens to the script with a specific datum and the second is the one which will try to spend that script, providing some redeemer.</p>
<p>Every dApp in Cardano needs to revolve around those two types of transaction. Some more complex ones, however, might mix both types by spending a script and sending some tokens back to that script with a new datum.</p>
<p>The theory behind it is out of scope, but there are currently multiple libraries which you can use to build this off-chain code. Some of which are the following:</p>
<ol>
<li><a href="https://github.com/spacebudz/lucid" rel="nofollow noreferrer">Lucid</a></li>
<li><a href="https://github.com/Python-Cardano/pycardano/tree/main" rel="nofollow noreferrer">PyCardano</a></li>
<li><a href="https://meshjs.dev" rel="nofollow noreferrer">Mesh</a></li>
</ol>
<p>Each one is well documented and have their own guides and examples, my advice you would be to use Lucid. PyCardano is great and I have personally used it even more often than lucid, but it builds the transactions in the back-end so you will still need to create a client interface to sign it and submit it. It can be good, however, if you simply want to see your script in the chain and want to test it quickly and easily.</p>

CC BY-SA 4.0
2023-01-24T13:25:43.647Z
Really? Can i make the smart contract using Helios. Like I did certain RnD on cardano smart contracts, and the only thing i get to know that cardano only supports haskell and plutus, which is truly a language giving you headache. So point is, can i really make any smart contracts like staking etc with helios??
duaa azhar
CC BY-SA 4.0
2023-01-24T15:10:45.150Z
@duaaazhar Yes and there are examples of it already deployed on-chain, I made some my self
Mateus
CC BY-SA 4.0
2023-01-24T17:55:40.983Z
@duaaazhar But take a look at Aiken, it looks really easy to use, just maybe not ready for production yet https://aiken-lang.org/getting-started/hello-world
Mateus
CC BY-SA 4.0
2023-01-25T11:08:10.690Z
Yah Aiken is seeming bit easy to understand but i also have to go for production environment, so i think i should take start with a mature language like helios right?
duaa azhar
CC BY-SA 4.0
2023-02-09T00:59:52.897Z
I’m a huge Helios fan, so much so I wrote a book on it https://www.amazon.com/Cardano-Smart-Contracts-Helios-Lawrence-ebook/dp/B0BTBK6YM7/

I’ve also released an open source repo of examples from the book as well.

https://github.com/lley154/helios-examples

I also share similar nightmares of nix-shell/cabal hell….thank God I don’t have to do that anymore.
lley154
CC BY-SA 4.0
2023-02-09T01:04:24.360Z
Forgot to mention, not only can you use Helios for on-chain smart contracts, it also has excellent libraries off-chain for Tx building as well.
lley154
CC BY-SA 4.0
2023-01-24T12:09:12.863Z
2023-01-24T12:09:12.863Z
Mateus
<p>I am following Plutus-pioneer-program to learn smart contract development in Cardano. I have tried the onchain and offchain code, compiled and tested in Plutus playground and also in emulator trace. Now i want to know how can i use these smart contracts and deploy on blockchain. Some of the methods which i know are</p>
<ol>
<li>By Cardano-cli, but I think it will be having a lot of .sh commands which is not easy to code every time.</li>
<li>By PAB, I tried to run PAB along with cardano-node, chain-index, plutus-pab-examples. But it's quite hectic to wait for days for their syncing. Also I was not able to proceed PAB as the process got killed due to out of memory.</li>
<li>By Alonzo testnet, I am also trying alonzo testnet tutorial, but its full of dependency errors. Also I don't know</li>
</ol>
<p>Now I need to clear up my mind by having some clear steps of the smart contract compilation, testing, deployment and interaction. How can we do these all with the most recommended and practical way.</p>
<p>Also I need the tutorial/guidance to do deployment of smart contract on Cardano testnet, other than these or with the suitable and most used way.</p>
<p>I have explored many more stuff on Cardano, but I think everything has got quite messed up due to lack of proper guidance on that. Please guide we with a recommendable way and a proper flow of how to do all these stuff.</p>

<plutus><plutus-pioneer-program><cardano-cli><smart-contract><haskell>
How to deploy the Plutus smart contract
# How to deploy the Plutus smart contract

(Asked by: username_0 on 2023-01-24)

I am following Plutus-pioneer-program to learn smart contract development in Cardano. I have tried the onchain and offchain code, compiled and tested in Plutus playground and also in emulator trace. Now i want to know how can i use these smart contracts and deploy on blockchain. Some of the methods which i know are

1. By Cardano-cli, but I think it will be having a lot of .sh commands which is not easy to code every time.
2. By PAB, I tried to run PAB along with cardano-node, chain-index, plutus-pab-examples. But it's quite hectic to wait for days for their syncing. Also I was not able to proceed PAB as the process got killed due to out of memory.
3. By Alonzo testnet, I am also trying alonzo testnet tutorial, but its full of dependency errors. Also I don't know

Now I need to clear up my mind by having some clear steps of the smart contract compilation, testing, deployment and interaction. How can we do these all with the most recommended and practical way.

Also I need the tutorial/guidance to do deployment of smart contract on Cardano testnet, other than these or with the suitable and most used way.

I have explored many more stuff on Cardano, but I think everything has got quite messed up due to lack of proper guidance on that. Please guide we with a recommendable way and a proper flow of how to do all these stuff.

**Tags:** plutus, plutus-pioneer-program, cardano-cli, smart-contract, haskell

---

## 1 answers

### Answer by username_1 on 2023-01-24. Score: 4

There are two steps you need to follow in order to create a dApp on Cardano.

1. Create the script itself - the on-chain code
2. Create the transaction which will make use of that script, ideally make it abstract enough so that any user can interact with you app - this is called the off-chain code

## OnChain code

For step 1, your end goal is to have your script compiled into Plutus-core, whose hex representation you can see [here](https://github.com/Python-Cardano/pycardano/blob/3527aa4644f892e9e9c9969f6e8012a9b60412a5/examples/plutus/forty_two/fortytwo.plutus), for example.

In order to produce this code, you will probably want some kind of high-level language. You don't write assembly every time you want to create an API, instead you usually write it in C or some language that can be compiled to Assembly.

Currently we have three languages, two of which are still in early stages of development (Aiken and Eopsin):

1. PlutusTx
2. [Helios](https://github.com/Hyperion-BT/Helios)
3. [Aiken](https://aiken-lang.org)
4. [Eopsin](https://github.com/ImperatorLang/eopsin)

If you are doing the Plutus Pioneers Program, you probably learned PlutusTx. The advantage of PlutusTx is that it was developed by IOG so it will probably always have the most up-to-date code. In the sense that if we have a new feature added to Cardano (like reference inputs were recently), they will most likely be the first to have it implemented.

In the other hand, as you might have found out already, it is a language extremely difficult to understand, develop and test and I still occasionally scream in my sleep when I remember nix-shell and cabal.

Worst of all, it was not very well-designed in the sense that all other languages mentioned above have significant performance and script size improvements (50% above).

So, honestly, I would suggest you to rewrite whatever script you made using PlutusTx in another language (they are quite easy to understand), because it will keep you from turning mad in the long term.

I have used Helios before and it was very easy to use. You can take [this repository](https://github.com/Et9797/vesting-example-helios/tree/main/contract) as a guide to write and compile the script. I think Aiken will be better in the future, but I have not tried it yet and it is very likely to have bugs since it's earlier in its development phase than Helios.

## OffChain code

Finally, for your off-chain code, you will need to create two transactions. The first is the one which sends some amount of tokens to the script with a specific datum and the second is the one which will try to spend that script, providing some redeemer.

Every dApp in Cardano needs to revolve around those two types of transaction. Some more complex ones, however, might mix both types by spending a script and sending some tokens back to that script with a new datum.

The theory behind it is out of scope, but there are currently multiple libraries which you can use to build this off-chain code. Some of which are the following:

1. [Lucid](https://github.com/spacebudz/lucid)
2. [PyCardano](https://github.com/Python-Cardano/pycardano/tree/main)
3. [Mesh](https://meshjs.dev)

Each one is well documented and have their own guides and examples, my advice you would be to use Lucid. PyCardano is great and I have personally used it even more often than lucid, but it builds the transactions in the back-end so you will still need to create a client interface to sign it and submit it. It can be good, however, if you simply want to see your script in the chain and want to test it quickly and easily.

> **Comments:**
> **username_0**: Really? Can i make the smart contract using Helios. Like I did certain RnD on cardano smart contracts, and the only thing i get to know that cardano only supports haskell and plutus, which is truly a language giving you headache. So point is, can i really make any smart contracts like staking etc with helios??  
> **username_1**: @duaaazhar Yes and there are examples of it already deployed on-chain, I made some my self  
> **username_1**: @duaaazhar But take a look at Aiken, it looks really easy to use, just maybe not ready for production yet https://aiken-lang.org/getting-started/hello-world  
> **username_0**: Yah Aiken is seeming bit easy to understand but i also have to go for production environment, so i think i should take start with a mature language like helios right?  
> **username_2**: I’m a huge Helios fan, so much so I wrote a book on it https://www.amazon.com/Cardano-Smart-Contracts-Helios-Lawrence-ebook/dp/B0BTBK6YM7/  I’ve also released an open source repo of examples from the book as well.  https://github.com/lley154/helios-examples  I also share similar nightmares of nix-shell/cabal hell….thank God I don’t have to do that anymore.  
> **username_2**: Forgot to mention, not only can you use Helios for on-chain smart contracts, it also has excellent libraries off-chain for Tx building as well.  

---

