๐Ÿ“ฑFor Applications

For application looks for a sybil resistance Solution

If you want to integrate us this usually means you are building an application on NEAR and either

  • Front End Gating: check a user logged is a human to display different views

  • NEAR Contracts: using for a cross contract call to our registry to enforce on the contract level

Front End Gating

BOS/NEARJS

NEARJS/BOS is a framework for front end development that stores front end JSX code on chain that can be accessed across different gateways / web apps that support the BOS VM. NEAR API JS is built in. Here is an easy way to detect human checks

Check Contract for Human

Humans are calculated by adding assigned weights of stamps a user has, against a set of rules of how stamps interacts, against a human threshold. If the account that is being checked passes the human threshold score after being called than an account is considered a human

https://near.social/plugrel.near/widget/nadabot_human (Example of BOS helper component)

// check is_human method that enables
const accountId = props.accountId ?? "odins_eyehole.near";

Near.asyncView("v1.nadabot.near", "is_human", { account_id: accountId }).then(
  (result) => {
    State.update({ human: result });
  }
);

return <>{state.human && <span>โœ…</span>}</>;

Check Contract for Human Score

VanillaJS

Check out the NEAR Docs to get a better sense of how to integrate in the front end. If you are using a javascript front end library you will most likely be integrating with our contract via NEAR API JS

In your javascript app

Check Human and Human Score

Some notes about the code snippet

  • Interact with NEAR Blockchain: Utilizes near-api-js to connect to the NEAR mainnet and interact with a specified smart contract, handling blockchain operations like querying account details and executing contract methods.

  • Verify Human Status: The checkHuman function checks if a given NEAR account is recognized as human by calling the is_human method on the smart contract, useful for differentiating between automated bots and human users.

  • Retrieve Human Score: The humanScore function queries the smart contract for a "human score" associated with the account, providing a quantitative measure of the account's human-like behavior or verification status via the get_human_score method.

  • Configurable for Environments: Supports switching between staging and production environments by altering the contract address, allowing for flexible testing and deployment scenarios.

  • Asynchronous and Error Handling: Implements asynchronous JavaScript patterns for non-blocking calls to the NEAR blockchain and includes error handling for robust operation and debugging.

Make sure to handle the UI elements (like the popup modal) according to your application's frontend framework or library. The above code assumes a basic JavaScript setup and will need to be adapted to fit your specific implementation details.

NEAR Contract

NEAR Protocl is a layer 1 blockchain with Rust contracts that compile to Wasm.

Create Your First Rust Contract: After installing Rust, you can create your first Rust contract. Here are the steps:

Resources: For more information and examples, you can refer to the following resources:

  • Documentation: https://docs.near.org/develop/contracts/anatomy

  • Examples: https://docs.near.org/tutorials/welcome

  • Github: https://github.com/near/near-sdk-rs

Cross Contract Calls

Here is an example with how nada.bot does it with I-Am Human contract https://github.com/PotLock/core/blob/71f35051f81c333c85fafc42d073173191ad14ca/contracts/sybil/src/human.rs#L43

To make a cross-contract call in Rust for a NEAR smart contract, you would typically use the promise_then method to schedule the execution of a callback after the initial cross-contract call completes. Here's a basic example of how you might structure this in your Rust smart contract:

Ideas to Integrate

  • Airdropping and amplified rewards for loyalty programs

  • 1 person 1 vote for governance on governance contract

  • Quadratic funding

  • Human based fees

Last updated