Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vgrichina/web4-min-contract
Minimal useful Web4 contract. Can be used together with web4-deploy to deploy static websites
https://github.com/vgrichina/web4-min-contract
ipfs nearprotocol web3 web4 zig
Last synced: 8 days ago
JSON representation
Minimal useful Web4 contract. Can be used together with web4-deploy to deploy static websites
- Host: GitHub
- URL: https://github.com/vgrichina/web4-min-contract
- Owner: vgrichina
- Created: 2022-11-30T03:43:48.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-01T04:32:08.000Z (4 months ago)
- Last Synced: 2025-01-06T02:35:02.607Z (27 days ago)
- Topics: ipfs, nearprotocol, web3, web4, zig
- Language: Zig
- Homepage:
- Size: 26.4 KB
- Stars: 10
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# web4-min-contract
Minimal useful [Web4](https://github.com/vgrichina/web4) contract. Can be used together with [web4-deploy](https://github.com/vgrichina/web4-deploy)
to deploy website tied to your `.near` account, with static content hosted on IPFS.## Building from source
Install [Zig](https://ziglang.org/learn/getting-started/#installing-zig). Below command uses [v0.13.0](https://github.com/ziglang/zig/releases/tag/0.13.0).
Then run:
```bash
zig build-exe web4-min.zig -target wasm32-freestanding -O ReleaseSmall --export=web4_get --export=web4_setStaticUrl --export=web4_setOwner -fno-entry
```You should get `web4-min.wasm` file.
## Deploying smart contract
Install [near-cli-rs](https://github.com/near/near-cli-rs) first.
Then run:
```bash
near deploy --wasmFile web4-min.wasm --accountId .near
```See more on [how to deploy NEAR smart contracts](https://docs.near.org/develop/deploy).
## Deploying website
Run [web4-deploy](https://github.com/vgrichina/web4-deploy) using `npx`:
```bash
npx web4-deploy path/to/your/website .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://.near.page` Web4 gateway.