# Overview

Entangle is a programmable interoperability layer that seamlessly connects all blockchains, data sources, and the real world, unlocking endless possibilities for future-ready decentralized applications. With Entangle, developers can easily launch, scale, and automate dApps, tokens and AI agents to interact across all blockchains without limitations.&#x20;

Entangle’s toolkit provides developers access to ultra-fast, verifiable and programmable data from any source while enabling secure, trustless verification of complex off-chain software on-chain.

The technology stack serves as the foundational toolkit to build and scale mass-adoption ready applications including: DeFAI, Autonomous AI Agents, GameFAI, Real World Assets (RWA), DeSci and more.

***

For any inquiries or assistance, feel free to reach out to the **Entangle** team via the [contact form](https://entangle.zendesk.com/hc/en-us/requests/new) or the community via the [Discord](https://discord.gg/entangle) channel.

## Products

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>Universal Token Standard (UTS)</td><td><a href="/universal-token-standard/overview">Overview</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FVwco2pUC5Ym8iJBiivdE%2FEntangle%20Token%20Standard.png?alt=media&amp;token=74c2f6dc-85fe-442f-8321-7a875fcddc98">Entangle Token Standard.png</a></td></tr><tr><td>Universal Data Feeds (UDF)</td><td><a href="/universal-data-feeds/overview">Overview</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FCdI1mYXyCmluQkv70GLE%2FUniversal%20Data%20Feeds.png?alt=media&amp;token=e95d48b7-5eda-449a-9c8b-6fba9a8f5490">Universal Data Feeds.png</a></td></tr><tr><td>Entangle Interoperable Blockchain (EIB)</td><td><a href="/entangle-interoperable-blockchain/overview">Entangle Interoperable Blockchain</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FPzlqHfJccqtXxaD3snUE%2FEntangle%20Interoperable%20Blockchain%20(EIB).png?alt=media&amp;token=42e7830c-96ac-46fb-b102-3aebeb303252">Entangle Interoperable Blockchain (EIB).png</a></td></tr></tbody></table>

## More

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>Security Audits</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FPLMiLexbwI6U7V7gmpk8%2FSecurity%20Audits.png?alt=media&amp;token=5afbc9de-d0a6-4101-8449-5a1c36a3f292">Security Audits.png</a></td><td><a href="/entangle/security-audits">Security Audits</a></td></tr><tr><td>Join the Entangle Community</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FrXVV728CBk25Q4ALT89n%2FJoin%20the%20Entangle%20Community.png?alt=media&amp;token=5bd07b57-acee-4df1-b874-8a0ed5ff0999">Join the Entangle Community.png</a></td><td><a href="/entangle/community">Community</a></td></tr><tr><td>FAQ &#x26; Troubleshooting</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FDMUNx6pbDlFZ9cnRfCZV%2FFAQ%20Troubleshooting.png?alt=media&amp;token=9a6cfc3d-1c3c-48b5-9f5a-35e9603862c1">FAQ Troubleshooting.png</a></td><td><a href="/more/faq">FAQ</a></td></tr><tr><td>Report an Issue</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FjfE9r6iHc1IIRQVPViv8%2FReport%20an%20Issue.png?alt=media&amp;token=53d6dd2a-0bc4-4e41-a4a0-6f98f5abaedb">Report an Issue.png</a></td><td><a href="/more/report-an-issue">Report an Issue</a></td></tr><tr><td>Become a Partner</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FPPETeTW4IwcVNzm0ixkx%2FBecome%20a%20Partner.png?alt=media&amp;token=8df76ccf-2e03-4200-ad1e-d043736ecb92">Become a Partner.png</a></td><td><a href="/more/become-a-partner">Become a Partner</a></td></tr></tbody></table>


# Security Audits

Entangle has undergone rigorous audits by the industry's top security firms — Halborn, Sentnl, and Astrarizon — ensuring its infrastructure is fortified and secure at the highest standards.

### Halborn Audits

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>Entangle Blockchain Audit</td><td><a href="https://drive.google.com/file/d/1e5DJthW6VztmkO214N3yPTjIQWeydtxb/view?usp=sharing">https://drive.google.com/file/d/1e5DJthW6VztmkO214N3yPTjIQWeydtxb/view?usp=sharing</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fd4w6yQczt2oLBwNIlp9g%2FEntangle%20Blockchain%20Audit.png?alt=media&amp;token=8419381b-4f4f-4a33-8072-a68ff5f281ed">Entangle Blockchain Audit.png</a></td></tr><tr><td>TGE Audit</td><td><a href="https://drive.google.com/file/d/1duYCq9bkRRovZd7_jPURLcdREifNp6wA/view?usp=sharing">https://drive.google.com/file/d/1duYCq9bkRRovZd7_jPURLcdREifNp6wA/view?usp=sharing</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fr4jDjsaOuqZlIJgCIhLn%2FTGE%20Audit.png?alt=media&amp;token=6caeeb67-8c00-489e-87cb-bd8c5e520bad">TGE Audit.png</a></td></tr><tr><td>NGL Token Audit</td><td><a href="https://drive.google.com/file/d/1eKRuwAbfCxn89NgpWGt1H7o447MiPVZB/view?usp=sharing">https://drive.google.com/file/d/1eKRuwAbfCxn89NgpWGt1H7o447MiPVZB/view?usp=sharing</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FHZ9GtBm2OdeyG0aAgDEC%2FNGL%20Token%20Audit.png?alt=media&amp;token=4171442b-7c48-40ce-9a0d-36222209fd15">NGL Token Audit.png</a></td></tr></tbody></table>

## Sentnl Audits

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>Photon Messaging Audit</td><td><a href="https://drive.google.com/file/d/1dhkMclCG9F-Jle-crhvSBFiNPH3tmaAq/view?usp=sharing">https://drive.google.com/file/d/1dhkMclCG9F-Jle-crhvSBFiNPH3tmaAq/view?usp=sharing</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FzpX2UuDykYUxVafhlHt3%2FPhoton%20Messaging%20Audit.png?alt=media&amp;token=ce568941-4c20-4444-9b5e-3ed87cdf1945">Photon Messaging Audit.png</a></td></tr><tr><td>Audit Results</td><td><a href="https://drive.google.com/file/d/1Gnhdy2mG3teBLYme9I0QJn8zkZg-Q_EU/view?usp=sharing">https://drive.google.com/file/d/1Gnhdy2mG3teBLYme9I0QJn8zkZg-Q_EU/view?usp=sharing</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FeMaiykW3Mj8nJa6HwsmK%2FAudit%20Results.png?alt=media&amp;token=d72c047a-0471-49d4-ad9a-b7ff2d1c4fcf">Audit Results.png</a></td></tr><tr><td>Entangle IDO Audit</td><td><a href="https://drive.google.com/file/d/1dYBTbc6fam_-YzRFfEUXpdWiApRPU-3L/view?usp=sharing">https://drive.google.com/file/d/1dYBTbc6fam_-YzRFfEUXpdWiApRPU-3L/view?usp=sharing</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FNBDrUIfrYDlOKrHdpjmw%2FEntangle%20IDO%20Audit.png?alt=media&amp;token=72ae2a3e-e5f7-49d2-bb6e-3ca850f7a66f">Entangle IDO Audit.png</a></td></tr></tbody></table>

### Astrarizon Audits

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>Code Review Report</td><td><a href="https://drive.google.com/file/d/1e0Mu7gu7NE0y4rSMWHyl0CIln5MKxOpm/view?usp=sharing">https://drive.google.com/file/d/1e0Mu7gu7NE0y4rSMWHyl0CIln5MKxOpm/view?usp=sharing</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FZu23rNH2hiipQX5f6kpw%2FCode%20Review%20Reporter.png?alt=media&amp;token=93e7b7be-9ba0-4410-abe4-ff629ea65926">Code Review Reporter.png</a></td></tr></tbody></table>


# Community

Welcome to the Entangle Community — a hub for builders, developers, and innovators driving the infinite Web. Here, you’ll find the resources, networks, and discussions needed to explore, integrate, and leverage Entangle’s technology to elevate your products and solutions.

Connect with us on[ Discord](https://discord.com/invite/entangle), stay updated on[ X](https://x.com/Entanglefi) (formerly Twitter), engage in discussions on[ Telegram](https://t.me/entangle_community), begin building with our examples on[ GitHub](https://github.com/Entangle-Protocol), catch up on[ YouTube](https://www.youtube.com/@entanglefi), or explore our broader ecosystem on the official[ website](https://entangle.fi/).

Together, we’re shaping and actively building the infinite web. Let’s get started.

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>Discord</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FSKQmOyPMxkzpVAWNmi5I%2FDiscord.png?alt=media&amp;token=c4ac0fea-7968-4d3b-81f7-d5ea0190f43a">Discord.png</a></td><td><a href="https://discord.com/invite/entangle">https://discord.com/invite/entangle</a></td></tr><tr><td>X (Twitter)</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FyYui27g3e6vIWQzGyIxw%2FX.png?alt=media&amp;token=0f39d0c0-d595-40ee-86da-a7bf8e32c7b3">X.png</a></td><td><a href="https://x.com/Entanglefi">https://x.com/Entanglefi</a></td></tr><tr><td>Telegram</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F1THC5vYFFwmDARGTEEKq%2FTelegram.png?alt=media&amp;token=e0a20ecd-a7b9-45b3-9cf5-868346411a4f">Telegram.png</a></td><td><a href="https://t.me/entangle_community">https://t.me/entangle_community</a></td></tr><tr><td>GitHub</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FaH9SRwUz8ck8ARH0C9QW%2FGithub.png?alt=media&amp;token=7f67271f-44aa-4a3b-904a-9fced29dfce6">Github.png</a></td><td><a href="https://github.com/Entangle-Protocol">https://github.com/Entangle-Protocol</a></td></tr><tr><td>YouTube</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FNwxbqmmbC6hkQmrSCGqn%2Fyoutube.png?alt=media&amp;token=32eeb905-2249-4ca7-aeac-8790987e16fc">youtube.png</a></td><td><a href="https://www.youtube.com/@entanglefi">https://www.youtube.com/@entanglefi</a></td></tr><tr><td>Entangle Website</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FmiPnbjc8rqgMXxZ52HD2%2FWebsite.png?alt=media&amp;token=9a93a91d-d692-401e-873c-ca9ebf887658">Website.png</a></td><td><a href="https://entangle.fi/">https://entangle.fi/</a></td></tr></tbody></table>


# Overview

Entangle’s Universal Interoperability Protocol (UIP) revolutionizes the web by enabling secure communication across all blockchains using the industry's fastest, fully abstracted, and infinitely scalable cross-chain messaging protocol.

UIP enables developers to build, scale and automate applications and assets that operate across any chain, including complex use-cases, such as omnichain autonomous AI agents, cross-chain liquidity pools, real world assets and more.

Today users, liquidity, and data exist in isolation. UIP is to blockchains what TCP/IP was to the early internet, enabling seamless communication between isolated blockchains and paving the way for enhanced connectivity across roll-ups, app-chains, blockchains, and entire ecosystems.

UIP is built with multiple layers of security, including blockchain middleware, proof of stake validators, smart contract immutability and decentralised proof of stake machines which deliver information between every blockchain.

Developing in-house interoperability solutions can be complex, time-consuming, and costly. UIP eliminates these barriers by providing builders the protocols and ecosystems necessary for an automated developer friendly solution that's trustable, secure, and reliable.

For a deeper analysis, explore the details in our [whitepaper](https://entangle.fi/documents/UIP%20Whitepaper.pdf).

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FlxfljOo5kZAf67tGwCba%2Fwhat%20is%20uip.gif?alt=media&amp;token=89237835-f339-48a2-8700-c3a865725e08" alt=""><figcaption></figcaption></figure>

## Interoperability

Interoperability is the ability for blockchains to communicate and share data seamlessly, despite their differences. Without it, blockchains function like isolated islands, unable to exchange assets or information. UIP builds secure, decentralized connections between these islands, allowing assets, data, and smart contracts to flow and function freely across networks. This transforms fragmented systems into a connected, multi-chain ecosystem. With Entangle's UIP, developers can build across chains and can innovate without limitations. UIP ensures blockchains don’t just coexist but also collaborate effectively.

## Protocols Built on UIP

UIP’s superior and security first design makes it an ideal foundation for infrastructure protocols and applications. UIP has been battle tested and is the foundation of both [UDF (Universal Data Feeds)](/universal-data-feeds/overview) and [UTS (Universal Token Standard)](/universal-token-standard/overview) powering data feeds and asset transfers of various protocols across the industry.

## Omnichain Use Cases with UIP

UIP enables a level of connectivity that unlocks new possibilities within the infinite web.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FI0lCWHH5YfIt9hRJbHqD%2Fimage.png?alt=media&amp;token=cc4ae8d2-74bb-4056-9107-cf0a25629f8c" alt=""><figcaption></figcaption></figure>

* **DeFAI** - Enable AI driven protocols to automate trading strategies, optimize liquidity pools, and execute on-chain decisions in real-time across any blockchain.
* **GameFAI** - Unite players, viewers and developers with a universal chain abstracted settlement layer, connecting any game to users on any ecosystem; power intelligent in-game economies and AI-driven agents.
* **DePIN** - Build decentralized wireless networks, edge computing, shared sensor networks, autonomous physical networks, and more.
* **IoT** - Connect IoT devices across the interconnected web for real-time data-flow, automated responses, and unified connectivity.
* **Robotics** - Connect autonomous robotic systems to smart contracts and cross-chain data sources to provide trustable robotics.
* **Predictions** - Accurate, real-time on- and off-chain insights. Build reliable prediction markets powered by verifiable and programmable data.
* **Real World Assets** - Provide real-time and accurate pricing for tokenized real-world assets, ensuring reliable valuations and enhanced market transparency.
* **DeSci** - Scientific collaboration enabled by cross-chain data sharing, funding mechanisms, and transparent research validation on immutable ledgers.

[Contact us](https://entangle.zendesk.com/hc/en-us/requests/new) to find out more about how you can use UIP for your project.

## Features

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>Transmitter Network</strong></td><td>Decentralized transmitter network ensures permissionless, censorship-resistant messaging. Super-transmitters provide additional security, enhancing network reliability without centralization.</td></tr><tr><td><strong>Layer 2 Utility Blockchains</strong></td><td>Lightweight nodes called tethered transmitters and auxiliary Layer 2 blockchains process messages in parallel at high speeds and low costs. Reliable communication even in peak demand.</td></tr><tr><td><strong>Dual Consensus Mechanism</strong></td><td>Decentralized transaction verification provides multi-layered protection, prevents common attacks and mitigates single points of failure. Secure, trustworthy cross-chain interactions.</td></tr><tr><td><strong>Customizable Messaging Framework</strong></td><td>Tailored transactions and customized messaging. E.g., signature thresholds and block finalization intervals, from diverse needs such as high security to rapid transaction processing.</td></tr></tbody></table>

## Explore

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>Getting Started</td><td><a href="/universal-interoperability-protocol/developer-guides/getting-started">Getting Started</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FNBDrUIfrYDlOKrHdpjmw%2FEntangle%20IDO%20Audit.png?alt=media&amp;token=72ae2a3e-e5f7-49d2-bb6e-3ca850f7a66f">Entangle IDO Audit.png</a></td></tr><tr><td>Developer Guides</td><td><a href="/universal-interoperability-protocol/developer-guides">Developer Guides</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F7TYUWLA2eYs27kowU9Mc%2FDeveloper%20Resources.png?alt=media&amp;token=9c1045ee-5895-4b7b-8270-972621d0501b">Developer Resources.png</a></td></tr><tr><td>Architecture</td><td><a href="/universal-interoperability-protocol/architecture">Architecture</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FXXTqyr0jx7RCZhtLdU0K%2FUser%20Flows.png?alt=media&amp;token=70c0d785-bbd4-4c46-8bef-3dfb6234d47d">User Flows.png</a></td></tr><tr><td>Frequently Asked Questions</td><td><a href="/more/faq">FAQ</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FWhD3OfXU0q0AbKF5THh4%2F25.png?alt=media&amp;token=091c6862-1a6c-4bb9-9c9c-d41a3290abc2">25.png</a></td></tr></tbody></table>


# Architecture

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FlZZAWGDdo30Ti7PDW0sn%2FUIP%20Architecture.png?alt=media&amp;token=770d9b5f-d4e3-4c3a-a817-226764269a72" alt=""><figcaption></figcaption></figure>

UIP brings forward a reimagined cross-chain messaging protocol architecture that optimizes scalability, decentralization, and security. This new design ensures seamless communication between blockchains, allowing for high transaction throughput, efficient message delivery, and a more inclusive network of transmitters.

Learn more about how UIP works by exploring the topics below, or head over to our [whitepaper](https://entangle.fi/documents/UIP%20Whitepaper.pdf) to explore the details.

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>Scalability and Network Stability</td><td><a href="/universal-interoperability-protocol/architecture/scalability-and-network-stability">Scalability and Network Stability</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FTLBDlvlHiGJUqrLcZgdY%2FEconomy%20Model.png?alt=media&amp;token=7f698ad7-9245-4d01-8d26-2e1aaa8c2e2d">Economy Model.png</a></td></tr><tr><td>Security and Consensus Mechanism</td><td><a href="/universal-interoperability-protocol/architecture/security-and-consensus-mechanism">Security and Consensus Mechanism</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fzg9KEnWYDRFNpES5mWt5%2FDelegating%20NGL.png?alt=media&amp;token=dbb9b1df-25a5-4b7c-9d11-c2a44a98f0ae">Delegating NGL.png</a></td></tr><tr><td>Finality</td><td><a href="/universal-interoperability-protocol/architecture/finality">Finality</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FemwP69atNJAnhXWl66Vt%2F15.png?alt=media&amp;token=544a1f5a-9502-41fe-ad8a-a90987e7dca3">15.png</a></td></tr><tr><td>Execution Latency</td><td><a href="/universal-interoperability-protocol/architecture/execution-latency">Execution Latency</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FOPhfRclZvEgxyuVjcuea%2F4.png?alt=media&amp;token=5b893cd8-49e8-4f63-8d89-37754da86ad7">4.png</a></td></tr><tr><td>Compatibility and Integration</td><td><a href="/universal-interoperability-protocol/architecture/compatibility-and-interoperability">Compatibility and Interoperability</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FxoFvUBTRjzCeSv1EYa5b%2FHow%20to%20Integrate.png?alt=media&amp;token=76a83b10-5954-41a2-a72c-f40a5435f58a">How to Integrate.png</a></td></tr></tbody></table>


# Scalability and Network Stability

UIP’s architecture is designed for horizontal scalability, ensuring it can handle increasing Transactions Per Second (TPS) across multiple connected networks. By leveraging dedicated L2 utility networks and optimizing agent group parallelism, UIP achieves high throughput, efficient message processing, and robust cross-chain communication, ensuring reliable performance as the network grows.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F9AOlN1K0xanweR6VgT6Q%2Fscalability%20model.png?alt=media&amp;token=eadcbad0-6ef4-4a1c-9448-9e4aa29fec76" alt=""><figcaption></figcaption></figure>

For UIP to sustain maximum throughput, its Messages Per Second (MPS) must match or exceed the total TPS of all connected networks. As new networks are added, UIP scales horizontally to manage the increased load without compromising message delivery speed.

### Key Scalability Components

* **L2 Utility Blockchains:** UIP integrates Layer 2 solutions like Optimistic Rollups to offload traffic from the main Entangle Layer 1 network. This allows messages to be distributed across independent L2 networks for parallel processing and faster execution.
* **Transmitter Groups:** Independent transmitter groups in the transmitter network process messages for each network, enhancing parallelism and ensuring seamless message delivery without disrupting nonce sequences.

This architecture enables UIP to maintain performance and reliability while accommodating the growing demands of interconnected blockchain networks.

## Explore

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>L2 Utility Blockchain</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2File32ojhXCplRyNf09En%2F11.png?alt=media&amp;token=00dea182-f78f-434f-a738-7c9e3f0b66ba">11.png</a></td><td><a href="/universal-interoperability-protocol/architecture/scalability-and-network-stability/l2-utility-blockchains">L2 Utility Blockchains</a></td></tr><tr><td>Transmitter Groups</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F2tBC7XW2Y5eU8sF3Kjrj%2F5.png?alt=media&amp;token=a8a55284-771f-4a2c-abcf-d0f5556b9436">5.png</a></td><td><a href="/universal-interoperability-protocol/architecture/scalability-and-network-stability/transmitter-groups">Transmitter Groups</a></td></tr></tbody></table>


# L2 Utility Blockchains

UIP addresses scalability challenges by utilizing dedicated Layer 2 (L2) networks to store and process delivered messages. This approach reduces congestion on the Entangle Layer 1 (L1) network, improving throughput and efficiency.

## L2 Blockchain

L2 blockchains are built on top of L1 blockchains and they inherit finality from the L1 blockchain they rely on. There are several methods to achieve L2 finality:

**Optimistic Rollups**

* Transactions are bundled and posted to the L1 blockchain as "commitments."
* A "challenge period" allows for disputes if any fraud is detected. This period can last up to a week, delaying transaction finality.

**ZK Rollups**

* Similar to Optimistic Rollups, but instead of a challenge period, transactions are validated using cryptographic proofs (validity proofs) before being finalized on L1.
* This approach is faster but relies on specialized technology.

Note that many L2 solutions, like rollups, use a centralized sequencer to order and bundle transactions before committing them to L1. While efficient, this method introduces trust dependency on the sequencer. On the other hand, UIP utilizes Optimistic Rollups for quick transaction rollups.

### Integration with L2 Solutions

UIP integrates L2 solutions, such as Optimistic Rollups, to offload traffic from the main network. Messages from source chains are distributed across multiple L2 networks through agent groups, enabling parallel processing and faster execution. Unlike traditional L2 processes, UIP's internal utility networks bypass full block finalization for messages that do not involve value transfers, relying solely on source network finalization to speed up delivery.

### Optimized Message Delivery Flow

UIP ensures efficient and scalable message delivery through a streamlined process:

* **Group Splitting for High Volume:** Agent groups split when transaction volume exceeds a threshold, with larger groups earning additional fees to incentivize efficiency.
* **Message Assignment:** Messages are randomly assigned to agent groups on the source chain and indexed to L2 utility chains for balanced workload distribution.
* **Master and Sub-Master Contracts:** A master contract on the L1 chain manages configurations, while sub-master contracts on L2 networks handle executor selection and fee distribution.
* **Executor Selection:** Executors are chosen through a two-step process, first selecting the agent group and then assigning active slots, ensuring efficient processing and avoiding double execution.
* **Secure Message Handling:** With a single endpoint per chain, UIP prevents double message execution, ensuring reliable and secure cross-chain delivery.

This architecture delivers a high-performance, scalable solution for cross-chain communication while maintaining security and efficiency.

## Message Routing in L2 Utility Networks

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FNBcqvBAp8oeugsW0UsDK%2Fmessage%20delivery%20process.png?alt=media&amp;token=e7788a7a-4f39-47a7-a4f3-4ee8cf9d2846" alt=""><figcaption><p>Message Delivery Flow Through L2 Utility Networks</p></figcaption></figure>

The UIP employs a structured, parallelized message delivery flow through L2 utility networks. This design ensures that even high transaction volumes do not create bottlenecks, effectively reducing queuing delays and enabling efficient, scalable omnichain communication.

Once processed by transmitter groups, messages are forwarded to L2 utility networks for consensus and coordination among transmitters. These networks bypass full block finalization, as no value transfer occurs between the Entangle Layer 1 (EIB) and the L2s, accelerating processing and minimizing the delays typically associated with L2 rollups or similar systems.

The primary functions of the L2 utility chains include facilitating message verification, managing signature exchanges, and providing transaction status updates among transmitters. To ensure balanced processing, each message is routed to a specific L2 chain based on its index at the source chain’s Endpoint, preventing any single network from becoming a bottleneck and optimizing performance across the system.


# Transmitter Groups

UIP utilizes independent transmitter groups to process messages across networks, ensuring scalability and preventing transaction backlogs. Each transmitter group’s Transactions Per Second (TPS) is designed to match or exceed the TPS of the network it serves, maintaining efficiency and speed.

## Transmitters

Transmitters operate exclusively within a single network, except for utility networks. To mitigate delays caused by consensus tasks like message validation and signature generation, UIP enables multiple parallel transmitter groups. This parallel structure accelerates processing while preserving message sequences and nonces, ensuring reliable and orderly cross-network communication.

### The Role of Transmitters

UIP optimizes transmitters to improve scalability and efficiency in cross-chain messaging. These changes simplify integration for new protocols and streamline functionality for developers.

1. **Single Network Focus:** Transmitters work exclusively in one network plus the Entangle blockchain, allowing them to specialize and maximize performance. This eliminates the inefficiency of spreading resources across multiple chains.
2. **Dual Functionality:** Transmitters act as both transmitters and executors simultaneously. They handle the entire process — relaying messages and executing transactions — removing the need for separate entities to manage these tasks.
3. **No More Protocol-Specific Executors:** Protocols no longer need to deploy their own executors. They only need to know [EndPoint addresses](/universal-interoperability-protocol/endpoints). This drastically reduces the complexity of integrating with Photon, making it plug-and-play.
4. **New Networks Manage Their Own Transmitters:** When a new network is added, only that network needs to deploy transmitters to activate cross-chain messaging. Existing networks don’t need to manage transmitter deployment, streamlining onboarding and scalability.

## Super Transmitters

Super Transmitters are specialized validators that enhance security and decentralization by validating cross-chain messages without executing transactions. They add a layer of scrutiny to confirm or reject messages, reducing fraud risks. Often public figures or trusted entities, they play a key role in achieving consensus and receive a share of protocol revenue as compensation for maintaining network reliability.

### The Role of Super Transmitters

The concept of the Super Transmitter introduces an additional layer of security and decentralization within the message transmission system. The Super Transmitter acts as both a counterbalance to regular transmitters and a facilitator for their connections. Key characteristics include:

* **Transaction Oversight**: Unlike regular transmitters, Super Transmitters do not engage in executing operations on the destination network. Instead, they confirm or reject transactions originating from the source network, adding an extra layer of scrutiny.
* **Public Figures as Transmitters:** The role can be assumed by public figures such as companies or influencers, whose accounts are integrated through Governance or DAO. This approach leverages their credibility to enhance trust within the network.

Super Transmitters play a critical role in the security and decentralization of UIP. These trusted entities—potentially public figures or organizations—validate transactions without executing them, adding a layer of scrutiny to ensure message integrity. Initially, only Entangle transmitters will act as Super Transmitters for controlled testing and refinement.

Super Transmitters are rewarded by receiving a percentage of the income generated by regular transmitters. The specific share of income allocated to Super Transmitters is determined through feedback from the community and the transmitters themselves, ensuring a balanced distribution of rewards. This reward structure incentivizes Super Transmitters to maintain high levels of reliability and trust within the network.

## Grouping and Rotation

UIP introduces an efficient and scalable approach to transmitter management through dynamic grouping and rotation, designed to enhance performance, scalability, and decentralization.

### Transmitter Grouping

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>Single Network Specialization</strong></td><td>Each transmitter group processes messages for a single network, optimizing performance and minimizing delays caused by network-specific conditions such as validation times and signature generation. Utility networks are an exception, where multiple agent groups may interact.</td></tr><tr><td><strong>Parallel Groups for High-TPS Networks</strong></td><td>For networks with high transactions per second, UIP enables multiple parallel transmitter groups to process messages. This ensures backlogs are prevented and high throughput is maintained. Parallel processing allows the system to scale efficiently as transaction loads increase.</td></tr><tr><td><strong>Dynamic Group Splitting</strong></td><td>When transaction volumes exceed thresholds, transmitter groups can split into smaller units. E.g., a group with 6 may split to handle messages independently, enabling real-time scalability.</td></tr><tr><td><strong>Random Assignment</strong></td><td>Messages are randomly assigned to a transmitter group on the source chain and routed through a Layer 2 (L2) utility network for consensus.</td></tr><tr><td><strong>Secure Message Execution</strong></td><td>With one endpoint per chain, UIP prevents double execution risks, streamlining message processing and ensuring secure cross-chain transactions.</td></tr><tr><td><strong>Executor Selection</strong></td><td>The L2 network is determined by the message index. Once consensus is reached, an executor is selected from the active agents through a double-selection process, ensuring fairness and efficiency.</td></tr></tbody></table>

### Scalable Transmitter Network

UIP supports infinite scalability by enabling the addition of new transmitter groups as blockchains are integrated into the network. This horizontal scaling allows UIP to handle increasing transaction volumes and network participation without compromising speed or efficiency.

### Transmitter Rotation

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FaPEunVnaYkoFsSL97ySV%2Ftransmitter%20rotation%20process.png?alt=media&amp;token=65a3b27b-2899-4753-b166-f309e58093fb" alt=""><figcaption></figcaption></figure>

UIP rotates transmitters regularly to ensure fairness, decentralization, and optimized performance. Rotation is based on staking size and recent activity, prioritizing higher-staked and active agents for message handling. This approach prevents any single agent or group from gaining excessive control, promoting a decentralized and secure network.


# Security and Consensus Mechanism

UIP introduces a two-tier consensus model:

* **Agent Signatures**: Regular agents execute and transmit messages across networks, ensuring that all operations are verified collectively to reduce risks of manipulation.
* **Super-Agent Signatures**: Super-agents validate transactions to add trust and mitigate risks, particularly in the protocol's early stages.

This consensus structure enhances network security by requiring signatures from both agents and at least one super-agent. When executing cross-chain messages, the process includes:

* **Transmitters Consensus**: Ensures reliable message delivery with sufficient gas for execution.
* **Executors Consensus:** Validates message legitimacy and appropriate pricing on the destination chain.

## Penalty System for Agent Downtime

To maintain network stability, UIP enforces a penalty system for agents experiencing extended downtime (over one hour). The penalties incentivize agents to maintain uptime, adopt proactive maintenance, and minimize service disruptions, enhancing the network's resilience and reliability.

## Smart Contract Immutability

The Master Smart Contract, UIP's immutable core, ensures tamper-resistance, transparency, and trust for seamless omnichain operations.

1. **Resistance to Tampering**: Once deployed on the blockchain, smart contracts cannot be altered or deleted. This immutability ensures that the terms of the contract remain intact and cannot be manipulated by any party, reducing the risk of fraud and unauthorized changes.
2. **Transparency**: The code of the smart contract is publicly accessible on the blockchain. This transparency allows all participants to view and verify the contract's terms, fostering trust among parties and minimizing disputes regarding contract interpretation.
3. **Reduced Risk of Manipulation**: Since smart contracts are self-executing and governed by code, there is little room for manipulation by external parties. This characteristic is particularly beneficial in scenarios where trust is a concern, as it ensures that outcomes are determined solely by the coded logic of the contract.


# Finality

Just because a transaction shows up on the blockchain doesn’t mean it’s set in stone — it can still be reversed or reorganized, depending on how the blockchain works. I.e., blockchains differ in their consensus mechanisms and finality times so while transactions may appear on-chain shortly after submission, they are not immediately secure from potential modifications or reversals. This impacts UIP's transaction speed.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FOoprJX53RbhJzJxGWeD7%2Ftransaction%20push.png?alt=media&amp;token=52e0f6f3-e9e7-4eeb-bdbb-c37aae09887b" alt=""><figcaption></figcaption></figure>

### Types of Finality

The finality of the source and destination blockchains plays a critical role in transaction execution latency. On fast-finality blockchains like [Avalanche](https://www.avax.network/) or [Cosmos](https://cosmos.network/), finality can occur in under a second, allowing near-instantaneous cross-chain interactions. Conversely, blockchains with slower finality, such as [Ethereum](https://ethereum.org/en/) or [Bitcoin](https://bitcoin.org/en/), introduce additional delays, which can range from minutes to hours depending on network conditions and the number of confirmations required.

Different blockchains have their own ways of deciding when a transaction is truly final, and these methods can vary a lot in terms of speed and security. Generally, there are two types of finality:

* **Determinisitic Finality** - Ensures that once a transaction is finalized, it cannot be undone. This type is common in Proof of Stake (PoS) and Proof of Authority (PoA) blockchains, which rely on validators reaching consensus to confirm a transaction's permanence. Deterministic finality offers users predictability and security, as transactions are finalized once specific protocol criteria are met, often within seconds to minutes.
* **Probabilistic Finality -** Typical in Proof of Work (PoW) blockchains, provides increasing certainty over time. Transactions become more secure as additional blocks are added on top of the block containing the transaction. While this model works effectively, it is slower than deterministic systems, often requiring minutes or even hours for practical finality.

### **Examples**

* [**Ethereum (PoS)**](https://ethereum.org/en/developers/docs/consensus-mechanisms/pos/) **-** Finality is reached when validators agree on "checkpoint" blocks, requiring a two-thirds majority for validation. Reverting a finalized block would require burning one-third of the total staked ether, making such attacks prohibitively expensive.
* [**Cosmos (Comet BFT)**](https://docs.cosmos.network/main/learn/intro/sdk-app-architecture) **-** Cosmos achieves near-instant finality through Byzantine Fault Tolerant consensus, finalizing blocks as soon as two-thirds of validators confirm them.
* [**Avalanche**](https://docs.avax.network/protocol/avalanche-consensus) **-** Employs probabilistic sampling, where validators repeatedly vote until a consensus is reached, achieving sub-second deterministic finality.


# Execution Latency

UIP sets a new standard for fast and efficient blockchain interactions by enabling ultra-fast message delivery between source and destination chains, depending on the source chain’s block confirmation times. This ensures rapid transaction finality across blockchains, making UIP the go-to solution for high-performance decentralized systems.

As a critical performance metric, execution latency measures the time from when a transaction is submitted to its execution and visibility on the target blockchain. UIP’s advanced architecture, featuring scalable multi-threaded messaging and intelligent transmitters, ensures seamless and reliable cross-chain operations. This section delves into how UIP's innovative design minimizes latency, offering developers and users unmatched speed and efficiency in omnichain applications.

For a deeper analysis, explore the details in our [whitepaper](https://entangle.fi/documents/UIP%20Whitepaper.pdf).

## **Latency Mitigation Techniques in UIP**

{% hint style="success" %}
Best Practices for Minimizing Latency

* For applications requiring low latency, developers can utilize blockchains with faster finality and lower congestion risks.
* Entangle's developer tools allow fine-tuning of transaction parameters like signature thresholds and finalization intervals.
  {% endhint %}

1. **Parallel Processing via L2 Utility Networks:**\
   UIP uses auxiliary blockchains to handle high transaction volumes, reducing congestion on the primary EIB chain.
2. **Transmitter Group Parallelism:**\
   Independent groups of transmitters process transactions simultaneously, optimizing throughput.
3. **Automated Gas Price Adjustments:**\
   UIP dynamically adjusts gas prices for destination transactions, balancing cost-efficiency with execution speed.

## Understanding Key Blockchain Factors

To better understand execution latency, consider familiarizing yourself with the terms below.&#x20;

* **Finality**: The point at which a blockchain transaction is considered permanent and cannot be reversed. Different blockchains achieve finality at varying speeds: some offer near-instant confirmation, while others require multiple blocks to be added for security assurance. Faster finality is crucial for time-sensitive applications like cross-chain messaging.
* **Network Congestion**: When too many transactions compete for limited blockchain resources, the network can become congested. This congestion slows transaction processing times and may lead to higher fees as users compete for priority. Common causes include sudden spikes in activity, such as NFT drops or token launches.
* **Gas Price**: Represent the fees users pay to incentivize validators to process their transactions. When the network is busy, higher gas prices are often required to secure faster processing, whereas low gas fees might result in significant delays during peak times.

## Transmitter Groups and Latency

UIP's architecture relies on a decentralized network of transmitters to facilitate seamless cross-chain communication. These transmitters are lightweight, modular, and optimized for minimal latency while maintaining security and scalability. The distributed nature of the transmitter groups ensure that latency is mitigated at each stage. While individual transmitters may experience delays due to specific factors (e.g., network congestion or execution costs), the architecture ensures that no single bottleneck affects the entire transaction lifecycle.

UIP introduces several optimizations to minimize transmitter latency across its network:

* **Parallel Processing**: Multiple transmitter groups handle transactions simultaneously, reducing bottlenecks.
* **Dynamic Resource Allocation**: Transmitters dynamically adjust resource usage based on network demand, ensuring high throughput during peak loads.
* **Efficient Consensus Mechanisms**: Lightweight Byzantine Fault Tolerant (BFT) consensus ensures quick decision-making without compromising security.

There are two primary functions of transmitters in UIP, regular **transmission** and **execution**, each performing essential functions to ensure seamless cross-chain communication. [Learn More](/universal-interoperability-protocol/architecture/scalability-and-network-stability/transmitter-groups) about transmitters.

## Transaction Lifecycle

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FTNBqCUlHCymGFZk80Qq9%2Fmessage_delivery_process.png?alt=media&amp;token=bcd7c131-c8c7-4a78-9366-43677e883de2" alt=""><figcaption><p>UIP Message Delivery Process</p></figcaption></figure>

The UIP transaction lifecycle consists of multiple stages, each contributing to overall execution latency.

1. **Event Detection**\
   Transmitters on the source blockchain monitor specified events, such as contract interactions or external data triggers. When an event is detected, it is fetched for processing. This step introduces minimal latency due to the polling or event-driven nature of transmitter monitoring. Latency could increase slightly under high network activity or if the transmitters are operating under resource constraints.
2. **Message Transmission**\
   Detected events are converted into messages and submitted to the Entangle Interoperable Blockchain (EIB), which manages consensus and routing and handles validation using the master smart contract. In this step, latency arises from the processing power of EIB and the inclusion time of the transaction in its blocks. For high-performance Layer 1 blockchains like EIB, this step is optimized to incur minimal delay.
3. **Consensus Mechanism**\
   UIP employs a dual-consensus model utilizing transmitters to ensure secure and decentralized validation. This process involves **Transmitters** and **Executor** Transmitters working in tandom, with support from **Super Transmitters** for additional oversight. For example, transmitters on chain A retrieve event data, validate it, construct a proposal, and sign it to ensure message authenticity. Next, executor transmitters execute the transaction on the destination chain, ensuring proper finalization. Super Transmitters validate the actions taken at each step, adding a layer of security and adherence to protocol standards.
4. **Execution on Destination Chain**\
   Once the proposal is validated and signed, executor transmitters retrieve it from the EIB and execute it on the destination chain. The latency at this stage depends on several factors, including network congestion, and gas price dynamics. On high-performance chains, execution can be completed in seconds, but slower chains or those under heavy load may introduce delays.


# Compatibility and Interoperability

## Upgrading To UIP

UIP ensures seamless migration from its predecessor so you can upgrade worry free. Users can switch by updating their endpoint address, and the old interface remains supported, reducing any transition barriers. It supports all EVM chains from the previous version and integrates Solana for high throughput and low transaction costs. The protocol is designed to expand as demand grows, fostering greater cross-chain functionality.

## Interoperability with Competing Interfaces

UIP is compatible with interfaces of competing cross-chain messaging protocols like LayerZero, Axelar,  and Wormhole, ensuring an easy transition for users seeking enhanced features and performance.


# Developer Guides

UIP is a modular interoperability protocol that enables seamless communication between EVM and non-EVM blockchains. It provides developers with secure, scalable, and customizable messaging tools for omnichain applications. With its dual-consensus architecture and dynamic scaling, UIP ensures reliable and efficient data transfer across networks.

Developers working on cross-chain applications or looking to enhance their dApps with omnichain functionality can explore our guides to get started with UIP. Each guide walks you through the setup and integration process step by step.

## Video Guides

For voiced over guides with full walk throughs you can check out our [YouTube](https://www.youtube.com/@entanglefi) page.

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>UIP Series Introduction</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FXzjx8Za0yL2GpUUeGwnT%2Fuip_series-2_720.jpg?alt=media&amp;token=700c47d9-2a8e-4935-92e5-d78defa1a56b">uip_series-2_720.jpg</a></td><td><a href="https://www.youtube.com/watch?v=BO4Mtsw_Xis">https://www.youtube.com/watch?v=BO4Mtsw_Xis</a></td></tr><tr><td>Environment Setup</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FStXogp9at685wX8jZWEO%2Fuip_series-1_720.jpg?alt=media&amp;token=945e2e23-b10f-460e-9544-968053bf4f39">uip_series-1_720.jpg</a></td><td><a href="https://www.youtube.com/watch?v=FGATDM3x_Lw">https://www.youtube.com/watch?v=FGATDM3x_Lw</a></td></tr><tr><td>Deploying Contracts &#x26; Sending Messages</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FchBrFAvUmqxIWK45Ksze%2Fuip_series_720.jpg?alt=media&amp;token=2c7d6f05-fb61-48b3-99fd-88eab1a23442">uip_series_720.jpg</a></td><td><a href="https://www.youtube.com/watch?v=eu0kHrCrvlk">https://www.youtube.com/watch?v=eu0kHrCrvlk</a></td></tr></tbody></table>

## Text Guides

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>Getting Started</td><td><a href="/universal-interoperability-protocol/developer-guides/getting-started">Getting Started</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FBHLQfcamMiy0VmPUfTVn%2FHow%20to%20Integrate.png?alt=media&amp;token=771b5356-1cff-468b-976c-093b462a1489">How to Integrate.png</a></td></tr><tr><td>Solidity Examples &#x26; Guides</td><td><a href="/universal-interoperability-protocol/developer-guides/solidity">Solidity</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FX7sBOyrKKQpKc8x2uIyq%2F1.png?alt=media&amp;token=004c2a87-863b-4c39-a9f7-ca20b23dee67">1.png</a></td></tr><tr><td>Solana Examples &#x26; Guides</td><td><a href="/universal-interoperability-protocol/developer-guides/solana">Solana</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FjfE9r6iHc1IIRQVPViv8%2FReport%20an%20Issue.png?alt=media&amp;token=53d6dd2a-0bc4-4e41-a4a0-6f98f5abaedb">Report an Issue.png</a></td></tr><tr><td>Calculate Cross-Chain Transaction Cost</td><td><a href="/universal-interoperability-protocol/developer-guides/calculate-cross-chain-transaction-cost">Calculate Cross-Chain Transaction Cost</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FvuAgFvZSPb1DSzXshMH9%2FContracts.png?alt=media&amp;token=cca5510d-0e23-4d7c-88d2-8cca7b3308b7">Contracts.png</a></td></tr><tr><td>Becoming a Transmitter</td><td><a href="broken://pages/ochsXZJBiv52Qx6olU7l">Broken link</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FNBDrUIfrYDlOKrHdpjmw%2FEntangle%20IDO%20Audit.png?alt=media&amp;token=72ae2a3e-e5f7-49d2-bb6e-3ca850f7a66f">Entangle IDO Audit.png</a></td></tr><tr><td>How to Debug Sent Messages</td><td><a href="/universal-interoperability-protocol/developer-guides/how-to-debug-sent-messages">How to Debug Sent Messages</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FX7sBOyrKKQpKc8x2uIyq%2F1.png?alt=media&amp;token=004c2a87-863b-4c39-a9f7-ca20b23dee67">1.png</a></td></tr><tr><td>Customizable Message Transmission Options</td><td><a href="/universal-interoperability-protocol/developer-guides/customizable-message-transmission-options">Customizable Message Transmission Options</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FdvBsmmwU7CBqGZUgu9ts%2F23.png?alt=media&amp;token=a25b9bca-e9b6-4d17-874a-0d34feff961c">23.png</a></td></tr><tr><td>SDK Setup</td><td><a href="/universal-interoperability-protocol/developer-guides/sdk-setup">SDK Setup</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FemwP69atNJAnhXWl66Vt%2F15.png?alt=media&amp;token=544a1f5a-9502-41fe-ad8a-a90987e7dca3">15.png</a></td></tr><tr><td>Revenue Sharing for Transmitters</td><td><a href="/universal-interoperability-protocol/developer-guides/revenue-sharing-for-transmitters">Revenue Sharing for Transmitters</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FiTBtPU7h0wY40nUD8Eya%2F20.png?alt=media&amp;token=b444ae25-86c4-42bf-a58c-f493d7bb28c0">20.png</a></td></tr><tr><td>How to Become a Super Transmitter</td><td><a href="/universal-interoperability-protocol/developer-guides/how-to-become-a-super-transmitter">How to Become a Super Transmitter</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F2tBC7XW2Y5eU8sF3Kjrj%2F5.png?alt=media&amp;token=a8a55284-771f-4a2c-abcf-d0f5556b9436">5.png</a></td></tr></tbody></table>


# Getting Started

{% hint style="info" %}
If you need technical guidance or wish to discuss your project's implementation, please reach out to us. Our committed team is available to assist with your projects and help ensure their success. For expert support, contact us via our [contact form](https://entangle.zendesk.com/hc/en-us/requests/new).
{% endhint %}

## Prerequisites

Before you begin, you'll need to ensure you're familiar with the concepts we'll be using for most of the guides. If you're unsure about anything, we recommend reading more via the provided links.&#x20;

* A crypto wallet like [MetaMask](https://metamask.io/) or [Coinbase](https://www.coinbase.com/en-sg/wallet).
* Basic knowledge of a version management system like [git](https://git-scm.com/).
* Understand the basics of [smart contracts](https://ethereum.org/en/learn/#smart-contracts).
* The guides will use the testnet. To deploy contracts and make calls, you'll need testnet funds, which you can obtain from public faucets ([Option 1](https://faucet.polygon.technology/), [Option 2](https://sepolia-faucet.pk910.de/), [Option 3](https://faucet.sepolia.mantle.xyz/), [Option 4](https://www.alchemy.com/faucets), [Option 5](https://cloud.google.com/application/web3/faucet/ethereum/sepolia)).

## Understanding the Basics

In a nutshell, as a Web3 developer planning to utilize UIP, you need to understand the basic architecture.

* You will need to deploy contracts on every network where your application will operate, and they should call the `Endpoints` methods.
* Through `Endpoints`, UIP will transmit your transactions and your clients’ transactions.
* `Endpoints` have interfaces that need to be followed.
* Your client will interact specifically with your contracts, while UIP will only deliver the messages.

### Application Architecture

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F2a918WUP0Q8rBKacxL1O%2Fapplication_architecture.jpg?alt=media&amp;token=c5816a68-5f66-4545-99e0-8e544af31cbf" alt=""><figcaption></figcaption></figure>

To use UIP, you first need to implement logic for handling crosschain operations within your smart contracts and connect them to the UIP Endpoint interface.

Once this is done, the process is as follows:

1. A user initiates a transaction on the source chain. This transaction includes a payload with information for execution on the destination chain.
2. Your smart contract on the source chain calls the 'propose' function of the UIP Endpoint contract. This notifies the network about the new message.
3. The message is verified and delivered to the destination chain. The Transmitter executes the message by calling the 'execute' function of the UIP Endpoint. During this stage, the message also undergoes a Transmitter signatures verification process.
4. After all security checks are passed, the message is passed through the Endpoint to your smart contract on the destination chain.

## Next Steps

Now that you understand the basics, you can begin deploying your protocol. For more details, refer to the [EVM](/universal-interoperability-protocol/developer-guides/solidity/deploying-your-custom-evm-protocol) or [Solana](/universal-interoperability-protocol/developer-guides/solana) protocol deployment guide. Alternatively, if you're looking for inspiration, explore the [Use Cases](/universal-interoperability-protocol/overview#omnichain-use-cases-with-uip) section of the [Overview](/universal-interoperability-protocol/overview) page to see what's possible with UIP.

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>Deploying Your EVM Protocol</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FUch7rkjMD1NZoEsCM0kr%2F9.png?alt=media&amp;token=140b6450-978e-49e5-b627-584e8ba86060">9.png</a></td><td><a href="/universal-interoperability-protocol/developer-guides/solidity/deploying-your-custom-evm-protocol">Deploying Your Custom EVM Protocol</a></td></tr><tr><td>Deploying Your Solana Protocol</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F0vpc5AKUALEFTWBs8nCL%2F19.png?alt=media&amp;token=a15d31df-229d-4ff8-b054-6c8492a54234">19.png</a></td><td><a href="/universal-interoperability-protocol/developer-guides/solana">Solana</a></td></tr><tr><td>Build the Future</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F3CvPZgHBoPU3SRWYZEXV%2F30.png?alt=media&amp;token=177ed72a-8096-425b-aa7c-01188f533ed6">30.png</a></td><td><a href="broken://pages/US1cwBwIqEddf1iWHrrF">Broken link</a></td></tr></tbody></table>


# Solidity

This section provides Solidity examples and guides to help developers integrate with Entangle’s Universal Interoperability Protocol (UIP).

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>Simple Abstract Messenger Example</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FemwP69atNJAnhXWl66Vt%2F15.png?alt=media&amp;token=544a1f5a-9502-41fe-ad8a-a90987e7dca3">15.png</a></td><td><a href="/universal-interoperability-protocol/developer-guides/solidity/simple-abstract-messenger-example">Simple Abstract Messenger Example</a></td></tr><tr><td>Deploying Your Custom EVM Protocol</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FUch7rkjMD1NZoEsCM0kr%2F9.png?alt=media&amp;token=140b6450-978e-49e5-b627-584e8ba86060">9.png</a></td><td><a href="/universal-interoperability-protocol/developer-guides/solidity/deploying-your-custom-evm-protocol">Deploying Your Custom EVM Protocol</a></td></tr><tr><td>Bridging Tokens with UIP</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F2NrO9wvrVp6M069jLWgS%2F6.png?alt=media&amp;token=05375e06-8f39-4e6b-b915-4f0c6d66ab39">6.png</a></td><td><a href="/universal-interoperability-protocol/developer-guides/solidity/bridging-tokens-with-uip">Bridging Tokens with UIP</a></td></tr><tr><td>Become an EVM  Transmitter</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FfB53jHXnjKjUcykH8Fbd%2F7.png?alt=media&amp;token=35b19cfe-4c37-43d2-9f25-07353cf45e90">7.png</a></td><td></td></tr></tbody></table>


# Simple Abstract Messenger Example

{% hint style="info" %}
If you have any questions or need assistance, please feel free to use our [contact form](https://entangle.zendesk.com/hc/en-us/requests/new) to connect with an expert on our team.
{% endhint %}

An effective implementation of blockchain interoperability is sending cross-chain messages. Traditionally, without UIP, this would be a challenging task. However, UIP makes this an easy and safe process. This guide walks you through building a simple dApp that utilises UIP to send cross-chain text messages with [EVM](https://ethereum.org/en/developers/docs/evm/) smart contracts.

For this guide, we won't need to worry about fees as we will deploy two smart contracts on the testnet — one on the Ethereum Sepolia testnet and the other on the Polygon Amoy network.&#x20;

## Prerequisites

Before you begin, you'll need to enure you're familiar with the concepts and have the tools we'll be using for this guide. If you're unsure about anything, we recommend reading more via the provided links.&#x20;

* The [Solidity](https://soliditylang.org/) programming language.
* The [Hardhat](https://hardhat.org/) development environment.

We will be using the following native tokens:

* [Ethereum Sepolia](https://www.alchemy.com/faucets/ethereum-sepolia)
* [Polygon Amoy](https://www.alchemy.com/faucets/polygon-amoy)

Click on the respective token to be taken to a public faucet and complete the steps to acquire the necessary funds in your wallet.

## Environment Setup

To begin with, let's setup the working environment. We'll initialize the Hardhat project and configure the environment file with the necessary information.

{% stepper %}
{% step %}
Clone the example project from GitHub.

```bash
git clone https://github.com/Entangle-Protocol/UIP-examples.git
```

{% endstep %}

{% step %}
Change your directory to the project folder.

```bash
cd UIP-examples/other/Messenger/EVM
```

{% endstep %}

{% step %}
Install the dependencies.

```bash
npm install
```

{% endstep %}

{% step %}
You can setup your wallet details using a mnemonic phrase (default) or a private key. Below we describe the configuration process for each type.

Since the same wallet can be used across multiple networks, there's no need to add separate wallets. However, if you're alternating between working on Testnet and Mainnet you have to make sure you update the *.env* file to specify wallet details for both.

{% tabs %}
{% tab title="Mnemonic Phrase" %}
{% hint style="warning" %}
Ensure spaces are included between words for your mnemonic phrase.&#x20;
{% endhint %}

The mnemonic phrase is configured in the *.env* file and is used by default. You may need to create this file in your root directory if it's missing.

Please specify details for Testnet and Mainnet individually as described below.

{% code title=".env" %}

```
TESTNET_MNEMONIC = ""
MAINNET_MNEMONIC = ""
```

{% endcode %}
{% endtab %}

{% tab title="Private Key" %}
By default the *hardhat.config.ts* file is configured to use the mnemonic phrase. Therefore, users who prefer to use the private key should make the changes described below.

Change the following variables:

* `process.env.TESTNET_MNEMONIC` to `process.env.TESTNET_PK`
* `process.env.MAINNET_MNEMONIC` to `process.env.MAINNET_PK`

For example:

{% code title="hardhat.config.ts" %}

```typescript
ethereum_sepolia: {
    url: "https://ethereum-sepolia-rpc.publicnode.com",
    accounts: [
        process.env.TESTNET_PK || ""
    ],
    chainId: 11155111
}
```

{% endcode %}

Next you need to configure the private key in the *.env* file. You may need to create this file in your root directory if it's missing.

Please specify details for Testnet and Mainnet individually as described below.

{% code title=".env" %}

```
TESTNET_PK = ""
MAINNET_PK = ""
```

{% endcode %}
{% endtab %}
{% endtabs %}
{% endstep %}
{% endstepper %}

## Deploying Contracts

Once the environment has been successfully setup we can begin deploying contracts. Before beginning, double check to make sure your environment variables are all correct.

Hardhat makes it easy to deploy contracts, simply run the commands below.

{% stepper %}
{% step %}
Deploy the Ethereum Sepolia contract.

```bash
npx hardhat run scripts/deployMessenger.ts --network ethereum_sepolia
```

{% endstep %}

{% step %}
Deploy the Polygon Amoy contract.

```bash
npx hardhat run scripts/deployMessenger.ts --network polygon_amoy
```

{% endstep %}
{% endstepper %}

<details>

<summary>Example Deployment Log</summary>

After deploying the contract using the Hardhat run command, a log will confirm the successful deployment. Some values have been shortened (indicated by "...") for readability.

```
Using network: mantle_sepolia

ChainID mantle_sepolia: 5003

Signer: 0xB3...AF
Signer native balance: 98.477296506288888787

Deploying MessengerProtocol
With args: 0xB3...AF,0x5C...FB

MessengerProtocol deployed to: 0xf6...28
MessengerProtocol implementation deployed to: 0x49...d7


Data successfully saved to ./addresses/mantle_sepolia/MessengerProtocol.json
```

The *MessengerProtocol* file will also be generated, containing the addresses mentioned in the log. You can find it in the following directory:

```
EVM/addresses/ethereum_sepolia/MessengerProtocol.json
```

The deployment address is required for sending messages using Hardhat in the next section of this guide, so it's recommended to note or save the *MessengerProtocol* deployment address.

</details>

## Sending and Receiving Messages

In this section, we'll take a look at sending and receiving messages.

### Sending Messages

{% hint style="info" %}
The Chain ID specifies that the message is being sent to the Polygon Amoy chain. For a complete list of chain IDs, you can refer to [ChainList](https://chainlist.org/). Make sure to check the "Include Testnets" box to show testnet chains.&#x20;
{% endhint %}

To send a message from the source chain (Ethereum Sepolia) to the destination chain (Polygon Amoy) copy the below command, update the address of the deployed contract on Polygon Amoy and run it.

```
npx hardhat sendMessage --destchainid 80002 --destaddress <address of deployed contract on polygon amoy> --message "hello" --network ethereum_sepolia
```

By default, we use our recommended transmitter settings when sending messages. If you are familiar with the [customizable message transmission options](/universal-interoperability-protocol/developer-guides/customizable-message-transmission-options) and prefer manual configuration, your command will include two additional arguments:

```
npx hardhat sendMessage --destchainid <destination_chain_id> --destaddress <destination_address> --message <message> --finalization <block_finalization_option> --gaslimit <custom_gas_limit> --network <network_name>
```

<details>

<summary>Example Transaction Log</summary>

```
Using network: polygon_amoy
signer: <your sender wallet address>
Deployment address loaded from
        ./addresses/polygon_amoy/MessengerProtocol.json

===============================================
ContractTransactionReceipt {
  provider: HardhatEthersProvider {
    _hardhatProvider: LazyInitializationProviderAdapter {
      _providerFactory: [AsyncFunction (anonymous)],
      _emitter: [EventEmitter],
      _initializingPromise: [Promise],
      provider: [BackwardsCompatibilityProviderAdapter]
    },
    _networkName: 'polygon_amoy',
    _blockListeners: [],
    _transactionHashListeners: Map(0) {},
    _eventListeners: [],
    _isHardhatNetworkCached: false,
    _transactionHashPollingTimeout: undefined
  },
  to: <address of deployed contract on polygon amoy>,
  from: <your sender wallet address>,
  contractAddress: null,
  hash: '0x183c0b7d69511c556e171347fe28c1b96b5980623d1959d7845a395617c94401',
  index: 1,
  blockHash: '0xccf0a95c60edc064e3499b80562719b1f3606041fbcd4005783b6e587bc0f0cf',
  blockNumber: 14901297,
  logsBloom: '0x0000400000000000001000000400000000000000000000000000000000000000000000000000000000000010000000000010a000000000000000000000000000000000000000000000000000010000800020000000000000100100000020000000000200000000000000000000000000040000000000000080000000000000000000000000000000000000000000000000000000000000000000000001000000200000000000000000000000000000000000000000040000000000000000004000400000000000000001000000000020000002000000800000108000000000000000001000000000000000000000000000000000400000000000000000100000',
  gasUsed: 56902n,
  blobGasUsed: undefined,
  cumulativeGasUsed: 211811n,
  gasPrice: 50284800008n,
  blobGasPrice: undefined,
  type: 2,
  status: 1,
  root: undefined
}
===============================================
Operation proposed to chain 11155111 to address 0x1091029fCF0fa1d67037c6D84206c796A967cF7F with message: "hello"
```

</details>

### Receiving Messages

To read the last message on the destination chain (in this example it's Polygon Amoy) copy the below command, update your sender wallet address and run it.

```
npx hardhat getLastMessage --sender <your sender wallet address> --network polygon_amoy
```

<details>

<summary>Expected Result</summary>

```
Last message from address <your sender wallet address> is: "hello"
```

</details>

## Conclusion

In this guide we created a DApp utilising EVM contracts to facilitate in cross-chain text messaging between the [Ethereum Sepolia](https://www.alchemy.com/faucets/ethereum-sepolia) and [Polygon Amoy](https://www.alchemy.com/faucets/polygon-amoy) chains.


# Deploying Your Custom EVM Protocol

This guide provides step-by-step instructions on how to deploy your custom EVM protocol. By following these steps, you can successfully deploy your custom EVM protocol across multiple chains. If you encounter issues, refer to the [Troubleshooting](#troubleshooting) section of this guide and the [How to Debug Sent Messages](/universal-interoperability-protocol/developer-guides/how-to-debug-sent-messages) guide or reach out to us through our [contact form](https://entangle.zendesk.com/hc/en-us/requests/new).

## Prerequisites

Before deployment, ensure you are familiar with payable functions in [Solidity](https://soliditylang.org/) and have initiated a [Hardhat](https://hardhat.org/) project.

## Package Installation

To streamline development, start by installing the Entangle Labs UIP Contracts [NPM](https://www.npmjs.com/package/@entangle-labs/uip-contracts) package. It includes ready-to-use code and interfaces for deployment.

```bash
npm install @entangle-labs/uip-contracts
```

## Deployment Steps

{% stepper %}
{% step %}

### Endpoint Contract Address

Obtain the endpoint contract address for the chain where you plan to deploy your protocol. You can find endpoint addresses for each connected chain in the Entangle Labs UIP Contracts NPM package.

For testnet, they are located in the following folder:

```
@entangle-labs/uip-contracts/addresses/testnet/
```

For mainnet, they are located in the following folder:

```
@entangle-labs/uip-contracts/addresses/mainnet/
```

{% endstep %}

{% step %}

### Interfaces and Libraries

Ensure the following imports are included in your contract:

```solidity
import {IEndpoint, TransmitterParams} from "@entangle-labs/uip-contracts/contracts/interfaces/endpoint/IEndpoint.sol";
import "@entangle-labs/uip-contracts/contracts/lib/SelectorLib.sol";
```

{% endstep %}

{% step %}

### Default Selector Variable

To interact with the Endpoint properly, you need to send message with the correct selector to call its "execute" function. Make sure it's included in your contract like so:

```solidity
bytes4 public constant DEFAULT_SELECTOR = bytes4(keccak256("execute(bytes calldata)"));
```

{% endstep %}

{% step %}

### Payable Function to Send Proposals

{% hint style="warning" %}
Read [this](/universal-interoperability-protocol/developer-guides/customizable-message-transmission-options#encoded-parameter-option-definitions) section to learn more about the `propose` function, its parameters and the customizable message transmission options.
{% endhint %}

Develop a payable function that interacts with the endpoint. For example, sending a message to the endpoint requires calling the `propose` function using the `IEndpoint` interface:

```solidity
IEndpoint(endpoint).propose{value: msg.value}(
    chainID,
    SelectorLib.encodeDefaultSelector(DEFAULT_SELECTOR),
    encodedParams,
    destAddress,
    abi.encode(abi.encode(_msg), abi.encode(_msgSender()))
);
```

{% endstep %}

{% step %}

### Receive and Execute Messages

{% hint style="warning" %}
This step will only apply if your contract is designed to receive messages too.
{% endhint %}

The receiving contract must implement the `MessageReceiver` interface, which you can find in `@entagle-labs/uip-contracts` npm package — installed in the [Package Installation](#package-installation) step — specifically the `execute` function:

```solidity
function execute(bytes calldata data) external override payable
```

The `execute` function processes the received payload. Note that the Endpoint contract should have access control to this function. Make sure that your contract imports `MessageReceiver` and inherits from it, for example:

```solidity
import {MessageReceiver} from "@entangle-labs/uip-contracts/contracts/MessageReceiver.sol";
contract ExampleProtocol is MessageReceiver
```

Below, we provide the `MessageReceiver` code for convenience. Please refer to the package for the most up-to-date version.

<details>

<summary>MessageReceiver Code</summary>

```solidity
abstract contract MessageReceiver {
    /**
     * @dev Executes a function call from a specified source chain and address.
     *
     * This external function is intended to be used for executing cross-chain
     * calls with the provided payload. It requires to be overridden by child contracts to execute the command
     * @param data The data payload to be sent along with the function call.
     *
     */
    function execute(bytes calldata data) external payable virtual {}

    function _decode(
        bytes calldata data
    )
        internal
        virtual
        returns (
            uint256 sourceChainId,
            bytes memory senderAddr,
            bytes memory payload
        )
    {
        (sourceChainId, senderAddr, payload) = abi.decode(
            data,
            (uint256, bytes, bytes)
        );
    }
}
```

</details>
{% endstep %}
{% endstepper %}

## Troubleshooting & Notes

This section provides information, tips, and solutions for common issues you may encounter while deploying the protocol.

<details>

<summary>Deployment Failure</summary>

1. **Check the signer account balance**: Ensure the account has enough native currency on the target blockchain for deployment.
2. **Verify the credentials**: Double-check that you've correctly pasted the mnemonic phrase or private key in the `hardhat.config.ts` file under the appropriate chain section.
3. **Compile before deploying**: Run `npx hardhat compile` before deployment. If it fails, thoroughly check your contract for compilation errors.

</details>

<details>

<summary>Sending Message Failure</summary>

1. **Check the signer account balance**: Ensure the account has sufficient native currency for transactions.
2. **Verify the installed package version**: Make sure you have the latest version of the `@entangle-labs/uip-contracts` npm package installed. To check the latest version, visit the official [npm page](https://www.npmjs.com/package/@entangle-labs/uip-contracts).
3. **Confirm function signature compliance**: Ensure your contract correctly follows the `propose` function signature in the Endpoint contract:

   ```solidity
   function propose(
       uint256 destChainID, 
       bytes32 selectorSlot, 
       bytes calldata transmitterParams, 
       bytes calldata destAddress, 
       bytes calldata payload
   ) external payable;
   ```

</details>

<details>

<summary>Message Not Reaching Destination Contract</summary>

1. **Check destination chain support:** Ensure that the destination chain is currently supported.
2. **Retrieve message hash:** Use the following command to obtain the TEIB transaction hash for your message: [`npx hardhat getMsgHash`](/universal-interoperability-protocol/developer-guides/how-to-debug-sent-messages#retrieving-proposal-and-message-hash)
3. **Check message status:** Once you have the hash, use: [`getMsgStatusByHash`](/universal-interoperability-protocol/developer-guides/how-to-debug-sent-messages#check-message-status-by-hash)

**Message Status Explanations**

* **NOT\_INITIALIZED**: This indicates that the message was not proposed by the Endpoint on the source chain. Verify that the Endpoint address in your contract matches the official Endpoint address for your source chain.
* **PROTOCOL\_FAILED**: This occurs when the destination protocol is incompatible with the destination Endpoint. Ensure that the destination protocol implements the `MessageReceiver` interface (as described in the [Receiver Contract Requirements](#receiver-contract-requirements) section).
* **UNDERESTIMATED**: This status means that the source transaction’s `msg.value` was too low to cover gas costs on the destination chain. Try resending the message with a higher `msg.value`.
* **OUT\_OF\_GAS**: This means that the `customGasLimit` in the source transaction was too low, causing the execution on the destination chain to consume more gas than provided. Try resending the message with a higher `customGasLimit`.

</details>

<details>

<summary>Transaction Delivery Fee and Currency</summary>

All transactions use the native currency of the chain you're working on. The`msg.value` sent during the `propose` call is considered the combined delivery fee.

</details>

<details>

<summary>Package Referencing Issues</summary>

Ensure all configurations adhere to the latest documentation and libraries provided in the `@entangle-labs/uip-contracts` package.

</details>


# Bridging Tokens with UIP

This guide walks you through building a simple dApp that utilizes UIP to bridge tokens across different EVM-based blockchains. We will deploy an ExampleToken smart contract and use a Hardhat task to transfer tokens between chains.

## Prerequisites

Before you begin, ensure you have the following:

* Familiarity with Solidity and Hardhat.
* Node.js and npm installed.
* Native coins.

## Environment Setup

First, clone the repository and install dependencies:

```bash
git clone https://github.com/Entangle-Protocol/UIP-examples.git
cd UIP-examples/Token/FT/EVM
npm install
```

Next, configure your environment by updating the \`hardhat.config.ts\` file with your mnemonic phrase and RPCs:

{% hint style="info" %}
Note: In this guide, we deploy the ExampleToken on Ethereum Sepolia and Polygon Amoy for demonstration purposes only. You can choose any networks that best suit your requirements.
{% endhint %}

```java
ethereum_sepolia: {
    url: "your_rpc",
    accounts: { mnemonic: "your mnemonic here", },
    chainId: 11155111
}
polygon_amoy: { 
    url: "your_rpc",
    accounts: { mnemonic: "your mnemonic here", },
    chainId: 80002
}

```

## Deploying Contracts

Once your environment is set up, deploy the ExampleToken to Ethereum Sepolia and Polygon Amoy:

```
npx hardhat run scripts/deployExampleToken.ts --network ethereum_sepolia
npx hardhat run scripts/deployExampleToken.ts --network polygon_amoy
```

## Setting Origins

Before sending tokens, you need to set the token contract from another chain as an origin.

Run the following Hardhat task to set an origin:

```
npx hardhat setOrigin --destnetwork <other_network_name_as_per_hardhat_config> --network <current_network>
```

You need to run this task for both networks.

## Sending Tokens via Bridge

To transfer tokens from Ethereum Sepolia to Polygon Amoy, use the Hardhat task:

```
npx hardhat sendTokens --tochainid 80002 --to <receiver_address_on_Polygon_Amoy> --amount 100 --network ethereum_sepolia
```

This task:

* Fetches the ExampleToken contract.
* Sets the origin address if not already set.
* Calls the \`bridge\` function to send tokens.

Keep in mind that token has 18 decimals.

## Verifying Transactions

Check the logs to ensure the transaction is successful. You should see an output similar to:

{% code overflow="wrap" %}

```
100 tokens sent to chain 80002 to address 0xRecipient from chain 11155111 from address 0xSender
```

{% endcode %}

To verify the received tokens, check the destination chain’s block explorer.

## Summary

This guide demonstrated how to deploy and interact with a cross-chain token bridging contract using UIP. With this setup, you can seamlessly transfer assets across different EVM-compatible blockchains.


# Become an EVM Transmitter

Transmitters function as lightweight nodes that facilitate message transmission and execution of transactions across connected blockchain networks. They are responsible for signing message requests, ensuring secure and verified communication. Each transmitter operates tethered to a specific blockchain, which allows them to specialize in that network's protocols.

Transmitters can operate across multiple networks but are limited to a single network's parameters at any given time. Their dual role as transmitters and executors enables them to cover processing costs for transactions, enhancing the efficiency of the UIP messaging system.

On the other hand, Super Transmitters provide an additional layer of oversight and security within the UIP framework. Unlike transmitters, super-transmitters do not execute transactions; instead, they oversee the transaction process by confirming or rejecting messages originating from transmitters. This role is crucial for mitigating potential fraudulent activities, as super-transmitters enhance scrutiny and governance without being directly involved in transaction execution. Super-transmitters may include public figures or reputable organizations, adding credibility to the protocol's operations. Their independent function strengthens the overall decentralization and security of the UIP messaging system, ensuring that transactions are thoroughly vetted before proceeding.

## Dependencies

Before beginning make sure to install all of the necessary dependencies and tools. In this guide we'll be using several, including:

* [libusd](https://libusb.sourceforge.io/api-1.0/index.html), an open source library that allows communication with USB devices fom user space.
* [foundry](https://github.com/foundry-rs/foundry), a modular toolkit for Ethereum application development.
* [docker](https://www.docker.com/), a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers.

{% tabs %}
{% tab title="Mac" %}

```bash
brew install libusb
curl -L https://foundry.paradigm.xyz | bash
foundryup
```

{% endtab %}

{% tab title="Linux" %}
{% hint style="warning" %}
For the Zsh shell, use source "\~/.zshenv" instead of source "\~/.bashrc".
{% endhint %}

```bash
sudo apt update
sudo apt install curl build-essential libssl-dev pkg-config
sudo apt install libusb-1.0-0-dev
curl -L https://foundry.paradigm.xyz | bash
~./bashrc  
foundryup
```

{% endtab %}
{% endtabs %}

To verify the successful installation of dependencies, you can run the following command.

```bash
cast --version
```

If everything was successfully installed, the output should be the version of the cast command, as shown below.

```
cast 0.2.0 (31c24b0 2024-11-14T00:20:56.080456000Z)
```

## 1. Registration

Make sure that you have the native network token on Entangle and that you have added the Entangle network address to your wallet.

* Node:  [https://json-rpc.entangle.fi](https://json-rpc.entangle.fi/)
* Chain Id:  33033

Now run the cast command described below to register the transmitter.

```bash
cast send 0xB83E7753CAB418775f0dc91ACfcfECba24FE62C1 \
  "registerAgentOneKeyEVM(uint,address)" <chain_id> <agentaddress> \
  -r "https://json-rpc.entangle.fi" \
  --private-key <your key>
```

<details>

<summary>Command Parameter Explanation</summary>

The cast command includes several parameters, here we've described them.

1. The HEX address at the begining is the address of our AgentRegistrator contract.
2. \<agent address> is the wallet address which you plan to make an agent.
3. \<chainID> is the blockchain ID where the agent will be deployed.
4. \<your key> is the wallet’s private key.

</details>

You will receive a success message, as described below, if your transmitter is successfully registered.

```
status 1 (success)
```

## 2. Security Deposit

To ensure your transmitter works as expected you are required to stake a security deposit. A minimum of 100 NTGL is required.

Run the cast command again but this time with the follow parameters.

```
cast send 0x2897F9093bE0B5d5F9067c6f7842B949017eE830 \
  "deposit(uint256,address,uint256)" <chainID> <agent-address> <wntgl-value>\
  -r https://json-rpc.entangle.fi \
  --private-key <your key> --value <ntgl-value>
```

<details>

<summary>Command Parameter Explanation</summary>

{% hint style="warning" %}
Set WNTGL amount to 0 if you want to use NTGL for staking and vice versa, set NTGL amount to 0 if you want to use WNTGL for staking.
{% endhint %}

The cast command includes several parameters, here we've described them.

1. The HEX address at the begining is the address of the RewardVaults contract which is responsible for distributing rewards among UIP participants
2. \<chainID> is the blockchain ID where the agent will be deployed.
3. \<agent-address> is the wallet address which you plan to make an agent.
4. \<ntgl-value> is the amount of security deposit (in wei) min 100 NTGL.
5. \<wntgl-value> is the amount of security deposit (in wei) min 100WNTGL&#x20;
6. \<your key> is the wallet’s private key.

</details>

You will receive a success message, as described below, if you have successfully staked your security deposit.

```
status 1 (success)
```

## 3. Docker Environment Setup

To simplify this process, we've created a docker image. In this part we will describe how to install and setup docker.

{% tabs %}
{% tab title="Ubuntu" %}
{% stepper %}
{% step %}
Update the system.

```bash
sudo apt update && sudo apt upgrade -y
```

{% endstep %}

{% step %}
Install dependencies.

```bash
sudo apt install -y ca-certificates curl gnupg
```

{% endstep %}

{% step %}
Add the official Docker GPG key.

{% code overflow="wrap" %}

```bash
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo tee /etc/apt/keyrings/docker.asc > /dev/null
sudo chmod a+r /etc/apt/keyrings/docker.asc
```

{% endcode %}
{% endstep %}

{% step %}
Add the Docker repository.

{% code overflow="wrap" %}

```bash
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
```

{% endcode %}
{% endstep %}

{% step %}
Install Docker and Docker Compose.

{% code overflow="wrap" %}

```bash
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
```

{% endcode %}
{% endstep %}

{% step %}
Verify the installation.

```bash
docker --version
docker compose version
```

{% endstep %}

{% step %}
Add the current user to the Docker group (to run commands without using sudo).

```bash
sudo usermod -aG docker $USER
```

{% endstep %}

{% step %}
Then log out and log back in, or run.

```bash
newgrp docker
```

{% endstep %}
{% endstepper %}
{% endtab %}

{% tab title="Mac" %}
{% stepper %}
{% step %}
Install Docker via Homebrew

```
brew install --cask docker
```

{% endstep %}

{% step %}
Launch Docker Desktop

Simply find it in your applications and open it.
{% endstep %}

{% step %}
Verify the installation

```
docker --version
docker compose version
```

{% endstep %}
{% endstepper %}
{% endtab %}
{% endtabs %}

## 4. Starting the Transmitter

{% stepper %}
{% step %}
Update the docker image.

```
docker pull msentangle/agent:3.0
docker pull msentangle/agent-setup:3.0
```

{% endstep %}

{% step %}
Create a directory for the transmitterand move to it.

```
mkdir transmitter  
cd transmitter  
```

{% endstep %}

{% step %}
Start the transmitter.

{% hint style="warning" %}
If you want this transmitter to be a super transmitter you need to specify "-e IS\_SUPER\_AGENT=true".
{% endhint %}

```
docker run --rm \
  -v $(pwd)/.:/app/agent/ \
  -e PRIVATE_KEY="yourprivatekey" \
  -e PASSWORD="yourpassword" \
  -e EVM_CHAINS="<chain_id>" \
  msentangle/agent-setup:3.0
```

<details>

<summary>Command Parameter Explanation</summary>

1. **EVM\_CHAINS** is used to specify the chain Id of the network where you want to deploy your agent.
2. **yourprivatekey** is your wallet's private key.
3. **yourpassword** is your desired password to encrypt the private key.

</details>

After the successful execution of the program, you will see the message:

```
Your Address: 0x1C414914bAc557B7980db4184594867E1dfca359 please check correct

11:43AM WRN > contract has no events Contract Name=Slasher
...
```

{% endstep %}
{% endstepper %}

## Choosing a Transmitter Name

You can also set a unique name for your agent to more easily distinguish it. Run the below command to do so.

```
docker-compose -p <agent-name> up -d
```

<details>

<summary>Command Parameter Explanation</summary>

1. \<agent-name> is where you provide the unique name for the agent (e.g. agent-sonic-1).

</details>

## Change Round

To change the round, run the following command.

{% code overflow="wrap" %}

```
docker exec -it <agent-name>-evm_agent-1 sh -c "apk add curl && curl 'http://localhost:9131/turnround?chainId=<chain_id>'"
```

{% endcode %}

<details>

<summary>Command Parameter Explanation</summary>

1. \<agent-name> the name of the agent (e.g. agent-sonic-1).
2. \<chain\_id> is the blockchain Id (for Sonic, use 146).

</details>

## Changing Blockchain Providers

You can change blockchain providers (RPC nodes) by modifying the *source.config.yaml* file.&#x20;

{% code title="source.config.yaml" %}

```yaml
evmchains_tolisten:
    - chain_id: "80002"
      name: Polygon Amoy
      rpc_http_urls:
        - https://polygon-amoy.gateway.tenderly.co
        - https://polygon-amoy.gateway.tenderly.co
        - https://polygon-amoy.gateway.tenderly.co
```

{% endcode %}

### Additional Configuration Parameters

Below are additional configuration parameters you can use for the blockchain provider source configuration file.

<table><thead><tr><th width="246.00006103515625">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>parse_new_headers_interval</td><td>How often to update blockchain information (e.g.,  5s,  1m).</td></tr><tr><td>max_query_in_batch</td><td>The number of requests in a single batch request.</td></tr><tr><td>filter_logs_max_blocks</td><td>The maximum difference between fromBlock  and toBlock.</td></tr><tr><td>blocks_delay</td><td>The maximum difference between block shifts.</td></tr><tr><td>blocks_batch_to_filter</td><td>The minimum number of blocks to process.</td></tr><tr><td>min_balance_to_alert</td><td>The minimum wallet balance for notifications (in wei).</td></tr></tbody></table>

## Troubleshooting

<details>

<summary>Error Code -32000</summary>

Make sure there are enough native tokens in the wallet to cover the transaction fees.

</details>

<details>

<summary>Git Command Not Found</summary>

Install git using the command below.

```bash
sudo apt install git -y
```

</details>


# Solana

This section provides Solana examples and guides to help developers integrate with Entangle’s Universal Interoperability Protocol (UIP).

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>Simple Abstract Messenger Example</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FemwP69atNJAnhXWl66Vt%2F15.png?alt=media&amp;token=544a1f5a-9502-41fe-ad8a-a90987e7dca3">15.png</a></td><td><a href="/universal-interoperability-protocol/developer-guides/solana/simple-abstract-messenger-example">Simple Abstract Messenger Example</a></td></tr><tr><td>Deploying Your Custom Solana Protocol</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FUch7rkjMD1NZoEsCM0kr%2F9.png?alt=media&amp;token=140b6450-978e-49e5-b627-584e8ba86060">9.png</a></td><td><a href="/universal-interoperability-protocol/developer-guides/solana/deploying-your-custom-solana-protocol">Deploying Your Custom Solana Protocol</a></td></tr><tr><td>Become a Solana Transmitter</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FfB53jHXnjKjUcykH8Fbd%2F7.png?alt=media&amp;token=35b19cfe-4c37-43d2-9f25-07353cf45e90">7.png</a></td><td><a href="/universal-interoperability-protocol/developer-guides/solana/become-a-solana-transmitter">Become a Solana Transmitter</a></td></tr></tbody></table>


# Simple Abstract Messenger Example

{% hint style="info" %}
If you have any questions or need assistance, please feel free to use our [contact form](https://entangle.zendesk.com/hc/en-us/requests/new) to connect with an expert on our team.
{% endhint %}

An effective implementation of blockchain interoperability is sending cross-chain messages. Traditionally, without UIP, this would be a challenging task. However, UIP makes this an easy and safe process. This guide walks you through deploying a simple dApp that utilizes UIP to send cross-chain text messages between [Solana](https://solana.com/) and other networks.

For this guide, we won't need to worry about fees as we will deploy the smart contracts on devnet, which is the commonly used Solana testnet network.

## Prerequisites

Before you begin, you'll need to ensure you're familiar with the concepts and have the tools we'll be using for this guide. If you're unsure about anything, we recommend reading more via the provided links.&#x20;

* The [Rust](https://www.rust-lang.org/) programming language.
* The [Anchor](https://www.anchor-lang.com/docs) development environment.
* The [Bun](https://bun.sh/) toolkit.

We will be using the following native token:

* [Solana SOL](https://faucet.solana.com/)

Click on the token to be taken to its public faucet and complete the steps to acquire the necessary funds in your wallet.

## Environment Setup

To begin with, let's setup the working environment.

{% stepper %}
{% step %}
Clone the example project from GitHub.

```bash
git clone https://github.com/Entangle-Protocol/UIP-examples.git
```

{% endstep %}

{% step %}
Change your directory to the project folder.

```bash
cd UIP-examples/other/Messenger/Solana
```

{% endstep %}

{% step %}
Install the JS dependencies.

```bash
bun install
```

{% endstep %}
{% endstepper %}

## Set the Program Address

To deploy your own instance of the messenger, you need to generate a custom keypair for it and put it in `target/deploy`folder.

Run the below command to generate your keypair.

```sh
solana-keygen grind --starts-with mes:1 --ignore-case
```

It will generate a file called `<your program address>.json`, where `<your program address>` is the resulting public key. Move it to the `target/deploy`folder using the below command.

```sh
mv <your program address>.json target/deploy/messenger-keypair.json
```

Next, replace the program address in `programs/messenger/src/lib.rs` and\
`Anchor.toml` with the public key of the generated keypair.

## Whitelist Configuration

The Solana Messenger example employs a whitelist to only allow messages from specific contracts. For messages to be accepted, you will need to specify all the contracts from other chains that you plan on communicating with.

First, put the addresses of the deployed EVM contracts in `programs/messenger/src/addresses.rs`. They have to be padded with 12 zero bytes, as the EVM addresses undergo encoding to bytes.

If you want to change the chains you want to send messages to or chains you want to receive messages from, make changes to `programs/messenger/src/instructions/send_message.rs` or `programs/messenger/src/instructions/execute.rs` accordingly.

Alternatively, you can redesign the contract to add the allowed origins and destinations dynamically.

## Deploying Contracts

Build the Solana program by running the below command.

```sh
anchor build
```

If you are planning to deploy to mainnet, run the following command.

```sh
anchor build --features mainnet
```

After that, you can deploy your program by running the below command.

```sh
solana program deploy --url devnet \
  --upgrade-authority ~/.config/solana/id.json \
  --program-id target/deploy/messenger-keypair.json target/deploy/messenger.so
```

### Building the TypeScript SDK <a href="#registering-the-extension" id="registering-the-extension"></a>

To run the client-side scripts, make sure to build the TypeScript SDK after compiling the program.

```sh
cp target/idl/messenger.json target/types/messenger.ts ts-sdk/src/idl/
bun run build:sdk
```

### Registering the Extension <a href="#registering-the-extension" id="registering-the-extension"></a>

Now, you need to register the protocol extension. Extensions exist to let the UIP transmitters know how to interact with your program. In essence, they are WebAssembly executables that are shared by uploading to the IPFS network. Every Solana contract connected to UIP needs to register its extension to start receiving messages.

Run the command below to compile the messenger extension.

```sh
rustup target add wasm32-wasip1
cargo build --target wasm32-wasip1 --release -p messenger-extension
```

The generated `target/wasm32-wasip1/release/messenger_extension.wasm` file needs to be uploaded to IPFS. It can be done using a service such as [Pinata](https://pinata.cloud/) (it’s free). Upon uploading, copy the CID of the extension file.

You can run the initialization script to set up the messenger config and to register the extension.

```sh
anchor run initialize --provider.cluster devnet -- \
  --extension <extension CID>
```

## Sending and Receiving Messages

In this section, we'll take a look at sending and receiving messages.

### Sending Messages

To send a message from the Solana contract to another chain, use the `send-message` script.

```sh
anchor run send-message --provider.cluster devnet -- \
  --times 1 \
  --dst-chain base-sepolia \
  --fee 100000 \
  --custom-gas-limit 300000 \
  --text "Hi from Solana"
```

Here, we are sending one message, choosing the destination to be Base Sepolia, paying 0.0001 SOL for fees, and setting the gas limit for execution on target chain to be 300k.

### Receiving Messages

To display all the messages sent from a wallet, copy the command below, update the sender address with the EVM address and run it.

{% code overflow="wrap" %}

```sh
anchor run get-messages-by-sender --provider.cluster devnet -- <your sender wallet address>
```

{% endcode %}

## Conclusion

In this guide we created a dApp utilising SOL contracts to facilitate in cross-chain text messaging.


# Deploying Your Custom Solana Protocol

This guide provides step-by-step instructions on how to deploy your custom Solana protocol. By following these steps, you can successfully deploy your custom Solana protocol across multiple chains. If you encounter issues, refer to the [How to Debug Sent Messages](/universal-interoperability-protocol/developer-guides/how-to-debug-sent-messages) guide or reach out to us through our [contact form](https://entangle.zendesk.com/hc/en-us/requests/new).

## Prerequisites

{% hint style="info" %}
Ensure you have the latest versions installed.
{% endhint %}

Before proceeding, ensure you are familiar with writing Solana programs in [Rust](https://www.rust-lang.org/).

In this guide we'll be using anchor as the framework of choice, but native programs will work as well. You can follow the anchor [installation guide](https://www.anchor-lang.com/docs/installation) if it's your first time using it.&#x20;

Before proceeding make sure you have setup your environment first, as shown below.

```bash
agave-install init 2.1.0 # solana
avm use 0.31.0 # anchor
```

## Contract Dependencies <a href="#contract-dependencies" id="contract-dependencies"></a>

To streamline development, start by adding the UIP Solana SDK dependency to the configuration file.

{% hint style="info" %}
If you are not using Anchor, you don’t need to enable the `anchor-lang` feature.
{% endhint %}

{% code title="programs/\*/Cargo.toml" %}

```toml
uip-solana-sdk = { version = "0.13", default-features = false, features = ["anchor-lang"] }
```

{% endcode %}

Then, if you are developing an EVM to non-EVM protocol, you will likely need to use a library for EVM ABI encoding, we recommend using [alloy](https://github.com/alloy-rs):&#x20;

```toml
alloy-sol-types = "0.7"
```

## Sending a message <a href="#sending-a-message" id="sending-a-message"></a>

To send a message you need to perform a [CPI](https://solana.com/ru/docs/core/cpi) to the endpoint.

First, you need to declare the following accounts:

```rust
use uip_solana_sdk::UipEndpoint;

#[derive(Accounts)]
pub struct SendMessage<'info> {
    #[account(mut)]
    sender: Signer<'info>,
    /// CHECK: checked in the CPI
    endpoint_config: AccountInfo<'info>,
    /// CHECK: checked in the CPI
    #[account(mut)]
    uts_connector: AccountInfo<'info>,
    system_program: Program<'info, System>,
    uip_program: Program<'info, UipEndpoint>,
}
```

`sender` is the payer for the operation. `endpoint_config`  and`uts_connector` can be retrieved using the `ENDPOINT_CONFIG` constant and the `fetchUtsConnector` function from the TypeScript package.

Now, in the instruction, you can perform the `Propose` CPI:

```rust
use uip_solana_sdk::{chains::*, Commitment, UipEndpoint};

UipEndpoint::propose()
    .payer(ctx.accounts.sender.to_account_info())
    .endpoint_config(ctx.accounts.endpoint_config.to_account_info())
    .uts_connector(ctx.accounts.uts_connector.to_account_info())
    .system_program(ctx.accounts.system_program.to_account_info())
    .total_fee(uip_fee)
    .dest_chain_id(dest_chain_id)
    .dest_addr(&dest_addr)
    .payload(&payload)
    .custom_gas_limit(custom_gas_limit)
    .proposal_commitment(Commitment::Confirmed)
    .call()?;
```

Notice the following parameters:

* `total_fee` - it’s the fee paid for the message, usually calculated using the TypeScript UIP SDK
* `dest_chain_id` - chain ID of the destination network
* `selector` - in most situations it should be omitted
* `dest_addr` - address of the destination contract. If you’re sending to an EVM chain, make sure you left pad it so it’s 32 bytes
* `payload` - the payload, carries any data you want to send
* `proposal_commitment` - whether transmitters should wait for your proposal transaction to be finalized or confirmed. Skipping the finalization will reduce the transmission time by about 15 seconds, but could theoretically pose a risk if the Solana blockchain is compromised
* `custom_gas_limit` - used on the EVM destination to limit gas usage, must not be zero

## Receiving a message <a href="#receiving-a-message" id="receiving-a-message"></a>

First, import some helper methods.

```rust
use uip_solana_sdk::{chains::*, parse_uip_message, route_instruction, MessageDataRef};
```

When a message is received, the endpoint will invoke a special instruction on your contract with a specific discriminator: `uip_solana_sdk::EXECUTE_DISCRIMINATOR`. When using the Anchor framework, it can be declared like so:

```rust
#[instruction(discriminator = uip_solana_sdk::EXECUTE_DISCRIMINATOR)]
pub fn execute<'info>(ctx: Context<'_, '_, 'info, 'info, Execute>) -> Result<()> {
    // your code
}
```

If you are not using Anchor, make sure that the first 8 bytes of instruction data match `uip_solana_sdk::EXECUTE_DISCRIMINATOR`.

Now, the `Execute` instruction should take no arguments and require a single account, the UIP message:

```rust
#[derive(Accounts)]
pub struct Execute<'info> {
    /// CHECK: It's checked in `parse_uip_message`.
    uip_msg: AccountInfo<'info>,
}
```

The payer and the accounts that are specific to your protocol (specified in [the extension](#extension-registration)) will come after `uip_msg`. If you only need a single set of accounts for all possible payloads, you can specify these accounts in the same structure after `uip_msg`. Otherwise, they will be put in `ctx.remaining_accounts` for further routing.

In the function body, you should parse the incoming message:

```rust
let uip_msg_data = ctx.accounts.uip_msg.try_borrow_data()?;
let MessageDataRef {
    payload,
    sender_addr,
    src_chain_id,
    msg_hash,
    ..
} = parse_uip_message(&ctx.accounts.uip_msg, &uip_msg_data, &crate::ID)?;
```

First, you should validate that `src_chain_id` and `sender_addr` match one of the smart contracts that your protocol supports.

Then, decode the `payload` for further processing.

If you are using Anchor and expect different accounts for different types of messages, you can use the helper `route_instruction` function that can make it appear as if you are routing a real instruction, for example:

```rust
if some_condition {
    let ix_data = MyIxData {
        //
    };
    let params = MyIxParams {
        //
    };

    route_instruction(
        &crate::ID,
        my_ix,
        ctx.remaining_accounts,
        ix_data,
        params,
    )?;
} else {
  // route another instruction
}
```

Here, `my_ix` is defined as any other instruction, **but is not made public**. The first account must be payer, which is the UIP executor. The following accounts must be the custom accounts that you need. Don’t forget to perform all the required checks for these accounts.

```rust
/// Data for use in the anchor `instruction` attribute.
#[derive(AnchorSerialize, AnchorDeserialize)]
struct MyIxData {}

/// Input for the instruction function.
struct MyIxParams {}

#[derive(Accounts)]
#[instruction(ix_data: MyIxData)]
struct MyIx<'info> {
    #[account(mut)]
    payer: Signer<'info>,
    // other accounts
}

fn my_ix(ctx: Context<MyIx>, params: MyIxParams) -> Result<()> {
    // your implementation
}
```

Lastly, for the `Execute` instruction to be connected to the UIP network, you need to register your protocol extension.

## Extension registration <a href="#extension-registration" id="extension-registration"></a>

Solana is different to other networks in that apart from function parameters it needs accounts to be specified. In order for the executor to know what accounts need to be passed, we utilize something called extensions, compiled to WASM and stored on IPFS. Basically, it’s a separate library that describes your `Execute` instruction interface.

To implement it, initialize a new library and specify the following in `Cargo.toml`:

```toml
[lib]
crate-type = ["cdylib"]

[dependencies]
solana-program = ">=2.0,<2.2"
uip-solana-sdk = { version = "0.13", default-features = false, features = ["extension"] }
```

Then, you need to write a function called `get_api_version` that returns the version of the extension API that your extension supports. Right now, 1 is the highest supported version.

Then, you need to write the `get_instruction_info` function with a specific signature, that takes `MessageData` and writes the required accounts, compute units, and heap frame back into `InstructionInfo`. If your program needs more heap than the default, you can request heap frame (it must be a multiple of 1024 less than 256 KiB), otherwise leave it at 0.

Extensions can request at most 57 accounts for execution.

Here’s an example of an extension:

```rust
use solana_program::{instruction::AccountMeta, pubkey, pubkey::Pubkey, system_program};
use uip_solana_sdk::{
    extension::{HostCallContext, InstructionInfo},
    MessageDataRef,
};

#[no_mangle]
pub extern "C" fn get_api_version() -> u32 {
    1
}

#[no_mangle]
pub unsafe extern "C" fn get_instruction_info(
    msg_data_ptr: *const u8,
    msg_data_len: usize,
    result: &mut InstructionInfo,
) {
    let MessageDataRef {
        payload, msg_hash, ..
    } = MessageDataRef::load(msg_data_ptr, msg_data_len);

    let mut ctx = HostCallContext::new(msg_data_ptr, msg_data_len);

    // host call example
    let accounts =
        ctx.get_multiple_accounts(&[pubkey!("So11111111111111111111111111111111111111112")]);

    let (example_pda, _) = Pubkey::find_program_address(&[b"EXAMPLE"], &my_protocol::ID);
    result.push_account(AccountMeta::new(example_pda, false)).unwrap();
    result.push_account(AccountMeta::new_readonly(system_program::ID, false)).unwrap();
    result.compute_units = 50_000;
    result.heap_frame = 0;
}
```

Extensions run in an isolated environment, so they are limited in what they can do and how much CPU/memory they can use. To provide a way to communicate with the outside world, a host call mechanism is implemented. In particular, it allows extensions to fetch on-chain account data via `HostCallContext::get_multiple_accounts`.

The extension needs to be compiled to the WASI target:

```sh
cargo build --target wasm32-wasip1 --release -p example-extension
wasm-opt -O4 target/wasm32-wasip1/release/example_extension.wasm -o target/wasm32-wasip1/release/example_extension-optimized.wasm
```

Then upload `target/wasm32-wasip1/release/example_extension-optimized.wasm` to IPFS, using a service such as [Pinata](https://pinata.cloud/) (it’s free).

After that, record the CID of the uploaded file. You need to convert it to 36 bytes, it can be done using the `multiformats` package:

```typescript
import { CID } from "multiformats";

Array.from(CID.parse(ipfsCid).toV1().bytes) 
```

Your program needs to have an instruction that registers the extension using a CPI call. We recommend gating it with access control, so that only an admin or multisig can call it. You can run the instruction during initialization or upgrade of your program.

```rust
use uip_solana_sdk::UipEndpoint;

UipEndpoint::register_extension()
    .payer(ctx.accounts.payer.to_account_info())
    .extension(ctx.accounts.extension.to_account_info())
    .program_signer(ctx.accounts.program_signer.to_account_info())
    .system_program(ctx.accounts.system_program.to_account_info())
    .program_signer_bump(ctx.bumps.program_signer)
    .program_id(&crate::ID)
    .ipfs_cid(ipfs_cid)
    .call()?;
```

`program_signer` needs to be a special PDA with the following seeds: `[b"UIP_SIGNER"]`. The required `extension` can be found using the `findExtension` function from the Typescript SDK.

After performing `RegisterExtension`, your contract can now receive UIP messages!

## Client-side scripts and testing <a href="#client-side-scripts-and-testing" id="client-side-scripts-and-testing"></a>

The Solana endpoint has a TypeScript package to help with client-side interaction and testing. To use it, specify the following dependency in `package.json`:

```json
"@entangle-labs/uip-solana-sdk": "^0.6.2"
```

## Testing your contract <a href="#testing-your-contract" id="testing-your-contract"></a>

In order to test execution of your messages, you can mimic the cross-chain message execution on localnet. For this, you can use a mock UIP config with a predefined signer configuration:

```json
{
  "pubkey": "CMFjqmzBd59mHnHZgGz9c1ppZPN8VFnWZ8UtxPVUEJLq",
  "account": {
    "lamports": 1000000000,
    "data": [
      "Y29uZmlnAADJAd8re5StLtozqnHQTIUxBPzcP1D/0BcF5yammv9nTQ2e/M9oMSShewHJlfygI6T5KqWd24VF/aRvU3Qlr6VzAAAQYy1ex2sFAAAAAAAAAG2BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACY+ZK1fNWkTftaMdnFKgY/2Z5kggAAAAAAAAAAAAAAALdwH8xglWoFfkgKJ0m/FQO4fdawHgAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAC8sz2vhLHvUETFLNZB2x1X18k/xAEAAADGRxLEtG/v6UJahvO6/n/u9lZC2gEAAADJAd8re5StLtozqnHQTIUxBPzcP1D/0BcF5yammv9nTQ==",
      "base64"
    ],
    "owner": "uipby67GWuDDt1jZTWFdXNrsSu83kcxt9r5CLPTKGhX",
    "executable": false,
    "rentEpoch": 1844674407
  }
}
```

You can put it in `tests/accounts/uip_config.json`. Then, you can configure Anchor to load the mock account and the other accounts necessary for UIP endpoint execution. Add this to `Anchor.toml`:

```toml
[test.validator]
url = "https://api.devnet.solana.com"
[[test.validator.clone]]
# UIP program
address = "uipby67GWuDDt1jZTWFdXNrsSu83kcxt9r5CLPTKGhX"
[[test.validator.clone]]
# UTS config
address = "CTspuKSu7eRXzKqtYzR83H5VCZMWVRC4uRLfrA5Cy8WX"
[[test.validator.clone]]
# UTS connector
address = "vAukQz25gyuAHbdzEQS9GxMVZipVFu18MUoayKpETJz"
[[test.validator.account]]
address = "CMFjqmzBd59mHnHZgGz9c1ppZPN8VFnWZ8UtxPVUEJLq"
filename = "tests/accounts/uip_config.json"
```

Here’s an example of sending a message and intercepting the UIP proposal event.

```typescript
import {
  checkConsensus,
  encodeTransmitterParams,
  execute,
  fetchExtension,
  findExtension,
  findMessage,
  loadMessage,
  msgHashFull,
  onMessageProposed,
  sendSimulateExecuteLite,
  setProvider as setEndpointProvider,
  signMsg,
  unloadMessage,
} from "@entangle-labs/uip-solana-sdk";

const eventPromise: Promise<void> = new Promise((resolve, reject) => {
  onMessageProposed((event) => {
    try {
      selector = event.selector;
      payload = event.payload;
      resolve();
    } catch (error) {
      reject(error);
    }
  });
  setTimeout(() => {
    reject(new Error("Event did not fire within timeout"));
  }, 12000);
});

// send message via your protocol

await eventPromise;
```

And here’s an example of executing a message.

```typescript
import { privateKeyToAccount } from "viem/accounts";

const transmitterParams = {
  proposalCommitment: { confirmed: {} },
  customGasLimit: new BN(2),
};
const transmitterParamsEncoded = encodeTransmitterParams(transmitterParams);

const signer = privateKeyToAccount(
  "0x74e3ffad2b87174dc1d806edf1a01e3b017cf1be05d1894d329826f10fa1d72f",
);
const superSigner = privateKeyToAccount(
  "0xf496bcca0a4896011dbdbe2ec80417ed759a6a9cc72477b3a65b8d99b066b150",
);

const msgData = {
  initialProposal: {
    senderAddr,
    destAddr,
    ccmFee,
    payload,
    reserved: Buffer.from([]),
    transmitterParams: transmitterParamsEncoded,
    selector,
  },
  srcChainData: {
    srcBlockNumber,
    srcChainId,
    srcOpTxId,
  },
};

const signatures = [await signMsg(signer, msgData)];
const superSignatures = [
  await signMsg({ signer: superSigner, msgData, solanaChainId }),
];

const message = findMessage(msgData, solanaChainId);
await sendTx([
  await loadMessage({
    executor: executor.publicKey,
    msgData,
    solanaChainId,
  }),
  await checkConsensus({
    executor: executor.publicKey,
    message,
    signatures,
    superSignatures,
  }),
  await execute({
    executor: executor.publicKey,
    accounts,
    spendingLimit: new BN(2_000_000),
    deadline: new BN(Math.floor(Date.now() / 1000) + 10),
    destinationComputeUnits: 30_000,
    dstProgram: msgData.initialProposal.destAddr,
    message,
  }),
], [executor]);

await sendIx(await unloadMessage({ executor: executor.publicKey, message }), [
  executor,
]);
```

## Sending messages that don’t fit in a single Solana transaction <a href="#sending-messages-that-dont-fit-in-a-single-solana-transaction" id="sending-messages-that-dont-fit-in-a-single-solana-transaction"></a>

We have developed a utility program to allow loading data in chunks to later be used to invoke a Solana instruction. It allows passing up to 10KB of data to an instruction, bypassing the normal limit of around 1KB per instruction.

It will be automatically used by executors when a large message is passed to Solana from another chain. However, if you want to send a large transaction *from* Solana, you can also use the Chunk Loader program TypeScript SDK:

```json
"@lincot/solana-chunk-loader": "^0.4.4",
```

In order to pass large data to your function, you need to manually encode the function selector and arguments to a buffer, and then pass it by chunks to the Chunk Loader program. The `loadByChunks` instructions can be sent concurrently, and then followed by the `passToCpi` instruction.

```typescript
const chunkHolderId = randomInt(1 << 19);
const preInstructions = await loadByChunks({
  owner: sender,
  data,
  chunkHolderId,
});
const instruction = await passToCpi({
  owner: sender,
  program: YOUR_PROGRAM_ID,
  chunkHolderId,
  accounts: [
    { pubkey: sender, isSigner: true, isWritable: true },
    { pubkey: ENDPOINT_CONFIG, isSigner: false, isWritable: false },
    {
      pubkey: await fetchUtsConnector(connection),
      isSigner: false,
      isWritable: true,
    },
    {
      pubkey: SystemProgram.programId,
      isSigner: false,
      isWritable: false,
    },
    {
      pubkey: ENDPOINT_PROGRAM_ID,
      isSigner: false,
      isWritable: false,
    },
  ],
  cpiComputeUnits: 30_000,
});
```


# Become a Solana Transmitter

This guide will walk you through how to become a Solana transmitter. From wallet details to transmitter setup, we'll cover it all here.

## Dependencies

Before beginning make sure to install all of the necessary dependencies and tools. In this guide we'll be using several, including:

* [libusd](https://libusb.sourceforge.io/api-1.0/index.html), an open source library that allows communication with USB devices fom user space.
* [foundry](https://github.com/foundry-rs/foundry), a modular toolkit for Ethereum application development.
* [docker](https://www.docker.com/), a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers.

{% tabs %}
{% tab title="Mac" %}

```bash
brew install python
brew install pipx       
pipx install base58
brew install libusb
curl -L https://foundry.paradigm.xyz | bash
foundryup
```

{% endtab %}

{% tab title="Linux" %}
{% hint style="warning" %}
For the Zsh shell, use source "\~/.zshenv" instead of source "\~/.bashrc".
{% endhint %}

{% hint style="warning" %}
If pipx install base58 doesn’t work, try using: python3 -m pip install base58
{% endhint %}

```bash
sudo apt update
sudo apt install pipx
pipx install base58
sudo apt install curl build-essential libssl-dev pkg-config
sudo apt install libusb-1.0-0-dev
curl -L https://foundry.paradigm.xyz | bash
~./bashrc  
foundryup
```

{% endtab %}
{% endtabs %}

To verify the successful installation of dependencies, you can run the following command.

```bash
cast --version
```

If everything was successfully installed, the output should be the version of the cast command, as shown below.

```
cast 0.2.0 (31c24b0 2024-11-14T00:20:56.080456000Z)
```

## Wallet Setup

{% hint style="warning" %}
Your Solana wallet should only hold SOL tokens. The security of other tokens is not guaranteed.
{% endhint %}

To become an transmitter on Solana you need two wallets. An EVM standard wallet and a Solana standard wallet. To proceed you need to convert your wallets into a format suitable for transmitter registration, below we describe the process.

{% tabs %}
{% tab title="Convert a Solana Wallet to Hex" %}
For your Solana wallet (\<solana\_wallet>) in Base58 format, run the following command.

{% code overflow="wrap" %}

```
python3 -c "import base58; import sys; print('0x' + base58.b58decode(sys.argv[1]).hex())" <solana_wallet>
```

{% endcode %}

* Example for a Solana Wallet:
  * Hj12XrWQmcfRZk4nEejLRvF3tE5QXk5EpxmMm3zZzQbC (Base58)
* Hexadecimal Representation (Output):  &#x20;
  * 0xf87d6a27b105812cdaf3ade4ba67fe501092df51a716671db13f05387dc04603
    {% endtab %}

{% tab title="Convert an EVM Wallet to Hex" %}
For your EVM wallet (\<evm\_address>), run the following command.

{% code overflow="wrap" %}

```
cast to-uint256 <evm_address>
```

{% endcode %}

* Example for a EVM Wallet:
  * 0xff22Fb238CfA1013A793FC917F242F9f82a61417
* Hexadecimal Representation (Output):  &#x20;
  * 0x000000000000000000000000ff22fb238cfa1013a793fc917f242f9f82a61417
    {% endtab %}
    {% endtabs %}

## 1. Registration

Make sure that you have the native network token on Entangle and that you have added the Entangle network address to your wallet.

* Node:  [https://json-rpc.entangle.fi](https://json-rpc.entangle.fi/)
* Chain Id:  33033

Now run the following command to register your transmitter in the desired network.

```bash
cast send 0xB83E7753CAB418775f0dc91ACfcfECba24FE62C1 \
    "registerAgent(uint,address,bytes[])" \
    <chain_id> \
    <evm_address> \
    "[<hex_address_evm>, <hex_address_solana>, <hex_address_evm>, <hex_address_evm>]" \
    -r "https://json-rpc.entangle.fi" \
    --private-key <private_key>
```

<details>

<summary>Command Parameter Explanation</summary>

The cast command includes several parameters, here we've described them.

* The HEX address at the begining is the address of our AgentRegistrator contract
* \<chain\_id> is the Blockchain Id (for Solana, use 11100000000000000501).
* \<evm\_address> is your EVM wallet address (master key).
* \<hex\_address\_evm> is the hex representation of your EVM wallet.
* \<hex\_address\_solana> is the hex representation of your Solana wallet.
* \<private\_key> is the private key of your EVM wallet (in EVM format).
  * Expl. \[\<hex\_evm\_1>, \<hex\_solana\_1>, \<hex\_evm2>, \<hex\_evm\_3>]
    * \<hex\_address\_evm\_1> is used to execute transactions in EIB.
      * \<hex\_address\_solana\_1> is used to execute transactions in Solana .
      * \<hex\_address\_evm\_2> rewards will be distributed to this address.
      * \<hex\_address\_evm\_3> reserved.

</details>

If you encounter the error tx already in mempool, try adding the following optional parameter:

```
--gas-price <actual gas in chain> * 2
```

To get the actual gas price in the network, run:

```
cast gas-price -r "https://json-rpc.entangle.fi"
```

## 2. Security Deposit

To ensure your transmitter works as expected you are required to stake a security deposit. A minimum of 100 NTGL is required.

Run the cast command again but this time with the follow parameters.

{% code overflow="wrap" %}

```
cast send 0x2897F9093bE0B5d5F9067c6f7842B949017eE830 "deposit(uint256,address,uint256)" <chainID> <agent-address> <wntgl-value> -r https://json-rpc.entangle.fi --private-key <your_key> --value <ntgl-value>
```

{% endcode %}

<details>

<summary>Command Parameter Explanation</summary>

{% hint style="warning" %}
Set WNTGL amount to 0 if you want to use NTGL for staking and vice versa, set NTGL amount to 0 if you want to use WNTGL for staking.
{% endhint %}

The cast command includes several parameters, here we've described them.

1. The HEX address at the begining is the address of the RewardVaults contract which is responsible for distributing rewards among UIP participants
2. \<chainID> is the blockchain ID where the agent will be deployed (e.g., 146 for Sonic).
3. \<agent-address> is the EVM wallet address (master key).
4. \<wntgl-value> is the amount of security deposit (in wei) min 100WNTGL&#x20;
5. \<your key> is the wallet’s private key.

</details>

## 3. Docker Environment Setup

To simplify this process, we've created a docker image. In this part we will describe how to install and setup docker.

{% tabs %}
{% tab title="Ubuntu" %}
{% stepper %}
{% step %}
Update the system.

```bash
sudo apt update && sudo apt upgrade -y
```

{% endstep %}

{% step %}
Install dependencies.

```bash
sudo apt install -y ca-certificates curl gnupg
```

{% endstep %}

{% step %}
Add the official Docker GPG key.

{% code overflow="wrap" %}

```bash
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo tee /etc/apt/keyrings/docker.asc > /dev/null
sudo chmod a+r /etc/apt/keyrings/docker.asc
```

{% endcode %}
{% endstep %}

{% step %}
Add the Docker repository.

{% code overflow="wrap" %}

```bash
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
```

{% endcode %}
{% endstep %}

{% step %}
Install Docker and Docker Compose.

{% code overflow="wrap" %}

```bash
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
```

{% endcode %}
{% endstep %}

{% step %}
Verify the installation.

```bash
docker --version
docker compose version
```

{% endstep %}

{% step %}
Add the current user to the Docker group (to run commands without using sudo).

```bash
sudo usermod -aG docker $USER
```

{% endstep %}

{% step %}
Then log out and log back in, or run.

```bash
newgrp docker
```

{% endstep %}
{% endstepper %}
{% endtab %}

{% tab title="Mac" %}
{% stepper %}
{% step %}
Install Docker via Homebrew

```
brew install --cask docker
```

{% endstep %}

{% step %}
Launch Docker Desktop

Simply find it in your applications and open it.
{% endstep %}

{% step %}
Verify the installation

```
docker --version
docker compose version
```

{% endstep %}
{% endstepper %}
{% endtab %}
{% endtabs %}

## 4. Starting the Transmitter

{% stepper %}
{% step %}
Update the docker image.

```
docker pull msentangle/agent:3.0
docker pull msentangle/agent-setup:3.0
docker pull msentangle/solana:3.0
```

{% endstep %}

{% step %}
Create a directory for the transmitter and move to it.

```
mkdir transmitter
cd transmitter
```

{% endstep %}

{% step %}
Start the transmitter.

{% hint style="warning" %}
If you want this transmitter to be a super transmitter you need to specify "-e IS\_SUPER\_AGENT=true".
{% endhint %}

```
docker run --rm \
  -v $(pwd)/.:/app/agent/ \
  -e PRIVATE_KEY="yourprivatekey" \
  -e PASSWORD="yourpassword" \
  -e NON_EVM_CHAINS="11100000000000000501" \
  -e SOLANA_PRIVATE_KEY="solanaprivate" \
  msentangle/agent-setup:3.0
```

<details>

<summary>Command Parameter Explanation</summary>

1. **yourprivatekey** is your wallet's private key.
2. **yourpassword** is your desired password to encrypt the private key.
3. **solanaprivate** is the private key of your Solana wallet.

</details>

{% hint style="info" %}
The program will generate a default configurations for the selected networks.
{% endhint %}

After the successful execution of the program, you will see the message:

```
Your Address: 0x96564904617F27722C522D4Ed9D0e7b9911Aa5cC please check correct

2:57PM WRN > contract has no events Contract Name=Slasher
...
```

{% endstep %}
{% endstepper %}

## Choosing a Transmitter Name

You can also set a unique name for your transmitter to more easily distinguish it. Run the below command to do so.

```
docker-compose -p <agent-name> up -d
```

<details>

<summary>Command Parameter Explanation</summary>

1. \<agent-name> is where you provide the unique name for the agent (e.g. agent-sonic-1).

</details>

## Change Round

You can either wait for another participant to make changes to the round or update the round yourself. Run the following command to change the round.

{% hint style="info" %}
You can check the fees for changing the round in the logs of the evm\_agent program.
{% endhint %}

{% code overflow="wrap" %}

```
docker exec -it <agent-name>-evm_agent-1 sh -c "apk add curl && curl 'http://localhost:9131/turnround?chainId=<chain_id>'"
```

{% endcode %}

<details>

<summary>Command Parameter Explanation</summary>

1. \<agent-name> the name of the agent (e.g. agent-sonic-1).
2. \<chain\_id> is the blockchain Id (for Sonic, use 146).

</details>

## Change Node

You can change blockchain providers (RPC nodes) by modifying the *configs/solana/transmitter-config.yml* file. You can add multiple nodes to ensure high availability

{% code title="transmitter-config.yml" %}

```yaml
solana:
    read_rpcs:
        - url: https://api.mainnet-beta.solana.com
          ratelimit: 4
    write_rpcs:
        - url: https://api.mainnet-beta.solana.com
          ratelimit: 1
```

{% endcode %}

### Additional Configuration Parameters

Below are additional configuration parameters you can use for the blockchain provider source configuration file.

<table><thead><tr><th width="246.00006103515625">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>parse_new_headers_interval</td><td>How often to update blockchain information (e.g.,  5s,  1m).</td></tr><tr><td>max_query_in_batch</td><td>The number of requests in a single batch request.</td></tr><tr><td>filter_logs_max_blocks</td><td>The maximum difference between fromBlock  and toBlock.</td></tr><tr><td>blocks_delay</td><td>The maximum difference between block shifts.</td></tr><tr><td>blocks_batch_to_filter</td><td>The minimum number of blocks to process.</td></tr><tr><td>min_balance_to_alert</td><td>The minimum wallet balance for notifications (in wei).</td></tr></tbody></table>

## Withdraw Security Deposit & Stopping Transmitter

To withdraw your security deposit and stop being a transmitter, run the following command.

{% code overflow="wrap" %}

```
cast send 0x2897F9093bE0B5d5F9067c6f7842B949017eE830 "withdraw(uint256,address,uint256,bool)" <chain_id> <agent-address> <nglt-amount> <flag> -r "https://json-rpc.entangle.fi" --private-key <private-key>
```

{% endcode %}

<details>

<summary>Command Parameter Explanation</summary>

1. The HEX address at the begining is the address of the RewardVaults contract which is responsible for distributing rewards among UIP participants
2. \<chainID> is the Blockchain Id.
3. \<agent-address> is the EVM wallet address  (master key).
4. \<nglt-amount> is the amount in wei.
5. \<flag> if set to true, WNGL will be unwrapped and sent to the wallet (you will receive NGL), otherwise WNGL will be sent wrapped (you will receive WNGL)
6. \<your key> is the wallet’s private key.

</details>

## Troubleshooting

<details>

<summary>Insufficient Funds</summary>

Make sure there are enough native tokens in the wallet to cover the transaction fees.

</details>

<details>

<summary>Git Command Not Found</summary>

Install git using the command below.

```bash
sudo apt install git -y
```

</details>


# Calculate Cross-Chain Transaction Cost

### The cost of cross-chain messages includes:

1. Source chain transaction costs: Paid in the source network’s native token to cover transaction processing.
2. Destination chain transaction costs: Calculated in the source token based on the current exchange rate, this covers execution on the destination chain. Transmitters use the UDF protocol on the EIB to determine the maximum affordable gas price; if funds are insufficient, the transaction may be flagged as underpriced.
3. Transmitter Fee: A fixed fee in the source token compensates transmitters for message delivery, supporting reliable service with predictable costs.

### How to Calculate Transaction Cost

To calculate transaction costs, you can use our SDK. For detailed instructions and examples, refer to the SDK's [README documentation](https://www.npmjs.com/package/@entangle-labs/uip-sdk/v/0.0.21).

### Case example: Consider a transaction from Binance Smart Chain (BSC) to Ethereum (ETH).&#x20;

1. Source chain cost: The transaction on BSC incurs a 0.01 BNB fee, paid by the sender.
2. Destination chain cost: With ETH gas prices at 100 Gwei, the transmitter uses the UDF protocol to estimate a cost of 0.005 ETH, converted to 0.00075 BNB.
3. Transmitter Fee: Assume that the transmitter's fixed fee is 0.001 BNB.

The total transaction cost would stand at 0.01175 BNB, paid entirely in the source network’s currency by the sender. In some cases, omni-chain application owners may subsidize a portion of this cost on-chain as an incentive.

Final transaction costs are calculated via the frontend SDK, backend API, or directly on-chain. The fee model is adaptable and will be periodically revised based on market demands and community feedback. Alternative models (e.g., USD, BTC, or NTGL) are also under consideration.

### Fee Distribution

Collected fees are allocated to:

1. Transmitter Rewards: Rewards based on the work transmitters perform in message verification and delivery.
2. Super Transmitter Rewards: A fixed share of transmitters' income to compensate Super Transmitters for message verification.
3. Protocol revenue: Initially set to zero, protocol revenue may be adjusted later based on community governance.


# Customizable Message Transmission Options

UIP allows users to tailor message transmission settings to meet specific application requirements, balancing priorities like speed and security. These options are encoded and stored in the encoded parameter option, enabling agents to execute transactions in line with user-defined preferences.&#x20;

## Propose Function

This function emits an event from the smart contract, which is picked up by our agents. The agents decode the event to extract details such as the destination chain, the message content, the block finalization option, any custom gas limits, and other relevant information. Once decoded, the message is transmitted to our EIB chain for further processing.

```solidity
function propose(
    uint256 destChainID,
    bytes32 selectorSlot,
    bytes calldata encodedParams,
    bytes calldata destAddress,
    bytes calldata payload
) external payable {
    _propose(
        _msgSender(), 
        destChainID, 
        selectorSlot, 
        agentParams, 
        destAddress, 
        payload
    );
}
```

<details>

<summary>Solidity Example Code</summary>

```solidity
function sendMessage(
        uint256 chainID,
        uint256 blockFinalizationOption,
        uint256 customGasLimit,
        bytes calldata destAddress,
        string calldata _msg
    ) external payable {
        TransmitterParamsLib.TransmitterParams memory transmitterParams = TransmitterParamsLib.TransmitterParams(
            blockFinalizationOption,
            customGasLimit
        );
        bytes memory encodedParams = abi.encodePacked(transmitterParams.blockFinalizationOption, transmitterParams.customGasLimit);
        
        IEndpoint(endpoint).propose{value: msg.value}(
            chainID,
            SelectorLib.encodeDefaultSelector(
                DEFAULT_SELECTOR
            ),
            encodedParams,
            destAddress,
            abi.encode(abi.encode(_msg), abi.encode(_msgSender()))
        );
    }
```

</details>

<details>

<summary>Solana Example Code</summary>

We're currently working on Solana integration as part of our next milestone. We have prepared guides for teams and developers interestered in early access. To learn more or request access, visit our [contact page](https://entangle.zendesk.com/hc/en-us/requests/new).

</details>

### Parameter Definitions

<table><thead><tr><th width="205.99993896484375">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>destChainID</td><td>The identifier of the destination chain.</td></tr><tr><td>selectorSlot</td><td>A default selector for the <code>execute</code> function in the endpoint contract (this value should remain unchanged).</td></tr><tr><td>encodedParams</td><td>Encoded parameters such as <code>blockFinalizationOption</code> and <code>customGasLimit</code> in<code>byte</code> format (details on creating these parameters are provided below).</td></tr><tr><td>destAddress</td><td>The address of the recipient on the destination chain.</td></tr><tr><td>payload</td><td>The payload is any data which should be carried to the destination chain. Use <code>abi.encode(...)</code> to convert your data into "bytes" format.</td></tr></tbody></table>

### Encoded Parameter Option Definitions

The transmission options are stored in a struct called the  `TransmitterParams`.  For up-to-date parameter definitions please refer to the latest implementation of the `TransmitterParamsLib`.

```solidity
struct TransmitterParams {
    uint256 blockFinalizationOption;
    uint256 customGasLimit;
}
```

The transmission options descriped below are then encoded into bytes and stored in the `encodedParams` parameter of the propse function.

<table><thead><tr><th width="205.99993896484375">Option</th><th>Description</th></tr></thead><tbody><tr><td>blockFinalizationOption</td><td>Defines the number of blocks to wait before retrieving message events from the source chain and execution events from the destination chain.</td></tr><tr><td>customGasLimit</td><td>Specifies the gaslimit for transaction execution on destination chain.</td></tr></tbody></table>

### Encoding Parameters

To encode these parameters into bytes, use the `abi.encodePacked()` function and pass in the `TransmitterParams` options one by one, as shown in the example below.

```solidity
bytes memory encodedParams = abi.encodePacked(transmitterParams.blockFinalizationOption, transmitterParams.customGasLimit);
```

## Block Finalization

UIP gives full control to developers. One such way is via the block finalization option which allows you to fine tune the block wait time. By default the standard type is recommended and used. However, if you wish to use another option, we provide extra details and use cases for each finalization type.

### Block Finalization Option Descriptions

{% hint style="danger" %}
Warning: Use the "Unsafe" option with **EXTREME CAUTION**. By selecting it, you explicitly acknowledge and accept the risk that the transaction or event might be reverted due to a block reorg. This could lead to data inconsistency or financial loss.
{% endhint %}

<table><thead><tr><th width="140.3333740234375">Finalization Type</th><th>Description</th></tr></thead><tbody><tr><td>Standard</td><td>The default and safest option. It adheres to the full finalization process defined by the source network. This ensures the highest or close to the highest level of security and immutability.</td></tr><tr><td>Fast</td><td>Prioritizes speed while maintaining a reasonable level of safety. It uses a reduced finalization process that is less strict than Standard Finalization but still guarantees secure delivery.</td></tr><tr><td>Unsafe</td><td>The fastest option, but it bypasses standard finalization processes. This dramatically reduces confirmation time but introduces the risk of block restructuring (reorgs).</td></tr></tbody></table>

### Block Finalization Option Behaviour Explanations

<table><thead><tr><th width="140.3333740234375">Finalization Type</th><th>Behaviour</th></tr></thead><tbody><tr><td>Standard</td><td>Confirmation occurs only after the standard block finalization period (or block depth) specified by the source network has elapsed.</td></tr><tr><td>Fast</td><td>Confirmation occurs after a minimal finalization process, ensuring the block sequence is unlikely to be reverted.</td></tr><tr><td>Unsafe</td><td>Confirmation is immediate or near-immediate, based on minimal criteria. There's no guarantee that the confirmed transaction will be permanent.</td></tr></tbody></table>

### Block Finalization Option Use Cases

<table><thead><tr><th width="140.3333740234375">Finalization Type</th><th>Use Case</th></tr></thead><tbody><tr><td>Standard</td><td>Recommended for applications handling high-value transactions or where data integrity is paramount.</td></tr><tr><td>Fast</td><td>Suitable for most applications.</td></tr><tr><td>Unsafe</td><td>Only recommended for experimental purposes, low-value transactions where the risk of reorg is acceptable, or in specific scenarios where immediate confirmation is more critical than data integrity (e.g., certain types of data feeds where eventual consistency is sufficient). Thoroughly understand the implications before using this option.</td></tr></tbody></table>

### Recommended Values for Block Finalization

Below is a list of recommended values for block finalization for different networks and finalization types.

| Network   | Standard | Fast | Unsafe |
| --------- | -------- | ---- | ------ |
| Base      | 195      | 30   | 1      |
| Entangle  | 1        | 1    | 1      |
| Ethereum  | 32       | 12   | 1      |
| Mantle    | 195      | 30   | 1      |
| Avalanche | 5        | 2    | 1      |
| Sonic     | 20       | 10   | 1      |
| Polygon   | 100      | 50   | 1      |
| Solana    | 32       | 16   | 2      |
| Berachain | 5        | 2    | 1      |
| Binance   | 40       | 5    | 1      |
| Arbitrum  | 1500     | 240  | 5      |
| Abstract  | 900      | 20   | 1      |
| Manta     | 40       | 5    | 1      |
| Immutable | 195      | 20   | 1      |
| Optimism  | 195      | 30   | 1      |


# How to Debug Sent Messages

This guide provides instructions on debugging sent messages using command-line tools and hardhat. It covers retrieving message status, inspecting arguments of emitted events by the Endpoint, and more. If you have not deployed your custom protocol yet, refer to the [Getting Started](/universal-interoperability-protocol/developer-guides/getting-started) guide before proceeding.

## Retrieving Account Balance

To get the balance of any account on an EVM-compatible network, execute the command below. It will print the specified account balance.

{% code fullWidth="false" %}

```
npx hardhat balance --acc <address> --network <network_name>
```

{% endcode %}

<details>

<summary>Output</summary>

```
Using network: teib

199.999999999953525184 native
```

</details>

## Fetching Block Data

To retrieve block details from an EVM-compatible network, execute the command below. It will output the block number, block hash, and creation timestamp.

```
npx hardhat getBlock --num <block_number> --network <network_name>
```

<details>

<summary>Output</summary>

```
Reading block: 7892216

Number:  7892216
Hash:    0x69ad02f4b65f73043cb2d228d43c4ad1cd89b51c84410330ca4d6b301e1f0291
Time:    1741849068
```

</details>

## Extracting Transaction Details

To obtain details of a specific transaction, execute the command below. It will output the sender address, the receiver address, msg.value, payload, and block number.

```
npx hardhat getTxData --hash <tx_hash> --network <network_name>
```

<details>

<summary>Output</summary>

In this example, some values have been shortened (indicated by "...") for visibility.&#x20;

```
Reading data from tx: 0x872f7acf59f32...7e3c694826c7

From: 0xB8F2952882622Bee2fD495148a35109dc108858d
To: 0xC1a4aD3AaC062d875A9395B041ef5E4885BB8F9c
Value: 0
Data: 0x095ea7...28dde4d10ee5c56f
Block: 7892221
```

</details>

## Printing Proposal Data

If a proposal was sent to the Endpoint, parse the emitted event by executing the below command. It will output the destination chain ID, msg.value, selector slot, agent parameters, sender address, destination address, encoded payload.

```
npx hardhat proposal --hash <tx_hash> --network <network_name>
```

<details>

<summary>Output</summary>

In this example, some values have been shortened (indicated by "...") for visibility.&#x20;

```
Reading proposal event from tx: 0x85...e9750
Chain id:  5003n
Msg.value:  1000000n
Selector slot:  0...00af859a79
Agent parameters:  0x0...000042748
Sender address:  0x0...1c3f92c305a
Destination address:  0x0...f744a2d2
Encoded payload:  0x0...0d5bde9af
Reserved:  0x
```

</details>

## Retrieving Proposal and TEIB Message Hash

To find the message hash associated with a transaction hash from the source network, execute the command below. If a proposal is found in the transaction receipt, it will be reconstructed, and the corresponding message hashes will be displayed.

```
npx hardhat getMsgHash --hash <source_tx_hash> --network <network_name>
```

#### Status Codes

```
0  = NOT_INITIALIZED
1  = INVALID
2  = SAVED
3  = TRANSMITTED
4  = QUEUED
5  = PENDING
6  = PROTOCOL_FAILED
7  = EXTENSION_NOT_REGISTERED
8  = EXTENSION_NOT_REACHABLE
9  = EXTENSION_PANICKED
10 = UNDERESTIMATED
11 = SUCCESS
12 = FAILED
13 = OUT_OF_GAS
```

<details>

<summary>Output</summary>

In this example, some values have been shortened (indicated by "...") for visibility.&#x20;

```
Proposals found in receipt:  1

Source Chain Data: {
  srcChainId: 5003n,
  srcBlockNumber: 20076568,
  srcOpTxId: [
    '0xf545...d74f',
    '0x0000...0000'
  ]
}
LogDescription {
  fragment: EventFragment {
    type: 'event',
    inputs: [
      [ParamType],
      [ParamType],
      [ParamType],
      [ParamType],
      [ParamType],
      [ParamType],
      [ParamType],
      [ParamType]
    ],
    name: 'MessageProposed',
    anonymous: false
  },
  name: 'MessageProposed',
  signature: 'MessageProposed(uint256,uint256,bytes32,bytes,bytes,bytes,bytes,bytes)',
  topic: '0x87e6e...0390',
  args: Result(8) [
    80002n,
    1000000n,
    '0x0000...9a79',
    '0x0000...2748',
    '0x0000...a2d2',
    '0x0000...db46',
    '0x0000...e9af',
    '0x'
  ]
}

[Proposal created]:  {
  destChainId: 80002n,
  nativeAmount: 1000000n,
  selectorSlot: '0x0000...9a79',
  agentParams: '0x0000...2748',
  senderAddr: '0x0000...a2d2',
  destAddr: '0x0000...db46',
  payload: '0x0000...e9af',
  reserved: '0x'
}

Hashes found: [
  '0x14ed...0fa8'
]
```

</details>

## Retrieve Source & Destination Chain ID

{% hint style="warning" %}
If you're working on the Mainnet environment, change "teib" to "eib".
{% endhint %}

The below command will output the status of the message with the specified hash, including the source and destination chain ID.

```
npx hardhat getChainIds --hash <teib_tx_hash> --network teib
```

<details>

<summary>Output</summary>

{% code overflow="wrap" %}

```
Current status of message with hash 0x93f013014a46f9dc8ba9efa60da3683700a73fae736770c7234f477898ebab3b

Source chain id: 5003

Destination chain id: 33133
```

{% endcode %}

</details>

## Retrieve Initial `msg.value`

{% hint style="warning" %}
If you're working on the Mainnet environment, change "teib" to "eib".
{% endhint %}

The below command will output the reward value of the specified hash.

```
npx hardhat getReward --hash <teib_tx_hash> --network teib
```

<details>

<summary>Output</summary>

{% code overflow="wrap" %}

```
Current status of message with hash 0x6bf45198264adcb493e2c07864c71d324eec70d111552757f842186612c12bae

Reward: 1
```

{% endcode %}

</details>

## Retrieve Entire Message

{% hint style="warning" %}
If you're working on the Mainnet environment, change "teib" to "eib".
{% endhint %}

The below command will retrieve the full message, including status, nonce, and initial proposal.

```
npx hardhat getMsg --hash <teib_tx_hash> --network teib
```

<details>

<summary>Output</summary>

In this example, some values have been shortened (indicated by "...") for visibility.&#x20;

```
Message of hash:
0x6...186612c12bae

- GLOBAL -
Status: 11 | SUCCESS | delivery zone
Global nonce: 30539

- Proposal -
Destination chain:          5003
Native amount:              1
Selector slot:              0x0...0af859a79
Sender address:             0x0...03f5a530b
Destination address:        0x0...00cd4b974
Payload:                    0x0...01bdd243c
Reserved:                   0x
Block finalization option:  0
Custom gas limit:           300000

- Source chain -
Location:       1127457...683956
Source tx hash: 0xf...1b65841895

Retrieve Initial Proposal & Source Chain Data --  delete
Retrieve Source Chain ID -- delete
Retrieve Destination Chain ID --  delete
```

</details>

## Check Message Status by Hash

{% hint style="warning" %}
If you're working on the Mainnet environment, change "teib" to "eib".
{% endhint %}

To determine the current status of a sent message, execute the below command. If the transaction is found, the output will display its current status along with information from the initial proposal.

```
npx hardhat getMsgStatusByHash --hash <teib_tx_hash> --network teib
```

<details>

<summary>Output</summary>

```
Current status of message with hash <teib_tx_hash>

Status: SUCCESS

Zone: delivery
```

</details>

## Checking Message Execution on Destination Endpoint

The below command will retrieve the execution status of the provided hash on the specified network. There are 3 possible execution statuses, described below.

```
npx hardhat getMsgExecution --hash <teib_tx_hash> --network <dest_network_name>
```

<details>

<summary>Output</summary>

{% code overflow="wrap" %}

```
Current execution status of message with hash 0xdfc2c4b17f947abca4aa90697d3d82627e520c0644f9b56e6bace16d16d6b43c

Execution status: Executed
```

{% endcode %}

</details>

#### **Status Codes**

```
0 - Does not exist
1 - Executed
2 - Protocol failed
```

## Retrieving the Last Received Message by Sender

To get the last received message using a sender address, execute the command below. If the message is found, it will output message length and the message itself in bytes, which is the decoded representation.

```
npx hardhat getLastMessage --sender <sender_address> --network <network_name>
```

<details>

<summary>Output</summary>

In this example, some values have been shortened (indicated by "...") for visibility.&#x20;

```
===============================================
Bytes len of message: 194
Msg Bytes: 0x000866726f6d5f6574680000000...0000
===============================================

Last message from address 0xB3B029...5Bde9AF is: "from_eth"
```

</details>

## Get Estimate Fee

To get estimated fee for message execution on destination chain + UIP commissions execute the below command.

```
npx hardhat estimateFee --srcchainid <source chain id> --destchainid <destination chain id> --gaslimit <custom gas limit>
```

<details>

<summary>Output</summary>

```
Cross-chain Fee Estimate:
- Network: Chain 11155111 → Chain 80002
- Estimated native value (ETH): 0.000005188940008676
- Estimated native value (Gwei): 5188.940008676
- Estimated native value (Wei): 5188940008676
```

</details>


# SDK Setup

The SDK helps you interact with the messaging layer across chains. It handles functionality such as, fee estimation, message hashing, and network activity checks. The SDK is compatible whether you're working with EVM or Solana. It gives you the tools to simulate and prepare cross-chain messages with minimal setup. This guide will walk you through the setup process for the SDK.

The SDK provides fees functionalities that's used to calculate fees, check network activity, and calculate message hashes from source network transaction receipts. Below we go over examples and usage

{% hint style="info" %}
Reach out to us via our [contact page](https://entangle.zendesk.com/hc/en-us/requests/new) for suggestions or requests.
{% endhint %}

## Installation <a href="#installation" id="installation"></a>

Begin by installing the SDK in your project first. We'll be using NPM in this guide. Run the installation command below to get started.

```bash
npm install @entangle-labs/uip-sdk
```

## API

There are two main methods for estimation as shown below.

{% tabs %}
{% tab title="EVM" %}

```solidity
public async estimateExecutionWithGas({
  srcChainId: bigint,
  destChainId: bigint,
  gasLimit: bigint
})
```

{% endtab %}

{% tab title="Solana" %}

```rust
public async estimateExecutionSolana(
  input: SimulateExecuteLiteInput
)

export type SimulateExecuteLiteInput = {
  connection: Connection;
  payload: Buffer;
  srcChain: bigint;
  senderAddr: Buffer;
  destChain: bigint;
  destAddr: PublicKey;
  accounts: AccountMeta[];
  payerOverride?: PublicKey;
  computeUnits?: number;
};
```

{% endtab %}
{% endtabs %}

## Mode

By default, the SDK is configured for Mainnet usage. However, you can configure it to work for testnet like so.

{% tabs %}
{% tab title="Mainnet" %}

```typescript
const provider = new UIPProvider("<https://evm-testnet.entangle.fi>")
const feesEvm = new FeesEvm(provider)
feesEvm.mode = "mainnet"
feesEvm.EIBName = "eib"
```

{% endtab %}

{% tab title="Testnet" %}

```typescript
const provider = new UIPProvider("<https://json-rpc.entangle.fi>")
const feesEvm = new FeesEvm(provider)
feesEvm.mode = "testnet"
feesEvm.EIBName = "teib"
```

{% endtab %}
{% endtabs %}

## Network Configuration

SDK use public RPC providers by default. If you want to use your own&#x20;personal config, redefine config with.

```typescript
const feesSdkConfigured = new FeesEvm(provider, config as Chain[])
```

Where config is an array of `Chain` objects:

```typescript
{
  id: BigInt(11155111),
  name: "ethereum_sepolia",
  hexId: "0xAA36A7",
  type: "evm",
  mode: "testnet",
  rpcUrl: "<https://ethereum-sepolia-rpc.publicnode.com>",
  nativeCurrency: {
    name: "Sepolia Ether",
    symbol: "ETH",
    decimals: 18,
  },
  blockExplorerUrl: "<https://sepolia.etherscan.io>",
}
```

## Usage

{% tabs %}
{% tab title="EVM" %}

```typescript
import { FeesEvm, FeesSolana, UIPProvider } from "@entangle-labs/uip-sdk"

const provider = new UIPProvider("<https://json-rpc.entangle.fi>")
const feesEvm = new FeesEvm(provider)

async function getDstChainFee() {
  const fee = await feesSdk.estimateExecutionWithGas({
    srcChainId: 11155111n,
    destChainId: 33133n,
    gasLimit: 200000n,
  });
  console.log("Estimated price:", fee)
}
```

```typescript
  import { generateReceiptHash } from "@entangle-labs/uip-sdk"
  // ... get receipt

  const msgHash = await generateReceiptHash(BigInt(33133), receipt)
```

{% endtab %}

{% tab title="Solana" %}

```typescript
import { FeesSolana } from "@entangle-labs/uip-sdk"

const feesSolana = new FeesSolana()

fee = await feesSolana.estimateExecutionSolana({
  connection: new Connection(srcChain.rpcUrl),
  payload: Buffer.from(payloadOriginal),
  srcChain: BigInt(srcChainId),
  senderAddr: Buffer.from(senderContractAddr),
  destChain: BigInt(dstChainId),
  destAddr: new PublicKey(destAddr),
  accounts: [
    // Provide the accounts required for execution on the destination address
  ],
})
```

{% endtab %}
{% endtabs %}


# Revenue Sharing for Transmitters

Revenue sharing in UIP allows transmitters to split their earned rewards with delegators through a flexible and transparent mechanism. This system is built on a Delegated Proof of Stake (DPoS) model, where participants can stake $NGL tokens to support transmitters in securing the network and processing messages.

As detailed in the **Economy Model** section of the UIP [Whitepaper](https://entangle.fi/documents/UIP%20Whitepaper.pdf), this structure ensures fair compensation for contributors, encourages decentralisation, and increases economic alignment across the ecosystem.

## How It Works

Each transmitter receives fees for delivering and executing messages on supported networks. With revenue sharing, transmitters can define how much of their earnings are passed on to delegators. This percentage is fully configurable, allowing for flexible incentive structures. The system is designed to promote collaboration and unlock opportunities for participation, even for those who don’t run nodes themselves.

{% hint style="info" %}
For a deeper analysis, explore the details in our [whitepaper](https://entangle.fi/documents/UIP%20Whitepaper.pdf).
{% endhint %}

For example:

* A share of `10,000` (100%) means all rewards go to delegators.
* A share of `7,500` (75%) means delegators receive 75%, and the transmitter retains 25%.

This setting is managed via the staking contract on the Entangle network.&#x20;

## Why It Matters

Revenue sharing underpins UIP’s decentralization and resilience. It:

* Encourages wider participation by letting token holders back trusted transmitters
* Improves network security by distributing stake and incentives
* Increases earning potential for both transmitters and delegators
* Supports fair selection in transmitter rotation rounds, where stake weight determines eligibility

By aligning incentives, this model helps keep the protocol community-driven, reliable, and scalable.

## How to Set Revenue Share

To configure your transmitter’s reward share, you’ll need the staking contract address and access to the Entangle EIB RPC.

#### Mainnet Details

* **EIB RPC:** `https://json-rpc.entangle.fi`
* **Staking Contract Address:** `0x2897F9093bE0B5d5F9067c6f7842B949017eE830`

#### Command to Set:

```
cast send <staking_contract_address> "setRewardShare(uint256,uint256)" <chain_id> <share_percent> -r <rpc_url> --private-key <your_private_key>
```

<details>

<summary>Parameters</summary>

* `<chain_id>` – The ID of the source chain
* `<share_percent>` – A number between `0` and `10000`, where `10000` represents 100%. This value determines the portion of rewards allocated to delegators. The remaining amount is sent to the transmitter.
* `<rpc_url>` – Adjust depending on your environment
* `<your_private_key>` – Your wallet’s private key

</details>

## How to Check Your Current Share

To verify the current reward share setting, run (replacing the placeholders with the appropriate values):

```
cast call <staking_contract_address> "vaultDelegationSharePercent(uint256,address)" -r <rpc_url>
```

***

For a full breakdown of fee mechanics, rewards, and the DPoS system, see the Economy Model and Transmitter Rewards sections in the UIP [Whitepaper](https://entangle.fi/documents/UIP%20Whitepaper.pdf).


# How to Become a Super Transmitter

#### Requirements

* An EVM-compatible wallet
* Native NTGL tokens on the Entangle network (to cover registration and transaction fees)
* Docker and Docker Compose installed

## Step 1: Register as a Super Transmitter

{% stepper %}
{% step %}

#### Connect to the Entangle Network

Add the Entangle network to your wallet:

* **RPC URL:** `https://json-rpc.entangle.fi`
* **Chain ID:** `33033`
  {% endstep %}

{% step %}

#### Send the Registration Transaction

Use the following command to register:

```bash
cast send 0xB83E7753CAB418775f0dc91ACfcfECba24FE62C1 \
  "registerSuperAgentOneKeyEVM(address)" <agent-address> \
  -r "https://json-rpc.entangle.fi" \
  --private-key <your-private-key>
```

<details>

<summary>Parameter Explanation</summary>

* `<agent-address>` – The wallet address you want to register as a Super Agent
* `<your-private-key>` – The private key of your EVM wallet

</details>
{% endstep %}

{% step %}

#### Complete Registration

Contact the Entangle team via the [contact page](https://entangle.zendesk.com/hc/en-us/requests/new) to finalize your registration on the network.
{% endstep %}
{% endstepper %}

## Step 2: Launch the Transmitter Node

{% stepper %}
{% step %}

#### Pull the Latest Agent Images

```bash
docker pull msentangle/agent:3.0
docker pull msentangle/agent-setup:3.0
```

{% endstep %}

{% step %}

#### Generate Transmitter Configurations

Create an empty folder and run the setup command:

```bash
bashCopyEditdocker run --rm \
  -v $(pwd)/.:/app/agent/ \
  -e PRIVATE_KEY="yourprivatekey" \
  -e PASSWORD="yourpassword" \
  -e NON_EVM_CHAINS="11100000000000000501,othernonevmchainid" \
  -e EVM_CHAINS="146,1,otherevmchainids" \
  -e IS_SUPER_AGENT=true \
  msentangle/agent-setup:3.0
```

<details>

<summary>Parameter Explanation</summary>

* Replace `yourprivatekey` with your actual private key
* Replace `yourpassword` with a password of your choice
* Use `NON_EVM_CHAINS` for non-EVM chain IDs (e.g., `11100000000000000501` for Solana)
* Use `EVM_CHAINS` for EVM chain IDs (e.g., `146` for Sonic)

</details>
{% endstep %}

{% step %}
**Start the Transmitter Node**

Pick a unique name for your agent (e.g., `superagent-1`) and start it:

```bash
bashCopyEditdocker-compose -p <agent-name> up -d
```

Congratulations, you're now a Super Transmitter.
{% endstep %}
{% endstepper %}

## Changing Nodes

To switch to different nodes, update the relevant configuration files:

* **Solana modules:** Modify node settings in `transmitter-config.yaml`
* **Multiple node support:** In `watcher-config.yml`, use `read_rpcs` and `write_rpcs` fields to define endpoints

```json
evmchains_to_listen:
    - chain_id: "80002"
      name: Polygon Amoy
      rpc_http_urls:
        - https://polygon-amoy.gateway.tenderly.co
        - https://polygon-amoy.gateway.tenderly.co
        - https://polygon-amoy.gateway.tenderly.co
```

## Optional Configuration Parameters

You can adjust performance and behaviour by modifying the following values:

* **`parse_new_headers_interval`** – How often to fetch new block headers (e.g., `5s`, `1m`)
* **`max_query_in_batch`** – Max number of requests in one batch
* **`filter_logs_max_blocks`** – Max block range for log filtering
* **`blocks_delay`** – Delay between latest block and the one being processed
* **`blocks_batch_to_filter`** – Min number of blocks to filter in one go
* **`min_balance_to_alert`** – Threshold (in wei) for triggering low-balance alerts


# Endpoints

The table below shows the UIP Endpoint addresses on supported networks. Use these addresses when connecting your smart contracts to UIP. They handle sending, verifying, and executing crosschain transactions, so make sure your integration references the correct address for your target blockchain.

{% tabs %}
{% tab title="Mainnet" %}

<table><thead><tr><th width="44.66668701171875">#</th><th width="125.333251953125" valign="middle">Name</th><th width="100.3333740234375">Chain ID</th><th>Address</th></tr></thead><tbody><tr><td>1</td><td valign="middle">Solana</td><td>11100000000000000501</td><td>uipby67GWuDDt1jZTWFdXNrsSu83kcxt9r5CLPTKGhX</td></tr><tr><td>2</td><td valign="middle">Ethereum</td><td>1</td><td>0xc0943B2AC1744a0C3283C9D4F232c9F37623d365</td></tr><tr><td>3</td><td valign="middle">Sonic</td><td>146</td><td>0xc0943B2AC1744a0C3283C9D4F232c9F37623d365</td></tr><tr><td>4</td><td valign="middle">Avalanche</td><td>43114</td><td>0xc0943B2AC1744a0C3283C9D4F232c9F37623d365</td></tr><tr><td>5</td><td valign="middle">Polygon</td><td>137</td><td>0xc0943B2AC1744a0C3283C9D4F232c9F37623d365</td></tr><tr><td>6</td><td valign="middle">Mantle</td><td>5000</td><td>0xc0943B2AC1744a0C3283C9D4F232c9F37623d365</td></tr><tr><td>7</td><td valign="middle">EIB</td><td>33033</td><td>0x1ef075DC23Ac2B6716Ab35Ee9Bf80A31D30316F7</td></tr><tr><td>8</td><td valign="middle">Abstract</td><td>2741</td><td>0x072C840A8C1D232BBf83E4007d829Be60E81e672</td></tr><tr><td>9</td><td valign="middle">Berachain</td><td>80094</td><td>0xc0943B2AC1744a0C3283C9D4F232c9F37623d365</td></tr><tr><td>10</td><td valign="middle">Manta</td><td>169</td><td>0xc0943B2AC1744a0C3283C9D4F232c9F37623d365</td></tr><tr><td>11</td><td valign="middle">Immutable</td><td>13371</td><td>0xc0943B2AC1744a0C3283C9D4F232c9F37623d365</td></tr><tr><td>12</td><td valign="middle">Optimism</td><td>10</td><td>0xc0943B2AC1744a0C3283C9D4F232c9F37623d365</td></tr><tr><td>13</td><td valign="middle">Arbitrum</td><td>42161</td><td>0x10f6f1569AA23EB5A744F2b3e81C4bC9e4286bB3</td></tr><tr><td>14</td><td valign="middle">Binance</td><td>56</td><td>0xf2D94b3e153052Ea3654feAdDb477D8D16468b76</td></tr><tr><td>15</td><td valign="middle">Base</td><td>8453</td><td>0xc0943B2AC1744a0C3283C9D4F232c9F37623d365</td></tr></tbody></table>
{% endtab %}

{% tab title="Testnet" %}

<table><thead><tr><th width="44.66668701171875">#</th><th width="125.3333740234375">Name</th><th width="100">Chain ID</th><th>Address</th></tr></thead><tbody><tr><td>1</td><td>Solana</td><td>100000000000000000000</td><td>uipby67GWuDDt1jZTWFdXNrsSu83kcxt9r5CLPTKGhX</td></tr><tr><td>2</td><td>Ethereum Sepolia</td><td>11155111</td><td>0x6cD023DCfd56F807199fA563b235f61D83EfF8B3</td></tr><tr><td>3</td><td>Sonic Blaze</td><td>57054</td><td>0x7849B81013c9531D5aCB351537142D86837032Ba</td></tr><tr><td>4</td><td>Avalanche Fuji</td><td>43113</td><td>0x98f2547b938DC5FF603bF1cA0feb2E8518fb723F</td></tr><tr><td>5</td><td>Polygon Amoy</td><td>80002</td><td>0x065AAeA3416f518717d3f2f7C03C9B9Ca96bA68C</td></tr><tr><td>6</td><td>Mantle Sepolia</td><td>5003</td><td>0x8Cd0f9e0F24C4e8dD511146249fa2caCC76dD023</td></tr><tr><td>7</td><td>TEIB</td><td>33133</td><td>0xdB106F7FA0CbD91dF3A9e6162fC9a7BB5041E5E0</td></tr><tr><td>8</td><td>Base Sepolia</td><td>84532</td><td>0x641153d6f5cc0aA910db01bdcdE7F23126845037</td></tr></tbody></table>
{% endtab %}
{% endtabs %}


# Overview

[Universal Data Feeds (UDF)](https://udf.entangle.fi/) is a next-generation, high-performance oracle network delivering hyper-fast, cost-efficient, reliable, and highly secure data feeds across multiple blockchains. UDF is the gateway to a new era of decentralized data, enabling real-time, high-frequency data delivery for DeFi, AI-driven applications, and Real-World Assets (RWAs). Supporting both push and pull models through dedicated marketplace contracts deployed on target chains, UDF ensures trust-minimized, low-latency updates while optimizing costs for decentralized applications.&#x20;

For a deeper analysis, explore the details in our [whitepaper](https://entangle.fi/documents/UDF%20Whitepaper.pdf).

## How does it work?

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FP8w7eP7Ygb8FUqCHbO4J%2Fwhat_is_udf_2.png?alt=media&amp;token=44ceca12-0c01-4633-9a7d-861f42395939" alt=""><figcaption></figcaption></figure>

UDF is a decentralized platform that connects on-chain and off-chain data to smart contracts, facilitating real-time data delivery from a variety of sources. UDF supports both EVM and non-EVM networks with a standardized delivery format that's designed to offer developers the flexibility to work across blockchains — providing a flexible, secure, and scalable infrastructure for creating data-driven solutions across diverse platforms.

By offering both **Push** and **Pull** Oracle delivery models, UDF allows developers to choose the most suitable method for their use cases. The **Push** model continuously updates data at predetermined intervals, while the **Pull** model gives applications the ability to retrieve data only when needed, optimizing efficiency and cost. UDF empowers decentralized applications to interact with real-time data, whether it’s for trading, cross-chain communication, or any other data-dependent function.

Additionally, UDF offers an intuitive and easy to use marketplace hub, a fully integrated ecosystem, acting as the entry point for users to access feeds. It provides users an all in one page to search for assets and manage their data feed subscriptions.

[Learn More](/universal-data-feeds/architecture/data-delivery-methods)

## Features

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F9huriI4eipPaYC8jzr84%2Fimage.png?alt=media&amp;token=13dfdd88-9f72-4acf-9e2e-2f2e08f151e0" alt=""><figcaption></figcaption></figure>

<table data-card-size="large" data-view="cards" data-full-width="false"><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>High-Frequency Updates</strong></td><td>Ultra-low-latency data updates by leveraging the Entangle Interoperable Blockchain and parallelized Layer 2 rollups. This means 200ms frequency for updates, short block times and reduced data latency. Ideal for high-speed trading, gaming, and AI-driven dApps.</td></tr><tr><td><strong>Flexible Data Delivery Models</strong></td><td>Choose exactly how your dApp receives oracle data. Select Pull for on-demand data access within transactions (PAYG or subscription), or Push for continuous updates using subscriptions with a fair cost-sharing model. Efficiently and precisely manage your  data consumption needs.</td></tr><tr><td><strong>Monetization Options</strong></td><td>Control your oracle costs with flexible monetization options: Pay-As-You-Go for occasional data requests, Pull Subscriptions for predictable monthly access, and Push Subscriptions with deposits and cost-sharing. UDF provides affordability whatever your  scale.</td></tr><tr><td><strong>Intuitive Marketplace UI</strong></td><td>Find, manage, and buy oracle feeds easily via the intuitive Marketplace UI. Quickly discover available feeds, customize subscription settings, and track your usage seamlessly from a single convenient dashboard. Accessing decentralized data has never been easier.</td></tr><tr><td><strong>Customizable Update Parameters</strong></td><td>Customize Push updates precisely with selectable price deviation thresholds (0.25%, 0.5%, 1%, 2.5%, 5%) and a default 24-hour heartbeat. Optimize data freshness and costs according to your app’s sensitivity, ensuring timely updates that are aligned with market movements and your specific needs.</td></tr><tr><td><strong>Robust Security</strong></td><td>Trusted data delivery using Byzantine Fault Tolerance (BFT). Decentralized transmitter nodes securely aggregate and cryptographically verify data, instantly detecting and penalizing malicious activity. UDF guarantees that your application always receives tamper-proof, validated data, even under adverse network conditions.</td></tr></tbody></table>

## Explore

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>Architecture</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F2J8Wb7OV9gMcXXalDzQW%2FArhitecture.png?alt=media&amp;token=c8aa63ae-1f32-4dc7-a9ff-079f47268175">Arhitecture.png</a></td><td><a href="/universal-data-feeds/architecture">Architecture</a></td></tr><tr><td>Developer Guides</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FZu23rNH2hiipQX5f6kpw%2FCode%20Review%20Reporter.png?alt=media&amp;token=93e7b7be-9ba0-4410-abe4-ff629ea65926">Code Review Reporter.png</a></td><td><a href="/universal-data-feeds/developer-guides">Developer Guides</a></td></tr><tr><td>User Guides</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fen3MQYtYTiju2yC07tBs%2F24.png?alt=media&amp;token=f42cb13d-ffb1-45bd-9859-54f68ce66b31">24.png</a></td><td><a href="/universal-data-feeds/user-guides">User Guides</a></td></tr><tr><td>Data Endpoints</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FpFQQPOL66dha7yv9Nw68%2F22.png?alt=media&amp;token=0d02a7dd-72c5-45f8-8a54-e3d0f92d4e06">22.png</a></td><td><a href="/universal-data-feeds/data-endpoints">Data Endpoints</a></td></tr><tr><td>Frequently Asked Questions</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FWhD3OfXU0q0AbKF5THh4%2F25.png?alt=media&amp;token=091c6862-1a6c-4bb9-9c9c-d41a3290abc2">25.png</a></td><td><a href="/more/faq">FAQ</a></td></tr></tbody></table>


# Architecture

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FXT2iq9pGptdq53V8MmZu%2Funiversal_data_feeds-1.jpg?alt=media&amp;token=d47b1bb2-0d74-49c0-b9ba-51c153c7ebd4" alt=""><figcaption></figcaption></figure>

The diagram above illustrates the architecture of Entangle's **Universal Data Feeds** (UDF), a system designed to ensure secure, efficient, and scalable delivery of verified data across blockchains. At its core, UDF integrates data **Aggregation**, **Attestation**, and **Updating** with a convenient **Data Delivery** method, supporting diverse use cases while ensuring reliability and accuracy.

## Terminology

<table data-view="cards"><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>UDF Oracle</strong></td><td>Core system for data aggregation, signature verification, and on-chain publication.</td></tr><tr><td><strong>Pull Model</strong></td><td>Data-verification method for each user transaction, containing oracle votes.</td></tr><tr><td><strong>Push Model</strong></td><td>Data publication method where nodes regularly push updated values on-chain.</td></tr><tr><td><strong>Transmitters</strong></td><td>Decentralized agents that sign and attest to data, forming a security layer for aggregated values.</td></tr><tr><td><strong>Entangle Interoperable Blockchain (EIB)</strong></td><td>A specialized oracle chain that coordinates data availability, finalization, and bridging logic.</td></tr><tr><td><strong>Layer 2 (L2)</strong></td><td>Layer 2 rollups that further boost throughput and reduce latency of the EIB.</td></tr><tr><td><strong>Finalized Snapshot</strong></td><td>A canonical data set  aggregated from various sources &#x26; attested by transmitters.</td></tr><tr><td><strong>VerificationLib</strong></td><td>A smart contract library that validates oracle votes for secure data feeds on target chains.</td></tr><tr><td><strong>Byzantine Fault Tolerance (BFT)</strong></td><td>An algorithim for fault tolerance used by transmitters to sign data updates.</td></tr></tbody></table>

## Core Stages

The process begins with **data collection**, where the raw data is fetched from reliable, high-quality **Data Providers** at fixed intervals. This data is encapsulated into a structured format containing key attributes such as the `feedKey`, `value`, and `timestamp`. To ensure the integrity and authenticity of the data, it is signed using **ECDSA signatures**, effectively securing it from tampering. Once packaged, the signed data is sent as an update transaction to the **Oracle Chain**, where it undergoes aggregation and attestation (validation).

The **Oracle Chain** serves as the processing hub, consisting of two key modules. It offloads data collection and processing to L2 auxiliary blockchains, enabling fast, distributed data collection and parallel processing for real-time data feeds. The **Aggregation** module consolidates inputs from multiple publishers into a coherent dataset. Subsequently, the **Attestation** module creates on-chain verifiable proofs, certifying the accuracy and reliability of the aggregated data on the target chain.

Users can then use the **Update Provider Service** which is a service to generate snapshots of data which are maintained on the Oracle Chain for consistency and retrieved via a **Delivery Method** (i.e., an API) for accessibility. It provides a unified reference point, eliminating the need to interact directly with the Oracle Chain.

On the **Target Chain**, UDF plays a pivotal role in managing delivered data. It enables decentralized applications to access and utilize verified data directly in their logic. It also facilitates verification of data using the VerificationLib which is the smart contract library that handles validating data on target chains. These measures ensure that all signatures are valid, votes are unique, and the data has met consensus thresholds. For numerical feeds, the verification process aggregates the data into a final state, often using statistical methods like medians to derive a reliable result.

## Integration with EIB & L2 Solutions <a href="#integration-with-l2-solutions" id="integration-with-l2-solutions"></a>

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fue3DNOCKVUAgpgZBRV93%2Fl2_interoperability.jpg?alt=media&amp;token=0528f11a-2ebf-4509-89a1-422ae4380093" alt=""><figcaption></figcaption></figure>

UDF integrates EIB with L2 solutions for scalability, performance, and cost optimization. This approach allows relaying aggregated data snapshots to each target chain. The L2 network is parallelized and synced with EIB to handle specific tasks (aggregator rollups) and offload mainchain overhead while enabling unlimited horizontal scaling. &#x20;

EIB's robust consensus mechanism (Tendermint BFT) that finalizes data more rapidly than many L1 networks is leveraged by the L2 solutions as a trusted layer to periodically commit their state. This lets the L2 solutions inherit EIB’s security while achieving greater compute bandwidth and lower costs, enabling near real-time data updates.

Additionally, unlike traditional L2 processes, UIP's internal utility networks bypass full block finalization for messages that do not involve value transfers, relying solely on source network finalization to speed up delivery.

In short, UDF leverages the EIB, a specialized blockchain, for orchestrating:

* **Cross-Chain Consensus**
* **Validator Set & Finality**
* **Performance & Lower Costs**

## Role of Transmitters & Decentralized Agent Network

A decentralized network of lightweight transmitter nodes retrieves raw data from various sources and cryptographically signs each update before submission to the oracle chain. These signatures collectively form a Byzantine-tolerant proof, ensuring the integrity and validity of the data. Signatures are merged into a final proof, which is used for validation on external blockchains and off-chain applications.

* Transmitters must stake the native EIB tokens to participate in the network, aligning incentives with honest operation. Staked assets act as a security deposit, misbehavior, downtime, or incorrect data submissions result in slashing penalties. This mechanism prevents Sybil attacks while ensuring that only committed, well-incentivized nodes contribute to UDF’s data integrity.
* Generate signatures on data updates, contributing to a trust-minimized consensus.
* Are monitored and rotated, with penalties for downtime or producing inconsistent signatures.

## Finalized Data Snapshot

Once finalized, the data snapshot is posted on the EIB/L2 oracle chain, ensuring accuracy through multiple layers of signed votes. The Finalized Data Snap service continuously synchronizes with the oracle chain, providing real-time oracle data for users and push nodes to retrieve validated oracle data efficiently.

The final snapshot is a cryptographically verifiable object that includes:

* Aggregated Value (e.g., BTC/USD = 100,000)
* Timestamp
* Transmitter Signatures
* Optional Extra Metadata (standard deviation, volume data, etc.)

## Summary

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F9jgSFS1Euh1mSSGP4zl6%2Flimitless%20access%20any%20feed%20any%20chain%20any%20sourc.jpg?alt=media&amp;token=63900cb8-c5c7-46c7-b333-658a0a8cfa42" alt=""><figcaption></figcaption></figure>

UDF supports two primary delivery models, **Push** and **Pull.** In the Push Model, updates are actively sent by the Push Publisher (i.e., Push Node) to the target chain, while in the Pull Model, users initiate requests for the latest data snapshots and append verification details to their transactions.

UDF offloads computationally intensive tasks such as aggregation and validation to the Oracle Chain, allowing the system to minimize on-chain costs while ensuring rapid updates. Additionally, a robust verification process guarantees that the data remains tamper-proof throughout its lifecycle, allowing cross-chain deployments without comprising data integrity.

UDF is an essential pillar in infrastructure for modern blockchain ecosystems. It excels in delivering accurate, timely, and secure data to decentralized applications, positioning it as a leading solution for cross-chain data delivery.


# Data Delivery Methods

UDF provides both push and pull oracle solutions through dedicated marketplace contracts deployed on target chains. These contracts enable seamless data access tailored to different use cases. Pull model is like ordering data on demand; push model is like subscribing to a live feed.

At the core of this system is VerificationLib, a smart contract deployed on target chains to aggregate signed oracle votes into a single, consensus-driven value. It supports multiple data types, including price feeds and high-precision floating-point values, ensuring adaptability across various applications.

Both push and pull marketplace contracts operate alongside VerificationLib, leveraging its validation mechanism to guarantee the integrity and reliability of oracle data.

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Pull Model</strong></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FuWmIsZxVAHHNkIvApZeq%2F26.png?alt=media&amp;token=cb7b3c8d-4dab-43c8-82cc-db964c13a6ec">26.png</a></td><td><a href="/universal-data-feeds/architecture/data-delivery-methods/pull-model">Pull Model</a></td></tr><tr><td><strong>Push Model</strong></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FZkjfhG90QLzb8GXZp2lI%2F21.png?alt=media&amp;token=10d0901b-4213-4e1d-a17c-1a98fdfc2e07">21.png</a></td><td><a href="/universal-data-feeds/architecture/data-delivery-methods/push-model">Push Model</a></td></tr></tbody></table>

## **When to Use Push vs. Pull Models**

The **Pull Model (On-Demand)** fetches data only when required, ensuring it is up-to-date and reducing unnecessary updates. This method optimizes for accuracy and cost efficiency since the data is retrieved in real time based on the application’s needs. It eliminates delays caused by maintaining an on-chain state and is ideal for scenarios requiring real-time precision, such as DeFi trades or event-based actions.

On the other hand, for the **Push Model (Continuous)**, data is delivered periodically, irrespective of immediate need, by maintaining an on-chain state. While it ensures that data is consistently available, this approach can introduce delays and inaccuracies due to the cost and technical limitations of frequently updating the on-chain state. As a result, this model is best suited for DEXs or stablecoin issuers requiring continuous price updates for liquidity pools at fixed intervals or price deviations.

## **Pricing**

UDF’s flexible monetization covers both subscription-based payments for push and pull feeds and a pay-as-you-go (PAYG) model for pull verifications, allowing users to choose plans based on their data needs and cost preferences. Pricing details are implemented via the PullMarketplace and PushMarketplace contracts.

The **Push Model** delivers regular oracle updates based on configurable price deviations (0.25%, 0.5%, 1%, 2.5%, 5%) or a default heartbeat (every 24 hours). Users deposit funds upfront, and subscription costs are shared among all users. This becomes increasingly cost-effective as more subscribers join the same feed.

The **Pull Model** lets users fetch oracle data directly within their transactions using either Pay-As-You-Go (PAYG) or monthly subscriptions. PAYG users pay a small fee per data request, ideal for occasional queries, while subscriptions offer unlimited data access at predictable monthly rates. Since data updates occur continuously off-chain, users only pay transaction verification costs, regardless of usage frequency.

Please refer to the UDF [whitepaper](https://entangle.fi/documents/UDF%20Whitepaper.pdf) for in-depth details on how the prices are calculated.

#### Pull Model

* **PAYG (Pay-As-You-Go)**: Users pay a small protocol fee per request. This model is best for dApps with sporadic or low-frequency data needs, as costs scale with usage. Learn more about the exact formula we use in our [whitepaper](https://entangle.fi/documents/UDF%20Whitepaper.pdf). PAYG is solely programatic and cannot be purchased through the marketplace, learn more [here](/universal-data-feeds/developer-guides/fetch-data-via-pull-model-payg).
* **Subscription**: Users can subscribe to continuous data access for a fixed periodic (e.g. monthly) fee, eliminating the PAYG protocol fee. This model is ideal for applications with consistent data consumption, reducing transaction overhead while ensuring predictable expenses. You can manage your subscriptions through the marketplace.&#x20;

#### Push Model

* **Fair Pricing Model**: The protocol ensures pricing transparency by dynamically estimating costs based on gas prices, assets volatility, and cost sharing mechanisms. Users prepay for updates, there is a minimum deposit covering a few updates, and an estimated suggested deposit to cover for about 7 days of updates for the user to be able evaluate costs. Additionally we advise users to also consider the buffer deposit to cove for gas spikes and volatility.
* **Exclusive Access**: On-chain price data is restricted to paying users, ensuring that only those contributing to the ecosystem benefit from updates.
* **Cost Sharing Mechanism**: As more consumers subscribe to a feed, the cost per user decreases, making the model more economical at scale.

#### Cost Structure Across Multiple Chains

Gas prices vary significantly (e.g., Ethereum vs. an L2) and UDF must adapt. Fees vary based on the target chain’s gas costs; higher fees apply to expensive chains, while cheaper chains benefit from lower costs. Pricing is periodically adjusted to reflect changes in network fees, ensuring sustainable operations across all supported chains.&#x20;

## Speed

The **Pull Model** ensures that data updates are available in real-time, with minimal delay since users fetch and verify updates themselves, making it particularly useful for time-sensitive applications where immediate data updates are crucial, such as trading platforms or live dashboards.

In contrast, the **Push Model**, may introduce some latency since data is pushed periodically on-chain, an expensive process. While it is generally fast, it is better suited for applications where real-time updates are not as critical.

## Gas Usage

The **Pull Model** provides excellent scalability for applications requiring frequent updates. It is best suited for scenarios with lower transaction volumes, where the cost impact of update verification remains minimal.

On the other hand, the **Push Model** scales efficiently across all scenarios by providing much simpler flow for feed value retrieval, saving gas for end-users. It's particularly advantageous for applications with medium-to-high transaction volumes, where gas usage is a significant concern. Push users simply read the latest data from storage without incurring additional gas charges, making this model a more cost-effective solution for handling high transaction volumes.


# Pull Model

Entangle's Pull Model ensures real-time data availability for user transactions, eliminating dependency on scheduled updates. This approach enhances the precision and reliability of blockchain applications by providing up-to-date information when needed.

When a transaction is initiated, the application requests the latest data directly from Entangle's decentralized sources. The data is retrieved instantly from a snapshot of verified data, and is authenticated within the same transaction. This ensures only accurate, real-time data is used, minimizes costs, and provides a reliable foundation for cross-chain applications.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FlQF8cyUkftPyJ9jFgPXP%2Fpull%20model%20sequence.png?alt=media&amp;token=1060f55d-459c-4f56-b31b-5f3bf9055d84" alt=""><figcaption></figcaption></figure>

#### User Transaction

When a dApp user wants to perform an action (e.g., open a leveraged position, or open a lending/borrowing position), the latest data feed proof is included in the transaction’s calldata. This action uses the PullMarketplace contract with the functions `verifyWithFee` and `verifyAsSubscriber` for PAYG and Subscription methods respectively.

#### On-Chain Verification

The UDF oracle contract verifies signatures from the aggregator (transmitters). If valid, the feed value is accepted for that user’s transaction.

#### Gas & Fee Implication

Each user pays a “verification fee” in native tokens (either through Pay-As-You-Go (PAYG) approach or predefined monthly subscriptions) to cover the cost of verifying the aggregator’s signatures and for the aggregator’s services. This suits lower-frequency but latency-sensitive use cases.

## Summary

* **Minimal Data Staleness**: The feed is as fresh as the aggregator’s most recent update with an update frequency of 200ms.
* **Lower Latency**: Data is fetched during transaction creation and verified during execution, ensuring real-time accuracy.
* **Decentralized Access**: Each user includes the proof, removing reliance on a single push node.
* **Fine-Grained Cost**: Perfect for dApps using PAYG with moderate or unpredictable usage, as they pay only when they need the data.
* **Transaction Gas Costs**: Each transaction requiring oracle verification incurs verification overhead.
* **Best for On-Demand Use Cases**: Ideal for lending protocols, derivatives, and real-time settlement applications.


# Push Model

Entangle's Push Model delivers continuous, automated updates for critical data, such as prices and asset values, across multiple blockchains. These updates are delivered periodically, making them ideal for scenarios requiring data at set intervals or infrequently, without the need for user requests. This is particularly useful for applications like monitoring dashboards or dApps that display market prices or feed metrics, ensuring optimal performance without user-initiated transactions.

The Push Model transmits verified information across blockchains when specified deviations occur and at set heartbeat intervals. All updates undergo a secure, consensus-driven verification process before being published on-chain, ensuring data accuracy and security.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FJTmYSMsgZJYHotfRRMko%2Fimage.png?alt=media&amp;token=48336121-e754-41c3-bc17-74fdf04ab10c" alt=""><figcaption></figcaption></figure>

#### Scheduled or Triggered Updates

UDF push nodes post the current aggregated feed to a target chain at given price deviations of 0.25%, 0.5%, 1%, 2.5%, or 5% depending on the deviation parameter selected by users, or based on a predefined heartbeat of 24 hours to guarantee sufficient data freshness even when price variations are minimal.

This means users with stricter update frequencies bear a proportionally higher cost, increasing a user's cost share. This ensures that users requiring frequent updates pay more, while those with wider deviation tolerances contribute adequately less, maintaining fairness and economic efficiency.

#### Single On-Chain Storage

The UDF push oracle contract holds the verified value so that authorized users’ dApps can read it without paying additional verification overhead. This is managed by the PushMarketplace contract, and whitelisted addresses can read via the `getFeedPrice` function.

#### Fee Model

Subscribed users can share the cost of running the same feed which guarantees cost efficiency for users. As more consumers subscribe to a feed, the cost per user decreases, making the model more economical at scale. Consider checking out our [whitepaper](https://entangle.fi/documents/UDF%20Whitepaper.pdf) for indepth details on the cost sharing formula.&#x20;

UDF charges a small percentage on deposits to the push marketplace contract. The push oracle updates cost is shared across subscribed readers, making it cheaper for the UDF push oracle user base wanting continuous access.

## Summary

* **Gas Efficiency for Consumers**: Price reads are restricted to subscribed users and data updates are shared across multiple users, reducing individual verification costs.
* **Cost Efficiency for Consumers**: Cost sharing mechanisms amongst subscribed users makes subscriptions cost efficient.
* **Slight Delay in Data Freshness**: Updates happen periodically (price deviation triggers or time-based heartbeats).
* **Best for Continuous Data Access**: Suited for DEXs, stablecoin issuers, and liquidity protocols needing steady price updates.


# Oracle Contract & User Interaction

UDF’s oracle contracts provide two distinct interfaces, Pull and Push, designed to deliver flexible data access for dApps. Please refer to the [developer guides](/universal-data-feeds/developer-guides) section for implementation details.

The Pull interface enables on-demand verification within user transactions, supporting both Pay-As-You-Go (PAYG) and subscription-based models. The Push interface offers subscribed users seamless access to pre-verified, on-chain data updates.

These interfaces, detailed in the table below, leverage VerificationLib to ensure data integrity and adaptability across diverse use cases.

<table><thead><tr><th width="94">Interface</th><th width="175">Function</th><th width="276">Purpose</th><th>Use Case</th></tr></thead><tbody><tr><td><br>Pull</td><td>verifyWithFee()</td><td>Processes the protocol fee for the PAYG pull model during a transaction, verifies transmitter votes, and returns the aggregated data value.</td><td>Ideal for dApps with sporadic data needs.</td></tr><tr><td><br>Pull</td><td>verifyAsSubscriber()</td><td>Confirms the user has an active pull subscription, verifies votes, and returns the aggregated data value without additional protocol fees.</td><td>Suited for protocols (e.g. lending) needing frequent, real-time price checks with predictable costs.</td></tr><tr><td><br>Push</td><td>getFeedPrice()</td><td>Allows subscribed users to read the latest push feed data stored on-chain without verification overhead.</td><td>Suited for DEXs or stablecoin issuers requiring continuous price updates for liquidity pools.</td></tr></tbody></table>

## Data Endpoints & Omnichain Infrastructure

* **Multiple Chains**: Each supported chain has UDF Oracle Push and Pull contract deployments. See the [data endpoints](/universal-data-feeds/data-endpoints) page for more information.
* **Push Node Authorization**: Authorization mechanisms manage the push nodes that are permitted to submit updates on each chain, ensuring controlled data propagation through access control mechanisms.
* **Cross-Chain**: For multi-network deployments, EIB supports two sync methods. In the subscription model, chains listen for finalized updates. In the push model, updates are actively sent when values change or a heartbeat is triggered. Both approaches keep data consistent with minimal delay.

## Omnichain Messaging & Cross-Chain Data Propagation

UDF supports seamless omnichain data delivery through two models. In the subscription model, transmitter nodes monitor the Entangle Interoperable Blockchain (EIB) and relay oracle updates to subscribed chains as they’re finalized. This ensures efficient propagation with minimal overhead. In contrast, the push model takes a more active approach. Specialised nodes listen to live oracle emissions from L2, compare them with on-chain values, and trigger updates when deviation thresholds or heartbeat timers are met. Each target chain is updated independently, keeping data in sync and available in real time for multi-chain dApps.


# Developer Guides

UDF is a modular oracle protocol that allows smart contracts to access both Web2 and Web3 data seamlessly, delivering authenticated, customizable data on-demand. It offers developers the flexibility to choose between push and pull data feeds, optimizing cost-efficiency and performance. UDF standardizes data streaming into a universal format, enabling dApps to easily connect with data sources across any EVM and non-EVM network.

Existing dApps or developers planning to build one requiring an oracle for price data, can integrate our data feeds into your smart contracts. Get started by taking a look at one of our guides.

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>Custom Data Feeds</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FfgRGA9e7qIlL9VvNAfEa%2FConnecting%20Custom%20Data.png?alt=media&amp;token=f820395a-b977-4f76-b51f-6bfbd7d6491a">Connecting Custom Data.png</a></td><td><a href="/universal-data-feeds/developer-guides/custom-data-feeds">Custom Data Feeds</a></td></tr><tr><td>Fetch Data via Pull Model (PAYG)</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FI3OHTZNvHC0PE8pqJGMb%2FLiquid%20Vault%20Audit.png?alt=media&amp;token=5ba9deb8-d430-4a0a-868a-be694448af72">Liquid Vault Audit.png</a></td><td><a href="/universal-data-feeds/developer-guides/fetch-data-via-pull-model-payg">Fetch Data via Pull Model (PAYG)</a></td></tr><tr><td>Fetch Data via Pull Model (Subscription)</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FMxrz0JJYICzoDEaNASSe%2FETS%20Guides.png?alt=media&amp;token=92a8df20-217d-482f-bc20-b06df89bc48e">ETS Guides.png</a></td><td><a href="/universal-data-feeds/developer-guides/fetch-data-via-pull-model-subscriptions">Fetch Data via Pull Model (Subscriptions)</a></td></tr><tr><td>Fetch Data via Push Model</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FemwP69atNJAnhXWl66Vt%2F15.png?alt=media&amp;token=544a1f5a-9502-41fe-ad8a-a90987e7dca3">15.png</a></td><td><a href="/universal-data-feeds/developer-guides/fetch-data-via-push-model">Fetch Data via Push Model</a></td></tr></tbody></table>


# Custom Data Feeds

{% hint style="info" %}
If you're looking for a data type that isn't currently supported but would like it to be, feel free to [contact us](https://entangle.zendesk.com/hc/en-us/requests/new), and we can discuss implementing it.
{% endhint %}

Custom data in data feeds refers to user-defined information that is integrated into a data feed to meet the specific needs of a dApp or smart contract. This enables developers to pull tailored data from both on-chain and off-chain sources, facilitating more accurate and relevant decision-making and operations. With UDF, users can easily expand the data available to their applications by incorporating new data types into the Entangle UDF infrastructure.

***

## When Is Custom Data Needed?

* **Integrating New Crypto Assets:** Add new cryptocurrency price feeds to ensure decentralized exchanges, lending platforms, or wallets always have the latest market prices.
* **Real-World Asset (RWA) Integration:** Introduce real-world assets like commodities, real estate, or physical goods into the decentralized ecosystem, enabling their tokenization and trading.
* **Proof of Reserves Integration:** Add external data feeds to verify asset reserves, providing transparency and confidence in the backing of digital assets or financial platforms.

***

## Requesting New Data Types

To integrate new data into UDF, [contact us](https://entangle.zendesk.com/hc/en-us/requests/new) and provide the following information:

* **Initial Data with Examples**: Share real sample data that will be processed during the integration.
* **Data Processing Requirements**: Outline any necessary transformations or formatting for the data to be delivered on-chain.
* **Update Frequency Suggestions**: Recommend the desired update frequency to tailor the integration to the protocol’s needs.

***

## Integration Process

This section outlines the process of integrating a new data feed into UDF. The default integration flow ensures smooth onboarding of new data sources and utilizes UDF’s capabilities for fetching, parsing, and distributing data on-chain.

{% stepper %}
{% step %}

### **Define REST URL Template**

The Rest URL template defines how data is fetched from external sources. You will need to create a URL template that points to the endpoint of the data provider. The template uses Go text syntax, with placeholders such as `DataKey` and `SourceID`. Example for Binance API:

```
https://api.binance.com/api/v3/avgPrice?symbol={{.DataKey}}
```

This URL template is inserted into the configuration file, allowing Entangle's backend to fetch the necessary data.
{% endstep %}

{% step %}

### **Set Up Parsing Pipelines**

In the configuration file, set up pipelines to parse data from the response JSON. Below is an example JSON response structure:

```json
{
  "asset": {
    "price": 1000000000000000000,
    "timestamp": 1721636387,
    "volume": 10000000000
  }
}
```

* **Pipeline for Price**: `asset.price`
* **Pipeline for Timestamp**: `asset.timestamp`
* **Pipeline for Volume**: `asset.volume`

These pipelines should be defined using GJSON syntax to extract the required fields.
{% endstep %}

{% step %}

### **Configure the System**

The next step is to implement both the URL template and parsing pipelines in the YAML configuration file. This connects the data feed with Entangle UDF.

Example configuration snippet:

```yaml
urlTemplate: "https://api.binance.com/api/v3/avgPrice?symbol={{.DataKey}}"
pipelines:
  - value: "asset.price"
  - timestamp: "asset.timestamp"
  - volume: "asset.volume"
```

{% endstep %}

{% step %}

### **Fetch Data**

To retrieve data updates, use the Finalized Data API. For example, to fetch the BTC/USD price feed, execute the following curl command:

```sh
curl https://udfsnap.ent-dx.com/last_votes?feedKeys=BTC/USD
```

Below is a sample response containing publisher votes along with their signatures, and data encoded as bytes in the `update_call_data` property which is ready to be used on-chain.

```json
{
  "update_call_data": "0x..",
  "feeds": [
    {
      "feed_key": "BTC/USD",
      "votes": [
        {
          "Value": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAS4fbe+zAAA=",
          "Timestamp": 1737093395,
          "Signature": {
            "R": "0xfb2e89fb52f1d832d5437f4b773c0f67749b914b25c592af9cbc8ffe58e9e928",
            "S": "0x3c7e717a67b8a0c072f0271f35f3994c865c12b930f20b57149b623cade43d43",
            "V": 27
          }
        },
        {
          "Value": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAS4fbe+zAAA=",
          "Timestamp": 1737093402,
          "Signature": {
            "R": "0xe6a1448feac17a219c63a426f978cd395f8be55a74ebc717a88385033c7c5432",
            "S": "0x1a16ba5138e5293b03c093097c8564c55a0f054537a6c665d3b4bc9cf716d46f",
            "V": 28
          }
        },
        {
          "Value": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAS4fbe+zAAA=",
          "Timestamp": 1737093400,
          "Signature": {
            "R": "0x8308dc0d3b5a32a12374fbc8a2852cb14af4e31cc015b4d463e4cfb41d5aa469",
            "S": "0x12d5746c9499e7dc5edbbc436f696478ab4ad5a96247fb357d3d0c418769778d",
            "V": 28
          }
        }
      ]
    }
  ]
}
```

{% endstep %}

{% step %}

### **Finishing**

{% hint style="info" %}
**Monitor and Update**

Ongoing monitoring ensures that the integration functions correctly. Periodically review the configuration and update it as needed to accommodate changes in the data provider's API or Entangle’s system.
{% endhint %}

Once you have fetched the data, use the `PushMarketplace`or `PullMarketplace` smart contract to verify the updates on-chain.
{% endstep %}
{% endstepper %}


# Fetch Data via Pull Model (PAYG)

In this section we will guide you on how to implement the Pull Model using the PAYG method.

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>EVM Smart Contracts</td><td><a href="/universal-data-feeds/developer-guides/fetch-data-via-pull-model-payg/evm-smart-contracts">EVM Smart Contracts</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FpFQQPOL66dha7yv9Nw68%2F22.png?alt=media&amp;token=0d02a7dd-72c5-45f8-8a54-e3d0f92d4e06">22.png</a></td></tr><tr><td>Solana Smart Contracts</td><td><a href="/universal-data-feeds/developer-guides/fetch-data-via-pull-model-payg/solana-smart-contracts">Solana Smart Contracts</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FdvBsmmwU7CBqGZUgu9ts%2F23.png?alt=media&amp;token=a25b9bca-e9b6-4d17-874a-0d34feff961c">23.png</a></td></tr></tbody></table>


# EVM Smart Contracts

In the Pull model, consumers include verification data about the most recent update directly in their transaction. This data is fetched from the oracle and verified within the same transaction before being used.

This scheme comes with the following properties:

1. Consumers always use the latest update in their transaction, so the price used in the transaction is as close to real time as protocol update frequency.
2. The cost for maintaining update relevance on-chain relies on end-consumers. This allows the oracle protocol to have much larger set of assets.

This guide will help developers who want to use Pull model (PAYG) within their contracts. It uses Hardhat for contract compilation, although similar methods apply with other frameworks.

## Step 1: Initialize new hardhat project

In the first step, we are establishing a basic solidity development setup.

```bash
yarn init -y
# yarn initialization flow
yarn add --dev hardhat
yarn hardhat init
# Hardhat initialization flow (select TypeScript project)
```

## Step 2: Write a contract that verifies an update in the transaction

Now create a new `PullVerifier` contract, which utilizes the `pullMarketplace.verifyWithFee` function to verify the update information provided through calldata. The update contains oracle votes along with their signatures.

Once the `PullVerifier` contract verifies the update against these inputs, it returns the verified value to the caller contract. If the verification fails (e.g., due to mismatched data, invalid signatures, or other inconsistencies) the contract reverts the entire transaction, ensuring that only valid data is accepted.

{% code title="./contractrs/PullVerifier.sol" %}

```solidity
// SPDX-License-Identifier: BSL1.1
pragma solidity ^0.8.20;

interface IPullMarketplace  {
        struct PriceUpdate {
        uint256 price;
        uint256 timestamp;
    }
    function verifyWithFee(
        bytes calldata updateData,
        bytes32 feedKey
    ) external payable returns (PriceUpdate memory);
    function getUpdateFee(uint256 nUpdates) external view returns (uint256);
    
}
contract PullVerifier {
    IPullMarketplace public pullMarketplace;
    uint public latestPrice;
    uint public latestTimestamp;
    constructor(address _pullMarketplace){
        pullMarketplace = IPullMarketplace(_pullMarketplace);
    }
    // @notice function that verifies feed from provided update PAYG through PullMarketplace and stores update data
    function VerifyPAYG(bytes calldata updateData, bytes32 feedKey) external{
	  // Calculate required fee
        uint256 fee = pullMarketplace.getUpdateFee(1);
	// Verify the update
        IPullMarketplace.PriceUpdate memory priceUpdate = pullMarketplace.verifyWithFee{value: fee}(updateData, feedKey);
	// store update data
        latestPrice = priceUpdate.price;
        latestTimestamp = priceUpdate.timestamp;
    }
   

    // @notice deposit native tokens for fee coverage
   receive() payable external {}

}

```

{% endcode %}

Now that we have a contract, let's write a hardhat ignition script to deploy it.

{% code title="./ignition/modules/PullVerifier.ts" %}

```typescript
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";

// PullMarketplace address on Eth Sepolia network
const PullMarketplaceAddress = "0xC6670092056e7bf56c3149FDE52A187b3e9f2e63";

const PullVerifierModule = buildModule("PullVerifierModule", (m) => {
	const consumer = m.contract("PullVerifier", [PullMarketplaceAddress ]);

	return { consumer };
});

export default PullVerifierModule;
```

{% endcode %}

## Step 3: Deploy the contract

{% hint style="info" %}
To deploy your contract on testnet, you'll need ETH eth\_sepolia testnet tokens. You can obtain funds from public faucets ([Option 1](https://faucet.polygon.technology/), [Option 2](https://sepolia-faucet.pk910.de/), [Option 3](https://faucet.sepolia.mantle.xyz/), [Option 4](https://www.alchemy.com/faucets), [Option 5](https://cloud.google.com/application/web3/faucet/ethereum/sepolia)).&#x20;
{% endhint %}

Now let's modify the hardhat configuration file to add the `eth_sepolia` network.

{% code title="./hardhat.config.ts" %}

```typescript
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";

const config: HardhatUserConfig = {
  solidity: "0.8.28",
  networks: {
    eth_sepolia: {
        chainId: 11155111,
        // or http://127.0.0.1:8545, if you forked it locally
        url: "https://ethereum-sepolia-rpc.publicnode.com",
        accounts: [ "0x" ], // TODO: Set deployer private key
    },
  },
};

export default config;
```

{% endcode %}

Now we can deploy the `PullVerifier` contract by running the command below.

```bash
yarn hardhat ignition deploy ./ignition/modules/PullVerifier.ts --network eth_sepolia
```

<details>

<summary>Expected Result</summary>

```
✔ Confirm deploy to network eth_sepolia (11155111)? … yes
Hardhat Ignition 🚀

Resuming existing deployment from ./ignition/deployments/chain-11155111

Deploying [ PullVerifierModule ]

Batch #1
  Executed PullVerifierModule#PullVerifier

[ PullVerifierModule] successfully deployed 🚀

Deployed Addresses

PullVerifierModule#PullVerifier - 0xBd0AFEE88B7FcEE6139467700D6f40F13FEDa739
```

</details>

## Step 4: Understanding update format and Finalized Data API

At this point, the `PullConsumer` contract is ready to verify updates that we send it. But before doing that, let's quickly go through the update format and the data that it expects.

As an example, let’s imagine you need BTC/USD price in your contract. First, we need to fetch the latest update from the Finalized Data backend service. This service constantly synchronizes its state with oracle's state and provides oracle data via convenient APIs (REST, WebSocket).

```bash
curl https://udfsnap.ent-dx.com/last_votes?feedKeys=BTC/USD
```

<details>

<summary>Expected Result</summary>

```json
{
  "update_call_data": "0x55444646014254432f555344000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000103c693478ddd1a5ff8b0000000000000000000000000000000000000000000000000000000067f3bd9da5c05745f7651d2c2c9f8771ff435193f2b0c719ca149e0b20ef4ecf0b0050c07d76ac34ec08947a026ad849ccce7f324c1d206140c0cf23411ae13f8e5b60121b00000000000000000000000000000000000000000000103c8289badcc4b240340000000000000000000000000000000000000000000000000000000067f3bd9de20d0d68fe93309786b18387c48bbfdd6d2ff03da78bc31294d25b3363a988491f75e29da2c99e3a39bc9afd8bf3072f1c39fe1bfb00033a73af48ba7ad7bf291b00000000000000000000000000000000000000000000103c84ecee2483ad3be70000000000000000000000000000000000000000000000000000000067f3bd9d9ed7b8ba15718887607d52853a12de16bd79d6bf8df3c29a051561d42fe6b160208c1cc24ac7c186fad1f70828be7bbbd66fe7c090193223f788c652ebc127071b",
  "feeds": [
    {
      "feed_key": "BTC/USD",
      "votes": [
        {
          "Value": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAABA8aTR43dGl/4s=",
          "Timestamp": 1744027037,
          "Publisher": "0x6733D110A59Dc160b5C8093066A7f5103885196F",
          "Signature": {
            "R": "0xa5c05745f7651d2c2c9f8771ff435193f2b0c719ca149e0b20ef4ecf0b0050c0",
            "S": "0x7d76ac34ec08947a026ad849ccce7f324c1d206140c0cf23411ae13f8e5b6012",
            "V": 27
          }
        },
        {
          "Value": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAABA8gom63MSyQDQ=",
          "Timestamp": 1744027037,
          "Publisher": "0xbe524616e96bb4b62ccE8034AB6beA8F2505B55a",
          "Signature": {
            "R": "0xe20d0d68fe93309786b18387c48bbfdd6d2ff03da78bc31294d25b3363a98849",
            "S": "0x1f75e29da2c99e3a39bc9afd8bf3072f1c39fe1bfb00033a73af48ba7ad7bf29",
            "V": 27
          }
        },
        {
          "Value": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAABA8hOzuJIOtO+c=",
          "Timestamp": 1744027037,
          "Publisher": "0x93b502d3eb45b9EAE948F8Fca01E64D9c0BA538a",
          "Signature": {
            "R": "0x9ed7b8ba15718887607d52853a12de16bd79d6bf8df3c29a051561d42fe6b160",
            "S": "0x208c1cc24ac7c186fad1f70828be7bbbd66fe7c090193223f788c652ebc12707",
            "V": 27
          }
        }
      ]
    }
  ]
}
```

</details>

This response provides all necessary details to verify the BTC/USD update, specifically:

* **feeds**: An array containing parsed update data for requested feeds.
* **votes**: Publisher's latest votes on the specific feed. This aggregated array of votes is necessary to obtain agreed-upon value on-chain.&#x20;
  * **Value**: The data that Publisher observed.
  * **Timestamp:** Timestamp at which the Publisher observed that data.
  * **Publisher:** Publisher's public key.
  * **Signature**: ECDSA signature for the observed value. This signature represents commitment from publisher that this data is what he observed.

This data enables executing the transaction on the PullVerifier contract. To begin, fetch the latest update from the Finalized Data API for the BTC/USD price.

## Step 5: Send a transaction with the update data

Now that we understand the Finalized Data API, we can create scripts to demonstrate update verification.

First of all, we need to fund the PullVerifier contract, so it will be able to pay the verification fee. Copy the following code to the `scripts/fundVerifier.ts` file.&#x20;

{% code title="./scripts/fundVerifier.ts" %}

```typescript
import { ethers } from "hardhat";

// PullVerifier contract address on ETH Sepolia
const PullVerifierAddress = "0xBd0AFEE88B7FcEE6139467700D6f40F13FEDa739";

async function main() {

  // Use default hardhat signer to fund the PullConsumer contract
  const [funder] = await ethers.getSigners();

  // 0.0003 is the exact cost for 10 updates on eth_seoplia
  const depositAmount = ethers.parseEther("0.0003");

  // Send funding transaction
  const tx = await funder.sendTransaction({
    to: PullVerifierAddress ,
    value: depositAmount
  });
  await tx.wait();

  console.log(`sent ${depositAmount} to PullVerifier, tx: ${tx.hash}`);
}

main()
  .then(() => process.exit(0))
  .catch(error => {
    console.error(error);
    process.exit(1);
  });

```

{% endcode %}

Change the `PullConsumerAddress` to the address you got from deployment and execute the script to fund the deployed `PullConsumer` contract.

```bash
yarn hardhat run ./scripts/fundVerifier.ts --network eth_sepolia
```

Now we will need to create a script that retrieves an update from the API, parses the response, encodes it to EVM calldata, and sends a transaction to verify the update. The contract can then validate the update and incorporate the verified price into its on-chain logic.&#x20;

First, add the UDF SDK library. We will use it to fetch the update using the REST API and encode it for on-chain usage.

```bash
yarn add --dev @entangle-labs/udf-sdk
```

Copy the script below to the `scripts/fetchAndVerify.ts` file.&#x20;

{% hint style="info" %}
Don't forget to change the `PullVerifierAddress` to your contract address.
{% endhint %}

{% code title="scripts/fetchAndVerify.ts" %}

```typescript
import { ethers } from "hardhat";
import {
  PullVerifier,
} from "../typechain-types";
import { UdfSdk } from '@entangle-labs/udf-sdk';

// PullVerifier contract address on ETH Sepolia
const PullVerifierAddress = "0xBd0AFEE88B7FcEE6139467700D6f40F13FEDa739";

async function main() {

  // Fetch the update data from finalized-data-snap
  const sdk = new UdfSdk();
  const updateData = await sdk.getCallData(["BTC/USD"]);
  const feedKey = ethers.encodeBytes32String("BTC/USD");

  // Bind PullVerifier contract on the network
  const verifier = await ethers.getContractAt(
    "PullVerifier",
    PullVerifierAddress
  );

  // Send verify transaction
  let tx = await verifier.VerifyPAYG(
    updateData,feedKey 
  );
  await tx.wait();
  console.log("sent tx:", tx.hash);
  let price = await verifier.latestPrice();
  let timestamp = await verifier.latestTimestamp();
  console.log("price:", price );
  console.log("timestamp:", timestamp );
}

main()
  .then(() => process.exit(0))
  .catch(error => {
    console.error(error);
    process.exit(1);
  });
```

{% endcode %}

Now let’s execute the script using the command below.

```bash
yarn hardhat run ./scripts/fetchAndVerify.ts --network eth_sepolia
```

<details>

<summary>Expected Result</summary>

```
sent tx: 0xb66fb4112b7fdf72211c2238b9b0a609a8321e2694ddad9b69ec7dcc953fdb18
price: 76683771643884818373141n
timestamp: 1744027087n
```

</details>

You can use cast to examine the transaction call trace and logs. The emitted event shows the latest update that we verified.

Note that gas usage may vary depending on the result and the version of the library in use.

```
cast run 0xb66fb4112b7fdf72211c2238b9b0a609a8321e2694ddad9b69ec7dcc953fdb18 -r https://eth-sepolia.public.blastapi.io
```

<details>

<summary>Expected Result</summary>

<pre><code><strong>Executing previous transactions from the block.
</strong>Traces:
  [137017] 0xBd0AFEE88B7FcEE6139467700D6f40F13FEDa739::2e37a79c(00000000000000000000000000000000000000000000000000000000000000404254432f5553440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a955444646014254432f555344000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000103d081c72d9f475f0bd0000000000000000000000000000000000000000000000000000000067f3bdcf2e2ffc130ee5e218e62e5babe2b2c6d0fa30f07c44b3eb131bf32e8dbda99b1e419e4016c33066e7f736958fb849a20edf1f84ecc71acd6ebe1a822142d7276a1c00000000000000000000000000000000000000000000103d091c76140eff9a150000000000000000000000000000000000000000000000000000000067f3bdcf27ef18a4bb82a9d25c7384e5dc40a992a8f6c85d4099d9f77c2833641e91bef96f8c7f3e4296ad701dbd2d93ed345fde78bcbd6c430b5294b81be0eccce83efa1b00000000000000000000000000000000000000000000103d09c19608a94bf2d10000000000000000000000000000000000000000000000000000000067f3bdcf9240ac502823b0d89ec923abcd895508c38ff00f763332d89a5b5acb292600632af57fc4382aa10b59e95d963dd2f39072ba9133186af6c73b939a1a5b6afd371b0000000000000000000000000000000000000000000000)
    ├─ [8177] 0xC6670092056e7bf56c3149FDE52A187b3e9f2e63::getUpdateFee(1) [staticcall]
    │   ├─ [3284] 0xF9E8AEE871D1e9cED62702050F16E0660a88645a::getUpdateFee(1) [delegatecall]
    │   │   └─ ← [Return] 0x00000000000000000000000000000000000000000000000000001b48eb57e000
    │   └─ ← [Return] 0x00000000000000000000000000000000000000000000000000001b48eb57e000
    ├─ [70181] 0xC6670092056e7bf56c3149FDE52A187b3e9f2e63::b90ffe1f{value: 30000000000000}(00000000000000000000000000000000000000000000000000000000000000404254432f5553440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a955444646014254432f555344000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000103d081c72d9f475f0bd0000000000000000000000000000000000000000000000000000000067f3bdcf2e2ffc130ee5e218e62e5babe2b2c6d0fa30f07c44b3eb131bf32e8dbda99b1e419e4016c33066e7f736958fb849a20edf1f84ecc71acd6ebe1a822142d7276a1c00000000000000000000000000000000000000000000103d091c76140eff9a150000000000000000000000000000000000000000000000000000000067f3bdcf27ef18a4bb82a9d25c7384e5dc40a992a8f6c85d4099d9f77c2833641e91bef96f8c7f3e4296ad701dbd2d93ed345fde78bcbd6c430b5294b81be0eccce83efa1b00000000000000000000000000000000000000000000103d09c19608a94bf2d10000000000000000000000000000000000000000000000000000000067f3bdcf9240ac502823b0d89ec923abcd895508c38ff00f763332d89a5b5acb292600632af57fc4382aa10b59e95d963dd2f39072ba9133186af6c73b939a1a5b6afd371b0000000000000000000000000000000000000000000000)
    │   ├─ [69692] 0xF9E8AEE871D1e9cED62702050F16E0660a88645a::b90ffe1f{value: 30000000000000}(00000000000000000000000000000000000000000000000000000000000000404254432f5553440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a955444646014254432f555344000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000103d081c72d9f475f0bd0000000000000000000000000000000000000000000000000000000067f3bdcf2e2ffc130ee5e218e62e5babe2b2c6d0fa30f07c44b3eb131bf32e8dbda99b1e419e4016c33066e7f736958fb849a20edf1f84ecc71acd6ebe1a822142d7276a1c00000000000000000000000000000000000000000000103d091c76140eff9a150000000000000000000000000000000000000000000000000000000067f3bdcf27ef18a4bb82a9d25c7384e5dc40a992a8f6c85d4099d9f77c2833641e91bef96f8c7f3e4296ad701dbd2d93ed345fde78bcbd6c430b5294b81be0eccce83efa1b00000000000000000000000000000000000000000000103d09c19608a94bf2d10000000000000000000000000000000000000000000000000000000067f3bdcf9240ac502823b0d89ec923abcd895508c38ff00f763332d89a5b5acb292600632af57fc4382aa10b59e95d963dd2f39072ba9133186af6c73b939a1a5b6afd371b0000000000000000000000000000000000000000000000) [delegatecall]
    │   │   ├─ [60369] 0xc0931aEE1064BD5245fEe76A2d740eab8436621e::40366475(00000000000000000000000000000000000000000000000000000000000000404254432f5553440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a955444646014254432f555344000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000103d081c72d9f475f0bd0000000000000000000000000000000000000000000000000000000067f3bdcf2e2ffc130ee5e218e62e5babe2b2c6d0fa30f07c44b3eb131bf32e8dbda99b1e419e4016c33066e7f736958fb849a20edf1f84ecc71acd6ebe1a822142d7276a1c00000000000000000000000000000000000000000000103d091c76140eff9a150000000000000000000000000000000000000000000000000000000067f3bdcf27ef18a4bb82a9d25c7384e5dc40a992a8f6c85d4099d9f77c2833641e91bef96f8c7f3e4296ad701dbd2d93ed345fde78bcbd6c430b5294b81be0eccce83efa1b00000000000000000000000000000000000000000000103d09c19608a94bf2d10000000000000000000000000000000000000000000000000000000067f3bdcf9240ac502823b0d89ec923abcd895508c38ff00f763332d89a5b5acb292600632af57fc4382aa10b59e95d963dd2f39072ba9133186af6c73b939a1a5b6afd371b0000000000000000000000000000000000000000000000) [staticcall]
    │   │   │   ├─ [55380] 0xB2F863B68d85b198DDe2fE7da1D8baFdCFf199c0::40366475(00000000000000000000000000000000000000000000000000000000000000404254432f5553440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a955444646014254432f555344000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000103d081c72d9f475f0bd0000000000000000000000000000000000000000000000000000000067f3bdcf2e2ffc130ee5e218e62e5babe2b2c6d0fa30f07c44b3eb131bf32e8dbda99b1e419e4016c33066e7f736958fb849a20edf1f84ecc71acd6ebe1a822142d7276a1c00000000000000000000000000000000000000000000103d091c76140eff9a150000000000000000000000000000000000000000000000000000000067f3bdcf27ef18a4bb82a9d25c7384e5dc40a992a8f6c85d4099d9f77c2833641e91bef96f8c7f3e4296ad701dbd2d93ed345fde78bcbd6c430b5294b81be0eccce83efa1b00000000000000000000000000000000000000000000103d09c19608a94bf2d10000000000000000000000000000000000000000000000000000000067f3bdcf9240ac502823b0d89ec923abcd895508c38ff00f763332d89a5b5acb292600632af57fc4382aa10b59e95d963dd2f39072ba9133186af6c73b939a1a5b6afd371b0000000000000000000000000000000000000000000000) [delegatecall]
    │   │   │   │   ├─ [3000] PRECOMPILES::ecrecover(0x6f256b7d268ebd1218609a792f492fed69e60f9b2bbb7a6aa535dd7eb100cb0a, 28, 20891172600762156370158823662620543704900665111721513626205233704845164780318, 29679939319588129535545874401977999632529215185806134268849298554013395396458) [staticcall]
    │   │   │   │   │   └─ ← [Return] 0x0000000000000000000000006733d110a59dc160b5c8093066a7f5103885196f
    │   │   │   │   ├─ [8142] 0x996520f9717f6141e53D8083168027d7834c172f::55b5190b(7564662d76312e310000000000000000000000000000000000000000000000000000000000000000000000006733d110a59dc160b5c8093066a7f5103885196f) [staticcall]
    │   │   │   │   │   ├─ [3246] 0xA7a8eAAA131dc4D2f70636F5F8796e640B119926::55b5190b(7564662d76312e310000000000000000000000000000000000000000000000000000000000000000000000006733d110a59dc160b5c8093066a7f5103885196f) [delegatecall]
    │   │   │   │   │   │   └─ ← [Return] 0x0000000000000000000000000000000000000000000000000000000000000001
    │   │   │   │   │   └─ ← [Return] 0x0000000000000000000000000000000000000000000000000000000000000001
    │   │   │   │   ├─ [3000] PRECOMPILES::ecrecover(0x8b9e9727843f84ccc91c0597d691d6605a1747bc2d35a5d80ed49bae125b3559, 27, 18062647626320149720686750389925445179000734462126404388533040417546752343801, 50454962982126875055591883219065593480805620376717083982408678482645524954874) [staticcall]
    │   │   │   │   │   └─ ← [Return] 0x00000000000000000000000093b502d3eb45b9eae948f8fca01e64d9c0ba538a
    │   │   │   │   ├─ [3642] 0x996520f9717f6141e53D8083168027d7834c172f::55b5190b(7564662d76312e3100000000000000000000000000000000000000000000000000000000000000000000000093b502d3eb45b9eae948f8fca01e64d9c0ba538a) [staticcall]
    │   │   │   │   │   ├─ [3246] 0xA7a8eAAA131dc4D2f70636F5F8796e640B119926::55b5190b(7564662d76312e3100000000000000000000000000000000000000000000000000000000000000000000000093b502d3eb45b9eae948f8fca01e64d9c0ba538a) [delegatecall]
    │   │   │   │   │   │   └─ ← [Return] 0x0000000000000000000000000000000000000000000000000000000000000001
    │   │   │   │   │   └─ ← [Return] 0x0000000000000000000000000000000000000000000000000000000000000001
    │   │   │   │   ├─ [3000] PRECOMPILES::ecrecover(0x58a2d42e31439b65105206f2c0eaf9da88c41c7ca83b26422134baee5517faa0, 27, 66151943366697264661083307274467456252907404044355893425437843030218939695203, 19430898983218506555122872121129293766952693229336645534639974540211705806135) [staticcall]
    │   │   │   │   │   └─ ← [Return] 0x000000000000000000000000be524616e96bb4b62cce8034ab6bea8f2505b55a
    │   │   │   │   ├─ [3642] 0x996520f9717f6141e53D8083168027d7834c172f::55b5190b(7564662d76312e31000000000000000000000000000000000000000000000000000000000000000000000000be524616e96bb4b62cce8034ab6bea8f2505b55a) [staticcall]
    │   │   │   │   │   ├─ [3246] 0xA7a8eAAA131dc4D2f70636F5F8796e640B119926::55b5190b(7564662d76312e31000000000000000000000000000000000000000000000000000000000000000000000000be524616e96bb4b62cce8034ab6bea8f2505b55a) [delegatecall]
    │   │   │   │   │   │   └─ ← [Return] 0x0000000000000000000000000000000000000000000000000000000000000001
    │   │   │   │   │   └─ ← [Return] 0x0000000000000000000000000000000000000000000000000000000000000001
    │   │   │   │   └─ ← [Return] 0x00000000000000000000000000000000000000000000103d091c76140eff9a150000000000000000000000000000000000000000000000000000000067f3bdcf
    │   │   │   └─ ← [Return] 0x00000000000000000000000000000000000000000000103d091c76140eff9a150000000000000000000000000000000000000000000000000000000067f3bdcf
    │   │   ├─  emit topic 0: 0xc721ed5888a17a766f8018cb6748b49a685bdec1837b10b49c8c56de9e4d5618
    │   │   │           data: 0x000000000000000000000000bd0afee88b7fcee6139467700d6f40f13feda7394254432f55534400000000000000000000000000000000000000000000000000
    │   │   └─ ← [Return] 0x00000000000000000000000000000000000000000000103d091c76140eff9a150000000000000000000000000000000000000000000000000000000067f3bdcf
    │   └─ ← [Return] 0x00000000000000000000000000000000000000000000103d091c76140eff9a150000000000000000000000000000000000000000000000000000000067f3bdcf
    └─ ← [Stop] 


Transaction successfully executed.
Gas used: 163365
</code></pre>

</details>


# Solana Smart Contracts

This page is under construction and will be available soon. We're exploring Solana connectivity as a possible addition in a future release. We appreciate your patience and encourage you to follow us on [social media](https://docs.entangle.fi/entangle/community) to stay updated.


# Fetch Data via Pull Model (Subscriptions)

In this section we will guide you on how to implement the Pull Model using the Subscription method.

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>EVM Smart Contracts</td><td><a href="/universal-data-feeds/developer-guides/fetch-data-via-pull-model-subscriptions/evm-smart-contracts">EVM Smart Contracts</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FpFQQPOL66dha7yv9Nw68%2F22.png?alt=media&amp;token=0d02a7dd-72c5-45f8-8a54-e3d0f92d4e06">22.png</a></td></tr><tr><td>Solana Smart Contracts</td><td><a href="/universal-data-feeds/developer-guides/fetch-data-via-pull-model-subscriptions/solana-smart-contracts">Solana Smart Contracts</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FdvBsmmwU7CBqGZUgu9ts%2F23.png?alt=media&amp;token=a25b9bca-e9b6-4d17-874a-0d34feff961c">23.png</a></td></tr></tbody></table>


# EVM Smart Contracts

In the Pull model, consumers include verification data about the most recent update directly in their transaction. This data is fetched from the oracle and verified within the same transaction before being used.

This scheme comes with the following properties:

1. Consumers always use the latest update in their transaction, so the price used in the transaction is as close to real time as protocol update latency.
2. The cost for maintaining update relevance on-chain relies on end-consumers. This allows the oracle protocol to have much larger set of assets.

This guide will help developers who want to use UDF Pull model (with subscription) within their contracts. It uses Hardhat for contract compilation, although similar methods apply with other frameworks.

## Step 1: Initialize new hardhat project

In the first step, we are establishing a basic solidity development setup.

```bash
yarn init -y
# yarn initialization flow
yarn add --dev hardhat
yarn hardhat init
# Hardhat initialization flow(select TypeScript project)
```

## Step 2: Write a contract that verifies an update in the transaction

Now create a new `PullVerifierSub` contract, which utilizes the `pullMarketplace.verifyAsSubscriber` function to verify the update information provided through calldata. The update contains oracle votes along with their signatures.

This contract should already be in subscription so it can have access for verification. The subscription can be purchased from the marketplace and the consumer contract needs to be added as an authorized address for the subscription.&#x20;

Once the `PullVerifierSub` contract verifies the update against these inputs, it stores them on-chain, to later be accessed. If the verification fails (e.g., due to mismatched data, invalid signatures, or other inconsistencies) the contract reverts the entire transaction, ensuring that only valid data is accepted.

{% code title="./contractrs/PullVerifierSub.sol" %}

```solidity
// SPDX-License-Identifier: BSL1.1
pragma solidity ^0.8.20;

interface IPullMarketplace  {
        struct PriceUpdate {
        uint256 price;
        uint256 timestamp;
    }
    function verifyAsSubscriber(
        bytes calldata updateData,
        bytes32 feedKey
    )
        external
        returns (PriceUpdate memory);
}
contract PullVerifierSub {
    IPullMarketplace public pullMarketplace;
    uint public latestPrice;
    uint public latestTimestamp;
    constructor(address _pullMarketplace){
        pullMarketplace = IPullMarketplace(_pullMarketplace);
    }
    // @notice function that verifies feed as subscriber from provided update through UDFOracle and stores update data
    function verify(bytes calldata updateData, bytes32 feedKey) external{
        IPullMarketplace.PriceUpdate memory priceUpdate = pullMarketplace.verifyAsSubscriber(updateData,feedKey);
        latestPrice = priceUpdate.price;
        latestTimestamp = priceUpdate.timestamp;
    }
}

```

{% endcode %}

Next, create an ignition script to help with deployment of the new PullVerifierSub contract.

{% code title="./ignition/modules/PullVerifierSub.ts" %}

```typescript
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";

// PullMarketplace address on Eth Sepolia network
const PullMarketplaceAddress = "0xC6670092056e7bf56c3149FDE52A187b3e9f2e63";

const PullVerifierSubModule = buildModule("PullVerifierSubModule", (m) => {
	const consumer = m.contract("PullVerifierSub", [PullMarketplaceAddress ]);

	return { consumer };
});

export default PullVerifierSubModule;
```

{% endcode %}

## Step 3: Deploy PullVerifierSub

{% hint style="info" %}
To deploy your contract on testnet, you'll need ETH eth\_sepolia testnet tokens. You can obtain funds from public faucets ([Option 1](https://faucet.polygon.technology/), [Option 2](https://sepolia-faucet.pk910.de/), [Option 3](https://faucet.sepolia.mantle.xyz/), [Option 4](https://www.alchemy.com/faucets), [Option 5](https://cloud.google.com/application/web3/faucet/ethereum/sepolia)).&#x20;
{% endhint %}

Now let's modify the hardhat configuration file to add the `eth_sepolia` network.

{% code title="./hardhat.config.ts" %}

```typescript
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";

const config: HardhatUserConfig = {
  solidity: "0.8.28",
  networks: {
    eth_sepolia: {
        chainId: 11155111,
        // or http://127.0.0.1:8545, if you forked it locally
        url: "https://ethereum-sepolia-rpc.publicnode.com",
        accounts: [ "0x" ], // TODO: Set deployer private key
    },
  },
};

export default config;
```

{% endcode %}

Now we can deploy the `PullVerifierSub` contract by running the command below.

```bash
yarn hardhat ignition deploy ./ignition/modules/PullVerifierSub.ts --network eth_sepolia
```

<details>

<summary>Expected Result</summary>

<pre><code><strong>✔ Confirm deploy to network eth_sepolia (11155111)? … yes
</strong>Compiled 1 Solidity file successfully (evm target: paris).
Hardhat Ignition 🚀

Deploying [ PullVerifierSubModule ]

Batch #1
  Executed PullVerifierSubModule#PullVerifierSub

[ PullVerifierSubModule] successfully deployed 🚀

Deployed Addresses

PullVerifierSubModule#PullVerifierSub - 0x7c0ad1Bb6c6dD48CA70C190B400aD56DeF61F43C

</code></pre>

</details>

## Step 4: Create a Pull Subscribtion

Now we should add the deployed `PullVerifierSub` contract as an allowed address to our subscription, so that it can verify Pull updates.&#x20;

To do that, go to the BTC/USD [pair page](<https://udf.entangle.fi/pair/BTC-USD >) and select Pull Mode. Then add the address of the deployed `PullVerifierSub` contract under "Which addresses can read the contract?" and click Subscribe.

You may read more about subscribing to feeds at [Subscribe to a Data Feed](/universal-data-feeds/user-guides/subscribe-to-a-data-feed).

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FiPue3h7wF5vknf271VcR%2Fimage.png?alt=media&amp;token=89e5cc75-688f-44d5-8b31-bf4791c2ee30" alt=""><figcaption></figcaption></figure>

## Step 5: Execute transaction

First, add the UDF SDK library. We will use it to fetch the update using the REST API and encode it for on-chain usage.

<pre class="language-bash"><code class="lang-bash"><strong>yarn add --dev @entangle-labs/udf-sdk
</strong></code></pre>

To validate that we have our price, we will write an example backend script that send transaction to execute `PullVerifierSub.verifyAsSubscriber`. Let's create separate directory scripts and our new script `verifyAsSub.ts` to do just that.

```bash
mkdir scripts && touch ./scripts/verifyAsSub.ts
```

Change the `PullVerifierAddress` to the address you got from deployment and execute the script.

{% code title="./scripts/verifyAsSub.ts" %}

```typescript
import {
  PullVerifierSub,
} from "../typechain-types";
import { ethers } from "hardhat";
import { UdfSdk } from '@entangle-labs/udf-sdk';

// PullVerifierSub address we got from the deployment
const PullVerifierAddress = "0x7c0ad1Bb6c6dD48CA70C190B400aD56DeF61F43C";

async function main() {  
  const pullVerifier = await ethers.getContractAt(
    "PullVerifierSub",
    PullVerifierAddress 
  ) as PullVerifierSub;

  // Fetch the update data from finalized-data-snap
  const sdk = new UdfSdk();
  const updateData = await sdk.getCallData(["BTC/USD"]);
  const feedKey = ethers.encodeBytes32String("BTC/USD");
  let tx = await pullVerifier.verify(updateData,feedKey);
  await tx.wait();

  console.log("sent PullVerifierSub.verify tx", tx.hash);
  let price = await pullVerifier.latestPrice();
  let timestamp = await pullVerifier.latestTimestamp();
  console.log("price:", price );
  console.log("timestamp:", timestamp );
}

main()
  .then(() => process.exit(0))
  .catch(error => {
    console.error(error);
    process.exit(1);
  });
```

{% endcode %}

Now let's run the script using the command below to ensure it's working.

```bash
yarn hardhat run ./scripts/verifyAsSub.ts --network eth_sepolia
```

<details>

<summary>Expected Results</summary>

<pre><code><strong>sent PullVerifierSub.verify tx 0x7d202c67c1d3f04606743a406979eb4dd4a435be37eb0490c502895c28ecc0ec
</strong>price: 84087090417798546633122n
timestamp: 1743492361n
</code></pre>

</details>

You can use cast to examine the transaction call trace and logs. The emitted event shows the latest update that we verified. Note that gas usage may vary depending on the result and the version of the library in use.

```
cast run 0x7d202c67c1d3f04606743a406979eb4dd4a435be37eb0490c502895c28ecc0ec -r https://ethereum-sepolia-rpc.publicnode.com
```

<details>

<summary>Expected Results</summary>

```
Executing previous transactions from the block.
Traces:
  [99231] PullVerifierSub::verify(0x55444646014254432f55534400000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000011ce4ebc2338797454e80000000000000000000000000000000000000000000000000000000067eba567c157813327ab23012c0c51d803a60fdeb2db3460e19840849b99b5e4996ee90853a0d1ad5e5be5304cb76990ffd1e04680f7f2f85680ac62f529b5614031062e1c0000000000000000000000000000000000000000000011ce5ecc567d2b3ab1a20000000000000000000000000000000000000000000000000000000067eba567cd0d22ac7bc0820ebcbc11b087c059c2d36b207d020a3987b21b56b11c2ca0982796fc953c1ebf14434ee0dffc225d87e12ca4506f07f0971e4fcd72bcbab2241c0000000000000000000000000000000000000000000011ce6ed6df09a64f08420000000000000000000000000000000000000000000000000000000067eba567c82350a2e16b70134ec057193550fd49b18e793604b1e4743fc01c2cae01f9b7631cdfa9033e2c414cf29451f916c482316673fd8be956a1d5ea5dc1791115c01b, 0x4254432f55534400000000000000000000000000000000000000000000000000)
	├─ [82339] ERC1967Proxy::fallback(0x55444646014254432f55534400000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000011ce4ebc2338797454e80000000000000000000000000000000000000000000000000000000067eba567c157813327ab23012c0c51d803a60fdeb2db3460e19840849b99b5e4996ee90853a0d1ad5e5be5304cb76990ffd1e04680f7f2f85680ac62f529b5614031062e1c0000000000000000000000000000000000000000000011ce5ecc567d2b3ab1a20000000000000000000000000000000000000000000000000000000067eba567cd0d22ac7bc0820ebcbc11b087c059c2d36b207d020a3987b21b56b11c2ca0982796fc953c1ebf14434ee0dffc225d87e12ca4506f07f0971e4fcd72bcbab2241c0000000000000000000000000000000000000000000011ce6ed6df09a64f08420000000000000000000000000000000000000000000000000000000067eba567c82350a2e16b70134ec057193550fd49b18e793604b1e4743fc01c2cae01f9b7631cdfa9033e2c414cf29451f916c482316673fd8be956a1d5ea5dc1791115c01b, 0x4254432f55534400000000000000000000000000000000000000000000000000)
	│   ├─ [77350] PullMarketplace::verifyAsSubscriber(0x55444646014254432f55534400000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000011ce4ebc2338797454e80000000000000000000000000000000000000000000000000000000067eba567c157813327ab23012c0c51d803a60fdeb2db3460e19840849b99b5e4996ee90853a0d1ad5e5be5304cb76990ffd1e04680f7f2f85680ac62f529b5614031062e1c0000000000000000000000000000000000000000000011ce5ecc567d2b3ab1a20000000000000000000000000000000000000000000000000000000067eba567cd0d22ac7bc0820ebcbc11b087c059c2d36b207d020a3987b21b56b11c2ca0982796fc953c1ebf14434ee0dffc225d87e12ca4506f07f0971e4fcd72bcbab2241c0000000000000000000000000000000000000000000011ce6ed6df09a64f08420000000000000000000000000000000000000000000000000000000067eba567c82350a2e16b70134ec057193550fd49b18e793604b1e4743fc01c2cae01f9b7631cdfa9033e2c414cf29451f916c482316673fd8be956a1d5ea5dc1791115c01b, 0x4254432f55534400000000000000000000000000000000000000000000000000) [delegatecall]
	│   │   ├─ [60369] 0xc0931aEE1064BD5245fEe76A2d740eab8436621e::40366475(00000000000000000000000000000000000000000000000000000000000000404254432f5553440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a955444646014254432f55534400000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000011ce4ebc2338797454e80000000000000000000000000000000000000000000000000000000067eba567c157813327ab23012c0c51d803a60fdeb2db3460e19840849b99b5e4996ee90853a0d1ad5e5be5304cb76990ffd1e04680f7f2f85680ac62f529b5614031062e1c0000000000000000000000000000000000000000000011ce5ecc567d2b3ab1a20000000000000000000000000000000000000000000000000000000067eba567cd0d22ac7bc0820ebcbc11b087c059c2d36b207d020a3987b21b56b11c2ca0982796fc953c1ebf14434ee0dffc225d87e12ca4506f07f0971e4fcd72bcbab2241c0000000000000000000000000000000000000000000011ce6ed6df09a64f08420000000000000000000000000000000000000000000000000000000067eba567c82350a2e16b70134ec057193550fd49b18e793604b1e4743fc01c2cae01f9b7631cdfa9033e2c414cf29451f916c482316673fd8be956a1d5ea5dc1791115c01b0000000000000000000000000000000000000000000000) [staticcall]
	│   │   │   ├─ [55380] 0xB2F863B68d85b198DDe2fE7da1D8baFdCFf199c0::40366475(00000000000000000000000000000000000000000000000000000000000000404254432f5553440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a955444646014254432f55534400000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000011ce4ebc2338797454e80000000000000000000000000000000000000000000000000000000067eba567c157813327ab23012c0c51d803a60fdeb2db3460e19840849b99b5e4996ee90853a0d1ad5e5be5304cb76990ffd1e04680f7f2f85680ac62f529b5614031062e1c0000000000000000000000000000000000000000000011ce5ecc567d2b3ab1a20000000000000000000000000000000000000000000000000000000067eba567cd0d22ac7bc0820ebcbc11b087c059c2d36b207d020a3987b21b56b11c2ca0982796fc953c1ebf14434ee0dffc225d87e12ca4506f07f0971e4fcd72bcbab2241c0000000000000000000000000000000000000000000011ce6ed6df09a64f08420000000000000000000000000000000000000000000000000000000067eba567c82350a2e16b70134ec057193550fd49b18e793604b1e4743fc01c2cae01f9b7631cdfa9033e2c414cf29451f916c482316673fd8be956a1d5ea5dc1791115c01b0000000000000000000000000000000000000000000000) [delegatecall]
	│   │   │   │   ├─ [3000] PRECOMPILES::ecrecover(0x0a68e8365be00d0cd98a1171d18af4e3e1566fd09a59d61fe23743c2dbe50c12, 28, 87450987175619729345224437904190378668378471047311994984055329008011973683464, 37826109101770063310129024824192616189507182989479589014137121493233374922286) [staticcall]
	│   │   │   │   │   └─ ← [Return] 0x0000000000000000000000006733d110a59dc160b5c8093066a7f5103885196f
	│   │   │   │   ├─ [8142] ERC1967Proxy::55b5190b(7564662d76312e310000000000000000000000000000000000000000000000000000000000000000000000006733d110a59dc160b5c8093066a7f5103885196f) [staticcall]
	│   │   │   │   │   ├─ [3246] 0xA7a8eAAA131dc4D2f70636F5F8796e640B119926::55b5190b(7564662d76312e310000000000000000000000000000000000000000000000000000000000000000000000006733d110a59dc160b5c8093066a7f5103885196f) [delegatecall]
	│   │   │   │   │   │   └─ ← [Return] 0x0000000000000000000000000000000000000000000000000000000000000001
	│   │   │   │   │   └─ ← [Return] 0x0000000000000000000000000000000000000000000000000000000000000001
	│   │   │   │   ├─ [3000] PRECOMPILES::ecrecover(0x14e205399af2fdf39cd5ba0d6d33d50ffbb0007a622f772edc16663e7de9cd57, 28, 92747342280930951330331743016924826142985862405571157083665267571049381011608, 17906971417906977260169118529732908076796855624976136117544900421598137987620) [staticcall]
	│   │   │   │   │   └─ ← [Return] 0x000000000000000000000000be524616e96bb4b62cce8034ab6bea8f2505b55a
	│   │   │   │   ├─ [3642] ERC1967Proxy::55b5190b(7564662d76312e31000000000000000000000000000000000000000000000000000000000000000000000000be524616e96bb4b62cce8034ab6bea8f2505b55a) [staticcall]
	│   │   │   │   │   ├─ [3246] 0xA7a8eAAA131dc4D2f70636F5F8796e640B119926::55b5190b(7564662d76312e31000000000000000000000000000000000000000000000000000000000000000000000000be524616e96bb4b62cce8034ab6bea8f2505b55a) [delegatecall]
	│   │   │   │   │   │   └─ ← [Return] 0x0000000000000000000000000000000000000000000000000000000000000001
	│   │   │   │   │   └─ ← [Return] 0x0000000000000000000000000000000000000000000000000000000000000001
	│   │   │   │   ├─ [3000] PRECOMPILES::ecrecover(0xca613c8b1a20618b010d94a62a700c6e09917c2a8778a82c881f2be28d25a2b3, 27, 90524965894879087420297465183903263448359497350110207873450031945407891896759, 44829987373565001565186606953511927342046667061064660196284399196770407617984) [staticcall]
	│   │   │   │   │   └─ ← [Return] 0x00000000000000000000000093b502d3eb45b9eae948f8fca01e64d9c0ba538a
	│   │   │   │   ├─ [3642] ERC1967Proxy::55b5190b(7564662d76312e3100000000000000000000000000000000000000000000000000000000000000000000000093b502d3eb45b9eae948f8fca01e64d9c0ba538a) [staticcall]
	│   │   │   │   │   ├─ [3246] 0xA7a8eAAA131dc4D2f70636F5F8796e640B119926::55b5190b(7564662d76312e3100000000000000000000000000000000000000000000000000000000000000000000000093b502d3eb45b9eae948f8fca01e64d9c0ba538a) [delegatecall]
	│   │   │   │   │   │   └─ ← [Return] 0x0000000000000000000000000000000000000000000000000000000000000001
	│   │   │   │   │   └─ ← [Return] 0x0000000000000000000000000000000000000000000000000000000000000001
	│   │   │   │   └─ ← [Return] 0x0000000000000000000000000000000000000000000011ce5ecc567d2b3ab1a20000000000000000000000000000000000000000000000000000000067eba567
	│   │   │   └─ ← [Return] 0x0000000000000000000000000000000000000000000011ce5ecc567d2b3ab1a20000000000000000000000000000000000000000000000000000000067eba567
	│   │   ├─ emit VerifyAsSubscriberCalled(verifier: PullVerifierSub: [0x9Cd59BEbE8daBbb4a79739619a99DF890498305e], feedKey: 0x4254432f55534400000000000000000000000000000000000000000000000000)
	│   │   └─ ← [Return] PriceUpdate({ price: 84087090417798546633122 [8.408e22], timestamp: 1743496551 [1.743e9] })
	│   └─ ← [Return] PriceUpdate({ price: 84087090417798546633122 [8.408e22], timestamp: 1743496551 [1.743e9] })
	└─ ← [Stop]


Transaction successfully executed.
Gas used: 125591

```

</details>


# Solana Smart Contracts

This page is under construction and will be available soon. We're exploring Solana connectivity as a possible addition in a future release. We appreciate your patience and encourage you to follow us on [social media](https://docs.entangle.fi/entangle/community) to stay updated.


# Fetch Data via Push Model

In this section we will guide you on how to implement the Push Model.

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>EVM Smart Contracts</td><td><a href="/universal-data-feeds/developer-guides/fetch-data-via-push-model/evm-smart-contracts">EVM Smart Contracts</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FpFQQPOL66dha7yv9Nw68%2F22.png?alt=media&amp;token=0d02a7dd-72c5-45f8-8a54-e3d0f92d4e06">22.png</a></td></tr><tr><td>Solana Smart Contracts</td><td><a href="/universal-data-feeds/developer-guides/fetch-data-via-push-model/solana-smart-contracts">Solana Smart Contracts</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FdvBsmmwU7CBqGZUgu9ts%2F23.png?alt=media&amp;token=a25b9bca-e9b6-4d17-874a-0d34feff961c">23.png</a></td></tr></tbody></table>


# EVM Smart Contracts

Using the Push model means retrieving data from on-chain contract storage. This requires the data to exist in the on-chain contract storage, uploaded by a publisher or node operator beforehand. UDF maintains a node that continuously publishes updates for supported assets, but anyone is free to run their own node instance to ensure redundancy or customize their setup.

To utilize an update in your contract, you can read the value of the asset of interest from the **`PushMarketplace`** contract deployed on each supported chain. For demonstration purposes, in this guide we will create a consumer contract whose logic depends on the BTC/USD price.

## Step 1: Initialize hardhat project

First of all, let's create new project and initialize hardhat in it.

```bash
mkdir push-consumer && cd push-consumer
yarn init -y
# Yarn initialization
yarn add --dev hardhat
yarn hardhat init
# Hardhat initialization flow(select TypeScript project)
```

## Step 2: Create PushReader contract and hardhat ignition script

Next, let's create our consumer contract. The consumer contract, referred to as the PushReader, will retrieve data stored in `PushMarketplace`, which assumes the availability of verified updates pushed on-chain beforehand.

In this example, the contract will read the latest stored price of the BTC/USD asset and store it. To achieve this, we'll use the `getFeedPrice` function, a free data retrieval method for previously subscribed readers.

This contract should already be in subscription so it can have access for verification. The subscription can be purchased from the marketplace and the consumer contract needs to be added as an authorized address for the subscription.&#x20;

For convenience, this function returns both the price and the timestamp in a single call. Providing both values ensures that users can verify the freshness of the data, which is critical for applications where price accuracy and timing are essential for decision-making.

{% code title="./contracts/PushReader.sol" %}

```solidity
// SPDX-License-Identifier: BSL1.1
pragma solidity ^0.8.20;
interface IPushMarketplace  { 

   function getFeedPrice(
        bytes32 feed
    ) external returns (uint256 price, uint256 timestamp);
}
contract PushReader {
    IPushMarketplace public pushMarketplace;
    uint public latestPrice;
    uint public latestTimestamp;
    constructor(address _pushMarketplace){
        pushMarketplace = IPushMarketplace(_pushMarketplace);
    }
    function getData(bytes32 feedKey) external{
        (latestPrice, latestTimestamp) = pushMarketplace.getFeedPrice(feedKey);
    }
}
```

{% endcode %}

Next, create an ignition script to help with deployment of the new `PushReader` contract.

{% code title="./ignition/modules/PushReader.ts" %}

```typescript
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";

// PushMarketplace address on Eth Sepolia network
const PushMarketplaceAddress = "0x48A10FF4ea77A099Cc966b537b5efC5b15c1060A"

const PushReaderModule = buildModule("PushReaderModule", (m) => {
  const consumer = m.contract("PushReader", [PushMarketplaceAddress]);

  return { consumer };
});

export default PushReaderModule;
```

{% endcode %}

## Step 3: Deploy PushReader

{% hint style="info" %}
To deploy your contract on testnet, you'll need ETH eth\_sepolia testnet tokens. You can obtain funds from public faucets ([Option 1](https://faucet.polygon.technology/), [Option 2](https://sepolia-faucet.pk910.de/), [Option 3](https://faucet.sepolia.mantle.xyz/), [Option 4](https://www.alchemy.com/faucets), [Option 5](https://cloud.google.com/application/web3/faucet/ethereum/sepolia)).&#x20;
{% endhint %}

Now let's modify the hardhat configuration file to add the `eth_sepolia` network.

{% code title="./hardhat.config.ts" %}

```typescript
import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";

const config: HardhatUserConfig = {
  solidity: "0.8.28",
  networks: {
    eth_sepolia: {
        chainId: 11155111,
        // or http://127.0.0.1:8545, if you forked it locally
        url: "https://ethereum-sepolia-rpc.publicnode.com",
        accounts: [ "0x" ], // TODO: Set deployer private key
    },
  },
};

export default config;
```

{% endcode %}

Now we can deploy the `PushReader` contract by running the command below.

```bash
yarn hardhat ignition deploy ./ignition/modules/PushReader.ts --network eth_sepolia
```

<details>

<summary>Expected Result</summary>

```
✔ Confirm deploy to network eth_sepolia (11155111)? … yes
Compiled 1 Solidity file successfully (evm target: paris).
Hardhat Ignition 🚀

Deploying [ PushReaderModule]

Batch #1
  Executed PushReaderModule#PushReader

[ PushReaderModule] successfully deployed 🚀

Deployed Addresses

PushConsumerModule#PushConsumer - 0xe23650424625B602c0f996F25b287203632A3f16
```

</details>

## Step 4: Create Push Subscribtion

Now we should add deployed PushConsumer(PushReader) contract as allowed address to our subscribtion.&#x20;

[Subscribe to a push datafeed](/universal-data-feeds/user-guides/subscribe-to-a-data-feed) for desired feed and with desired parameters and put deployed PushConsumer contract as address that can read the contract.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FX3oD9mPLXk5RNvJpFRvu%2Fimage.png?alt=media&amp;token=e2767bc4-4099-4382-9c58-c52559ba96ac" alt=""><figcaption></figcaption></figure>

## Step 5: Execute PushConsumer.consumePrice transaction

To validate that we have our price, we will write an example backend script that send transaction to execute `PushConsumer.consumePrice`.

Let's create a separate directory called "scripts" and create a new script `consumePrice.ts` in it.

```bash
mkdir scripts && touch ./scripts/consumePrice.ts
```

{% code title="./scripts/consumePrice.ts" %}

```typescript
import {
  PushReader,
} from "../typechain-types";
import { ethers } from "hardhat";

// PushConsumer address we got from the deployment
const PushReaderAddress = "0xe23650424625B602c0f996F25b287203632A3f16";

async function main() {  
  const pushConsumer = await ethers.getContractAt(
    "PushReader",
    PushReaderAddress
  ) as PushReader
;
  const feedKey = ethers.encodeBytes32String("BTC/USD");
  let tx = await pushReader.getFeedPrice(feedKey);
  await tx.wait();

  console.log("sent PushReader.getData tx", tx.hash);
  let price = await pushReader.latestPrice();
  let timestamp = await pushReader.latestTimestamp();
  console.log("price:", price );
  console.log("timestamp:", timestamp );
}

main()
  .then(() => process.exit(0))
  .catch(error => {
    console.error(error);
    process.exit(1);
  });

```

{% endcode %}

Change the `PushReaderAddress` to the address you got from deployment and execute the script to send the transaction to the blockchain.

```bash
yarn hardhat run ./scripts/consumePrice.ts --network eth_sepolia
```

<details>

<summary>Expected Result</summary>

```
sent PushReader.getData tx 0x8c9c7abdfc243500d8f20dafd69cb6b2f9b5c41a1bb5f8a374bb04a31e43dc94
price: 76660817492475224330633n
timestamp: 1744027000n
```

</details>

You can use cast to examine the transaction call trace and logs. The emitted event shows the latest update that we read. Note that gas usage may vary depending on the result and the version of the library in use.

```
cast run 0x8c9c7abdfc243500d8f20dafd69cb6b2f9b5c41a1bb5f8a374bb04a31e43dc94 -r https://eth-sepolia.public.blastapi.io
```

<details>

<summary>Expected Result</summary>

```
Executing previous transactions from the block.
Traces:
  [70570] 0xe23650424625B602c0f996F25b287203632A3f16::getData(0x4254432f55534400000000000000000000000000000000000000000000000000)
    ├─ [20482] 0x48A10FF4ea77A099Cc966b537b5efC5b15c1060A::getFeedPrice(0x4254432f55534400000000000000000000000000000000000000000000000000)
    │   ├─ [15586] 0x9E5953C651932937e5a9185404B925030F5cCF3a::getFeedPrice(0x4254432f55534400000000000000000000000000000000000000000000000000) [delegatecall]
    │   │   ├─  emit topic 0: 0x3aa8c2e667a2fabc8ac13b12611dabfd9bdd2f66210ad437122a7ab032ddf011
    │   │   │           data: 0x000000000000000000000000e23650424625b602c0f996f25b287203632a3f164254432f55534400000000000000000000000000000000000000000000000000
    │   │   └─ ← [Return] 0x00000000000000000000000000000000000000000000103bca8eeefcd59d11890000000000000000000000000000000000000000000000000000000067f3bd78
    │   └─ ← [Return] 0x00000000000000000000000000000000000000000000103bca8eeefcd59d11890000000000000000000000000000000000000000000000000000000067f3bd78
    └─ ← [Stop] 


Transaction successfully executed.
Gas used: 91846
```

</details>


# Solana Smart Contracts

This page is under construction and will be available soon. We're exploring Solana connectivity as a possible addition in a future release. We appreciate your patience and encourage you to follow us on [social media](https://docs.entangle.fi/entangle/community) to stay updated.


# Data Publishing

Anyone can contribute to publishing updates to destination chains, ensuring a constant stream of data. To participate, use the pull-update-publisher tool. Clone the [udf-update-publisher repository](https://github.com/Entangle-Protocol/udf-update-publisher) and launch the daemon to start streaming updates to destination chains. For this, you will need [Git](https://git-scm.com/) to clone the code and [Docker](https://www.docker.com/) or [Go](https://go.dev/) to run it.

{% stepper %}
{% step %}

### Clone

Begin by cloning the [repository](https://github.com/Entangle-Protocol/udf-update-publisher) using [Git](https://git-scm.com/).

```
git clone https://github.com/Entangle-Protocol/udf-update-publisher.git
```

{% endstep %}

{% step %}

### Configure

Update the `config.yaml` file found in the repositories root directory. Ensure you select the data keys for which you want to secure updates for, set the private key, and optionally set your node URLs.

Below is an example of the configuration file, it can be used to configure: 1. the feeds to listen and push updates for, 2. push parameters (e.g., deviation and heartbeat), and 3. target chain information (i.e., where to push updates to and the publisher private key).

```yaml
finalizeSnapshotUrl: https://udfsnap.ent-dx.com
dataKeys:
  - NGL/USD
  - ETH/USD
  - BTC/USD
  - GAS-ETH
  - GAS-BSC
assets:
  - sourceID: prices-feed1
    dataKeys:
    - NGL/USD
    - ETH/USD
    - BTC/USD
  - sourceID: gas-feed1
    dataKeys:
    - GAS-ETH
    - GAS-BSC
publisher:
  updateInterval: 30 
  updateThreshold: 5m0s
  priceDiffThreshold: 100
networks:
  solana:
  eth_sepolia:
    targetChainUrl: https://ethereum-sepolia-rpc.publicnode.com
    pullOracleAddress: 0x0b2d8Ef1D9104c4Df5C89F00B645Ce8bAa56DeB5
    privateKey: 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
  mantle_sepolia:
    targetChainUrl: https://rpc.sepolia.mantle.xyz
    pullOracleAddress: 0x751c47110351806e41ccDA4C181a50edfA6b63E0
    privateKey: 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
```

{% endstep %}

{% step %}

### Run

If you're using [Docker](https://www.docker.com/) you can build and run the docker container using the following command:

```docker
docker compose -f ./docker/docker-compose.yml up
```

If you're using [Go](https://go.dev/) you can run the pull-update-publisher tool using the following command:

```go
go run ./cmd/pull-update-publisher
```

{% endstep %}
{% endstepper %}

## Pull Update Publisher Tool

The pull-update-publisher executable when run, tries to publish updates based on the `publisher.updateInterval` interval option, in concrete steps it does the following:

1. Fetch latest updates for keys specified in the configuration file using the "Retrieve Spotter's Assets in Detail" API endpoint of the Update Provider Service.
2. Select updates that have either of the following properties:
   1. Latest on-chain update is older than value specified by `publisher.updateThreshold` option in the configuration file.
   2. Latest on-chain update value differs by more than (`` `publisher.priceDiffThreshold` / 10000 % ``) from fetched update value.
3. Send selected updates to the PullOracle contract.

## Update Provider Service API <a href="#finalized-data-api" id="finalized-data-api"></a>

<details>

<summary>Retrieve Spotters List</summary>

**Endpoint:** `GET /spotters`

**Description:** Retrieves a list of spotters, including their IDs, supported assets, and networks.

</details>

<details>

<summary>Retrieve Spotter's Assets in Detail</summary>

**Endpoint:** `GET /spotters/{spotterID}`

**Description:** Retrieves a detailed view of a specific spotter's assets.

**Parameters:**

* `spotterID` (string): ID of the spotter.
* `assets` (string, query): Comma-separated list of asset keys (e.g., `NGL/USD, ETH/USD`).

</details>

<details>

<summary>Retrieve Calldata for Specific Network</summary>

**Endpoint:** `GET /spotters/{spotterID}/{network}/calldata`

**Description:** Retrieves a detailed view of a specific spotter's assets in calldata format for a particular network.

**Parameters:**

* `spotterID` (string): ID of the spotter.
* `network` (string): Blockchain network name.
* `assets` (string, query): Comma-separated list of asset keys (e.g., `NGL/USD, ETH/USD`).

**Response** (example in json):

```
{
  "value": {
    "timestamp": "1234567890",
    "data": "btc/usd_value"
  },
  "merkleRoot": "xxxxxxxxxxxxxxxxxxxxx", // bytes32
  "signatures": ["sig1", "sig2", "..."], // array of Signatures
  "merkleProofs": ["uncle_proof1", "uncle_proof2"] // array of strings
  "key": "btc/usd" // bytes32
}
```

</details>


# User Guides

UDF has an easy to use and intuitive hub for quickly managing all of your data feeds. This section walks you through everything you need to know to start using it. Whether you’re exploring data feeds or managing your existing subscriptions, you’ll find step-by-step guides to help you along the way. We’ve kept things clear and practical so you can focus on building without getting lost in the details.

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>Accessing Feeds</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FmoIqGroYdaJmqi5OiVGP%2F14.png?alt=media&amp;token=7429a063-170f-4e97-89d6-3f06e99d7e06">14.png</a></td><td><a href="/universal-data-feeds/user-guides/accessing-feeds">Accessing Feeds</a></td></tr><tr><td>Subscribe to a Data Feed</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F3CvPZgHBoPU3SRWYZEXV%2F30.png?alt=media&amp;token=177ed72a-8096-425b-aa7c-01188f533ed6">30.png</a></td><td><a href="/universal-data-feeds/user-guides/subscribe-to-a-data-feed">Subscribe to a Data Feed</a></td></tr><tr><td>Check Subscription</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F7WZKbCkTvhnTG5AoinNx%2F28.png?alt=media&amp;token=d043aaf0-96af-4aae-bcec-c892d1c4a01d">28.png</a></td><td><a href="/universal-data-feeds/user-guides/check-subscription">Check Subscription</a></td></tr><tr><td>Manage Subscription</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FVsEtS8RU8iqTbBBdkMVk%2F10.png?alt=media&amp;token=c86dcfbb-2971-404e-b03f-97075ccdce4f">10.png</a></td><td><a href="/universal-data-feeds/user-guides/manage-subscription">Manage Subscription</a></td></tr><tr><td>Renew Subscription</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2File32ojhXCplRyNf09En%2F11.png?alt=media&amp;token=00dea182-f78f-434f-a738-7c9e3f0b66ba">11.png</a></td><td><a href="/universal-data-feeds/user-guides/renew-subscription">Renew Subscription</a></td></tr></tbody></table>


# Accessing Feeds

In this step-by-step guide we'll go over how to connect your wallet and search for feeds to find the one that you'll need using the Universal Data Feeds (UDF) [hub](https://udf.entangle.fi/). This process is an intuitive and straight forward process, follow the instructions below to get started.

{% stepper %}
{% step %}

### Connect Wallet

Navigate to <https://udf.entangle.fi/> and click on "**Connect Wallet**" at the top right to connect your wallet.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FqVibEgpxIHdSNduZN9bx%2Fimage.png?alt=media&amp;token=384e54aa-e9eb-48d9-807b-b0672af68e20" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Choose Wallet

Choose which wallet you would like to connect. In this example we will use MetaMask.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FPS97svX88vDhGkUSiaMs%2Fimage.png?alt=media&amp;token=0cb6a074-2197-45ca-9004-90cfc5d2ffdb" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Authorize Wallet Access

Your wallet will request authorization to connect with UDF. Confirm the connection request to proceed.

<div align="left"><figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FRhLGvz5f0O7shwrkI4nw%2Fimage.png?alt=media&amp;token=42612190-bab0-462b-bb77-391853ee1b3d" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Data Feeds

Click the "Data Feeds" tab at the top to access the page containing all data feeds.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FHQX7ioE2O0JXToefjImM%2Fimage.png?alt=media&amp;token=a5b2581e-0767-40a0-9a4f-f6131ea0a7b1" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Filter Assets by Class

Click on "All Types" to begin filtering the view for a certain asset type. Alternatively, you can select an asset type from the list. Additionally, you can filter the assets by Top, Trending, Most Viewed, New and Coming Soon.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FPnUehdxKm0Fig3F6pZ6m%2Fimage.png?alt=media&amp;token=a9d12ce8-740c-4783-a39e-4e1ca90ae306" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Searching Assets

The search bar is located next to your wallet address. You can open it quickly using the forward slash shortcut button ("/").

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Ft1Tku7WV73e4HozHqmrg%2Fimage.png?alt=media&amp;token=9bfbbddb-30f3-496f-aaa3-26a63865d1aa" alt=""><figcaption></figcaption></figure>

Here you can begin typing the name of the asset you are looking for. If the name matches one in our database it will be shown in the list, like so.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fi9NYBUsDR2jZOvY9U1w7%2Fimage.png?alt=media&amp;token=9420caa7-a29e-439c-81b6-eb9ed5dd9f6d" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Ordering Assets

Click on the third button from the right to open the ordering menu. Here you can order the data feeds using different methods.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FMfTARq3cSk9B2WzliNOh%2Fimage.png?alt=media&amp;token=78d732da-da9b-48ee-b31c-0e65851f1b18" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


# Subscribe to a Data Feed

In this step-by-step guide we'll go over how to subscribe to a data feed using the Universal Data Feeds (UDF) [hub](https://udf.entangle.fi/). This process is an intuitive and straight forward process, follow the instructions below to get started.

{% stepper %}
{% step %}

### Connect Wallet

Navigate to <https://udf.entangle.fi/> and click on "**Connect Wallet**" at the top right to connect your wallet.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FsFh7dtN1AwW5WnUJBoUU%2Fimage.png?alt=media&amp;token=b60ad838-fde6-44c9-8d15-f6ffcab7b438" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Choose Feed

Click on the feed that you wish to subscribe to.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fb9qKGZJahnqpqFv4Bwad%2Fimage.png?alt=media&amp;token=0fd3ccd7-50b3-4eaf-9454-2f6b8b8d7920" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Select Destination Network

Select the "Network" that you wish to receive your data feed on.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FXEENhLU8EvslHP2KyH39%2Fimage.png?alt=media&amp;token=b0dcf9d8-2dad-4f10-b3a8-d14dc6403b05" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Choose Mode

{% hint style="info" %}
Learn more about the Push and Pull data delivery methods [here](/universal-data-feeds/architecture/data-delivery-methods).
{% endhint %}

Choose between "**Push**" or "**Pull**" mode.

* **Push** delivers updates proactively to the blockchain, ensuring automated data availability.
* **Pull** allows authorized addresses to fetch update on-demand during transactions, ensuring the latest data is used at the point of need.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FvkXE1NzeLTlWVSEKkOo6%2Fimage.png?alt=media&amp;token=e8600057-1d6e-4f26-94ac-85da1b3d2f4a" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Pull Mode

{% hint style="info" %}
If you chose Push Mode skip to the next step.
{% endhint %}

For "**Pull mode**" choose the desired duration. Your subscription will remain active for the selected duration extension and will end on the expiry date unless extended beforehand by depositing additional funds, allowing you to renew it seamlessly.

You can deposit any amount, as long as it meets the minimum required. The app will automatically calculate your subscription period based on the amount you choose to deposit.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FU1CZxkFFkoXLa8pqf1ka%2Fimage.png?alt=media&amp;token=7ff76afd-0f2b-4372-9493-0b7edf05027e" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Push Mode

{% hint style="info" %}
If you chose Pull Mode you can skip this step.
{% endhint %}

For "**Push mode**" select the desired deviation. This is the percentage change in value required to trigger a new update, ensuring updates are only made when meaningful updates occur.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FK9E30SVQgffS05n23xcP%2Fimage.png?alt=media&amp;token=743b068a-22dc-4788-8014-7917103c8698" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Payment

Enter the amount that you wish to pay. The duration is estimated based on current gas costs and asset volatility. Sudden gas spikes or high volatility can shorten the subscription period.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FcGlrdMvyUHSMjIQIYH5n%2Fimage.png?alt=media&amp;token=eaf048ca-a2af-4d4c-9df5-35cac52b178f" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Address

Specify the addresses that will have permission to access and read price updates directly from the oracle contract.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FHpVTLkl19iNtg5z7nnaL%2Fimage.png?alt=media&amp;token=a031c4b4-312b-44c2-bd1c-7f18754bb583" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Subscribe and Finish

Click on the "**Subscribe**" button to finalize the subscription.&#x20;

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FVwmYXmLFdokQhbylf70K%2Fimage.png?alt=media&amp;token=d44645bb-6eb9-48f1-b137-294ad92edff0" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


# Check Subscription

In this step-by-step guide we'll go over how to check if a subscription to a data feed is still active using the Universal Data Feeds (UDF) [hub](https://udf.entangle.fi/). This process is an intuitive and straight forward process, follow the instructions below to get started.

{% stepper %}
{% step %}

### Connect Wallet

Navigate to <https://udf.entangle.fi/> and click on "**Connect Wallet**" at the top right to connect your wallet.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Ftek8SBBced5Im1JCOjyL%2Fimage.png?alt=media&amp;token=0c70c2b1-fc88-41d8-9090-c7ca29a34358" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Navigate to Dashboard

Click on the "**Dashboard**" tab on the top of the page.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fx2KxvTPJPLRFbhfmPhHs%2Fimage.png?alt=media&amp;token=b88be02e-5da7-4790-8017-b52cb27b7bc9" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Open Your Feeds

Scroll down to "**Your** **Feeds**" section. Here you can view;

* The feed that you are subscribed to
* Network in which you are receiving the feed on
* Mode type for the particular feed (Push or Pull)
* Deviation selected for the feed
* Status of the feed (If the feed is **active** or **inactive**)&#x20;
* Expiration date of the feed

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FYAlbRGI1sffXAaqQQs14%2Fimage.png?alt=media&amp;token=25dad0fa-b288-411f-8bc7-9a303776f5dc" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


# Manage Subscription

In this step-by-step guide we'll go over how to manage your subscriptions using the Universal Data Feeds (UDF) [hub](https://udf.entangle.fi/). This process is an intuitive and straight forward process, follow the instructions below to get started.

{% stepper %}
{% step %}

### Connect Wallet

Navigate to <https://udf.entangle.fi/> and click on "**Connect Wallet**" at the top right to connect your wallet.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FYBd1ZkPuy4TLbHDahhRs%2Fimage.png?alt=media&amp;token=196bd04e-c36c-4848-8113-d41e254ecfbc" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Navigate to Dashboard

Click on the "**Dashboard**" tab on the top of the page.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fx2KxvTPJPLRFbhfmPhHs%2Fimage.png?alt=media&amp;token=b88be02e-5da7-4790-8017-b52cb27b7bc9" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Dashboard

Your "**Dashboard**" allows you to manage all your subscriptions. You may view both active and inactive feeds, top up or renew subscriptions as well as view all your subscription details.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FgoPxe5I6Aozn0QprGkGL%2Fimage.png?alt=media&amp;token=ba2510b7-77cf-4847-a41a-34033b118762" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


# Renew Subscription

Users can renew their previously subscribed data feeds without the need to set the parameters again. In this step-by-step guide we'll go over how to renew your subscriptions using the Universal Data Feeds (UDF) [hub](https://udf.entangle.fi/). This process is an intuitive and straight forward process, follow the instructions below to get started.

Users can renew their inactive subscriptions from the "[**Notifications**](#notification-section)" section or from the "[**Your Feeds**](#feeds-section)" section of the dashboard.

## Notification Section

{% stepper %}
{% step %}

### Connect Wallet

Navigate to <https://udf.entangle.fi/> and click on "**Connect Wallet**" at the top right to connect your wallet.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FqVibEgpxIHdSNduZN9bx%2Fimage.png?alt=media&amp;token=384e54aa-e9eb-48d9-807b-b0672af68e20" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Navigate to Dashboard

Click the "**Dashboard**" tab on the top of the page.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FSykEkNW5tTbAgWS0FTIJ%2Fimage.png?alt=media&amp;token=88c4aec2-2ae0-4456-a192-c072d4b445b0" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Notifications Section

Scroll down to the "**Notifications**" section.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FaeDuyuSB1hiSzL9mnQmQ%2Fimage.png?alt=media&amp;token=1fa9d867-51da-4b27-8eee-314a228091ba" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Select Feed

Identify the feed that you with to renew and click the "**Renew**" button.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fqzp08tn1G74rTVn01IZt%2Fimage.png?alt=media&amp;token=994b0241-d0f7-467b-81a2-ecbf059ffedb" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Renewal Amount

Enter the amount that you wish to for.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FDHdLMizXSS2O8wL73NSR%2Fimage.png?alt=media&amp;token=1bc1a0a6-1778-4770-9861-0918f75bc8fa" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Confirm and Finish

Click the "**Extend**" button and confirm the transaction on your wallet.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F1G3CEblXN3P2crRFh66b%2Fimage.png?alt=media&amp;token=af952e4c-4179-48d3-ad3e-8b0dac719960" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

## Your Feeds Section

{% stepper %}
{% step %}

### Connect Wallet

Navigate to <https://udf.entangle.fi/> and click on "**Connect Wallet**" at the top right to connect your wallet.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FqVibEgpxIHdSNduZN9bx%2Fimage.png?alt=media&amp;token=384e54aa-e9eb-48d9-807b-b0672af68e20" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Navigate to Dashboard

Click the "**Dashboard**" tab on the top of the page.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FSykEkNW5tTbAgWS0FTIJ%2Fimage.png?alt=media&amp;token=88c4aec2-2ae0-4456-a192-c072d4b445b0" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Feeds Section

Scroll down to "**Your Feeds**" section.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FBMtHqaZvw2Hs0nEydxVI%2Fimage.png?alt=media&amp;token=87052de0-a9fc-458d-81c2-1a63003b151c" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Select Feed

Select any feed by clicking on it to bring up the subscription page or click on the 3 vertical dots on the right-hand side of the desired feed.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F2q7bDtPPQQ0AlVYCwhAb%2Fimage.png?alt=media&amp;token=afed86a8-7262-4bd0-b96d-2ee79a9e7593" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Top Up

Click on the "**Top Up**" button.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FWLGOwPJVWBVv5IABLab4%2Fimage.png?alt=media&amp;token=e8249974-5804-4ca5-9b26-570813b35d4d" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Renewal Amount

Input the amount that you wish to top up.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FY9J94yWYNGfMLHCPdyxv%2Fimage.png?alt=media&amp;token=5f598f99-895f-48c8-8f50-dba56c0857be" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Confirm and Finish

Click on the "**Top Up**" button at the bottom of the page to renew your subscription.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FPwqgCZJPSJG9ve2kGFp7%2Fimage.png?alt=media&amp;token=f6949ebb-5a99-42fd-9163-8fdf67753d82" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


# Configuring Pull Model

* PAYG: Pay per request (verifyWithFee).
* Subscriptions: Monthly plans (1m–12m) with no protocol fee.
* Extension: Renew via marketplace UI (\[Screenshot: Extend Flow]).

In this guide we'll go over how to configure your pull mode data feed using the Universal Data Feeds (UDF) [hub](https://udf.entangle.fi/). This process is an intuitive and straight forward process, follow the instructions below to get started.

This guide only covers configuration. Read [this guide](/universal-data-feeds/user-guides/subscribe-to-a-data-feed) if you're looking for how to subscribe to a data feed.&#x20;

{% stepper %}
{% step %}

### Select Pull Mode

Begin by selecting Pull as the data delivery method. The **Pull Model (On-Demand)** fetches data only when required, ensuring it is up-to-date and reducing unnecessary updates. Learn more about the pull mode [here](/universal-data-feeds/architecture/data-delivery-methods).

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F0LYLrw3nEcwDaVUbX9Ar%2Fimage.png?alt=media&amp;token=ac523254-ca08-40b5-86ef-d671812aecfb" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Select Destination Network

Select the destination "Network" that you wish to receive your data feed on.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FplMuZ9FozHGL2m8bgiWz%2Fimage.png?alt=media&amp;token=8fbdfc7d-2bce-4474-9241-b669bb6f0242" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


# Configuring Push Model

* Subscriptions: Prepay deposit with 3.5% service fee.
* Cost-sharing: Scales with subscribers.
* Top-ups: Add funds when balance nears depletion.
* Minimum deposit: Covers a few updates.
* Suggested deposit: \~7 days (adjustable, with buffer advice).


# Data Endpoints

The table below lists the contract addresses for the UDF Push and Pull marketplace contracts across supported networks. These addresses must be used during integration. They serve as the interaction points for accessing UDF services on specific blockchains.

When implementing your integration, ensure that the correct address for the target network is referenced in your code.

## Marketplace Contract Addresses

{% tabs %}
{% tab title="Mainnet" %}

<table><thead><tr><th width="191">Chain</th><th>PushMarketplace</th><th>PullMarketplace</th></tr></thead><tbody><tr><td>base</td><td><a href="https://basescan.org/address/0x6d1713055b3060f67a999afe491ea09a437a4ce9">0x6D1713055B3060F67a999AfE491EA09a437a4CE9</a></td><td><a href="https://basescan.org/address/0xccead89c78f8b258d594e92bda00e924983cf53c">0xCcEad89c78F8B258D594e92BdA00E924983Cf53c</a></td></tr><tr><td>eth_sepolia</td><td><a href="https://sepolia.etherscan.io/address/0x48a10ff4ea77a099cc966b537b5efc5b15c1060a">0x48A10FF4ea77A099Cc966b537b5efC5b15c1060A</a></td><td><a href="https://sepolia.etherscan.io/address/0xc6670092056e7bf56c3149fde52a187b3e9f2e63">0xC6670092056e7bf56c3149FDE52A187b3e9f2e63</a></td></tr><tr><td>mantle</td><td><a href="https://explorer.mantle.xyz/address/0x24a4569Df777A14027516b4ed02116c026ebE8B2?tab=txs">0x24a4569Df777A14027516b4ed02116c026ebE8B2</a></td><td><a href="https://explorer.mantle.xyz/address/0x1b4C2D4828C7040B9197718AfAc0A1408d362d84">0x1b4C2D4828C7040B9197718AfAc0A1408d362d84</a></td></tr><tr><td>quai</td><td><a href="https://quaiscan.io/address/0x00211C841e8b76112a14e4EF282c9938Ee5C6016?shard=undefined">0x00211C841e8b76112a14e4EF282c9938Ee5C6016</a></td><td><a href="https://quaiscan.io/address/0x0069B5F77f4b9E2Deee35A43cA322958b942e7b7?shard=undefined">0x0069B5F77f4b9E2Deee35A43cA322958b942e7b7</a></td></tr><tr><td>quai_orchard_testnet</td><td><a href="https://orchard.quaiscan.io/address/0x0076FaF63BB27e8c18FaaC92faE26125c42E08B9?shard=undefined">0x0076FaF63BB27e8c18FaaC92faE26125c42E08B9</a></td><td><a href="https://orchard.quaiscan.io/address/0x003905DD0636A20FE4f2294f26ECE55d00B2c700?shard=undefined">0x003905DD0636A20FE4f2294f26ECE55d00B2c700</a></td></tr><tr><td>berachain</td><td><a href="https://berascan.com/address/0x293eb14cc1f3bfaeeb51abc772852f8942846759">0x293Eb14Cc1F3BfAEeB51Abc772852f8942846759</a></td><td><a href="https://berascan.com/address/0xf74570766569ab72b624b33a092143f1ce6ca56a">0xf74570766569AB72b624b33A092143f1cE6CA56A</a></td></tr><tr><td>sonic</td><td><a href="https://sonicscan.org/address/0x9bbdea6b42014240328ec4ff31f80a940714164c">0x9bBDea6b42014240328ec4ff31f80A940714164c</a></td><td><a href="https://sonicscan.org/address/0x293eb14cc1f3bfaeeb51abc772852f8942846759">0x293Eb14Cc1F3BfAEeB51Abc772852f8942846759</a></td></tr><tr><td>arbitrum</td><td><a href="https://arbiscan.io/address/0x996520f9717f6141e53d8083168027d7834c172f">0x996520f9717f6141e53D8083168027d7834c172f</a></td><td><a href="https://arbiscan.io/address/0xc0931aee1064bd5245fee76a2d740eab8436621e">0xc0931aEE1064BD5245fEe76A2d740eab8436621e</a></td></tr><tr><td>blast</td><td><a href="https://blastscan.io/address/0x29db51bd5c979af4307e73611efa56c3401f8013">0x29DB51bd5c979aF4307e73611eFA56C3401F8013</a></td><td><a href="https://blastscan.io/address/0x1cb2ba92285401ffacd258f57635d436de55f460">0x1Cb2Ba92285401fFaCd258f57635d436De55F460</a></td></tr><tr><td>polygon</td><td><a href="https://polygonscan.com/address/0x29db51bd5c979af4307e73611efa56c3401f8013">0x29DB51bd5c979aF4307e73611eFA56C3401F8013</a></td><td><a href="https://polygonscan.com/address/0x1cb2ba92285401ffacd258f57635d436de55f460">0x1Cb2Ba92285401fFaCd258f57635d436De55F460</a></td></tr><tr><td>optimism</td><td><a href="https://optimistic.etherscan.io/address/0xea8aff5fa7d35ab8f77e018cb5073f9b4dcb9065">0xea8AfF5fA7d35ab8f77e018CB5073F9b4DCB9065</a></td><td><a href="https://optimistic.etherscan.io/address/0x24a4569df777a14027516b4ed02116c026ebe8b2">0x24a4569Df777A14027516b4ed02116c026ebE8B2</a></td></tr><tr><td>linea</td><td><a href="https://lineascan.build/address/0x24a4569df777a14027516b4ed02116c026ebe8b2">0x24a4569Df777A14027516b4ed02116c026ebE8B2</a></td><td><a href="https://lineascan.build/address/0x1b4C2D4828C7040B9197718AfAc0A1408d362d84">0x1b4C2D4828C7040B9197718AfAc0A1408d362d84</a></td></tr><tr><td>ethereum</td><td><a href="https://etherscan.io/address/0xf74570766569ab72b624b33a092143f1ce6ca56a">0xf74570766569AB72b624b33A092143f1cE6CA56A</a></td><td><a href="https://etherscan.io/address/0xb2f863b68d85b198dde2fe7da1d8bafdcff199c0">0xB2F863B68d85b198DDe2fE7da1D8baFdCFf199c0</a></td></tr><tr><td>binance bnb</td><td><a href="https://bscscan.com/address/0x1cb2ba92285401ffacd258f57635d436de55f460">0x1Cb2Ba92285401fFaCd258f57635d436De55F460</a></td><td><a href="https://bscscan.com/address/0xa7a8eaaa131dc4d2f70636f5f8796e640b119926">0xA7a8eAAA131dc4D2f70636F5F8796e640B119926</a></td></tr><tr><td>monad_testnet</td><td><a href="https://testnet.monadexplorer.com/address/0x293Eb14Cc1F3BfAEeB51Abc772852f8942846759">0x293Eb14Cc1F3BfAEeB51Abc772852f8942846759</a></td><td><a href="https://testnet.monadexplorer.com/address/0xf74570766569AB72b624b33A092143f1cE6CA56A">0xf74570766569AB72b624b33A092143f1cE6CA56A</a></td></tr><tr><td>mantle_sepolia</td><td><a href="https://explorer.sepolia.mantle.xyz/address/0x293Eb14Cc1F3BfAEeB51Abc772852f8942846759">0x293Eb14Cc1F3BfAEeB51Abc772852f8942846759</a></td><td><a href="https://explorer.sepolia.mantle.xyz/address/0xf74570766569AB72b624b33A092143f1cE6CA56A">0xf74570766569AB72b624b33A092143f1cE6CA56A</a></td></tr><tr><td>abstract</td><td><a href="https://abscan.org/address/0x108bbF719032d088D9c7f3d899738A3685757fd6">0x108bbF719032d088D9c7f3d899738A3685757fd6</a></td><td><a href="https://abscan.org/address/0xFB36363e44aB688E2D104035941991166CAa00Af">0xFB36363e44aB688E2D104035941991166CAa00Af</a></td></tr></tbody></table>
{% endtab %}
{% endtabs %}

## Assets

The table below provides the **contract addresses** for supported assets across various networks. These addresses represent the deployed instances of the assets within Entangle’s ecosystem.

Note that assets are encoded in the `bytes32` EVM format using their ASCII representation converted to hexadecimal. You can perform this conversion using the below CLI commands with Python or `cast`. Simply replace `NGL/USD` in the command with the asset you are using.

{% tabs %}
{% tab title="python" %}

<pre class="language-bash"><code class="lang-bash"><strong>python -c "import sys; print(\"0x%s\" % sys.argv[1].encode('ascii').ljust(32,b'\x00').hex())" NGL/USD
</strong></code></pre>

{% endtab %}

{% tab title="cast" %}

<pre class="language-bash"><code class="lang-bash"><strong>cast format-bytes32-string NGL/USD
</strong></code></pre>

{% endtab %}
{% endtabs %}

In the output you should expect `NGL/USD` to be encoded as `0x4e474c2f55534400000000000000000000000000000000000000000000000000`

| Feed key    | Data Key                                                           | Aggregator Link                                                                                                                         |
| ----------- | ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
| 5IRE/USD    | 0x354952452F555344000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/5ire)                                                                                    |
| AAVE/USD    | 0x414156452F555344000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/aave)                                                                                    |
| ADA/USD     | 0x4144412F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/cardano)                                                                                 |
| AIT/USD     | 0x4149542F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/ait-protocol)                                                                            |
| AIXBT/USD   | 0x41495842542f5553440000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/aixbt-by-virtuals)                                                                       |
| APT/USD     | 0x4150542F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/aptos)                                                                                   |
| AVAX/USD    | 0x415641582F555344000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/avalanche)                                                                               |
| BCH/USD     | 0x4243482F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/bitcoin-cash)                                                                            |
| BERA/USD    | 0x424552412F555344000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/melania-meme)                                                                            |
| BICO/USD    | 0x4249434F2F555344000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/biconomy)                                                                                |
| BNB/USD     | 0x424E422F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/bnb)                                                                                     |
| BTC/USD     | 0x4254432F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/bitcoin)                                                                                 |
| CGPT/USD    | 0x434750542F555344000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/chaingpt)                                                                                |
| DAI/USD     | 0x4441492F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/dai)                                                                                     |
| DOGE/USD    | 0x444F47452F555344000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/dogecoin)                                                                                |
| DOT/USD     | 0x444F542F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/polkadot)                                                                                |
| ENJ/USD     | 0x454E4A2F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/enjin-coin)                                                                              |
| ERN/USD     | 0x45524E2F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/ethernity-chain), [coinmarketcap](https://coinmarketcap.com/currencies/ethernity-chain/) |
| ETH/USD     | 0x4554482F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/ethereum)                                                                                |
| FET/USD     | 0x4645542F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/artificial-superintelligence-alliance)                                                   |
| FTM/USD     | 0x46544D2F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/fantom)                                                                                  |
| GLMR/USD    | 0x474c4d522f555344000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/moonbeam)                                                                                |
| GORPLES/USD | 0x474F52504C45532F555344000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/gorples)                                                                                 |
| HYPE/USD    | 0x485950452f555344000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/hyperliquid)                                                                             |
| ICP/USD     | 0x4943502F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/internet-computer)                                                                       |
| IMX/USD     | 0x494D582F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/immutable-x)                                                                             |
| LINK/USD    | 0x4C494E4B2F555344000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/chainlink)                                                                               |
| LTC/USD     | 0x4C54432F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/litecoin)                                                                                |
| MANA/USD    | 0x4D414E412F555344000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/decentraland)                                                                            |
| MANTA/USD   | 0x4D414E54412F5553440000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/manta-network)                                                                           |
| MELANIA/USD | 0x4D454C414E49412F555344000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/melania-meme)                                                                            |
| MNT/USD     | 0x4D4E542F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/mantle)                                                                                  |
| MOVE/USD    | 0x4d4f56452f555344000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/movement)                                                                                |
| MOVR/USD    | 0x4d4f56522f555344000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/moonriver)                                                                               |
| NEAR/USD    | 0x4E4541522F555344000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/near)                                                                                    |
| NGL/USD     | 0x4E474C2F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/entangle)                                                                                |
| PEPE/USD    | 0x504550452F555344000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/pepe)                                                                                    |
| POL/USD     | 0x504F4C2F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/polygon)                                                                                 |
| QUAI/USD    | 0x515541492f555344000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/quai-network)                                                                            |
| RENDER/USD  | 0x52454E4445522F55534400000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/render)                                                                                  |
| RLUSD/USD   | 0x524C5553442F5553440000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/ripple-usd)                                                                              |
| RON/USD     | 0x524f4e2f55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/ronin)                                                                                   |
| ROSE/USD    | 0x524F53452F555344000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/oasis)                                                                                   |
| S/USD       | 0x532F555344000000000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/sonic)                                                                                   |
| SAND/USD    | 0x53414E442F555344000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/the-sandbox)                                                                             |
| SHIB/USD    | 0x534849422F555344000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/shiba-inu)                                                                               |
| SOL/USD     | 0x534F4C2F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/solana)                                                                                  |
| STX/USD     | 0x5354582F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/stacks)                                                                                  |
| SUI/USD     | 0x5355492F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/sui)                                                                                     |
| SUPER/USD   | 0x53555045522F5553440000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/superverse)                                                                              |
| sUSDS/USD   | 0x73555344532F5553440000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/susds)                                                                                   |
| TAO/USD     | 0x54414F2F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/bittensor)                                                                               |
| TON/USD     | 0x544F4E2F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/toncoin)                                                                                 |
| TRUMP/USD   | 0x5452554D502F5553440000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/official-trump)                                                                          |
| TRX/USD     | 0x5452582F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/tron)                                                                                    |
| UNI/USD     | 0x554E492F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/uniswap)                                                                                 |
| USD0/USD    | 0x555344302f555344000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/usual-usd)                                                                               |
| USDS/USD    | 0x555344532F555344000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/usds)                                                                                    |
| VIRTUAL/USD | 0x5649525455414c2f555344000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/virtual-protocol)                                                                        |
| WLD/USD     | 0x574C442F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/worldcoin)                                                                               |
| XLM/USD     | 0x584C4D2F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/stellar)                                                                                 |
| XRP/USD     | 0x5852502F55534400000000000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/xrp)                                                                                     |
| ZEREBRO/USD | 0x5a45524542524f2f555344000000000000000000000000000000000000000000 | [coingecko](https://www.coingecko.com/en/coins/zerebro)                                                                                 |


# Overview

Universal Tokens are cross-chain native tokens secured by UIP. The Universal Token Standard (UTS) enables token developers to launch new or expand existing tokens across all major blockchains through a [self service portal](https://uts.entangle.fi/) within a few clicks.&#x20;

UTS revolutionizes cross-chain management, giving developers the power to effortlessly expand their assets across popular chains while keeping full control of their smart contracts — UTS requires no special permissions or rights. Take your token to the next level with UTS, the ultimate tool to seamlessly scale and control, and unlock the infinite possibilities of the interconnected web.

{% embed url="<https://drive.google.com/file/d/1c1amneDVw8Xpe2F66fSs0I1QmQFbDLM5/view?usp=drive_link>" %}

## Features

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FpvNGzmyncBlWq8kXVk7K%2Funiversal_token_standard_features.png?alt=media&amp;token=acf61b19-20cd-4bf2-8321-3c160d1990e0" alt=""><figcaption></figcaption></figure>

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><strong>Contract Sovereignity</strong></td><td>Deploy, mint, burn, lock, or unlock tokens while retaining full control over your token.</td></tr><tr><td><strong>Logic Customization</strong></td><td>Easily add custom logic and cross-chain messaging to your token. </td></tr><tr><td><strong>Dual Proof of Stake Mechanics</strong></td><td>Transparent, verifiable, and tamper-proof, operating without third parties.</td></tr><tr><td><strong>Gas Management</strong></td><td>Set custom gas limits per blockchain with auto adjusting fees based on network conditions.</td></tr><tr><td><strong>Low Cost Bridging</strong></td><td>Simple and cost effective token bridging. Tokens mint or unlock automatically on the target chain.</td></tr><tr><td><strong>No Liquidity Pools Required</strong></td><td>Tokens move directly cross-chains without locking funds, reducing complexity and costs.</td></tr></tbody></table>

## Explore

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>Architecture</td><td><a href="/universal-token-standard/architecture">Architecture</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FODH53Gntgbn74M4gcdQ8%2FArhitecture.png?alt=media&amp;token=fd39d42c-29fc-4024-b86e-7fa439bd1af8">Arhitecture.png</a></td></tr><tr><td>Fee Components</td><td><a href="/universal-token-standard/architecture/fee-components">Fee Components</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F2LEbxImhCww3WuO2ZqOu%2FEconomy%20Model.png?alt=media&amp;token=c3bb79e3-1155-40d7-817e-99f06514337c">Economy Model.png</a></td></tr><tr><td>Developer Guides</td><td><a href="/universal-token-standard/developer-guides">Developer Guides</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FZu23rNH2hiipQX5f6kpw%2FCode%20Review%20Reporter.png?alt=media&amp;token=93e7b7be-9ba0-4410-abe4-ff629ea65926">Code Review Reporter.png</a></td></tr><tr><td>User Guides</td><td><a href="/universal-token-standard/user-guides">User Guides</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fen3MQYtYTiju2yC07tBs%2F24.png?alt=media&amp;token=f42cb13d-ffb1-45bd-9859-54f68ce66b31">24.png</a></td></tr><tr><td>Contract Addresses</td><td><a href="/universal-token-standard/contract-addresses">Contract Addresses</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F3CvPZgHBoPU3SRWYZEXV%2F30.png?alt=media&amp;token=177ed72a-8096-425b-aa7c-01188f533ed6">30.png</a></td></tr><tr><td>Frequently Asked Questions</td><td><a href="/more/faq">FAQ</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FWhD3OfXU0q0AbKF5THh4%2F25.png?alt=media&amp;token=091c6862-1a6c-4bb9-9c9c-d41a3290abc2">25.png</a></td></tr></tbody></table>


# Architecture

{% hint style="info" %}
If you have any questions or need assistance, please feel free to use our [contact form](https://entangle.zendesk.com/hc/en-us/requests/new) to connect with an expert on our team.
{% endhint %}

The Universal Token Standard is built for seamless deployment, management, and cross-chain interoperability of omnichain tokens. Integrated with the Entangle Bridge protocol, UTS enables efficient, secure cross-chain transactions using a flexible framework of smart contracts and mechanisms like mint-and-burn and lock-and-unlock.

Each token has its own token pool, which simplifies cross-chain transfers by handling the necessary token actions. Token pools act as a secure layer that limits how often tokens can be transferred, adding extra protection. They are set up to either "lock" or "burn" tokens on the source chain and then "unlock" or "mint" them on the destination chain. This results in four possible combinations: Burn and Mint, Lock and Mint, Burn and Unlock, and Lock and Unlock.

## Bridging

Token bridging is the process of transferring tokens from one blockchain to another, enabling interoperability and seamless interaction across multiple networks. Since blockchains operate independently and cannot directly communicate with one another, token bridging serves as a mechanism to "move" tokens between them.

UTS simplifies token bridging by integrating with the **Entangle Bridge Protocol**. This system automates the mint and burn or lock and mint processes, enabling developers to focus on token functionality while ensuring secure and efficient cross-chain transfers. With UTS, bridging is decentralized, trustless, and designed to minimize the complexity typically associated with multi-chain operations.  UTS offers two modes, expert mode, and simple mode.

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>Bridge SDK Developer Guide</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FfB53jHXnjKjUcykH8Fbd%2F7.png?alt=media&amp;token=35b19cfe-4c37-43d2-9f25-07353cf45e90">7.png</a></td><td><a href="/universal-token-standard/developer-guides/bridge-sdk">Bridge SDK</a></td></tr><tr><td>Bridging User Guide</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F2NrO9wvrVp6M069jLWgS%2F6.png?alt=media&amp;token=05375e06-8f39-4e6b-b915-4f0c6d66ab39">6.png</a></td><td><a href="/universal-token-standard/user-guides/bridging">Bridging</a></td></tr></tbody></table>

## Token Models

When transferring tokens there are several different models users can use to handle tokens on source and destination chains. In this section each type of model is explained.

### Burn and Mint

The burn and mint model maintains token supply consistency by burning tokens on the source chain and minting an equivalent amount on the destination chain. This preserves total supply during cross-chain transfers and supports custom tokenomics.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FUCaMLpu0Fd0nbOK4V1Oh%2FBurn%20and%20Mint.png?alt=media&amp;token=7843866a-5601-4f6c-9721-380e12c25e07" alt=""><figcaption></figcaption></figure>

### Lock and Mint&#x20;

In the lock and mint model, tokens are locked on the issuing blockchain, and fully collateralized wrapped tokens are minted on the destination blockchain. These wrapped tokens, with burn-and-mint functionality, enable cross-chain transfers and extended functionality.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F7cdG9hq857z4Q1w1kcpt%2FLock%20and%20Mint.png?alt=media&amp;token=70f20de5-8a3e-4a9d-87b8-bed9479aaede" alt=""><figcaption></figcaption></figure>

### Burn and Unlock

The burn and unlock model returns tokens to their issuing blockchain by burning them on the non-issuing source chain and releasing an equivalent amount on the issuing destination chain.

{% hint style="danger" %}
Unlock scheme requires to have enough liquidity on destination side to perform bridge operation, make sure to check this before bridging.
{% endhint %}

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FW7VH2U2QYfqwjI4CzGrZ%2FBurn%20and%20Unlock.png?alt=media&amp;token=0fae7071-ff16-4c24-8118-717671d93d1d" alt=""><figcaption></figcaption></figure>

### Lock and Unlock

The lock-and-unlock model enables cross-chain transfers for non-upgradable tokens by locking tokens on the source chain and releasing an equivalent amount on the destination chain. This method maintains token integrity and requires careful liquidity management to ensure balance across chains.

{% hint style="danger" %}
Unlock scheme requires to have enough liquidity on destination side to perform bridge operation, make sure to check this before bridging.
{% endhint %}

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FkRnDJA1pMS3T0IsdlQYl%2FLock%20and%20Unlock.png?alt=media&amp;token=647a590c-005e-44c5-adfa-ac61033b3a95" alt=""><figcaption></figcaption></figure>


# Fee Components

UTS provides a cost-efficient and transparent fee system for cross-chain transactions, ensuring users pay only for the resources required. Its optimized structure minimizes costs while maintaining reliable and secure token transfers.

## **Gas Fees**

Cross-chain transactions require gas fees on both source and destination networks, covering computational tasks like minting, burning, locking, and unlocking. Gas limits dynamically adjust to real-time network conditions to prevent overpayment.

* **Destination Gas Limit (dstGasLimit):** User-defined maximum gas for the destination network.
* **Destination Gas Price (dstGasPriceInWei):** Real-time gas price updated by UTS backend.
* **Native Token Prices:** Prices of source and destination native tokens (e.g., ETH, BNB) in USD are tracked for accurate fee estimation.

```plaintext
codebaseFeeAtCurrentNative = dstGasLimit * dstGasPriceInWei * (dstNativePriceInUSDe18 / curNativePriceInUSDe18)
```

## **Payload Fees**

Fees for transferring additional data, calculated based on the data size (in bytes) and destination gas price.

```plaintext
codepayloadPriceAtCurrentNative = payloadLength * dstPricePerByteInWei * (dstNativePriceInUSDe18 / curNativePriceInUSDe18)
```

## **Bridge Transaction Fees**

Protocol fees for managing token transfers, covering operational costs of the Entangle Bridge.

* **Source Network Execution:** Gas fees for burning or locking tokens.
* **Destination Network Execution:** Gas fees for minting or unlocking tokens.
* **Protocol Fee:** A flat fee deducted during the transaction.

## Fee Optimization

UTS minimizes on-chain workload by performing calculations off-chain. Backend services compute values like `dstGasPriceAtCurrentNative` and `dstPayloadPriceAtCurrentNative` before passing them to the contract, reducing unnecessary costs for users.


# Developer Guides

The Universal Token Standard (UTS) is a framework for deploying and managing omnichain tokens across multiple blockchains. It uses mint-and-burn or lock-and-unlock mechanisms to ensure consistent token supply during cross-chain transfers. Integrated with the Entangle Bridge, UTS supports EVM and non-EVM environments, enabling seamless token management and interoperability across diverse blockchains.

## Explore

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>Manual Deploy</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FUQaGuEBvY8jOxMiLpjix%2FQuick%20Launch%20Guide.png?alt=media&amp;token=7fb4f159-180d-431e-992f-e46b690ec5a1">Quick Launch Guide.png</a></td><td><a href="/universal-token-standard/developer-guides/manual-deploy">Manual Deploy</a></td></tr><tr><td>Bridge SDK</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FODH53Gntgbn74M4gcdQ8%2FArhitecture.png?alt=media&amp;token=fd39d42c-29fc-4024-b86e-7fa439bd1af8">Arhitecture.png</a></td><td><a href="/universal-token-standard/developer-guides/bridge-sdk">Bridge SDK</a></td></tr><tr><td>Token Verification</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FxoFvUBTRjzCeSv1EYa5b%2FHow%20to%20Integrate.png?alt=media&amp;token=76a83b10-5954-41a2-a72c-f40a5435f58a">How to Integrate.png</a></td><td><a href="/universal-token-standard/developer-guides/token-verification">Token Verification</a></td></tr><tr><td>Fees Calculation &#x26; Gas Estimation Logic</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FI3OHTZNvHC0PE8pqJGMb%2FLiquid%20Vault%20Audit.png?alt=media&amp;token=5ba9deb8-d430-4a0a-868a-be694448af72">Liquid Vault Audit.png</a></td><td><a href="/universal-token-standard/developer-guides/fees-calculation-and-gas-estimation-logic">Fees Calculation &amp; Gas Estimation Logic</a></td></tr><tr><td>Estimations</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FfgRGA9e7qIlL9VvNAfEa%2FConnecting%20Custom%20Data.png?alt=media&amp;token=f820395a-b977-4f76-b51f-6bfbd7d6491a">Connecting Custom Data.png</a></td><td><a href="/universal-token-standard/developer-guides/estimations">Estimations</a></td></tr></tbody></table>


# Manual Deploy

Developers who require greater control and flexibility can customize their token via smart contracts, a process referred to as manual deployment. It allows direct interaction with the Entangle framework and involves deploying token smart contracts to individual blockchains, requiring developers to define all token parameters, and manage bridging mechanisms programmatically.

While this approach offers more control, it requires a deeper understanding of blockchain infrastructure and additional effort to ensure consistency and security across networks. Manual deployment is ideal for projects requiring customized token behavior and complete flexibility in management.

This section provides information on how to create, deploy new tokens, or connect existing tokens to the UTS infrastructure manually.&#x20;

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>Token Deployment Types</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FmoIqGroYdaJmqi5OiVGP%2F14.png?alt=media&amp;token=7429a063-170f-4e97-89d6-3f06e99d7e06">14.png</a></td><td><a href="/universal-token-standard/developer-guides/manual-deploy/token-deployment-types">Token Deployment Types</a></td></tr><tr><td>Create a Custom Token</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FjuLWcTD79iQGBMlklNc9%2FToken%20Deployment.png?alt=media&amp;token=204e53b5-2555-4a20-be37-bf02fbdda847">Token Deployment.png</a></td><td><a href="/universal-token-standard/developer-guides/manual-deploy/create-a-custom-token">Create a Custom Token</a></td></tr><tr><td>Factory Blueprint Deployment</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FxoFvUBTRjzCeSv1EYa5b%2FHow%20to%20Integrate.png?alt=media&amp;token=76a83b10-5954-41a2-a72c-f40a5435f58a">How to Integrate.png</a></td><td><a href="/universal-token-standard/developer-guides/manual-deploy/factory-blueprint-deployment">Factory Blueprint Deployment</a></td></tr><tr><td>Examples</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FX7sBOyrKKQpKc8x2uIyq%2F1.png?alt=media&amp;token=004c2a87-863b-4c39-a9f7-ca20b23dee67">1.png</a></td><td><a href="/universal-token-standard/developer-guides/manual-deploy/examples">Examples</a></td></tr></tbody></table>


# Token Deployment Types

UTS offers three distinct types of token deployments for manually deployed tokens, each with its own characteristics.

## Custom Tokens

* Can be launched by anyone
* Not officially registered on the Entangle platform
* Token and connector contracts can be modified by deployers as needed
* Offer maximum flexibility but may lack official recognition

## Factory Tokens

* Deployed through Factory contracts
* In the case of UTS Connectors deployment:
  * Underlying tokens remain owned by third parties
  * Provides a standardized deployment process
* Offers a balance between customization and standardization

## Verified Tokens

* Registered and vetted by Entangle
* Official recognition on the Entangle platform
* Increased trust and credibility for token projects

For more detailed information about how to verify your token on Entangle platform please visit [GitHub](https://github.com/Entangle-Protocol/UTS-Public-Token-List) or check out the [token verification](/universal-token-standard/developer-guides/token-verification) guide.


# Create a Custom Token

You can extend the base implementation of the UTS Token or UTS Connector to meet your specific requirements. To implement your custom token, you’ll need to follow a few basic guidelines.

{% stepper %}
{% step %}

### Install Entangle Package

Start by installing the Entangle Labs UTS Contract package using NPM.

```bash
npm i @entangle-labs/uts-contracts
```

{% endstep %}

{% step %}

### Import Dependencies

Next, you'll need to import the UTS Base smart contract dependency. The UTS Base contract is the core component in the creation of a UTS Token or UTS Connector. To implement any token or connector, you’ll need to inherit from the UTS Base smart contract. Simply put, it acts as a wrapper around the cross-chain communication logic.&#x20;

To learn more, check out our [examples](/universal-token-standard/developer-guides/manual-deploy/examples), which include code with detailed technical documentation.

```solidity
import "@entangle-labs/uts-contracts/contracts/ERC20/UTSBase";
```

{% endstep %}

{% step %}

### Inheritance and Virtual Functions

Inherit from UTS Base contract. All necessary functions are virtual, allowing you to override them with your own logic if necessary.

{% hint style="info" %}

* The `__UTSBase_init` function MUST be called before using other functions of the UTSBase contract.
* The `_authorizeCall` function MUST be overridden to include access restriction to the `setRouter` and `setChainConfig` functions.
* The `_mintTo` function MUST be overridden to implement `mint`/`transfer` underlying tokens to receiver `to` address by `_router`.
* The `_burnFrom` function MUST be overridden to implement `burn`/`transferFrom` underlying tokens from `spender`/`from` address for bridging.
  {% endhint %}
  {% endstep %}

{% step %}

### Deployment

Once you've finished editing the logic in your implementation, you can proceed with deployment. If you don't have precomputed contract addresses, you can leave initial settings, such as `chain Ids` and `chain configs`, empty.
{% endstep %}

{% step %}

### Configuration

{% hint style="info" %}
Without configuring these settings in your Token/Connector contracts, your bridge will not function properly. Therefore, you must apply these configurations on both sides of your cluster.
{% endhint %}

If you didn’t provide chain configurations during deployment, you can add them afterward by calling `setChainConfig`.

```solidity
/**
 * @notice Sets the destination chains settings.
 * @param allowedChainIds chains Ids available for bridging in both directions.
 * @param chainConfigs array of {ChainConfig} settings for provided {allowedChainIds}, containing:
 *        peerAddress: connected {UTSToken} or {UTSConnector} contract address on the destination chain
 *        minGasLimit: the amount of gas required to execute {redeem} function on the destination chain
 *        decimals: connected {peerAddress} decimals on the destination chain
 *        paused: flag indicating whether current contract is paused for sending/receiving messages from the connected {peerAddress}
 *
 * @return success call result.
 */
function setChainConfig(
    uint256[] calldata allowedChainIds,
    ChainConfig[] calldata chainConfigs
) external virtual returns(bool success)
```

{% endstep %}

{% step %}

### Finishing

That's it! You've successfully created a custom token, and your cluster is now set up and ready to go. For additional important information, please refer to the section below. We also provide clear [examples](/universal-token-standard/developer-guides/manual-deploy/examples) of custom tokens to guide you further.
{% endstep %}
{% endstepper %}

## Additional Important Information and Notes

<details>

<summary>Ensure Connector is Funded for Proper Functioning</summary>

Connector's chain. Without funds, the Connector contract won't be able to unlock tokens. You can fill it by using the bridge from the Connector's chain, which will lock funds on that chain, or you can directly transfer the underlying token to the Connector's address. See how to [transfer liquidity to the Connector](/universal-token-standard/user-guides/transfer-liquidity-to-connector).

</details>

<details>

<summary>Maintain Adequate Token Balances in Your Connectors</summary>

If you have multiple Connectors in your cluster, you must ensure their balances always contain enough underlying tokens to facilitate the redemption of funds.

</details>

<details>

<summary>Automate Token Minting and Burning for Connector Liquidity</summary>

You can implement advanced logic to allow your Connector to mint and burn tokens, eliminating the need to manage liquidity on the Connectors.

</details>


# Factory Blueprint Deployment

If our blueprint Token or Connector meets your requirements, you can deploy the token using our Factory. You may also deploy the Token or Connector contracts on all desired chains (ensure that an existing UTS Router is available on these chains). See below for more information.

## Single-Chain Deployment via UTS Factory

### UTS Token

If you want to deploy UTS Token using our blueprint, you can call the function below on UTS Factory contract:

```solidity
/**
 * @notice Deploys a new {UTSToken} using the provided deployment parameters.
 * @param deployData the {DeployTokenData} struct containing deployment parameters.
 * @dev See the {UTSERC20DataTypes.DeployTokenData} for details.
 *
 * @return success call result.
 * @return newToken a newly deployed {UTSToken} contract address.
 */
function deployToken(DeployTokenData calldata deployData)
```

Use `DeployTokenData` :

```solidity
struct DeployTokenData {
    bytes     owner;
    string    name;
    string    symbol;
    uint8     decimals;
    uint256   initialSupply;
    uint256   mintedAmountToOwner;
    bool      pureToken;
    bool      mintable;
    bool      globalBurnable;
    bool      onlyRoleBurnable;
    bool      feeModule;
    bytes     router;
    uint256[] allowedChainIds;
    ChainConfig[] chainConfigs;
    bytes32   salt;
}
```

<table><thead><tr><th width="306">Field</th><th>Meaning</th></tr></thead><tbody><tr><td><pre><code>owner
</code></pre></td><td>Address encoded here will be setted as the owner of the token</td></tr><tr><td><pre><code>name
</code></pre></td><td>The name of new token</td></tr><tr><td><pre><code>symbol
</code></pre></td><td>The symbol of new token</td></tr><tr><td><pre><code>decimals
</code></pre></td><td>The decimals of new token</td></tr><tr><td><pre><code>initialSupply
</code></pre></td><td>Token initial supply, that will be minted</td></tr><tr><td><pre><code>mintedAmountToOwner
</code></pre></td><td>Token supply, that will be minted to owner (must be less than or equal initialSupply)</td></tr><tr><td><pre><code>pureToken
</code></pre></td><td>True/false flag is token should be without any extensions (non-mintable, non-burnable, without fee, working by lock/unlock scheme). If true, other flags should be false</td></tr><tr><td><pre><code>mintable
</code></pre></td><td>True/false flag is token mintable by owner (owner can mint arbitrary token amount)</td></tr><tr><td><pre><code>globalBurnable
</code></pre></td><td>True/false flag is token burnable (everyone can burn his tokens)</td></tr><tr><td><pre><code>onlyRoleBurnable
</code></pre></td><td>True/false flag is token burnable by BURNER_ROLE role only</td></tr><tr><td><pre><code>feeModule
</code></pre></td><td>True/false flag is token will supports fee extracting for bridging(currently unsupported, should be false by default)</td></tr><tr><td><pre><code>router
</code></pre></td><td>UTSRouter address on the deployment chain</td></tr><tr><td><pre><code>allowedChainIds
</code></pre></td><td>Array of initial destination chain IDs that token binded to</td></tr><tr><td><pre><code>chainConfigs
</code></pre></td><td>Array of ChainConfig structs, initial settings</td></tr><tr><td><pre><code>salt
</code></pre></td><td>Salt to deploy new token to specified address, you can specify it, if you want specific address</td></tr></tbody></table>

{% hint style="info" %}
If `PureToken` is set to `true`, then `initialSupply` should be equal or more than `mintedAmountToOwner`.
{% endhint %}

{% hint style="info" %}
If `PureToken` is set to `false`, then `initialSupply` should be equal to `mintedAmountToOwner`
{% endhint %}

### UTS Connector

If you want to deploy UTS Connector, you should use function below:

```solidity
/**
 * @notice Deploys a new {UTSConnector} using the provided deployment parameters.
 * @param deployData the {DeployConnectorData} struct containing deployment parameters.
 * @dev See the {UTSERC20DataTypes.DeployConnectorData} for details.
 *
 * @return success call result.
 * @return newConnector a newly deployed {UTSConnector} contract address.
 */
function deployConnector(DeployConnectorData calldata deployData)
```

Using struct `DeployConnectorData`&#x20;

```solidity
struct DeployConnectorData {
    bytes     owner;
    bytes     underlyingToken;
    bool      feeModule;
    bytes     router;
    uint256[] allowedChainIds;
    ChainConfig[] chainConfigs;
    bytes32   salt;
}
```

| Field             | Meaning                                                                                                                                                                                                                                   |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `owner`           | UTSConnector owner's address, encoded in bytes                                                                                                                                                                                            |
| `underlyingToken` | Address of the ERC20 token on top of which is UTSConnector built(you can also use a placeholder address `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE`, if the desired connector have to interact with network native currency, e.g. Ether) |
| `feeModule`       | True/false flag is connector will supports fee extracting for bridging(currently unsupported, should be false by default)                                                                                                                 |
| `router`          | UTSRouter address                                                                                                                                                                                                                         |
| `allowedChainIds` | Array of initial destination chain IDs that connector binded to                                                                                                                                                                           |
| `chainConfigs`    | Array of ChainConfig structs, initial settings                                                                                                                                                                                            |
| `salt`            | Provided salt to deploy new connector to specified address                                                                                                                                                                                |

Chain Config struct should be built using struct below:

```solidity
struct ChainConfig {
    bytes   peerAddress;
    uint32  minGasLimit;
    uint8   decimals;
    bool    paused;
}
```

Ensure the chain configurations are properly set up to allow all your smart contracts to communicate with each other.

| Name          | Meaning                                                                                                                                                 |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `peerAddress` | Destination peer address, that can bridge or receive tokens to/from source chain. Normally it should be address of token/connector on destination chain |
| `minGasLimit` | Minimal gas amount that can be provided as function's input and will be used at redeem function                                                         |
| `decimals`    | Destination peer token decimals                                                                                                                         |
| `paused`      | True/false flag is destination peer paused                                                                                                              |

{% hint style="info" %}
`owner`, `router` ,`chainConfigs.peerAddress`and  `underlyingToken` are addresses, but since UTS is omnichain, we designed our protocol to be ready for non evm blockchains like Solana, Ton and others. So, to pass address like data use `abi.encodePacked(address)`, on evm chains
{% endhint %}

{% hint style="info" %}
You may configure `minGasLimit` parameter to take more gas for transfer execution on destination chain if you need so. Please do your own calculations.
{% endhint %}

{% hint style="info" %}
You can set this `minGasLimit` as 0, so, minGasLimit will be set from UTSRouter. You can find more information in [Estimations](/universal-token-standard/developer-guides/estimations)
{% endhint %}

## Cross-Chain Deployment with UTS Deployment Router

You can use our Deployment Router for cross-chain deployment, allowing you to deploy and set up the entire cluster with a single function call. To do this, simply call the function below on the `UTSDeploymentRouter`.

```solidity
/**
 * @notice Sends UTSToken and UTSConnector deployment crosschain requests via UTS protocol V1.
 * @param deployMetadata array of {DeployMetadata} structs, containing destination chain Ids and deploy parameters:
 *        dstChainId: destination chain Id
 *        isConnector: flag indicating whether is request for deploy connector(true) or token(false)
 *        params: abi.encoded {DeployTokenData} struct or abi.encoded {DeployConnectorData} struct
 * @dev See the {UTSERC20DataTypes.DeployTokenData} and {UTSERC20DataTypes.DeployConnectorData} for details.
 *
 * @param paymentToken address of the token used for payment.
 * @dev Any {paymentToken} address different from the {PAYMENT_TOKEN} is identified as a payment in native currency.
 *
 * @return paymentAmount total payment required for send deployment requests.
 * @return currentChainDeployment deployment address on the current chain (if a relevant request was provided).
 */
function sendDeployRequest(
    DeployMetadata[] calldata deployMetadata,
    address paymentToken
) external payable whenNotPaused() returns(
    uint256 paymentAmount, 
    address currentChainDeployment
)
```

To do this you need to provide deployMetadata:

| Name          | Meaning                                                                                        |
| ------------- | ---------------------------------------------------------------------------------------------- |
| `dstChainId`  | Destination chain Id (or current)                                                              |
| `isConnector` | True/false flag is specified params for deploy UTSConnector                                    |
| `params`      | encoded deployData (encoded `DeployTokenData`  struct or encoded `DeployConnectorData` struct) |

{% hint style="info" %}
If you want to pay in ERC-20 token you can do it with `PAYMENT_TOKEN` in `UTSDeploymentRouter.` You also have a possibility to pay in native.  Currently it is NGL
{% endhint %}

{% hint style="info" %}
If you want to estimate deployment fee we have functions for that reason on UTSDeploymentRouter. You can find this information in [Estimations](/universal-token-standard/developer-guides/estimations) section
{% endhint %}

That's it, now you are ready to make your first cross-chain token transfer!


# Examples

This section will help you to set up the environment and get familiar with few examples using UTS Token and Connector.

***

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>Initial Setup</td><td><a href="/universal-token-standard/developer-guides/manual-deploy/examples/initial-setup">Initial Setup</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FxoFvUBTRjzCeSv1EYa5b%2FHow%20to%20Integrate.png?alt=media&amp;token=76a83b10-5954-41a2-a72c-f40a5435f58a">How to Integrate.png</a></td></tr><tr><td>UTS Connector</td><td><a href="/universal-token-standard/developer-guides/manual-deploy/examples/uts-connector">UTS Connector</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FzpX2UuDykYUxVafhlHt3%2FPhoton%20Messaging%20Audit.png?alt=media&amp;token=ce568941-4c20-4444-9b5e-3ed87cdf1945">Photon Messaging Audit.png</a></td></tr><tr><td>UTS Token</td><td><a href="/universal-token-standard/developer-guides/manual-deploy/examples/uts-token">UTS Token</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FHZ9GtBm2OdeyG0aAgDEC%2FNGL%20Token%20Audit.png?alt=media&amp;token=4171442b-7c48-40ce-9a0d-36222209fd15">NGL Token Audit.png</a></td></tr></tbody></table>


# Initial Setup

Before starting any of the examples, you’ll need to set up your environment. We recommend using the [Hardhat](https://hardhat.org/) development environment. If you choose to use it, please follow the [Hardhat setup guide](https://hardhat.org/hardhat-runner/docs/getting-started).&#x20;

Once your development environment is set up, install the core dependencies using the following [npm](https://www.npmjs.com/) commands:

```bash
npm i @entangle-labs/uts-contracts
```

```bash
npm i @openzeppelin/contracts
```

After initializing an empty Hardhat project and installing dependencies, you are ready to write your token or connector. Next, try creating a [simple token](/universal-token-standard/developer-guides/manual-deploy/examples/uts-token/simple-token) or a [lock and unlock connector](/universal-token-standard/developer-guides/manual-deploy/examples/uts-connector/lock-and-unlock-connector-scheme).

***

## Explore

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>Mint &#x26; Burn Connector Scheme</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fr4jDjsaOuqZlIJgCIhLn%2FTGE%20Audit.png?alt=media&amp;token=6caeeb67-8c00-489e-87cb-bd8c5e520bad">TGE Audit.png</a></td><td><a href="/universal-token-standard/developer-guides/manual-deploy/examples/uts-connector/mint-and-burn-connector-scheme">Mint &amp; Burn Connector Scheme</a></td></tr><tr><td>Lock &#x26; Unlock Connector Scheme</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fd4w6yQczt2oLBwNIlp9g%2FEntangle%20Blockchain%20Audit.png?alt=media&amp;token=8419381b-4f4f-4a33-8072-a68ff5f281ed">Entangle Blockchain Audit.png</a></td><td><a href="/universal-token-standard/developer-guides/manual-deploy/examples/uts-connector/lock-and-unlock-connector-scheme">Lock &amp; Unlock Connector Scheme</a></td></tr><tr><td>Connector Over Native Currency</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FzpX2UuDykYUxVafhlHt3%2FPhoton%20Messaging%20Audit.png?alt=media&amp;token=ce568941-4c20-4444-9b5e-3ed87cdf1945">Photon Messaging Audit.png</a></td><td><a href="/universal-token-standard/developer-guides/manual-deploy/examples/uts-connector/connector-over-native-currency">Connector Over Native Currency</a></td></tr><tr><td>Simple Token</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FHZ9GtBm2OdeyG0aAgDEC%2FNGL%20Token%20Audit.png?alt=media&amp;token=4171442b-7c48-40ce-9a0d-36222209fd15">NGL Token Audit.png</a></td><td><a href="/universal-token-standard/developer-guides/manual-deploy/examples/uts-token/simple-token">Simple Token</a></td></tr><tr><td>Token with Crosschain Messages</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FnAqSZmdyCrRMVzlEA7qZ%2FPhoton%20Messaging%20Use%20Cases.png?alt=media&amp;token=107a5f6e-c1c9-4cf0-ae59-adbd0d4174f6">Photon Messaging Use Cases.png</a></td><td><a href="/universal-token-standard/developer-guides/manual-deploy/examples/uts-token/token-with-messages">Token with Messages</a></td></tr></tbody></table>


# UTS Connector

The UTS Connector is designed to add cross-chain bridging capabilities to your tokens.  If you want to add bridging capabilities to an already deployed token, the Connector is the solution. Once deployed, it allows tokens to be locked on one chain and unlocked on another, facilitating the creation or release of UTS tokens. You can use the provided contract as it is or adjust it to suit your needs. To get started, simply deploy the Connector, and you'll be able to bridge tokens seamlessly.

{% hint style="info" %}
For additional technical details, you can explore the [UTSConnector.sol](https://github.com/Entangle-Protocol/uts-sc-v1/blob/main/contracts/ERC20/connector/UTSConnector.sol) contract on GitHub.
{% endhint %}

Below are two types of Connectors you can choose from based on your needs:

* **Connector with** [**Lock/Unlock Mechanism**](/universal-token-standard/developer-guides/manual-deploy/examples/uts-connector/lock-and-unlock-connector-scheme): If you do not want or cannot provide mint/burn access to the Connector, this option allows you to control the token’s locking and unlocking functions. Use this when you prefer to restrict token minting or burning but still want to enable bridging.
* **Connector with** [**Mint/Burn Mechanism**](/universal-token-standard/developer-guides/manual-deploy/examples/uts-connector/mint-and-burn-connector-scheme): Choose this option if you're able to provide mint and burn access to the Connector. It allows the Connector to mint and burn tokens during the bridging process.
* **Connector Based on** [**Native Currency**](/universal-token-standard/developer-guides/manual-deploy/examples/uts-connector/connector-over-native-currency): This type of Connector is built over the native currency of a blockchain, using the native token as the underlying asset for bridging.

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>Mint &#x26; Burn Connector Scheme</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fr4jDjsaOuqZlIJgCIhLn%2FTGE%20Audit.png?alt=media&amp;token=6caeeb67-8c00-489e-87cb-bd8c5e520bad">TGE Audit.png</a></td><td><a href="/universal-token-standard/developer-guides/manual-deploy/examples/uts-connector/mint-and-burn-connector-scheme">Mint &amp; Burn Connector Scheme</a></td></tr><tr><td>Lock &#x26; Unlock Connector Scheme</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fd4w6yQczt2oLBwNIlp9g%2FEntangle%20Blockchain%20Audit.png?alt=media&amp;token=8419381b-4f4f-4a33-8072-a68ff5f281ed">Entangle Blockchain Audit.png</a></td><td><a href="/universal-token-standard/developer-guides/manual-deploy/examples/uts-connector/lock-and-unlock-connector-scheme">Lock &amp; Unlock Connector Scheme</a></td></tr><tr><td>Connector Over Native Currency</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FzpX2UuDykYUxVafhlHt3%2FPhoton%20Messaging%20Audit.png?alt=media&amp;token=ce568941-4c20-4444-9b5e-3ed87cdf1945">Photon Messaging Audit.png</a></td><td><a href="/universal-token-standard/developer-guides/manual-deploy/examples/uts-connector/connector-over-native-currency">Connector Over Native Currency</a></td></tr></tbody></table>


# Mint & Burn Connector Scheme

Create contract with name `UTSConnectorMintBurnShowcase` .&#x20;

You need to import:

```solidity
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@entangle-labs/uts-contracts/contracts/ERC20/UTSBase";
```

`UTSBase` is our main contract that should be inherited by any Token or Connector.

In this implementation we also used `Ownable`, `Pausable` and `IERC20Metadata`

```solidity
contract UTSConnectorMintBurnShowcase is UTSBase, Ownable, Pausable {}
```

We are starting with defining contract and dependencies. As access control we are choosing Ownable and we also want make this contract as Pausable, because in bridge flow it is also nice to have an option to pause all interactions to make some changes for example.

```solidity
constructor(
    address underlyingToken_,
    address _router,  
    uint256[] memory _allowedChainIds,
    ChainConfig[] memory _chainConfigs
) Ownable(msg.sender) {
    __UTSBase_init(underlyingToken_, IERC20Metadata(underlyingToken_).decimals());

    _setRouter(_router);
    _setChainConfig(_allowedChainIds, _chainConfigs);
}
```

Then we need do define constructor. Since it is connector, we need `underlyingToken_`(the token that will be bridged through UTS protocol). We need also setup `_router` address, that can be found [here](/universal-token-standard/contract-addresses).&#x20;

`_allowedChainIds` are simply whitelist of chain id's, where you are allowing to bridge tokens.&#x20;

`_chainConfigs` is array of settings responsible for bridge settings. We described this config [here](/universal-token-standard/developer-guides/manual-deploy/factory-blueprint-deployment).

In constructor we need to call `__UTSBase_init` function to initialize UTS Base contract. Also we need to set router and chain config.

{% hint style="info" %}
We can skip setting router and chain configs in constructor, but before starting bridging we need to do it with relevant public functions.
{% endhint %}

After this step we need to override 3 functions: `_mintTo`*,*  `_burnFrom` and `_authorizeCall`. We need to do it, because this connector is mint/burn, so, internal logic should be of main bridging function should be done via mint/burn of underlying token.

{% hint style="info" %}
Of course to implement mint/burn logic you need to grant mintable/burnable roles on your underlying token to Connector contract.
{% endhint %}

```solidity
function _authorizeCall() internal override onlyOwner() {}
```

{% code fullWidth="false" %}

```solidity
function _burnFrom(
    address spender,
    address /* from */, 
    bytes memory /* to */, 
    uint256 amount, 
    uint256 /* dstChainId */, 
    bytes memory /* customPayload */
) internal override whenNotPaused() returns(uint256 bridgedAmount) {
    IERC20Extended(_underlyingToken).burnFrom(spender, amount);

    return amount;
}
```

{% endcode %}

```solidity
function _mintTo(
    address to,
    uint256 amount,
    bytes memory /* customPayload */,
    Origin memory /* origin */
) internal override whenNotPaused() returns(uint256 receivedAmount) {
    IERC20Extended(_underlyingToken).mint(to, amount);

    return amount;
}
```

So, here is very simple logic, in the inbounding `redeem` transaction, we need to mint tokens, in the outbounding `bridge` transaction, we need burn tokens.&#x20;

Also we will implement 3 more functions to controll pause state and getter for underlying token decimals.

```solidity
function unpause() external {
    _authorizeCall();
    _unpause();
}
    
function pause() external onlyOwner() {
    _pause();
}

function underlyingDecimals() external view returns(uint8) {
    return _decimals;
}
```

Also we need extended ERC20 interface to call mint and burn functions. In this example, we use standard `mint` and `burnFrom` token functions, but you can use any interface and logic supported by your `underlyingToken` contract.

```solidity
interface IERC20Extended {    
    function mint(address to, uint256 amount) external;
    function burnFrom(address from, uint256 amount) external;
}
```

So, our contract is ready, now it can be deployed on networks and we can start bridging tokens between each chain.

{% hint style="info" %}
You can find full code [here](https://github.com/Entangle-Protocol/uts-sc-v1/blob/main/contracts/ERC20/showcases/UTSConnectorMintBurnShowcase.sol)
{% endhint %}


# Lock & Unlock Connector Scheme

Create contract with name `UTSConnectorLockUnlockShowcase` .&#x20;

You need to import:

```solidity
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@entangle-labs/uts-contracts/contracts/ERC20/UTSBase";
```

`UTSBase` is our main contract that should be inherited by any Token or Connector.

In this implementation we also used `Ownable`, `Pausable` and `IERC20Metadata`

```solidity
contract UTSConnectorLockUnlockShowcase is UTSBase, Ownable {}
```

We are starting with defining contract and dependencies. As access control we are choosing `Ownable`.

```solidity
constructor(
    address underlyingToken_,
    address _router,  
    uint256[] memory _allowedChainIds,
    ChainConfig[] memory _chainConfigs
) Ownable(msg.sender) {
    __UTSBase_init(underlyingToken_, IERC20Metadata(underlyingToken_).decimals());

    _setRouter(_router);
    _setChainConfig(_allowedChainIds, _chainConfigs);
}
```

Then we need do define constructor. Since it is connector, we need `underlyingToken_`(the token that will be bridged through UTS protocol). We need also setup `_router` address, that can be found [here](/universal-token-standard/contract-addresses).&#x20;

`_allowedChainIds` are simply whitelist of chain id's, where you are allowing to bridge tokens.&#x20;

`_chainConfigs` is array of settings responsible for bridge settings. We described this config [here](/universal-token-standard/developer-guides/manual-deploy/factory-blueprint-deployment).

In constructor we need to call `__UTSBase_init` function to initialize UTS Base contract. Also we need to set router and chain config.

{% hint style="info" %}
We can skip setting router and chain configs in constructor, but before starting bridging we need to do it with relevant public functions.
{% endhint %}

After this step we need to override 3 functions: `_mintTo`*,* `_burnFrom` and `_authorizeCall`.&#x20;

{% hint style="info" %}
Since this connector is working via lock/unlock scheme, you need to fulfill it, to start bridging to this connector. This can be done or via just transferring underlying token to connector, or  you can initially bridge your tokens from this connector to any chain where you have uts token or connector with non zero balance and initial money will be locked in connector.
{% endhint %}

```solidity
function _authorizeCall() internal override onlyOwner() {}
```

```solidity
function _burnFrom(
    address spender,
    address /* from */, 
    bytes memory /* to */, 
    uint256 amount, 
    uint256 /* dstChainId */, 
    bytes memory /* customPayload */
) internal override returns(uint256 bridgedAmount) {
    IERC20(_underlyingToken).safeTransferFrom(spender, address(this), amount);

    return amount;
}
```

```solidity
function _mintTo(    
    address to,
    uint256 amount,
    bytes memory /* customPayload */,
    Origin memory /* origin */
) internal override returns(uint256 receivedAmount) {
    IERC20(_underlyingToken).safeTransfer(to, amount);

    return amount;
}
```

So, here is very simple logic, in the outbounding `bridge` transaction, we need to transfer tokens from `spender` to connector address, in the inbounding `redeem` transaction, we need to transfer tokens from connector to receiver `to` address.&#x20;

Also we will implement one more function: getter for underlying token decimals.

```solidity
function underlyingDecimals() external view returns(uint8) {
    return _decimals;
}

```

Also we need to use `SafeERC20` library by OpenZeppelin.

```solidity
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

using SafeERC20 for IERC20;
```

So, our contract is ready, now it can be deployed on networks and we can start bridging tokens between each chain.

{% hint style="info" %}
You can find full code [here](https://github.com/Entangle-Protocol/uts-sc-v1/blob/main/contracts/ERC20/showcases/UTSConnectorLockUnlockShowcase.sol)
{% endhint %}


# Connector Over Native Currency

The main idea of this connector is to have a possibility to bridge native currency between chains.

Create contract with name `UTSConnectorNativeShowcase` . &#x20;

You need to import:

```solidity
import "@openzeppelin/contracts/access/Ownable.sol";
import "@entangle-labs/uts-contracts/contracts/ERC20/UTSBase";
```

`UTSBase` is our main contract that should be inherited by any Token or Connector.

In this implementation we also used `Ownable`

```solidity
contract UTSConnectorNativeShowcase is UTSBase, Ownable {}
```

We are starting with defining contract and dependencies. As access control we are choosing `Ownable`.

Also we need to define `NATIVE_TRANSFER_GAS_LIMIT` some errors and address converter library.

```solidity
using AddressConverter for address;

uint256 public immutable NATIVE_TRANSFER_GAS_LIMIT;

error UTSConnectorNativeShowcase__E0();

error UTSConnectorNativeShowcase__E1();

error UTSConnectorNativeShowcase__E2(bytes);
```

```solidity
constructor(
    address _router,  
    uint256[] memory _allowedChainIds,
    ChainConfig[] memory _chainConfigs,
    uint8 _nativeCurrencyDecimals,
    uint256 _nativeTransferGasLimit
) Ownable(msg.sender) {
    __UTSBase_init(address(0), _nativeCurrencyDecimals);

    _setRouter(_router);
    _setChainConfig(_allowedChainIds, _chainConfigs);

    NATIVE_TRANSFER_GAS_LIMIT = _nativeTransferGasLimit;
}
```

Then we need do define constructor. Since it is connector, we need `_nativeCurrencyDecimals`( since our asset for bridging is native currency, we can provide a null address, but meaningful decimals value still required). We need also setup `_router` address, that can be found [here](/universal-token-standard/contract-addresses).&#x20;

`_allowedChainIds` are simply whitelist of chain id's, where you are allowing to bridge tokens.&#x20;

`_chainConfigs` is array of settings responsible for bridge settings. We described this config [here](/universal-token-standard/developer-guides/manual-deploy/factory-blueprint-deployment).

In constructor we need to call `__UTSBase_init` function to initialize UTS Base contract. Also we need to set router and chain config.

`_nativeTransferGasLimit` serves for defend your and your users gas to avoid attack vector over too complicated or useless `receive` function at the receiver address.&#x20;

{% hint style="info" %}
We can skip setting router and chain configs in constructor, but before starting bridging we need to do it with relevant public functions.
{% endhint %}

Lets start with defining 2 view functions that will help us to track balance of this connector and also decimals of native currency and also `receive` function that will allow our connector to receive native currency.

```solidity
receive() external payable {}

function underlyingDecimals() external view returns(uint8) {
    return _decimals;
}

function underlyingBalance() external view returns(uint256) {
    return address(this).balance;
}
```

After this step we need to override 3 functions: `_mintTo`*,*    `_burnFrom` and `_authorizeCall`.&#x20;

{% hint style="info" %}
Since this connector is working via lock/unlock scheme, you need to fulfill it, to start bridging to this connector. This can be done or via just transferring native to connector, or you can initially bridge your native from this connector to any chain where you have UTS token or connector with non zero balance and initial funds will be locked in connector.
{% endhint %}

<pre class="language-solidity"><code class="lang-solidity"><strong>function _authorizeCall() internal override onlyOwner() {}
</strong></code></pre>

```solidity
function _burnFrom(
    address /* spender */,
    address /* from */, 
    bytes memory /* to */, 
    uint256 amount, 
    uint256 /* dstChainId */, 
    bytes memory /* customPayload */
) internal override returns(uint256 bridgedNativeAmount) {
    if (amount >= msg.value) revert UTSConnectorNativeShowcase__E0();

    return amount;
}
```

```solidity
function _mintTo(
    address to,
    uint256 amount,
    bytes memory /* customPayload */,
    Origin memory /* origin */
) internal override returns(uint256 receivedNativeAmount) {
    if (amount > address(this).balance) revert UTSConnectorNativeShowcase__E1();

    (bool _success, bytes memory _response) = to.call{value: amount, gas: NATIVE_TRANSFER_GAS_LIMIT}("");

    if (!_success) revert UTSConnectorNativeShowcase__E2(_response);

    return amount;
}
```

In the outbounding transaction we need to ensure that `msg.value`  we are going to accept is greater than amount, to ensure that we received enough native currency.

In the inbounding transaction we need to ensure that we have enough native currency on connector balance and as a transfer method we will use raw call, since we want also provide restricted gas value.

Don't forget to check success.

Last but not least we need to override one our internal function that is responsible for sending request to router for bridge proposal. Here we need modify value of this message. Main fee asset in our protocol is native currency, and we need to transfer some fee to router to pay fee. If we will leave as it is, it will transfer whole `msg.value` to router. It is incorrect logic in this case, so we need to substruct our `amount` that will be locked on the connector balance.

```solidity
function _sendRequest(
    uint256 payment,
    bytes memory dstToken,
    bytes memory to,
    uint256 amount,
    uint8 srcDecimals,
    uint256 dstChainId,
    uint64 dstGasLimit,
    bytes memory customPayload,
    bytes memory protocolPayload
) internal override returns(bool success) {
    return IUTSRouter(router()).bridge{value: payment - amount}( 
        dstToken,
        msg.sender.toBytes(),
        to,
        amount,
        srcDecimals,
        dstChainId,
        dstGasLimit,
        customPayload,
        protocolPayload
    );
}
```

So, our contract is ready, now it can be deployed on networks and we can start bridging tokens between each chain.

{% hint style="info" %}
You can find full code [here](https://github.com/Entangle-Protocol/uts-sc-v1/blob/main/contracts/ERC20/showcases/UTSConnectorNativeShowcase.sol)
{% endhint %}


# UTS Token

The **UTS Token** is designed to be bridgeable by default. Once you create it, you can immediately begin bridging it across networks. You can use the provided implementation as-is or customize it to suit your needs.

{% hint style="info" %}
A key feature of the UTSToken is its ability to override the `_update` function to restrict burning access. For additional technical details, you can explore the [UTSToken.sol](https://github.com/Entangle-Protocol/uts-sc-v1/blob/main/contracts/ERC20/token/UTSToken.sol) contract on GitHub.
{% endhint %}

In this section, we’ll provide examples of two types of tokens: a [simple token](/universal-token-standard/developer-guides/manual-deploy/examples/uts-token/simple-token) and a [token that uses cross-chain messages](/universal-token-standard/developer-guides/manual-deploy/examples/uts-token/token-with-messages), allowing you to bridge tokens to multiple addresses in a single transaction.

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>Simple Token</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F2LEbxImhCww3WuO2ZqOu%2FEconomy%20Model.png?alt=media&amp;token=c3bb79e3-1155-40d7-817e-99f06514337c">Economy Model.png</a></td><td><a href="/universal-token-standard/developer-guides/manual-deploy/examples/uts-token/simple-token">Simple Token</a></td></tr><tr><td>Token with Messages</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F2NrO9wvrVp6M069jLWgS%2F6.png?alt=media&amp;token=05375e06-8f39-4e6b-b915-4f0c6d66ab39">6.png</a></td><td><a href="/universal-token-standard/developer-guides/manual-deploy/examples/uts-token/token-with-messages">Token with Messages</a></td></tr></tbody></table>


# Simple Token

Create contract with name `UTSTokenShowcase` .&#x20;

You need to import:

```solidity
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@entangle-labs/uts-contracts/contracts/ERC20/UTSBase";
```

We are starting with defining contract and dependencies. As access control we are choosing Ownable and also since it is UTS Token we need to import ERC20 implementation, here we are using one by OpenZeppelin.

`UTSBase` is our main contract that should be inherited by any Token or Connector.

In this implementation we also used `Ownable` and `ERC20`

```solidity
contract UTSTokenShowcase is UTSBase, Ownable, ERC20 {}
```

<pre class="language-solidity"><code class="lang-solidity"><strong>constructor(
</strong><strong>    address _router,  
</strong>    uint256[] memory _allowedChainIds,
    ChainConfig[] memory _chainConfigs
) Ownable(msg.sender) ERC20("UTS Token Showcase", "UTSTS") {
    __UTSBase_init(address(this), decimals());

    _setRouter(_router);
    _setChainConfig(_allowedChainIds, _chainConfigs);

    _mint(msg.sender, 1_000_000 * 10 ** decimals());
}
</code></pre>

Then we need do define constructor. Since it is Token, we don't need a lot, just general UTS settings and ERC20 metadata.&#x20;

We need setup `_router` address, that can be found [here](/universal-token-standard/contract-addresses).&#x20;

`_allowedChainIds` are simply whitelist of chain id's, where you are allowing to bridge tokens.&#x20;

`_chainConfigs` is array of settings responsible for bridge settings. We described this config [here](/universal-token-standard/developer-guides/manual-deploy/factory-blueprint-deployment).

In constructor we need to call `__UTSBase_init` function to initialize UTS Base contract. Also we need to set router and chain config.

{% hint style="info" %}
We can skip setting router and chain configs in constructor, but before starting bridging we need to do it with relevant public functions.
{% endhint %}

After this step we need to override 3 functions: `_mintTo`*,* `_burnFrom` and `_authorizeCall`.&#x20;

```solidity
function _authorizeCall() internal override onlyOwner() {}
```

```solidity
function _burnFrom(
    address spender,
    address from, 
    bytes memory /* to */, 
    uint256 amount, 
    uint256 /* dstChainId */, 
    bytes memory /* customPayload */
) internal override returns(uint256 bridgedAmount) {
    if (from != spender) _spendAllowance(from, spender, amount);

    _update(from, address(0), amount);

    return amount;
}
```

```solidity
function _mintTo(
    address to,
    uint256 amount,
    bytes memory /* customPayload */,
    Origin memory /* origin */
) internal override returns(uint256 receivedAmount) {
    _update(address(0), to, amount);

    return amount;
}
```

So, here is very simple logic, in the outbounding `bridge` transaction, we need to burn tokens from `from` address (do not forget about ERC20 allowance check), in the inbounding `redeem` transaction, we need to mint tokens to receiver `to` address.&#x20;

So, our contract is ready, now it can be deployed on networks and we can start bridging tokens between each chain.

{% hint style="info" %}
You can find full code [here](https://github.com/Entangle-Protocol/uts-sc-v1/blob/main/contracts/ERC20/showcases/UTSTokenShowcase.sol)
{% endhint %}


# Token with Messages

Create contract with name `UTSTokenWithLogicShowcase` .&#x20;

You need to import:

```solidity
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@entangle-labs/uts-contracts/contracts/ERC20/UTSBase";
```

We start with defining the contract and the dependencies. For the access control we choose Ownable and also since it is UTS Token we need to import ERC20 implementation, here we are using one by openzeppelin.

`UTSBase` is our main contract that should be inherited by any Token or Connector.

In this implementation we also used `Ownable` and `ERC20`.

```solidity
contract UTSTokenWithLogicShowcase is UTSBase, Ownable, ERC20 {}
```

<pre class="language-solidity"><code class="lang-solidity">constructor(
<strong>    address _router,  
</strong>    uint256[] memory _allowedChainIds,
    ChainConfig[] memory _chainConfigs
) Ownable(msg.sender) ERC20("UTS Token With Logic Showcase", "TWL") {
<strong>    __UTSBase_init(address(this), decimals());
</strong>
    _setRouter(_router);
    _setChainConfig(_allowedChainIds, _chainConfigs);

    _mint(msg.sender, 1_000_000 * 10 ** decimals());
}
</code></pre>

Then we need do define constructor. Since it is Token, we don't need a lot, just general UTS settings and ERC20 metadata.&#x20;

We need setup `_router` address, that can be found [here](/universal-token-standard/contract-addresses).&#x20;

`_allowedChainIds` are simply whitelist of chain id's, where you are allowing to bridge tokens.&#x20;

`_chainConfigs` is array of settings responsible for bridge settings. We described this config [here](/universal-token-standard/developer-guides/manual-deploy/factory-blueprint-deployment).

In constructor we need to call `__UTSBase_init` function to initialize UTS Base contract. Also we need to set router and chain config.

Also we added mint function to premint some tokens for deployer address.

{% hint style="info" %}
We can skip setting router and chain configs in constructor, but before starting bridging we need to do it with relevant public functions.
{% endhint %}

Also let's define some events to have a possibility to debug and track transactions and also some errors and library.

```solidity
using AddressConverter for bytes;

error UTSTokenWithLogicShowcase__E0();

error UTSTokenWithLogicShowcase__E1();

error UTSTokenWithLogicShowcase__E2();

event MultiBridged(
    address indexed spender, 
    address from, 
    bytes indexed dstPeerAddressIndexed, 
    bytes dstPeerAddress,
    bytes[] receivers, 
    uint256[] amounts,
    uint256 indexed dstChainId
);

event MultiRedeemed(
    address[] indexed receiversIndexed, 
    address[] receivers,
    uint256[] amounts, 
    bytes indexed srcPeerAddressIndexed, 
    bytes srcPeerAddress,
    uint256 indexed srcChainId,
    bytes sender
);

```

After this step we need to override 3 functions: `_mintTo`*,*  `_burnFrom` and `_authorizeCall`. We need to do it, because this token is mint/burn, so, internal logic should be of main bridging function should be done via mint/burn of underlying token.

```solidity
function _authorizeCall() internal override onlyOwner() {}
```

<pre class="language-solidity"><code class="lang-solidity"><strong>function _burnFrom(
</strong>    address spender,
    address from, 
    bytes memory /* to */, 
    uint256 amount, 
    uint256 dstChainId, 
    bytes memory customPayload
) internal override returns(uint256 bridgedAmount) {
    if (from != spender) _spendAllowance(from, spender, amount);

    _update(from, address(0), amount);

    // This is just an example of how multi-bridge can be implemented.
    if (customPayload.length > 0) {
        // {address} type array can be used here if the token will exist only in EVM-compatible chains.
        (bytes[] memory _receivers, uint256[] memory _amounts) = abi.decode(customPayload, (bytes[], uint256[]));

        // Some basic checks are added here:
        //     1. the {_receivers} and {_amounts} arrays lengths are the same
        //     2. the {_receivers} addresses are not empty
        //     3. the sum of {_amounts} is equal to {amount}

        if (_receivers.length != _amounts.length) revert UTSTokenWithLogicShowcase__E0();

        uint256 _amountsSum;

        for (uint256 i; _receivers.length > i; ++i) {
            if (_receivers[i].length == 0) revert UTSTokenWithLogicShowcase__E1();

            _amountsSum += _amounts[i];
        }

        if (amount != _amountsSum) revert UTSTokenWithLogicShowcase__E2();

        ChainConfig memory config = _chainConfig[dstChainId];

        emit MultiBridged(spender, from, config.peerAddress, config.peerAddress, _receivers, _amounts, dstChainId);
    }

    return amount;
}
</code></pre>

In this implementation, we use `customPayload` as an option to transfer tokens to multiple receivers in different amounts just by one transaction. To do that, we define rules for how the raw bytes passed in `customPayload` should be encoded. In the `_burnFrom` function, we burn the tokens from the token holder in the provided `amount` and implement basic validations of the `customPayload`, if it is provided.

```solidity
function _mintTo(
    address to,
    uint256 amount,
    bytes memory customPayload,
    Origin memory origin
) internal override returns(uint256 receivedAmount) {
    if (customPayload.length > 0) {
        (bytes[] memory _receiversInBytes, uint256[] memory _amounts) = abi.decode(customPayload, (bytes[], uint256[]));

        address[] memory _receivers = new address[](_receiversInBytes.length);

        for (uint256 i; _receiversInBytes.length > i; ++i) {
            _receivers[i] = _receiversInBytes[i].toAddress();
            _update(address(0), _receivers[i], _amounts[i]);
        }

        emit MultiRedeemed(
            _receivers, 
            _receivers,
            _amounts, 
            origin.peerAddress, 
            origin.peerAddress,
            origin.chainId,
            origin.sender
        );

    } else {
        _update(address(0), to, amount);
    }

    return amount;
}
```

Also, it is necessary to implement tokens minting to the receiver or multiple receivers in the `_mintTo` function. Both possible scenarios need to be handled depending on whether a meaningful `customPayload` was provided. In this case, the raw bytes should be decoded, and the corresponding token `_amounts` should be minted to `_receivers`.

So, our contract is ready, now it can be deployed on networks and we can start bridging tokens between each chain.

{% hint style="info" %}
You can find full code [here](https://github.com/Entangle-Protocol/uts-sc-v1/blob/main/contracts/ERC20/showcases/UTSTokenWithLogicShowcase.sol)
{% endhint %}


# Bridge SDK

This [repository](https://github.com/Entangle-Protocol/uts-bridge-frontend-sdk) provides everything you need to integrate the Web3 Bridge into your frontend application. The bridge supports multiple chains and tokens, offering seamless interoperability for Universal Token Standard (UTS).

{% hint style="info" %}
Refer to this [repository](https://github.com/Entangle-Protocol/bridge-example) for an example bridge project.
{% endhint %}

## Setup

After cloning the [repository](https://github.com/Entangle-Protocol/uts-bridge-frontend-sdk) using SSH or HTTPS and opening it locally, following the below guide to complete setup.

{% stepper %}
{% step %}

### Dependencies

install the necessary dependencies by running:

```
npm i
```

{% endstep %}

{% step %}

### Blockchain Providers

You can configure your blockchain providers like so:

1. Navigate to `/blockchain/EVM/provider.ts`.
2. Set up your wagmi configuration and provide your project ID (Learn more here:[ Wagmi Connect Wallet Guide](https://wagmi.sh/react/guides/connect-wallet)):

```typescript
const projectId = 'your project id';
```

3. Update the **transports** variable to use your custom RPC endpoints for different chains. By default, they are set to public RPCs, which may not be reliable:

```
export const transports = {
  [mainnet.id]: http('https://ethereum-rpc.publicnode.com'),
  [mantle.id]: http('https://mantle-rpc.publicnode.com'),
  [bsc.id]: http('https://bsc-rpc.publicnode.com'),
  ...
};
```

{% endstep %}

{% step %}

### Environment Variables

In `/core/Coin/CoinRepository/CoinRepository.ts`, ensure you provide the required environment variables:

```
NEXT_PUBLIC_COINGECKO_API_KEY=your API KEY
NEXT_PUBLIC_BASE_MESSAGES_URL=your GraphQL endpoint
```

* `NEXT_PUBLIC_COINGECKO_API_KEY`: Used to fetch USD prices for native currencies, essential for calculating bridge fees.
* `NEXT_PUBLIC_BASE_MESSAGES_URL`: GraphQL endpoint for tracking the history of bridge operations.
  {% endstep %}
  {% endstepper %}

## Using the Bridge

1. Navigate to `/constants/tokens.ts`:
   1. Add UTS tokens or connectors you want to bridge.
   2. Follow the `TokenOption` type to ensure compatibility.
2. The bridge SDK supports 10 default chains, compatible with UTS:
   1. **Ethereum**, **Mantle**, **BSC**, **Base**, **Arbitrum**, **Avalanche**, **Optimism**, **Polygon**, **CoreDAO**, and **XLayer**.
   2. These chains are defined in `SelectNetworkModal.tsx` and filtered based on tokens in the `TOKENS` file.

## How to Add a New Chain

To integrate a new chain, follow these steps:

1. Add the network to `Web3Manager` (e.g., `EVMManager` for EVM chains).
2. Add the network configuration to `tokens.ts`.

## File Structure

* `.husky` – Git hooks for the repository.
* `.next` – Next.js build folder.
* `api` – GraphQL API calls.
* `app` – Next.js app router directory for pages.
* `blockchain` – Blockchain logic, including providers, hooks, and ABIs.
* `containers` – Reusable container components.
* `core` – Redux layers (actively uses RTK; transitioning to RTK-query).
* `helpers` – Utility functions and helpers.
* `hooks` – Common application hooks.
* `lib` – Third-party libraries used in the project.
* `providers` – React contexts and providers.
* `public` – Public assets folder.
* `scripts` – Service scripts (e.g., Cosmos blockchain interactions).
* `ui–components` – Reusable components that are used in the whole app (like tabs and tables).
* `utils` – Common utilities.

## Contributing

{% hint style="info" %}
For questions or support, please reach out via the issues section or contact the repository maintainers.
{% endhint %}

Contributions are welcome! If you’d like to contribute, please follow the [repository](https://github.com/Entangle-Protocol/uts-bridge-frontend-sdk) guidelines and submit a pull request.


# Token Verification

Token verification is an optional process that enhances the visibility and usability of your token in Entangle’s bridge and dApp ecosystem. By verifying your token, it becomes searchable by name rather than by address, improving user accessibility and integration within the platform.

After deploying your token and setting up its cluster, you can use the bridge and associated dApps. By default, users can search for your token using its contract address. Token verification ensures your token is indexed, allowing users to find it quickly by name in search fields.

After deploying and setting up your cluster you can start bridging and using our dApp for this purpose, but by default, you can find your token using address only. This guide will help you to verify your token and after verification, we will index your token and you will have a possibility just to write the name of your token in the search field.

## Verification Steps

{% stepper %}
{% step %}
**Prepare Your Repository**

* Fork the token verification [repository](https://github.com/Entangle-Protocol/UTS-Public-Token-List).
* Create a project folder in the `projects` directory and add a `CLUSTER_INFO.json` file based on the provided [template](https://github.com/Entangle-Protocol/UTS-Public-Token-List/blob/main/CLUSTER_INFO_TEMPLATE.json).

```json
{
    "General information":{
        "TokenName":"Mytoken",
        "TokenSymbol":"MTK",
        "DeployedViaFactory": "false",
        "ChainIDs":[1, 42161]
    },
    "Deployments": [
        {
        "ChainId": 1,
        "Address": "0x",
        "Type": "Token",
        "Decimals": 18
    },
    {
        "ChainId": 42161,
        "Address": "0x",
        "Type": "Connector",
        "Decimals": 6  
    }
    ]
}
```

{% endstep %}

{% step %}
**Expand Existing Clusters**

* If you’ve already verified your token but added new deployments to its cluster, create a new pull request mentioning the expansion and update the `CLUSTER_INFO.json`.
  {% endstep %}

{% step %}
**Submit Your Request**

* Fill out the required details in the repository’s `README` and corresponding [Google form](https://forms.gle/1tVgd3HgmHBRJ4kT9).
* Submit a pull request using the provided `PULL_REQUEST_TEMPLATE.md` [file](https://github.com/Entangle-Protocol/UTS-Public-Token-List/blob/main/PULL_REQUEST_TEMPLATE.md).
  {% endstep %}
  {% endstepper %}

## Notes

<details>

<summary>Instructions for Expanding Verified Tokens in Cluster Updates After Token Verification</summary>

If your token is already verified but you've expanded your cluster, you can create a new pull request. Please mention that your token is already verified and you only need to expand it. Additionally, ensure that you include the updated information in the `CLUSTER_INFO.json` file as part of the pull request.

</details>

<details>

<summary>Specifying Entity Types in Deployment Information</summary>

In the deployment information's `type` field, there are two possible entities: `Token` and `Connector`.&#x20;

If the entity is a token, specify `Token`; if it is a connector, specify `Connector`.

</details>

<details>

<summary>Guidelines for Setting the DeployedViaFactory Field in Cluster Info</summary>

In the cluster information, there is a field called `DeployedViaFactory`. If you deployed your tokens or connectors through our factory (either manually or via the dApp), set this field to `true`. Otherwise, set it to `false`. Deployments using our predefined blueprints via the factory will result in a faster verification process.

</details>

<details>

<summary>Internal Requirements for Verified Tokens: Ensuring User Security</summary>

Our internal requirements for verified tokens are straightforward: we reject scam tokens and any other tokens that pose a risk to regular users' funds.

</details>

<details>

<summary>Chain ID Configuration for Solana and TON Deployments</summary>

As we prepare to expand to Solana and TON, please use the following `chainId` values for deployments:

* For Solana: `11100000000000000501`
* For TON: `100004503599627370496`

</details>


# Fees Calculation & Gas Estimation Logic

Fee calculation and gas estimation help you understand the costs involved in cross-chain transactions and deployments. These processes account for things like gas limits, payload size, and currency prices on the source and destination chains to ensure your operations run smoothly. Entangle provides [APIs](/universal-token-standard/developer-guides/estimations) to estimate fees for bridging and deploying tokens, making it easier to plan and execute your transactions.

This page explains the logic for calculating transaction fees and estimating gas costs for cross-chain operations, including base fees, payload costs, and optimization strategies handled off-chain by the backend.

## **Base Transaction Fee**

* **dstGasLimit**: User-defined gas limit to be used on the destination network during the redeem transaction.
* **dstGasPriceInWei**: Stored in the contract and updated by the backend; represents the gas price on the destination network based on `chainId`.
* **dstNativePriceInUSDe18**: Stored in the contract and updated by the backend; indicates the USD price of the native currency on the destination network, depending on `chainId`.
* **curNativePriceInUSDe18**: Stored in the contract and updated by the backend; reflects the USD price of the native currency on the source network.

## **Base Fee Calculation**

To calculate the base fee in terms of the current native currency:

```
baseFeeAtCurrentNative = dstGasLimit * dstGasPriceInWei * dstNativePriceInUSDe18 / curNativePriceInUSDe18
```

This formula determines the amount of native currency required on the source network to execute the transaction (excluding payload), which is then compared to `msg.value`.

## **Payload Cost Calculation**

To calculate the cost related to the payload, use these parameters:

* **payloadLength**: User-defined length of the payload in bytes.
* **dstPricePerByteInWei**: Cost per byte of payload in the native currency on the destination network.
* **dstNativePriceInUSDe18**: Represents the USD price of the native currency on the destination network.
* **curNativePriceInUSDe18**: Represents the USD price of the native currency on the source network.

The payload cost calculation in the current native currency is:

```
payloadPriceAtCurrentNative = payloadLength * dstPricePerByteInWei * dstNativePriceInUSDe18 / curNativePriceInUSDe18
```

This formula calculates how much native currency is needed on the source network to cover the payload cost, which is also compared to `msg.value`.

## **Final Calculation**

To determine the total required amount, sum `baseFeeAtCurrentNative` and `payloadPriceAtCurrentNative`, then compare to `msg.value`. Note that users may incur small losses if `dstGasLimit` exceeds the actual gas consumed.

## **Optimization of Calculations**

To optimize the process, the backend handles calculations off-chain to minimize contract updates across different destination networks:

* **dstGasPriceInWei**
* **dstPricePerByteInWei**
* **dstNativePriceInUSDe18**
* **curNativePriceInUSDe18**

Using these parameters, the backend performs these calculations:

* **Calculate `dstGasPriceAtCurrentNative`**:

  ```
  dstGasPriceAtCurrentNative = dstGasPriceInWei * dstNativePriceInUSDe18 / curNativePriceInUSDe18
  ```
* **Calculate `dstPayloadPriceAtCurrentNative`**:

  ```
  dstPayloadPriceAtCurrentNative = dstPricePerByteInWei * dstNativePriceInUSDe18 / curNativePriceInUSDe18
  ```

The backend then sends only the `dstGasPriceAtCurrentNative` value to the contract. Optionally, it can also send `dstPayloadPriceAtCurrentNative` if a dynamic price per byte is preferred; otherwise, a static price is more efficient.


# Estimations

We offer several functions to help you estimate costs, including bridging and deployment fees.

## Bridge Costs

To estimate bridge fees and minimum gas limits, we provide the `estimateBridgeFee` function. See below for more information.

<pre class="language-solidity"><code class="lang-solidity">/**
 * @notice Returns estimated minimal amount to pay for bridging and minimal gas limit.
 * @param dstChainId destination chain Id.
 * @param dstGasLimit {redeem} call gas limit on the destination chain.
 * @param customPayloadLength user's additional data length.
 * @param protocolPayload UTS protocol's additional data.
 * @return paymentAmount source chain native currency amount to pay for bridging.
 * @return dstMinGasLimit destination chain minimal {redeem} call gas limit.
 */
<strong>function estimateBridgeFee(
</strong>    uint256 dstChainId,
    uint64 dstGasLimit,
    uint16 customPayloadLength,
    bytes calldata protocolPayload
) public view virtual returns(uint256 paymentAmount, uint64 dstMinGasLimit)
</code></pre>

<table><thead><tr><th>Name</th><th>Meaning</th></tr></thead><tbody><tr><td><pre><code>dstChainId
</code></pre></td><td>Destination chain Id</td></tr><tr><td><pre><code>dstGasLimit
</code></pre></td><td>Destination gas limit</td></tr><tr><td><pre><code>customPayloadLength
</code></pre></td><td>Length of your custom payload</td></tr><tr><td><pre><code>protocolPayload 
</code></pre></td><td>UTS protocol payload</td></tr></tbody></table>

## Gas Limits

The UTS Router provides a function called `dstMinGasLimit` which returns the amount of gas required to execute the {redeem} function on the destination chain.

```solidity
/**
* @notice Returns the amount of gas required to execute {redeem} function on the destination chain.
* @param dstChainId destination chain Id.
* @return dstMinGasLimitAmount the amount of gas required to execute {redeem} function on the provided {dstChainId}.
*/
function dstMinGasLimit(
    uint256 dstChainId
) public view returns(uint64 dstMinGasLimitAmount)
```

## Deployment Costs

If you want to perform a cross-chain deploying using our `UTSDeploymentRouter`, you can use the `estimateDeploy` function to estimate the separated payments required for sending crosschain deployment requests in the payment token. The function will return the fees you need to pay in `PAYMENT_TOKEN.`

```solidity
/**
 * @notice Estimates the separated payments required for send crosschain deployment requests in the {PAYMENT_TOKEN}.
 * @param dstTokenChainIds destination chain Ids for {UTSToken} deployments.
 * @param dstConnectorChainIds destination chain Ids for {UTSConnector} deployments.
 * @return tokenPaymentAmount array of estimated payment amount in the {PAYMENT_TOKEN} for each {dstChainId}.
 * @return connectorPaymentAmount array of estimated payment amount in the {PAYMENT_TOKEN} for each {dstChainId}.
 * @return totalPaymentAmount estimated total payment amount in the {PAYMENT_TOKEN}.
 */
function estimateDeploy(
    uint256[] calldata dstTokenChainIds,
    uint256[] calldata dstConnectorChainIds
) external view returns(
    uint256[] memory tokenPaymentAmount, 
    uint256[] memory connectorPaymentAmount, 
    uint256 totalPaymentAmount
)
```

<table><thead><tr><th>Name</th><th>Meaning</th></tr></thead><tbody><tr><td><pre><code>dstTokenChainIds
</code></pre></td><td>Array of chain ids where UTS Tokens will be deployed</td></tr><tr><td><pre><code>dstConnectorChainIds
</code></pre></td><td>Array of chain ids where UTS Connectors will be deployed</td></tr></tbody></table>

## Deployment Costs in Native Currency

If you want to perform a cross-chain deploying using our `UTSDeploymentRouter`, you can use the `estimateDeployNative` function to estimate the separated payments required for sending crosschain deployment requests in the payment token. The function will return the fees you need to pay in native currency.

```solidity
/**
 * @notice Estimates the separated payments required for send crosschain deployment requests in native currency.
 * @param dstTokenChainIds destination chain Ids for {UTSToken} deployments.
 * @param dstConnectorChainIds destination chain Ids for {UTSConnector} deployments.
 * @return tokenPaymentAmountNative array of estimated payment amount in native currency for each {dstChainId}.
 * @return connectorPaymentAmountNative array of estimated payment amount in native currency for each {dstChainId}.
 * @return totalPaymentAmountNative estimated total payment amount in native currency.
 */
function estimateDeployNative(
    uint256[] calldata dstTokenChainIds,
    uint256[] calldata dstConnectorChainIds
) external view returns(
    uint256[] memory tokenPaymentAmountNative, 
    uint256[] memory connectorPaymentAmountNative, 
    uint256 totalPaymentAmountNative
)
```


# User Guides

The fastest way to start exploring and deploying omnichain tokens is through the UTS portal found via the navigation bar on the Entangle [website](https://entangle.fi/). Deployment through the UTS portal is referred to as automated deployment.

Automated deployment with UTS is specifically designed to simplify the expansion of existing tokens across multiple blockchains while providing the ability to launch new universal tokens. Using the intuitive UTS interface developers can effortlessly configure token details — such as name, ticker, total supply, decimals, and bridging mechanisms. Once the setup is verified, the system handles all deployment tasks, including creating contracts and allocating the token supply across the chosen chains. The UTS interface is designed to minimize errors and streamline processes.

This section provides information on how to launch new tokens, connect existing tokens, and other functionalities related to the UTS infrastructure using the UTS interface.

## Explore

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>Launch Universal Token</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FzpX2UuDykYUxVafhlHt3%2FPhoton%20Messaging%20Audit.png?alt=media&amp;token=ce568941-4c20-4444-9b5e-3ed87cdf1945">Photon Messaging Audit.png</a></td><td><a href="/universal-token-standard/user-guides/launch-universal-token">Launch Universal Token</a></td></tr><tr><td>Create a Liquidity Pool</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FmoIqGroYdaJmqi5OiVGP%2F14.png?alt=media&amp;token=7429a063-170f-4e97-89d6-3f06e99d7e06">14.png</a></td><td><a href="/universal-token-standard/user-guides/create-a-liquidity-pool">Create a Liquidity Pool</a></td></tr><tr><td>Expand Existing Token</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fr4jDjsaOuqZlIJgCIhLn%2FTGE%20Audit.png?alt=media&amp;token=6caeeb67-8c00-489e-87cb-bd8c5e520bad">TGE Audit.png</a></td><td><a href="/universal-token-standard/user-guides/expand-existing-token">Expand Existing Token</a></td></tr><tr><td>Transfer Liquidity to Connector</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FNBDrUIfrYDlOKrHdpjmw%2FEntangle%20IDO%20Audit.png?alt=media&amp;token=72ae2a3e-e5f7-49d2-bb6e-3ca850f7a66f">Entangle IDO Audit.png</a></td><td><a href="/universal-token-standard/user-guides/transfer-liquidity-to-connector">Transfer Liquidity to Connector</a></td></tr><tr><td>Bridging</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FODH53Gntgbn74M4gcdQ8%2FArhitecture.png?alt=media&amp;token=fd39d42c-29fc-4024-b86e-7fa439bd1af8">Arhitecture.png</a></td><td><a href="/universal-token-standard/user-guides/bridging">Bridging</a></td></tr></tbody></table>

## Video Guides

For voiced over guides with full walk throughs you can check out our [YouTube](https://www.youtube.com/@entanglefi) page.

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>How to Change Validators</td><td><a href="https://youtu.be/EEFpcdR5qbc?feature=shared">https://youtu.be/EEFpcdR5qbc?feature=shared</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fpz4u1eFhvMMDzAbOXtaE%2FHow%20to%20Change%20Validators.jpg?alt=media&amp;token=347af258-ac64-4318-9eb9-ebc081460486">How to Change Validators.jpg</a></td></tr><tr><td>How to Deploy Token on 3 Chains</td><td><a href="https://youtu.be/xYa_dHStr3U?feature=shared">https://youtu.be/xYa_dHStr3U?feature=shared</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FO19xa6pi2jEXMlkJj1hB%2FHow%20to%20Deploy%20Token%20on%203%20Chains.jpg?alt=media&amp;token=4ca98210-c395-4546-ac7c-6cc79d1be95d">How to Deploy Token on 3 Chains.jpg</a></td></tr><tr><td>How to Launch on a Single Chain</td><td><a href="https://youtu.be/gkfwVSk0Wa8?feature=shared">https://youtu.be/gkfwVSk0Wa8?feature=shared</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F67hNiXnckdvFwJAP6erO%2FHow%20to%20Launch%20on%20a%20Single%20Chain.jpg?alt=media&amp;token=46418c87-d5c1-4cf3-b80f-8ed029d9fd7a">How to Launch on a Single Chain.jpg</a></td></tr><tr><td>How to Create Liquidity Pool</td><td><a href="https://youtu.be/XIF6wPlbK0E?feature=shared">https://youtu.be/XIF6wPlbK0E?feature=shared</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FIkY3aXL39724y7cAX90n%2FHow%20to%20Create%20Liquidity%20Pool.jpg?alt=media&amp;token=7e78d222-bc4b-4092-8e90-70038df57720">How to Create Liquidity Pool.jpg</a></td></tr><tr><td>How to Expand a Token to Avalanche</td><td><a href="https://www.youtube.com/watch?v=Ju1-vbgXyls">https://www.youtube.com/watch?v=Ju1-vbgXyls</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FmJ3drTcIQVccXWLzAWeZ%2Futs_series_720.png?alt=media&amp;token=640a7542-ad44-476b-8272-13c2955e5400">uts_series_720.png</a></td></tr><tr><td>How to Expand a Token to Sonic</td><td><a href="https://www.youtube.com/watch?v=uoFPAIBGER8">https://www.youtube.com/watch?v=uoFPAIBGER8</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FFDF5ZT6nP1A6Dd8cRnQD%2Futs_series-5_720.png?alt=media&amp;token=d6fb4b13-d41c-48f3-88c5-3e17a8f34ecc">uts_series-5_720.png</a></td></tr><tr><td>How to Expand a Token to Base</td><td><a href="https://www.youtube.com/watch?v=eHsMV9Jjy_s">https://www.youtube.com/watch?v=eHsMV9Jjy_s</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FzpsqzOZVtc56LInL1AJd%2Futs_series-4_720.png?alt=media&amp;token=c6700960-f2b8-4777-a693-6b76298d8012">uts_series-4_720.png</a></td></tr><tr><td>How to Expand a Token to Arbitrum</td><td><a href="https://www.youtube.com/watch?v=Uv9Fa0IZjjw">https://www.youtube.com/watch?v=Uv9Fa0IZjjw</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F1soGDYFEgzyWxbgaYPV4%2Futs_series-2_720.png?alt=media&amp;token=34029a13-04aa-4637-9da3-1a4f95d478d9">uts_series-2_720.png</a></td></tr><tr><td>How to Expand a Token to BNB Chain</td><td><a href="https://www.youtube.com/watch?v=krBHT2K_Hic">https://www.youtube.com/watch?v=krBHT2K_Hic</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F1m4RcUVEMiAXYyvvbL4K%2Futs_series-1_720.png?alt=media&amp;token=11e573ce-84c5-477f-a5be-4beff4f9693f">uts_series-1_720.png</a></td></tr></tbody></table>

###


# Launch Universal Token

Creating a new token is a simple process with our streamlined and intuitive interface. This guide will walk you through how to create a new token using UTS. Alternatively, you can watch the video above for a voiced over walkthrough.

{% stepper %}
{% step %}

### Navigation

First, navigate to [UTS](https://uts.entangle.fi/) via the navigation bar on the Entangle [website](https://entangle.fi/).
{% endstep %}

{% step %}

### Token Details

{% hint style="info" %}
Total supply is the summarised initial supply on all chains; for more information about the mechanism, see the [architecture](/universal-token-standard/architecture) page.
{% endhint %}

Fill in all of the necessary information (Ticker, Name, Total Supply, Mechanism, Decimals, Contract Address) for the token you're launching, and then click "Preview Setup" to proceed to the next step.&#x20;

The button may be replaced with a connect your wallet button if you have not connected it yet. In which case please connect it first, then the preview button will become available.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FaGEltVD4KXYwyimmvvTL%2FUTS%20%20Launch%20New%20Token%20Interface.png.png?alt=media&amp;token=03c7ec8c-3386-42a1-8799-b60b99c5c65c" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Preview

On this page you should double check all of the details you entered to make sure it is correct before moving on. When you're ready click "Confirm Setup" to proceed to the next step.
{% endstep %}

{% step %}

### Network Selection

Now you should decide networks for deployment and how to initially split the total supply between chosen blockchains. You can decide to split it evenly, or define a custom value. If you decide to define a custom value, make sure that the total value of tokens on each chain equals the initial supply. The total deployment fee will be automatically updated and displayed in the native currency of the connected blockchain network.

When you're ready click "Setup & Deploy" and sign the transaction to confirm deployment of the smart contract. After a few seconds the deployment will be completed and you will be automatically redirected to the next step.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fx221zfR8s94q7ywtyDw1%2FUTS%20Launch%20New%20Token%20Interface%20Deploy.png?alt=media&amp;token=b436cbc0-5b5c-4085-9c69-2d6c01151405" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Finishing

After succesful deployment you will see the newly created cluster of smart contracts for the token on the station page. That's it! Now copy the token address and go to Entangle bridge page to [perform your first bridge](/universal-token-standard/user-guides/bridging)!

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FSp8JEXS0mjvoFjuK7QtK%2Fimage.png?alt=media&amp;token=53438f5e-2c96-4c1a-b17f-78564430d438" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

## Multiple Chains

UTS supports launching to multiples chains. The process is similar to the steps described above, for a full breakdown and walk through you can watch the video below.

{% embed url="<https://www.youtube.com/watch?v=xYa_dHStr3U>" %}


# Create a Liquidity Pool

If you want your token to be traded against other assets, you'll need to create a liquidity pool. A liquidity pool is a collection of cryptocurrency tokens locked in a smart contract on a decentralized exchange (DEX). It serves as a reserve, enabling users to exchange tokens directly using the pool's locked tokens without requiring a matching buyer or seller. Alternatively, you can watch the video above for a voiced over walkthrough.

{% stepper %}
{% step %}

### Launch Universal Token

To create a liquidity pool, you first need a token. If you don’t already have one, you will need to [launch a universal token](/universal-token-standard/user-guides/launch-universal-token).
{% endstep %}

{% step %}

### Import

Ensure that you have imported your token into your wallet. If you're using MetaMask, you can follow their [official guide](https://support.metamask.io/managing-my-tokens/custom-tokens/how-to-display-tokens-in-metamask/). For other wallets, please refer to their respective documentation for transferring tokens.
{% endstep %}

{% step %}

### Add Liquidity

{% hint style="info" %}
Be sure to copy the token address from the station page to ensure you select the correct token.
{% endhint %}

You can now create a liquidity pool to enable seamless exchanges. If you're using [Uniswap](https://app.uniswap.org/), the process is straightforward — follow their guide on [adding liquidity to Uniswap v3](https://support.uniswap.org/hc/en-us/articles/7423194619661-How-to-add-liquidity-to-Uniswap-v3). For other DEXs, refer to their respective documentation for instructions on adding liquidity.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F62Mr2jeO4jA7s2bbKBQD%2Flaunch%20universal%20token%20station%20page%20circle.png?alt=media&amp;token=3ebdc333-d865-493b-a9cd-e323280455bf" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

That’s it! You’ve successfully created a liquidity pool on a DEX, allowing your users to exchange tokens seamlessly.


# Expand Existing Token

On chains where token already exists UTS offers a **lock-and-unlock bridging mechanism**, similar to mint-and-burn but requiring additional liquidity for bridging. This guide will walk you through how to expand existing tokens using UTS.

{% stepper %}
{% step %}

## Entangle Hub

First, navigate to UTS via the navigation bar on the Entangle [website](https://uts.entangle.fi/).
{% endstep %}

{% step %}

### Token Details

Enter the address of the tokens that are on different chains which you wish to link. You can select the chain by clicking on the icon. In this example we're using the USDT addresses on BNB and Polgygon.

Make sure you read and understand the messages before checking them. Once you're ready click the "Import Tokens" button to move on.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F2H9CguOB41HNTSPr9mUA%2FScreenshot%202024-12-22%20020349.png?alt=media&amp;token=e3688df6-0a07-4c97-a409-94872ee2347a" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Network Selection

Now you should decide which networks to deploy on. Here you can choose your prefered bridging mechanism but remember the total supply will remain unchanged since the token already exists. If you don't want to add new chains (as in our example) click "Skip & Deploy".&#x20;

After signing the transaction to confirm deployment of the smart contract you be automatically redirected to the next step.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fn3gMEp7cRtygp0tFgAHI%2FScreenshot%202024-12-22%20020434.png?alt=media&amp;token=b4c47dcf-47ae-43bd-a787-9aac9caebfac" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Finishing

You have now completed expanding the existing token. However, to bridge tokens that exist on more than one chain, you're required to have liquidity locked into UTS Connectors. To find out how you canc achieve this, you can follow [this guide](/universal-token-standard/user-guides/transfer-liquidity-to-connector) to lock liquidity on connectors for [bridging](/universal-token-standard/user-guides/bridging).

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F9pQidST691bzxWJYxwhY%2Fimage.png?alt=media&amp;token=4a8735e4-7120-43e2-8235-c7b512d3261d" alt=""><figcaption></figcaption></figure>

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FJ4ZFhJzWpiaoL59Hmg52%2Fimage.png?alt=media&amp;token=3831110f-d697-442f-9783-fec10fc11277" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


# Transfer Liquidity to Connector

{% hint style="warning" %}
Caution, the liquidity you transfer to the UTS Connctor is non-refundable.
{% endhint %}

Adding liquidity to the UTS connector is simple, this guide will explain how it's done.

{% stepper %}
{% step %}

### Import

Import your underlying token for UTS Connector in Metamask. You may follow the [official guide](https://support.metamask.io/managing-my-tokens/custom-tokens/how-to-display-tokens-in-metamask/) to import any token.
{% endstep %}

{% step %}

### Transfer

{% hint style="info" %}
Copy the connector address from the station page to ensure that you are transferring tokens to the correct address.
{% endhint %}

Now you need to ensure you supply liquidity to all connectors to allow bridging in every direction.&#x20;

For those using Metamask, transferring is simple, follow their indepth [guide to transfer tokens](https://support.metamask.io/managing-my-tokens/moving-your-tokens/how-to-send-tokens-from-your-metamask-wallet/). If you're using another wallet please refer to its documentation for transfering tokens.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FESOQjl8jkmMUdq9nCbJy%2Futs%20station%20page%20-%20add%20liquidity.png?alt=media&amp;token=35f96899-79a9-4772-bda3-8b7141859fcc" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

That's it! Now the connector has liquidity and is ready to be unlocked in bridging transactions. Go to Entangle bridge page to [perform your first bridge](/universal-token-standard/user-guides/bridging)!


# Bridging

Bridging an asset is simple process with our streamlined and intuitive interface. This guide will walk you through how to link assets using the Bridge.

{% stepper %}
{% step %}

### Navigation

First navigate to the bridge interface via the [Entangle Hub](https://hub.entangle.fi/).

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FqDnu2MOv8pFZRdTaMRua%2FScreenshot%202024-12-24%20014718.png?alt=media&amp;token=bc725d9f-fd2e-4edc-a537-740720c8982d" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Source and Destination

Choose the source (from) and destination (to) network by clicking the network button. Then choose the token or connector by clicking the asset button. If you are bridging an unverified asset, you will need to paste the UTS Token or Connector address manually.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FJjaHK6Bbq3WmOUg1IbnP%2Fimage.png?alt=media&amp;token=b9ab3de2-6f5c-4647-8fed-8762fd37bcd2" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Sign

Sign the bridging transacition and wait until it is completed, it should only take several minutes.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FTvx6fncp3nBiMVU6eDrj%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA5.PNG?alt=media&amp;token=c34f9777-bfb3-4ddc-961f-cd9a65c06571" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Finishing

Once finished, the funds will have been bridged diretly to the address on the destination chain.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FqUHqMODXPmXGb4PloLUa%2F%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA8.PNG?alt=media&amp;token=77abc337-b3f8-46db-98ab-b17c3fcc42cc" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}


# Contract Addresses

{% hint style="info" %}
All chains have the same addresses
{% endhint %}

## Addresses

<table><thead><tr><th width="235">Contract name</th><th>Address</th></tr></thead><tbody><tr><td>UTS Router</td><td>0x5Ac3F749C209f0fdc9E1869Dcb9d109E75e48c61</td></tr><tr><td>UTS Registry</td><td>0x481d89337aBcb336bdfA422e85af8aa88919b342</td></tr><tr><td>UTS Factory</td><td>0x123d82338E00AecB432F526a8aEB9442D48e4412</td></tr><tr><td>UTS Deployment Router</td><td>0x587Bc1BB463F309c4511c36877825D6ec196f6A6</td></tr></tbody></table>

## Chains

* Arbitrum
* Mantle
* Binance Smart Chain
* xLayer
* CoreDAO
* Base
* Optimism
* Avalanche
* Polygon
* Ethereum


# Overview

EIB is at the core of Entangle's ecosystem. Built on the Cosmos SDK and powered by the Ethermint framework, this highly customised Layer-1 blockchain is designed to function as a central hub, coordinating cross-chain message processing and transaction validation across networks. It employs Merkle tree structures for efficient and secure data storage and retrieval, ensuring data integrity and optimizing storage for high-volume cross-chain applications.

## Explore

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td>Architecture</td><td><a href="/entangle-interoperable-blockchain/architecture">Architecture</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FdDqoxoX47cx0lLHOwGRi%2FArhitecture.png?alt=media&amp;token=c482fb86-7fcc-451b-9fc9-846837e676af">Arhitecture.png</a></td></tr><tr><td>Developer Guides</td><td><a href="broken://pages/syt9RPFvxvhP6JrquFjW">Broken link</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FZu23rNH2hiipQX5f6kpw%2FCode%20Review%20Reporter.png?alt=media&amp;token=93e7b7be-9ba0-4410-abe4-ff629ea65926">Code Review Reporter.png</a></td></tr><tr><td>Frequently Asked Questions</td><td><a href="/more/faq">FAQ</a></td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FWhD3OfXU0q0AbKF5THh4%2F25.png?alt=media&amp;token=091c6862-1a6c-4bb9-9c9c-d41a3290abc2">25.png</a></td></tr></tbody></table>


# Architecture

The Entangle Interoperable Blockchain consists of 3 Layers:

* Application Layer
* Modules Layer
* Tendermint Consensus Layer

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FakmFN0EsW5yEMEdVKx7z%2FEntangle%20Blockchain%20Layers.png?alt=media&amp;token=99ccb331-907d-41a8-a705-a14ac2674a7e" alt=""><figcaption><p>The Three Layers of EIB</p></figcaption></figure>

## **Application Layer**&#x20;

The Application Layer is the user-facing component of EIB, bridging consumer devices and the blockchain. It validates, decodes, and routes messages to enable smart contracts, dApps, and other blockchain-based applications, ensuring seamless user interaction and efficient execution.

**Sub-Layers**

* **Execution Layer:** Validates and executes smart contracts, chaincode, and foundational rules, ensuring accurate transaction processing.
* **Application Sub-Layer:** Provides end-user services like wallets, lending, and staking. Interfaces such as Web3 applications or APIs facilitate user interactions with blockchain-based services.

## **Modules Layer**

This comprises a variety of modules that provide specialized functions to the blockchain. These modules are responsible for handling core operations such as asset management, governance, and network security.&#x20;

*See the list of modules and their description in the table below.*

<table><thead><tr><th width="294">Module name</th><th>Description</th><th data-hidden></th></tr></thead><tbody><tr><td>Delegated Proof of Stake (DPoS)</td><td>Facilitates staking for Validators and Delegators.</td><td></td></tr><tr><td>Banking</td><td>Sending and receiving assets on Entangle Blockchain.</td><td></td></tr><tr><td>GOV Module</td><td>Changes to blockchain parameters, addition of new Validators, Distributors or Agents.</td><td></td></tr><tr><td>Auth Module</td><td>Allows authorized entities to launch smart contracts on Entangle Blockchain.</td><td></td></tr><tr><td>IBC Module</td><td>Facilitates communication with Cosmos-based Chains.</td><td></td></tr><tr><td>Distributor Module</td><td>A database of authorized Distributors added through the GOV Module.</td><td></td></tr><tr><td>EVM Module</td><td>Hosts smart contracts deployed on Entangle Blockchain such as the Controller. Provides composability between Entangle Blockchain and EVM Infrastructure such as Metamask, Hardhat, and Truffle.</td><td></td></tr><tr><td>Vesting Module</td><td>Facilitates vesting of native tokens.</td><td></td></tr></tbody></table>

## Tendermint Consensus Layer

EIB ensures reliability and security with a Byzantine Fault Tolerant (BFT) consensus mechanism, allowing the network to function even if up to one-third of nodes are faulty or compromised. This ensures consistent validation of cross-chain transactions and prevents disruptions from malicious actors.

**Participants:**

*Validators:* Propose and vote on transaction blocks, using round-robin scheduling based on their stake proportion.

*Delegators:* Delegate their tokens to validators, who in turn earn a commission from the delegated stake.

### Consensus Process

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FEA58nUNXqJrL0v72Oe0u%2FTendermint%20Consensus.png?alt=media&amp;token=cad2ebea-473d-42ad-8381-ca23831745c9" alt=""><figcaption></figcaption></figure>

The consensus process in Tendermint involves several key steps to ensure secure and consistent block creation:

1. *Propose:* A designated validator compiles transactions into a block and broadcasts it to peers. This ensures that all validators have a common starting point for considering new transactions.
2. *Pre-Vote*: Each validator decides whether to support the proposed block. If a validator is already locked on a previous block, or if it receives a valid new proposal, it broadcasts its prevote for that block. If no valid proposal is received, it signs a nil prevote. This step is crucial to gauge initial support for the block, ensuring that validators are aligned before moving forward.
3. *Pre-Commit:* Validators broadcast a precommit if they receive more than two-thirds of prevotes for a proposed block, effectively locking onto that block. Locking onto a block prevents validators from equivocating, which is essential for ensuring consensus consistency and security.
4. *Commit:* During the commit step, validators wait to receive at least two-thirds of commits for a block. Once this condition is satisfied, the validator sets the CommitTime and moves to the next phase. This step finalizes the block and adds it to the blockchain, ensuring that all validators have reached agreement.
5. *NewHeight*: After a block has been committed, the NewHeight step allows the network to gather additional commitments for the committed block from validators that may have been delayed. This step helps to maintain overall network integrity by ensuring that slower validators are included, promoting fairness and cohesion across the network.

### Locking Mechanisms

Locks play a crucial role in maintaining consistency during voting stages by preventing validators from changing their support within the same round. Once a validator locks onto a block, they remain committed to it until consensus is achieved. This mechanism ensures that validators do not equivocate, thereby maintaining the reliability of the consensus process.

### Initiating New Rounds

New rounds may be initiated in cases such as proposal failures, invalid blocks, untimely propagation, or insufficient pre-vote or pre-commit consensus. These new rounds are essential to the robustness of the Tendermint consensus process, allowing the network to overcome temporary challenges and maintain consistent block production. This flexibility is key to maintaining the integrity of the network even when disruptions occur.


# Developer Guides

This section provides information and guides for developers intending to use Entangle's Interoperable Blockchain (EIB). If you have any questions or need assistance, please feel free to use our [contact form](https://entangle.zendesk.com/hc/en-us/requests/new) to connect with an expert on our team.

## Validators

Each transaction processed on the network requires thorough validation to ensure compliance with established rules and protocols. Validators are responsible for verifying these transactions, ensuring that all operations are accurately checked, recorded, and aligned with the network’s governing principles.

### Staking and Voting Power

Validators use the native token, to participate in securing the network. Validators stake the native token to gain voting power, with greater stakes or delegated tokens enhancing their influence over the network's security and consensus. This staking mechanism ensures that validators have a vested interest in maintaining the network's security.&#x20;

### Security and Monitoring

Validators actively monitor the network for signs of malicious activity. Their vigilance is crucial in preventing attacks, double-spending, or other behaviors that could compromise the blockchain's security.&#x20;

### Rewards and Incentives

Validators are incentivized through rewards, which come from gas fees generated by the transactions they validate. This reward mechanism is designed to acknowledge and compensate validators for their crucial contributions and encouraging active participation.&#x20;

### Slashing and Penalties

Validators are held accountable through a robust slashing mechanism that discourages malicious behavior and ensures network security

1. If a validator signs two conflicting blocks, a percentage of their tokens are slashed.
2. Validators that sign fewer than 50 of the last 100 blocks will have a portion of their staked tokens slashed and be temporarily "jailed" for a set period.

## Explore

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>Set up a Validator Node</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fwin7uKd6rLUJMgGtIcHs%2FToken%20Deployment.png?alt=media&amp;token=b7ff9419-c747-49e8-b039-0f012c2c696d">Token Deployment.png</a></td><td><a href="/entangle-interoperable-blockchain/developer-guides/set-up-a-validator-node">Set up a Validator Node</a></td></tr><tr><td>Delegating to Validators</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FiTBtPU7h0wY40nUD8Eya%2F20.png?alt=media&amp;token=b444ae25-86c4-42bf-a58c-f493d7bb28c0">20.png</a></td><td><a href="/entangle-interoperable-blockchain/developer-guides/delegating-to-validators">Delegating to Validators</a></td></tr><tr><td>Undelegating from Validators</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FZkjfhG90QLzb8GXZp2lI%2F21.png?alt=media&amp;token=10d0901b-4213-4e1d-a17c-1a98fdfc2e07">21.png</a></td><td><a href="/entangle-interoperable-blockchain/developer-guides/undelegating-from-validators">Undelegating from Validators</a></td></tr><tr><td>Supported Accounts</td><td><a href="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F2J8Wb7OV9gMcXXalDzQW%2FArhitecture.png?alt=media&amp;token=c8aa63ae-1f32-4dc7-a9ff-079f47268175">Arhitecture.png</a></td><td><a href="/entangle-interoperable-blockchain/developer-guides/supported-accounts">Supported Accounts</a></td></tr></tbody></table>


# Set up a Validator Node

Becoming a validator on the EIB involves setting up your node, creating a wallet, configuring your system, and finally launching your validator node. This guide will walk you through these steps in detail to help you get started.

### Hardware Prerequisites

Before proceeding, ensure that your hardware meets the recommended specifications to run a validator node efficiently.

<table><thead><tr><th width="156">Hardware</th><th>Mainnet</th><th>Testnet</th></tr></thead><tbody><tr><td>CPU</td><td>4 or more physical CPU cores</td><td>2 or more physical CPU cores</td></tr><tr><td>RAM</td><td>16GB+</td><td>8GB+</td></tr><tr><td>Storage</td><td>500GB+ SSD</td><td>250GB+ SSD</td></tr><tr><td>Network</td><td>100mbps+</td><td>10mbps+</td></tr><tr><td>OS</td><td>Ubuntu 22.04</td><td>Ubuntu 22.04 or macOS</td></tr></tbody></table>

### Software Prerequisites

Before you begin, make sure your system has the following software installed:

* Git
* Golang (minimum version 1.21)
* Make
* jq
* Python
* golangci-lint
* Solc-JS

### Step 1: Setting Up Your Node

1. **Clone the Entangle Blockchain Repository**: Start by cloning the[ **official Entangle blockchain repository**](https://github.com/Entangle-Protocol/entangle-blockchain) and navigating into the project directory:<br>

   ```solidity
   git clone https://github.com/Entangle-Protocol/entangle-blockchain
   cd entangle-blockchain
   git checkout main
   ```
2. **Build the Project**: Compile the project using the `make` command, which will build the necessary binaries:<br>

   ```solidity
   make install
   ```

   \
   After installation, you can verify the installation by running:

   ```solidity
   entangled --help
   ```
3. **Initialize Your Node**: Create your node by initializing it with a unique moniker and specifying the chain ID:

   ```solidity
   entangled init <moniker> --chain-id entangle_33033-1
   ```

### Step 2: Wallet Generation

1. **Create a New Key**: Generate a new key for your wallet. You'll need to provide a key name and select the keyring backend and algorithm:<br>

   ```solidity
   entangled keys add <key_name> --keyring-backend file --algo eth_secp256k1
   ```
2. **Retrieve Your Address**: Extract your wallet address and store for later use:<br>

   ```solidity
   MY_ADDRESS=$(entangled keys show <key_name> -a --keyring-backend file)
   echo $MY_ADDRESS
   ```

### Step 3: Configuration

1. **Update Configuration Files**: Download [`genesis.json`](https://raw.githubusercontent.com/Entangle-Protocol/entangle-blockchain/main/config/genesis.json) and [`config.toml`](https://raw.githubusercontent.com/Entangle-Protocol/entangle-blockchain/main/config/config.toml). You'll need to replace the existing files in your `.entangle/config/` directory with these.
2. **Set Persistent Peers**: In your `.entangle/config/config.toml` file, update the [`persistent_peers`](https://github.com/Entangle-Protocol/entangle-blockchain/blob/main/config/env_seeds) field with the provided list of nodes:<br>

   ```solidity
   persistent_peers = "node1@ip:port, node2@ip:port"
   ```

### Step 4: Launching Your Node

1. **Start Your Node**: With the configurations set, you can start your node. Ensure to specify the chain ID and set the gas cap for JSON-RPC:<br>

   ```solidity
   entangled start --chain-id entangle_33033-1 --json-rpc.gas-cap 200000000
   ```
2. **Verify Node Synchronization**: Check if your node is fully synced with the network:<br>

   ```solidity
   curl -s 127.0.0.1:26657/status | jq '.result.sync_info.catching_up'
   ```

   \
   A response of `false` indicates successful synchronization.

### Step 5: Creating Your Validator Node

1. **Ensure You Have NTGL Tokens**: To create a validator, you must have a sufficient amount of NTGL tokens for staking and transaction fees.
2. **Create Validator**: Use the following command to create your validator. Replace `<key_name>` with your key name and adjust other parameters as necessary:<br>

   ```solidity
   entangled tx staking create-validator \
   --amount="5000000000000000000aNGL" \
   --pubkey=$(entangled tendermint show-validator) \
   --moniker="validator" \
   --chain-id=entangle_33033-1 \
   --commission-rate="0.10" \
   --commission-max-rate="0.20" \
   --commission-max-change-rate="0.01" \
   --min-self-delegation="1" \
   --gas=500000 \
   --gas-prices="10aNGL" \
   --from=<key_name> \
   --keyring-backend file
   ```
3. **Verify Your Validator Node**: Check if your validator has been successfully added to the validator set:<br>

   ```solidity
   entangled query tendermint-validator-set
   ```

***

By following these steps, you can set up and launch a validator node on the Entangle blockchain. Remember to keep your node online and perform regular maintenance to ensure its smooth operation and contribution to the network's security and efficiency.


# Delegating to Validators

This page provides step-by-step instructions on how to delegate tokens to your validators. This is a simple and quick process with our intuitive user interface, see below for more information.

{% stepper %}
{% step %}

### Step 1

Navigate to the [**Entangle Hub**](https://hub.entangle.fi/) and click the ‘Connect Wallet’ button. Approve connecting to the platform and adding Entangle Mainnet to your wallet.

<div align="left" data-full-width="false"><figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fmz9bj2Dq8aY7c28ZMQMX%2Fcopy_103FADF6-A74B-4650-8266-A34A7101F843.gif?alt=media&amp;token=566f2ff5-6e0b-499b-bf34-4972254fdbe3" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Step 2

Click ‘Blockchain’ in the header menu and Blockchain section will open. Here, select the ‘Validators’ tab.

<div align="left"><figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FnK7Lws7uerc4c3SiR7XP%2FScreen%20Recording%202024-04-25%20at%2018.07.51.gif?alt=media&amp;token=2ec4a4da-7fc2-4801-b609-58b8d9a1cb4e" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Step 3

Select any validator you want to delegate your tokens to and click ‘Delegate’ button next to it. This will open the ‘Delegate’ window.

<div align="left"><figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F7AwRP61TycnpfaqTKl6K%2FScreen%20Recording%202024-04-25%20at%2018.07.51%202.gif?alt=media&amp;token=1dda9edb-448c-4d79-afcd-18f2c59bcbb2" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Step 4

Enter the amount of tokens manually or simply use the ‘Max’ button. Please remember that you will need some native tokens for the gas fee.

<div align="left"><figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fuf8rdYygWyQfy24Y7oKu%2FScreen%20Recording%202024-04-25%20at%2018.07.51%203.gif?alt=media&amp;token=3a45c5e8-e402-44a1-b899-2d918062fb04" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Step 5

Click ‘Delegate’ and sign all transactions. Your delegated tokens take 21 days to unlock, starting from the transaction time.

<div align="left"><figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FEO8gen55M9nLyrMnf9mU%2FScreen%20Recording%202024-04-25%20at%2018.07.51%204.gif?alt=media&amp;token=28d95219-ea2f-44df-872c-0edddbb9757a" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Step 6

Great! You have successfully delegated your tokens. They will be available in your wallet in 21 days. During this period, you will continue to accrue yield. You can manage and track your delegation on the [**Dashboard**](https://hub.entangle.fi/msg/delegate).
{% endstep %}
{% endstepper %}


# Undelegating from Validators

This page provides step-by-step instructions on how to undelegate tokens from your validators. This is a simple and quick process with our intuitive user interface, see below for more information.

{% stepper %}
{% step %}

### Step 1

Navigate to the [**Entangle Hub**](https://hub.entangle.fi/) and click the ‘Connect Wallet’ button. Approve connecting to the platform and adding Entangle Mainnet to your wallet.

<div align="left" data-full-width="false"><figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2Fmz9bj2Dq8aY7c28ZMQMX%2Fcopy_103FADF6-A74B-4650-8266-A34A7101F843.gif?alt=media&amp;token=566f2ff5-6e0b-499b-bf34-4972254fdbe3" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Step 2

Click ‘Blockchain’ in the header menu and Blockchain section will open. Here, select the ‘Validators’ tab.

<div align="left"><figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FnK7Lws7uerc4c3SiR7XP%2FScreen%20Recording%202024-04-25%20at%2018.07.51.gif?alt=media&amp;token=2ec4a4da-7fc2-4801-b609-58b8d9a1cb4e" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Step 3

Select the validator for which you want to undelegate your tokens from and click ‘Delegate’ button next to it. This will open the ‘Delegate’ window. Switch to the "Undelegate" tab.

<div align="left"><figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F3tzlj8GAXxPIYl4Qoeed%2FScreen%20Recording%202024-04-25%20at%2018.08.48%202.gif?alt=media&amp;token=571cd20a-b3cc-4b1f-842a-b873f95e593c" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Step 4

Enter the amount of tokens manually or just use the “Max” button. Please, remember, that you will need native tokens for the gas fee.

<div align="left"><figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2F5P3QXx2NkK2nUVmCTGU9%2FScreen%20Recording%202024-04-25%20at%2018.08.48%203.gif?alt=media&amp;token=a58226b5-fd8d-499c-a9ec-951c02556c67" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}

### Step 5

Click “Undelegate” and sign the transactions.

<figure><img src="https://4040807501-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5AajewgFWO9EkufRORqL%2Fuploads%2FBANdIzp9mGxns9mgYr5W%2FScreen%20Recording%202024-04-25%20at%2018.08.48.gif?alt=media&amp;token=5dad0d97-d7b1-40a2-a646-8f51ce5a1163" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Step 6

Done! You have successfully undelegated your tokens.
{% endstep %}
{% endstepper %}


# Supported Accounts

Entangle supports two type of accounts EVM and Bech32. To navigate with the Bech32 address (with **ent** prefix) you can interact with the CLI commands outlined below.&#x20;

#### Converting Formats

You can convert between the HEX and Bech32 format like so:&#x20;

```bash
entangled debug addr <address>
```

#### Adding Keys

<pre class="language-bash"><code class="lang-bash"><strong>entangled keys add &#x3C;key_name> --keyring-backend file
</strong></code></pre>

#### Importing Keys

<pre class="language-bash"><code class="lang-bash"><strong>entangled keys add &#x3C;key_name> --keyring-backend file --recover
</strong></code></pre>

#### Exporting Private Keys

```bash
entangled keys unsafe-export-eth-key <key_name> --keyring-backend file
```

#### Querying Account Details

```bash
entangled q account <address> 
```

## Address Navigation

To navigate with HEX addresses you can use Metamask or other EVM wallets, with following parameters.

#### Entangle Mainnet

<table><thead><tr><th width="260">Category</th><th>Value</th></tr></thead><tbody><tr><td>Network Name</td><td>Entangle Mainnet</td></tr><tr><td>Default RPC URL</td><td>https://json-rpc.entangle.fi/</td></tr><tr><td>Chain ID</td><td>33033</td></tr><tr><td>Currency Symbol</td><td>NTGL</td></tr></tbody></table>

#### Entangle Testnet

<table><thead><tr><th width="260">Category</th><th>Value</th></tr></thead><tbody><tr><td>Network Name</td><td>Entangle Testnet</td></tr><tr><td>Default RPC URL</td><td>https://34.174.174.102:8545/</td></tr><tr><td>Chain ID</td><td>33133</td></tr><tr><td>Currency Symbol</td><td>NTGL</td></tr></tbody></table>


# Media Kit

Take care of the below points while using the logo

We are pleased to share Entangle’s media kit, which contains essential brand assets, key messaging, and valuable resources to support our shared efforts. As we continue to drive innovation in Web3, this kit will provide you with everything needed to accurately represent Entangle and strengthen our partnership. Together, we are building the future of decentralized technology.

### Guidelines

* Do not crop the logo, rotate it, or place it with other colors
* Do not re-create using any other typeface
* Do not use shadows, transparency, or any other effects
* Refrain from altering the shape, and proportion of the logos
* Keep padding around the logo.

### Colour Codes

<table><thead><tr><th width="363"></th><th></th></tr></thead><tbody><tr><td>Purple</td><td>A527E1</td></tr><tr><td>Dark Grey</td><td>1B1B1B</td></tr><tr><td>Light Grey</td><td>6E6A6A</td></tr><tr><td>Grey to White</td><td>F0F0F0 - FFFFFF</td></tr><tr><td>White</td><td>FFFFFF</td></tr></tbody></table>

### Logos

| **Name**      |                                                                                                    **PNG**                                                                                                    |                                                                                                    **SVG**                                                                                                    |
| ------------- | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| Circle White  |  ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2F1FwO5ml9JbqNNzDYzktj%2FWhite%20Circle.png?alt=media\&token=04805906-0975-41b8-8409-b89f2f0caef0)​ |  ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2FBL2795jAysbAelEo4wOC%2FWhite%20Circle.svg?alt=media\&token=71bc4003-c053-4e6f-8f77-890e2926910f)​ |
| Circle Black  |  ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2FZ0yT57BIikI1pDqvdgS7%2FBlack%20Circle.png?alt=media\&token=f5b04a08-7241-4f43-9efe-5959c1a737a9)​ |  ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2Fh46jmvgZyJTBNNuOu5tz%2FBlack%20Circle.svg?alt=media\&token=8a1dd99b-83ac-4d10-866d-2a5a7e31f7d7)​ |
| Circle Gray   |  ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2FtpxDzM64aQvSotBFHoEt%2FGray%20Circle.png?alt=media\&token=40f7523e-4b8a-4a46-a31b-861e038ae8b1)​  |  ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2FbkIErCnxDSDFnOnzczkM%2FGray%20Circle.svg?alt=media\&token=78569323-947f-4a0f-8ebd-51f1f4f29e2f)​  |
| Circle Purple | ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2F77ZdcZGtDBq88oWQvk30%2FPurple%20Circle.png?alt=media\&token=edae82e3-9e6e-4e04-ada6-67a189e42673)​ | ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2FM4XqWBvJsPbA9walzgcx%2FPurple%20Circle.svg?alt=media\&token=1ddb3191-ae2c-4caa-bf7e-6bac6bcd74af)​ |
|               |                                                                                                                                                                                                               |                                                                                                                                                                                                               |

| Сhamfer rectangle White  | ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2FRkGlwyKr52bts9JOZX6L%2FSquare%20White%20Corner%20Radius.png?alt=media\&token=7bc01378-6a83-44d5-a893-4a9939ab07be)​ | ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2FNBiEfPOspamdFM1xMtib%2FSquare%20White%20Corner%20Radius.svg?alt=media\&token=18b6637e-b761-4494-9bb7-e0519c4f1c4b)​ |
| ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Сhamfer rectangle Black  | ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2F63fkayWwZMHxezgEU8bE%2FSquare%20Black%20Corner%20Radius.png?alt=media\&token=fe8cc89e-e051-4776-9c5d-e808b3b7a722)​ | ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2FYxh1BvcUDP79GTA32bKV%2FSquare%20Black%20Corner%20Radius.svg?alt=media\&token=62f56452-d9e7-486a-89f5-4d73a302fda2)​ |
| Сhamfer rectangle Gray   | ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2F32CQjmnSWbrEZlUGeaAB%2FSquare%20Gray%20Corner%20Radius.png?alt=media\&token=0cd64d51-e01c-441b-8911-74e6fe9a6057)​  | ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2FK5nWVpJs3jaeuvW7CeW1%2FSquare%20Gray%20Corner%20Radius.svg?alt=media\&token=2dd662f2-5b05-450e-9dac-a7a6c492b8e2)​  |
| Сhamfer rectangle Purple | ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2FJlqTJJFEfPjlT0qVV4tC%2FSquare%20Pink%20Corner%20Radius.png?alt=media\&token=8ed6cfe1-74dc-4a51-87a7-f6ef892e5c95)​  | ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2F6lRFx5eIzPYBhaJYKBK5%2FSquare%20Pink%20Corner%20Radius.svg?alt=media\&token=6ae14ae6-1824-42c6-9a2d-991043d4824f)​  |

### Backgrounds <a href="#backgrounds" id="backgrounds"></a>

| Background White  | ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2FqNUw6znZLKemAxS1QTai%2FBG%20white.png?alt=media\&token=e775235b-6fa5-48d7-aab3-25990a9b6e40)​  |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Background Gray   | ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2Fh32Ub4HP4VkqVxwaE7pZ%2FBG%20gray.png?alt=media\&token=edc74c6f-d302-46a7-a304-15ba18d180e8)    |
| Background Purple | ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2FDB75o9APo38O8p0DNTNA%2FBG%20Purple.png?alt=media\&token=cf31751d-7cea-4c10-9bf8-1afe7ff2cba6)​ |

| Background White Without Logo  | ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2FHmKJnObeqlVBhvArfKO5%2FBG%20white%20without%20logo.png?alt=media\&token=a25f0cb2-fb7b-43ed-9766-16540f2318e9)​  |
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Background Gray Without Logo   | ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2F2e9ksEkUeToqIZNWLXxu%2FBG%20gray%20without%20logo.png?alt=media\&token=203bfb10-2f2c-46ee-be0b-9c52f04d8552)​   |
| Background Purple Without Logo | ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2FjB0Z9uIU0HyCaeSAy9zj%2FBG%20Purple%20without%20logo.png?alt=media\&token=dc6227ce-9900-408f-ba49-606368651288)​ |

| Background White Without Logo  | ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2F1sxmXSpBeFtFcjm3jT4Q%2FBg%20white%20with%20pattern.png?alt=media\&token=0b52ff70-a398-4714-ace4-fb10956cc09c)​  |
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Background Gray Without Logo   | ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2Fw1j9WNv5tpV3GTMOBYhZ%2FBg%20gray%20with%20pattern.png?alt=media\&token=c5aa885b-e4d6-468c-8fa2-72bda762ca6c)​   |
| Background Purple Without Logo | ​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW4hWFoOg1bsy9f1Z6FWM%2Fuploads%2F281MOlrPTciQ7JwojW00%2FBg%20purple%20with%20pattern.png?alt=media\&token=4d5d0d16-6660-4cc7-90b5-a434ed17a028)​ |

​


# FAQ

| Universal Token Standard                                                                                                                                                                                                                                                      |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Does UTS charge any fees?](https://entangle.zendesk.com/hc/en-us/articles/24451981845021-Does-UTS-charge-any-fees)                                                                                                                                                           |
| [How do I decide which bridging mechanism is better? Mint & Burn or Lock & Unlock](https://entangle.zendesk.com/hc/en-us/articles/24452378394781-How-do-I-decide-which-bridging-mechanism-is-better-Mint-Burn-or-Lock-Unlock)                                                 |
| [I want to deploy my token on several chains. Do I need to have all the native tokens to do so?](https://entangle.zendesk.com/hc/en-us/articles/24452251698461-I-want-to-deploy-my-token-on-several-chains-Do-I-need-to-have-all-the-native-tokens-to-do-so)                  |
| [How do I split the total supply of a new token?](https://entangle.zendesk.com/hc/en-us/articles/24452490486301-How-do-I-split-the-total-supply-of-new-token)                                                                                                                 |
| [What if I connect existing tokens and then try to bridge it without enough liquidity on the Connector?](https://entangle.zendesk.com/hc/en-us/articles/24452214776093-What-if-I-connect-existing-tokens-and-then-try-to-bridge-it-without-enough-liquidity-on-the-Connector) |
| [I’ve completed a deployment, but can’t see my token on the bridge.](https://entangle.zendesk.com/hc/en-us/articles/24451946801309-I-ve-completed-a-deployment-but-can-t-see-my-token-in-the-bridge)                                                                          |

| Universal Data Feeds                                                                                                                                                                                                                                    |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [How do I subscribe to a data feed?](https://entangle.zendesk.com/hc/en-us/articles/26260160933149-How-do-I-subscribe-to-a-data-feed)                                                                                                                   |
| [What is the UDF pricing model like?](https://entangle.zendesk.com/hc/en-us/articles/26258372828573-What-is-the-UDF-pricing-model-like)&#xD;                                                                                                            |
| [What is the difference between Push and Pull modes?](https://entangle.zendesk.com/hc/en-us/articles/26258117561885-What-is-the-difference-between-Push-and-Pull-modes)&#xD;                                                                            |
| [How much should be deposited for Push subscriptions?](https://entangle.zendesk.com/hc/en-us/articles/26270745875613-How-much-should-be-deposited-for-Push-subscriptions)                                                                               |
| [How can I check if a subscription is active?](https://entangle.zendesk.com/hc/en-us/articles/26269742867101-How-to-check-if-a-subscription-is-active)                                                                                                  |
| [What if the feed I am searching for is not available?](https://entangle.zendesk.com/hc/en-us/articles/26258462233245-What-if-the-feed-I-am-searching-for-is-not-available)&#xD;                                                                        |
| [What happens if my push deposit runs out?](https://entangle.zendesk.com/hc/en-us/articles/26270451978269-What-happens-if-push-deposit-runs-out)                                                                                                        |
| [How do I manage my subscriptions?](https://entangle.zendesk.com/hc/en-us/articles/26261142298397-How-do-I-manage-my-subscriptions)                                                                                                                     |
| [Can I implement smart contracts to my data feed?](https://entangle.zendesk.com/hc/en-us/articles/26258592905757-Can-I-implement-smart-contracts-to-my-data-feed)&#xD;                                                                                  |
| [How often should partners update data on their server?](https://entangle.zendesk.com/hc/en-us/articles/22671690541981-How-often-should-partners-update-data-on-their-server)                                                                           |
| [What should I do if the data provided by an external API does not meet the required format?](https://entangle.zendesk.com/hc/en-us/articles/22671710597661-What-should-I-do-if-the-data-provided-by-an-external-API-does-not-meet-the-required-format) |
| [Can Entangle UDF support custom modifiers for data parsing?](https://entangle.zendesk.com/hc/en-us/articles/22671766449693-Can-Entangle-UDF-support-custom-modifiers-for-data-parsing)                                                                 |
| [How do I handle optional fields like timestamp and volume in the server response?](https://entangle.zendesk.com/hc/en-us/articles/22671964445597-How-do-I-handle-optional-fields-like-timestamp-and-volume-in-the-server-response)                     |
| [Can I use public data providers for integration?](https://entangle.zendesk.com/hc/en-us/articles/22672009084701-Can-I-use-public-data-providers-for-integration)                                                                                       |

| Entangle Mainnet                                                                                                                                    |
| --------------------------------------------------------------------------------------------------------------------------------------------------- |
| [How do I connect to the Entangle Mainnet?](https://entangle.zendesk.com/hc/en-us/articles/19658458497181-How-do-I-connect-to-the-Entangle-Mainnet) |
| [How do I use the Entangle Explorer Hub?](https://entangle.zendesk.com/hc/en-us/articles/19655356991901-How-do-I-use-the-Entangle-Explorer-Hub)     |
| [Which wallets can I use?](https://entangle.zendesk.com/hc/en-us/articles/19658321019549-Which-wallets-can-I-use)                                   |

| Agent Network                                                                                                                                                                                                                                     |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [What is an Agent?](https://entangle.zendesk.com/hc/en-us/articles/19661371067421-What-is-an-Agent)                                                                                                                                               |
| [Can I run an Agent?](https://entangle.zendesk.com/hc/en-us/articles/19661576820253-Can-I-run-an-Agent)                                                                                                                                           |
| [I have an agent NFT, how do I run an Agent?](https://entangle.zendesk.com/hc/en-us/articles/19661815380765-I-have-an-agent-NFT-how-do-I-run-an-Agent)                                                                                            |
| [What is the process for onboarding as an Agent?](https://entangle.zendesk.com/hc/en-us/articles/19661644784797-What-is-the-process-for-onboarding-as-an-Agent)                                                                                   |
| [I’m a developer who wants to include Transmitter Agents in my build, what's the process?](https://entangle.zendesk.com/hc/en-us/articles/19661789888157-I-m-a-developer-who-wants-to-include-Transmitter-Agents-in-my-build-what-is-the-process) |

| Entangle Omnipoints                                                                                                                                                 |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [What are Omnipoints?](https://entangle.zendesk.com/hc/en-us/articles/20883893618845-What-are-Omnipoints)                                                           |
| [How do I earn Omnipoints?](https://entangle.zendesk.com/hc/en-us/articles/20886553453085-How-do-I-earn-Omnipoints)                                                 |
| [How do I check how many Omnipoints I have earned?](https://entangle.zendesk.com/hc/en-us/articles/20898077347357-How-do-I-check-how-many-Omnipoints-I-have-earned) |
| [What can I do with my earned Omnipoints?](https://entangle.zendesk.com/hc/en-us/articles/20897535617693-What-can-I-do-with-my-earned-Omnipoints)                   |

| Entangle e-Bridge                                                                                                                                 |
| ------------------------------------------------------------------------------------------------------------------------------------------------- |
| [How do I bridge USDC?](https://entangle.zendesk.com/hc/en-us/articles/22350305802141-How-do-I-bridge-USDC)                                       |
| [How long does the bridge take?](https://entangle.zendesk.com/hc/en-us/articles/19920724732829-How-long-does-the-bridge-take)                     |
| [How do I bridge to the Entangle mainnet?](https://entangle.zendesk.com/hc/en-us/articles/19661073801373-How-do-I-bridge-to-the-Entangle-Mainnet) |
| [How do I bridge back to Ethereum?](https://entangle.zendesk.com/hc/en-us/articles/19661140246429-How-do-I-bridge-back-to-Ethereum)               |
| [Bridging from Entangle to Solana](https://entangle.zendesk.com/hc/en-us/articles/19731925809181-Bridging-NGL-from-Entangle-to-Solana)            |
| [I cannot see my bridged tokens](https://entangle.zendesk.com/hc/en-us/articles/19660687289245-I-still-can-t-see-my-bridged-tokens)               |

| Delegating Tokens                                                                                                                                                                                          |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [What is delegating or staking?](https://entangle.zendesk.com/hc/en-us/articles/19659933822493-What-is-delegating-or-staking)                                                                              |
| [Why should I delegate?](https://entangle.zendesk.com/hc/en-us/articles/19660396990237-Why-should-I-delegate)                                                                                              |
| [What’s in it for me?](https://entangle.zendesk.com/hc/en-us/articles/19660467215901-What-s-in-it-for-me)                                                                                                  |
| [How do I delegate or stake $NGL?](https://entangle.zendesk.com/hc/en-us/articles/19659980815901-How-do-I-delegate-or-stake-NGL)                                                                           |
| [When can I claim my rewards?](https://entangle.zendesk.com/hc/en-us/articles/19660732434205-When-can-I-claim-my-rewards)                                                                                  |
| [How do I undelegate or unstake my $NGL?](https://entangle.zendesk.com/hc/en-us/articles/19660266244893-How-do-I-undelegate-or-unstake-my-NGL)                                                             |
| [What is the 21 day lock?](https://entangle.zendesk.com/hc/en-us/articles/19660352861725-What-is-the-21-day-lock)                                                                                          |
| [What are the risks associated with delegating or staking?](https://entangle.zendesk.com/hc/en-us/articles/19660540626717-What-are-the-risks-associated-with-delegating-or-staking)                        |
| [How can I mitigate the risks of delegating?](https://entangle.zendesk.com/hc/en-us/articles/19660571916829-How-can-I-mitigate-the-risks-of-delegating)                                                    |
| [My tokens are on a hardware wallet like Ledger. Can I still delegate?](https://entangle.zendesk.com/hc/en-us/articles/19660930236829-My-tokens-are-on-a-hardware-wallet-like-Ledger-Can-I-still-delegate) |
| [How can I stake my NFT?](https://entangle.zendesk.com/hc/en-us/articles/19662231180317-How-can-I-stake-my-NFT)                                                                                            |
| [I undelegated my tokens but cannot find them in my wallet.](https://entangle.zendesk.com/hc/en-us/articles/19778275069597-I-undelegated-unstaked-my-tokens-but-cannot-find-them-in-my-wallet)             |


# Report an Issue

If you encountered any issues during the integration process, or noticed a bug while integrating contracts, we’re here to help — simply submit a request on [ZenDesk](https://entangle.zendesk.com/hc/en-us/requests/new). Please provide as many details as possible, including any error messages or unexpected behavior you observed. Our team will assist you in identifying the problem and guiding you through a solution.

{% embed url="<https://entangle.zendesk.com/hc/en-us/requests/new?ticket_form_id=17464570919965>" fullWidth="false" %}


# Become a Partner

As the ultimate Web3 unification layer, Entangle brings together all blockchains, applications, tokens, and data sources into one seamless ecosystem. It’s built to accelerate scalability and fuel mass adoption, empowering developers and users alike to leverage cutting-edge technology that transcends the limitations of fragmented systems.

We invite everyone to join our growing ecosystem and leverage innovative technology that accelerates scalability and adoption. Please fill up the partnership request here:

{% embed url="<https://entangle.zendesk.com/hc/en-us/requests/new?ref=blog.entangle.fi&ticket_form_id=22454894777501>" %}


