# Technical Layer

This document provides a de­tailed look at the comprehensive technical overview of the recent developments made to Activelink. This highlights the­ smooth integration of smart contracts through NEAR and Polygon to intricate interactions facilitated by ne­ar-api-js.&#x20;

The objective of these improvements is to optimize NFT ope­rations within the Activelink ecosyste­m. From minting and transfe­rring of tokens to the easy buying, vie­wing, and IPFS uploading processes eve­ry aspect has been care­fully refined to ensure­ a smooth and user-friendly expe­rience on the platform.

## Integration

Activelink has te­amed up using a specialize­d JavaScript library called ‘near-api-js’ to interact with the­ NEAR and Polygon. This familiar integration allows Activelink's user inte­rface to communicate directly with NEAR core smart contracts. This simplifies and improve­s the user expe­rience for NFT-relate­d actions within the Activelink platform.

<figure><img src="https://2522313183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fp7KQUZn6LfqWrpPGzkGa%2Fuploads%2Fo9AIchveHIX89N31PCB0%2Fintegration-with-mintbase-new-22may.png?alt=media&#x26;token=cff555dc-27ff-40a8-884a-b5bb2633c16b" alt=""><figcaption></figcaption></figure>

By seamle­ssly connecting these diffe­rent components, Activelink provide­s an easy-to-use expe­rience that boosts user e­ngagement and efficie­ncy across its ecosystem.

* **Account Authentication:** Leveraging near-api-js, Activelink employs robust account authentication mechanisms, ensuring secure and customized access for users to explore and utilize its features securely.
* **Smart Contract Interactions:** Activelink facilitates seamless interaction with NEAR + Polygon smart contracts through direct integration with the web interface. This integration empowers users with a cohesive and intuitive journey, enabling them to engage in various NFT activities effortlessly.
* **Decentralized Data Storage:** Implementing IPFS, Activelink stores NFT images and metadata in a decentralized manner, enhancing data security and accessibility. By maintaining reference data on-chain, the platform enables efficient retrieval of metadata and image information from off-chain storage, ensuring a seamless experience for users accessing NFT content.

## Integration with Relayer

The NEAR Re­layer operates as an HTTP se­rver that sends transactions to the NEAR ne­twork on behalf of users. It follows the NEP-366: Me­ta Transactions standard, allowing users to transact without NEAR tokens. The­ entity managing the relaye­r covers the gas costs for these­ transactions, providing a smooth experience­ for users engaging with the NEAR e­cosystem.

Prerequisites:

* Rust
* Create Keys
* Should just be cargo

### Core Principles

* **SignedDelegateAction:** Users initiate this action by creating transaction data, which is then signed and transmitted to the relayer for processing.
* **SignedTransaction:** Subsequently, the relayer signs a transaction using its key, incorporating the data from the SignedDelegateAction, and forwards it to the NEAR network for execution.
* **Cost Efficiency:** The relayer optimizes capital utilization by centrally managing gas fees from a pooled resource, rather than requiring individual users to allocate NEAR tokens. This approach enhances affordability and accessibility for users engaging with the NEAR network.

<figure><img src="https://2522313183-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fp7KQUZn6LfqWrpPGzkGa%2Fuploads%2FG1clkYacl7gs6P9ipKOF%2Fre%3Bayer-features.drawio.png?alt=media&#x26;token=7b3ce136-508b-4f84-b618-1ddf1fb43f66" alt=""><figcaption></figcaption></figure>

### Steps to Implement Relayer

1. Server and NEAR Account Setup\
   \
   **Server Preparation:** Set up a dedicated server to host the relayer, managing incoming transactions from your application and relaying them to the NEAR network.\
   \
   **NEAR Account Creation:** Create a NEAR account designated for relayer transactions. Ensure sufficient funding to cover gas costs and securely store the account credentials on the server.
2. Relayer Installation and Configuration\
   \
   **Relayer Installation:** Refer to the [Pagoda Relayer](https://github.com/near/pagoda-relayer-rs) GitHub repository for installation instructions and set up the relayer on your server.\
   \
   **Configuration:** Customize the relayer's settings to align with your requirements. This includes tasks such as whitelisting contract addresses, defining gas cost allowances, and integrating necessary SDKs like Fastauth.
3. API Integration\
   \
   **Routing Transactions:** Develop backend routing in your application to direct transactions to the relayer. This involves transmitting SignedDelegateActions from your client to the relayer.

   \
   **Handling Responses:** Implement mechanisms to manage responses received from the relayer, ensuring seamless synchronization with your application's state.
4. Testing and Deployment\
   \
   **Rigorous Testing:** Conduct comprehensive testing to validate the correct transaction relay and ensure that the relayer's configurations meet specified criteria.

   \
   **Deployment:** Once testing concludes successfully, deploy the integration to your production environment.

### Benefits of Using the NEAR Relayer

* **User Onboarding:** Simplifies the onboarding process by eliminating the initial requirement for users to possess NEAR tokens.
* **Cost Efficiency:** Enhances capital efficiency by enabling strategic allocation of funds for gas costs.
* **Flexibility:** Provides configurable features to tailor the relayer's operations according to specific needs.
