- Web4 Protocol support
- Basic smart contract structure
- Scripts to build local/docker binaries
Live demo: https://near-web4-contract.testnet.page/
Create new repo && download this boilerplate to target folder:
wget https://github.com/zavodil/near-web4-contract/archive/refs/heads/main.zip -O "near-web4-contract-master.zip" && unzip ./"near-web4-contract-master.zip" -d $PWD && rm ./"near-web4-contract-master.zip" && mv -v $PWD/near-web4-contract-main/* $PWD && rm -rf near-web4-contract-main
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
- 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
Prepare docker
clone https://github.com/near/near-sdk-rs/pull/720/files
./build_docker_m1.sh
Run docker buildx contract-builder
./build_docker_m1.sh
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