Skip to content

Commit

Permalink
Merge pull request #6 from sCrypt-Inc/doc
Browse files Browse the repository at this point in the history
Update README
  • Loading branch information
gitzhou authored May 6, 2023
2 parents b964c1d + e1b7762 commit 309f5df
Showing 1 changed file with 57 additions and 8 deletions.
65 changes: 57 additions & 8 deletions README.md
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.

0 comments on commit 309f5df

Please sign in to comment.