https://github.com/primaryobjects/cardano-tutorial
Easy tutorial for developing with the Cardano blockchain. Create a wallet. Send and receive ADA.
https://github.com/primaryobjects/cardano-tutorial
ada blockchain cardano cardano-cli cardano-community cardano-wallet dapp javascript lovelace node-js nodejs tutorial tutorials web3
Last synced: 8 months ago
JSON representation
Easy tutorial for developing with the Cardano blockchain. Create a wallet. Send and receive ADA.
- Host: GitHub
- URL: https://github.com/primaryobjects/cardano-tutorial
- Owner: primaryobjects
- Created: 2024-12-06T18:13:08.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-26T04:21:15.000Z (about 1 year ago)
- Last Synced: 2024-12-26T05:19:23.678Z (about 1 year ago)
- Topics: ada, blockchain, cardano, cardano-cli, cardano-community, cardano-wallet, dapp, javascript, lovelace, node-js, nodejs, tutorial, tutorials, web3
- Language: JavaScript
- Homepage:
- Size: 14.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
Cardano Beginner Tutorial
=========================
An easy [tutorial](https://medium.datadriveninvestor.com/creating-my-first-cardano-wallet-a-journey-into-blockchain-development-6c35d0712617?sk=53e5be550b95c9e369a6eaba12ce8c3f) for developing with the Cardano blockchain. Create a wallet. Send and receive ADA.
## Quick Start
1. Clone the [Plutus](https://github.com/IntersectMBO/plutus-tx-template.git) project to setup the code.
```bash
git clone https://github.com/IntersectMBO/plutus-tx-template.git
```
2. Create a new directory `off-chain` and add required node js modules.
```bash
mkdir off-chain
cd off-chain
npm add @meshsdk/core
npm add cbor
```
3. Create an account on [BlockFrost](https://blockfrost.io/dashboard) to avoid needing to run your own local blockchain node.
4. Create a BlockFrost project named **hello-world** on the **Cardano preview** network.
5. Create a file `.env` with the contents:
```
BlockFrostProjectId=
SenderSecretPathName=keys/seller2.skey
RecipientAddress=
```
*Obtain the Project ID from your BlockFrost dashboard. Create a seller2.skey by running `generate.py`.*
6. Create a local wallet by running the file [generate-keys.mjs](generate-keys.mjs).
```bash
node generate-keys.mjs
```
You should see output similar to the following:
```
Generated key:
generate-keys.mjs:8
Wallet instance created: MeshWallet {_wallet: EmbeddedWallet, _accountIndex: 0, _keyIndex: 0, _fetcher: undefined, _submitter: undefined, …}
generate-keys.mjs:12
Unused addresses: (1) ['']
generate-keys.mjs:16
Generated address: addr_test1
generate-keys.mjs:25
Public key hash:
generate-keys.mjs:29
Creating seller.
generate-keys.mjs:42
Creating bidder1.
generate-keys.mjs:42
Creating bidder2.
```
7. Get free ADA for the new wallet by using the Cardano [Faucet](https://docs.cardano.org/cardano-testnets/tools/faucet/) on **Preview Testnet**. Enter the seller's **Address** from `keys/seller.addr` *(for example, `addr_test1`)*.
You should see output similar to the following:
```
Success
Your transaction has been successful and test funds have been sent to addr_test1.
Please verify the following transaction hash:
```
8. Verify the transaction for receiving ADA at [Cardanoscan](https://preview.cardanoscan.io). Paste in the transaction hash and click on the **UTXO** tab to see the ADA transferred to the wallet. *Return tokens after use to `addr_test1vqeux7xwusdju9dvsj8h7mca9aup2k439kfmwy773xxc2hcu7zy99`.*
9. Send ADA to another wallet by using [send-lovelace.mjs](send-lovelace.mjs). *Note, amount is in **lovelace**, where 1 ADA = 1,000,000 lovelace.*
```bash
node send-lovelace.mjs
```
You should see output similar to the following, which may also be confirmed on [Cardanoscan](https://preview.cardanoscan.io):
```
Ada sent. Recipient: addr_test, Tx hash:
```
10. Verify the transaction for sending ADA at [Cardanoscan](https://preview.cardanoscan.io). Paste in the transaction hash and click on the **UTXO** tab to see the ADA transferred to the wallet. *Return tokens after use to `addr_test1vqeux7xwusdju9dvsj8h7mca9aup2k439kfmwy773xxc2hcu7zy99`.*
11. Check the balance of any of the generated wallets using [balance.mjs](balance.mjs):
```bash
node balance.mjs addr_test1
```
You should see output similar to the following:
```
Assets: {lovelace: '1000000'}
Balance for address addr_test: 1 ADA
```
12. Confirm the wallet balance at [Cardanoscan](https://preview.cardanoscan.io) by entering the wallet address *(instead of a transaction hash)*.
## License
MIT
## Author
Kory Becker
http://primaryobjects.com