On-chain hackathon dApp on Rust / NEAR Blockchain
Example app built during the NEAR Web4 Online Hackathon Both the web3 logic and the web2 user interface stored and executed on a blockchain using Web4 Protocol.
Application features:
- On-chain storage of all hackathon submissions
- Preserved prize pool deposited by the hackathon owner and stored in the contract
- Submissions deadline stored in the contract
- Hackathon participant has an option to update the application before the deadline
- The owner of the hackathon marks the participant as winner and automatically transfers his part of the prize pool
All updates of the contract (new applications, rewards, etc) state became visible on a UI.
Video tutorial: https://youtu.be/tcBjZFWdMxI
To run this project:
- Run
./build.sh
to compile wasm binary fine - Register testnet account using https://wallet.testnet.near.org/create (for example,
contract.testnet
) - Store your contract_id in the environment variable
export CONTRACT_ID=contract.testnet
- Deploy contract to NEAR Blockchain:
near deploy $CONTRACT_ID --wasmFile=./res/web4.wasm -f
- Initialize the contract
near call $CONTRACT_ID new '{"owner_id": "'$CONTRACT_ID'"}' --accountId $CONTRACT_ID --deposit 10
- Check your contract online on https://$CONTRACT_ID.testnet.page (for example contract.testnet.page)
- Register account on a mainnet and deploy your contract there, yor app will be available on https://$CONTRACT_ID.near.page
You can use NEAR Web4 Contract Boilerplate.
Ensure near-cli
is installed by running:
near --version
If needed, install near-cli
:
npm install near-cli -g
Ensure Rust
is installed by running:
rustc --version
If needed, install Rust
:
curl https://sh.rustup.rs -sSf | sh
Run the compiler
./build_local.sh