Skip to content

Commit 1677712

Browse files
smart contract student crud operation
1 parent d175fa1 commit 1677712

File tree

12 files changed

+8526
-24
lines changed

12 files changed

+8526
-24
lines changed

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
INFURA_KEY="xxxxxx"
2+
PRIVATE_KEY=""
3+
ACCOUNT= "xxxxxxxxx"

.gitignore

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
1+
build/
2+
3+
# Created by https://www.toptal.com/developers/gitignore/api/node,macos
4+
# Edit at https://www.toptal.com/developers/gitignore?templates=node,macos
5+
6+
### macOS ###
7+
# General
8+
.DS_Store
9+
.AppleDouble
10+
.LSOverride
11+
12+
# Icon must end with two \r
13+
Icon
14+
15+
# Thumbnails
16+
._*
17+
18+
# Files that might appear in the root of a volume
19+
.DocumentRevisions-V100
20+
.fseventsd
21+
.Spotlight-V100
22+
.TemporaryItems
23+
.Trashes
24+
.VolumeIcon.icns
25+
.com.apple.timemachine.donotpresent
26+
27+
# Directories potentially created on remote AFP share
28+
.AppleDB
29+
.AppleDesktop
30+
Network Trash Folder
31+
Temporary Items
32+
.apdisk
33+
34+
### macOS Patch ###
35+
# iCloud generated files
36+
*.icloud
37+
38+
### Node ###
139
# Logs
240
logs
341
*.log
@@ -102,7 +140,9 @@ dist
102140

103141
# vuepress v2.x temp and cache directory
104142
.temp
105-
.cache
143+
144+
# Docusaurus cache and generated files
145+
.docusaurus
106146

107147
# Serverless directories
108148
.serverless/
@@ -125,3 +165,14 @@ dist
125165
.yarn/build-state.yml
126166
.yarn/install-state.gz
127167
.pnp.*
168+
169+
### Node Patch ###
170+
# Serverless Webpack directories
171+
.webpack/
172+
173+
# Optional stylelint cache
174+
175+
# SvelteKit build / generate output
176+
.svelte-kit
177+
178+
# End of https://www.toptal.com/developers/gitignore/api/node,macos

.npmignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
src
2+
tsconfig.json
3+
tslint.json
4+
.prettierrc

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"printWidth": 120,
3+
"trailingComma": "all",
4+
"singleQuote": true
5+
}

LICENSE

Lines changed: 0 additions & 21 deletions
This file was deleted.

README.md

Lines changed: 95 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,95 @@
1-
# simple-Dapp-typescript
2-
This is a basic CURD decentralized application in typescript
1+
# Dapp in typescript
2+
**A Create Your First dAPP On ethereum**
3+
4+
#### AUTHOR:
5+
6+
- [Vinod](https://github.com/vinodnextcoder "vinods's github profile")
7+
8+
#### DESCRIPTION:
9+
This repository contains a source code to create simple CURD application and smart contract code.
10+
11+
12+
#### Setup
13+
- Follow this [Article](https://cmjagtap.medium.com/create-your-first-dapp-on-ethereum-6eb50b4083f2) to create a decentralized application.
14+
15+
# Introduction
16+
```ts
17+
In this article, we are going to build a simple CRUD decentralized application on theEthereum blockchain. Also will create a CRUD smart contract for the sameapplications. This is a practical hands-on article.
18+
19+
Details process https://medium.com/geekculture/create-your-first-dapp-on-ethereum-6eb50b4083f2
20+
21+
- 1.Basic understanding of solidity or general programming.
22+
- 2.Metamask extension on chrome or firefox. (To connect withweb3)
23+
- 3.Basic understanding of Web3.
24+
- 4. Wallet on metamask with some ether(coins) for a ropsten network.
25+
- 5. Nodejs or javascript understanding.
26+
27+
```
28+
## Smart Contract Deployment
29+
```
30+
This is a simple curd smart contract, which deals with students’ data.
31+
Let’s deploy the contract in a remix environment
32+
First, navigate to address https://remix.ethereum.org/
33+
Add new curd.sol
34+
file and copy-paste the code from the repository.
35+
From the left side click on the 3rd button deployment window will appear of metamask
36+
```
37+
38+
# Setup Steps
39+
```
40+
Smart contract deployment on ropsten network
41+
First, create an account on https://infura.io get infra key
42+
Testing of a smart contract.
43+
The architecture of a decentralized application.
44+
Build the decentralized application (dAPP) to interact with the blockchain.
45+
Run and test the application
46+
get abi and contract address from https://remix.ethereum.org/
47+
48+
Run commands nodejs
49+
50+
```
51+
52+
53+
## Installation
54+
55+
```
56+
npm install
57+
```
58+
59+
## Run
60+
61+
```
62+
Step-1
63+
npx ts-node src/index.ts
64+
###################################
65+
Insert Record uncomment this linse
66+
obj.createStudent('Vinod','MSc');
67+
comment
68+
obj.readStudent(0);
69+
Step- ooutput
70+
{
71+
from: '0x8aeaexxxxxxxxxxxxxxxxxxxxxx',
72+
gasUsed: 101374,
73+
logs: [],
74+
logsBloom: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
75+
status: true, to: '0x83977bf3e9xxxxxxxxxxxxxxxx', transactionHash: '0x37169068b6606193XXXXXXXXXXXXXXXXXXXXX',
76+
transactionIndex: 25,
77+
type: '0x0'
78+
}
79+
80+
----------------------------------------------------------
81+
Step-2 Reading record
82+
npx ts-node src/index.ts
83+
###################################
84+
To read record
85+
// comment this line in the index file
86+
---->> obj.createStudent('Vinod','MSc');
87+
// uncomment this lin
88+
obj.readStudent(0);
89+
90+
91+
```
92+
93+
## License
94+
95+
MIT License

0 commit comments

Comments
 (0)