Skip to content

RijulGulati/nearpaste

Repository files navigation

NEAR Paste

NEAR Paste is an open-source blockchain-based Pastebin built on NEAR Protocol. The server has zero knowledge about any pasted data. Data is encrypted/decrypted using AES encryption in the browser itself.

The application neither requires user to login/signup nor connecting to any wallet. All pastes are funded by app's account itself.

Testnet account: nearpaste.testnet

Features

  • Paste encryption with Password: Encryption/decryption of data takes place in-browser. Your password is NEVER sent to server.
  • Zero-knowledge access: Server has no knowledge about any paste data being sent to blockchain.
    • Note: The server does not log any paste data. However, paste data content is visible in NEAR explorer. It is suggested to use password.

Smart contract

The contract code is written in Rust. Code is available in contract/ directory. Build instructions are available below.

Build

Rust contract

  • Requires Rust and wasm toolchain. Detailed setup instructions are available here

Build contract

$ cd contract/
$ cargo build --target wasm32-unknown-unknown --release

This will generate nearpaste.wasm binary in target/wasm32-unknown-unknown/release directory.

Deploy

$ near deploy <account_id> --wasmFile target/wasm32-unknown-unknown/release/nearpaste.wasm --initFunction 'new' --initArgs '{}'

Where <account_id> is NEAR Account Id.

Run tests

$ cargo test

NextJs application

  • Requires NodeJs and yarn installed.

  • The following environment variables are required:

    • NEAR_ACCOUNT_ID=<account_id> # Eg: nearpaste.testnet
    • NEAR_NETWORK_ID=testnet # or mainnet - TODO: add mainnet support
    • NEAR_ACCOUNT_PRIVATE_KEY=<private_key> # account private key

    Create a new file .env.local in application root and above mentioned variables.

Run development environment

$ yarn dev

Production build

$ yarn build

Contributions

All kinds of contributions are welcome. Please raise a pull request or create an Issue.

Contacts

Feel free to get in touch with me on Discord or Telegram.

License

MIT