vgrichina / web4-min-contract

Minimal useful Web4 contract. Can be used together with web4-deploy to deploy static websites

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

web4-min-contract

Minimal useful Web4 contract. Can be used together with web4-deploy to deploy website tied to your .near account, with static content hosted on IPFS.

Building from source

Install Zig first.

Then run:

zig build-lib web4-min.zig -target wasm32-freestanding -dynamic -rdynamic -OReleaseSmall

You should get web4-min.wasm file.

Deploying smart contract

Install near-cli first.

Then run:

near deploy --wasmFile web4-min.wasm --accountId <your-account>.near

See more on how to deploy NEAR smart contracts.

Deploying website

Run web4-deploy using npx:

npx web4-deploy path/to/your/website <your-account>.near

How it works

web4-deploy will upload your website to IPFS and then call web4_setStaticUrl method in this smart contract to set IPFS hash of your website.

Then you can access your website using https://<your-account>.near.page Web4 gateway.

About

Minimal useful Web4 contract. Can be used together with web4-deploy to deploy static websites


Languages

Language:Zig 92.4%Language:HTML 7.6%