-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from sCrypt-Inc/doc
Update README
- Loading branch information
Showing
1 changed file
with
57 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,65 @@ | ||
### Deploy | ||
# Voting | ||
|
||
Build your first decentralized application, or dApp, on the Bitcoin with this tutorial. | ||
|
||
[LIVE DEMO](http://classic.scrypt.io/voting/) 🚀 | ||
|
||
## Step 1. Clone the project | ||
|
||
```bash | ||
$ git clone https://github.com/sCrypt-Inc/voting.git | ||
``` | ||
|
||
## Step 2. Install dependencies | ||
|
||
```bash | ||
$ cd voting | ||
$ npm install | ||
``` | ||
|
||
## Step 3. Compile contract | ||
|
||
```bash | ||
$ npx scrypt-cli compile | ||
``` | ||
|
||
## Step 4. Deploy contract | ||
|
||
Before deploying the contract, create a `.env` file and save your private key in the `PRIVATE_KEY` environment variable. | ||
|
||
```text | ||
PRIVATE_KEY=xxxxx | ||
``` | ||
npm run compile | ||
npm run deploycontract | ||
|
||
If you don't have a private key, please follow [this guide](https://scrypt.io/docs/how-to-deploy-and-call-a-contract/#setup) to generate one using [Sensilet](https://sensilet.com/) wallet, then fund the private key's address with our [faucet](https://scrypt.io/faucet/). | ||
|
||
Run the following command to deploy the contract. | ||
|
||
```bash | ||
$ npm run deploy:contract | ||
``` | ||
|
||
### `npm start` | ||
After success, you will see an output similar to the following: | ||
|
||
![](https://aaron67-public.oss-cn-beijing.aliyuncs.com/202305060511743.png) | ||
|
||
Runs the app in the development mode.\ | ||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. | ||
Copy the deployment TxID then change the value of `ContractId` in file `src/App.tsx`: | ||
|
||
```ts | ||
const contract_id = { | ||
txId: "bccf73c0f49920fdbd2c66972b6ab14ac098239c429176acf5e599acb7dc6d4a", | ||
outputIndex: 0, | ||
}; | ||
``` | ||
|
||
## Step 5. Run the frontend app | ||
|
||
```bash | ||
$ npm start | ||
``` | ||
|
||
The page will reload if you make edits.\ | ||
You will also see any lint errors in the console. | ||
Runs the app in the development mode. Open [http://localhost:3000](http://localhost:3000) to view it in the browser. | ||
|
||
![](https://aaron67-public.oss-cn-beijing.aliyuncs.com/202305060521385.gif) | ||
|
||
If you're interested in how to build this dApp step by step, please refer to this [guide](https://scrypt.io/docs/tutorials/voting/) for more details. |