<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <id>https://goffxnca.github.io/docs/zh-CN/blog</id>
    <title>NEAR Documentation Blog</title>
    <updated>2024-11-07T00:00:00.000Z</updated>
    <generator>https://github.com/jpmonette/feed</generator>
    <link rel="alternate" href="https://goffxnca.github.io/docs/zh-CN/blog"/>
    <subtitle>NEAR Documentation Blog</subtitle>
    <icon>https://goffxnca.github.io/docs/zh-CN/img/favicon.ico</icon>
    <entry>
        <title type="html"><![CDATA[Hello Ethereum Wallets!]]></title>
        <id>https://goffxnca.github.io/docs/zh-CN/blog/hello-ethereum-wallets</id>
        <link href="https://goffxnca.github.io/docs/zh-CN/blog/hello-ethereum-wallets"/>
        <updated>2024-11-07T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[You can now login using MetaMask, WalletConnect and +400 Ethereum Wallets on Near!]]></summary>
        <content type="html"><![CDATA[<p><em>You can now login using MetaMask, WalletConnect and +400 Ethereum Wallets on Near!</em></p>
<p><img src="https://goffxnca.github.io/docs/blog/web3wallets/cover.png"></p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="ethereum-wallets-on-near">Ethereum Wallets on NEAR<a href="https://goffxnca.github.io/docs/zh-CN/blog/hello-ethereum-wallets#ethereum-wallets-on-near" class="hash-link" aria-label="Ethereum Wallets on NEAR的直接链接" title="Ethereum Wallets on NEAR的直接链接">​</a></h2>
<p>We are excited to announce that NEAR now supports Ethereum wallets! This means that you can now login to NEAR applications using MetaMask, WalletConnect, and over 400 other Ethereum wallets.</p>
<p>In this post, we will explain how Ethereum wallets work on NEAR, and where to find information on how to integrate them into your applications.</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="how-it-works">How it works<a href="https://goffxnca.github.io/docs/zh-CN/blog/hello-ethereum-wallets#how-it-works" class="hash-link" aria-label="How it works的直接链接" title="How it works的直接链接">​</a></h2>
<p>The idea of bringing Ethereum wallets to Near was born on the <a href="https://github.com/near/NEPs/issues/518" target="_blank" rel="noopener noreferrer">NEP-518</a>, and the <a href="https://aurora.dev/" target="_blank" rel="noopener noreferrer">Aurora Labs team</a> worked for over a year to make it a reality.</p>
<p>Since Ethereum wallets create <strong>ethereum transactions</strong> and talk with <strong>ethereum RPCs</strong>, the Aurora team had to create three components:</p>
<ol>
<li>A Translator API, that translates Ethereum RPC calls into NEAR RPC calls</li>
<li>A "Wallet Contract" deployed on Near, that can process Ethereum transactions</li>
</ol>
<img src="https://goffxnca.github.io/docs/blog/web3wallets/diagram.png" height="600px" style="width:auto;display:block;margin:0 auto">
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="login">Login<a href="https://goffxnca.github.io/docs/zh-CN/blog/hello-ethereum-wallets#login" class="hash-link" aria-label="Login的直接链接" title="Login的直接链接">​</a></h3>
<p>Imagine your account on Metamask is <code>0xD79...314</code>, and you want to login on a Near application.</p>
<p>The first time you login, <code>ethereum-wallets.near</code> will create the Near account <code>0xD79...314</code> for you.</p>
<img src="https://goffxnca.github.io/docs/blog/web3wallets/login.png" style="width:auto;display:block;margin:0 auto">
<p>Your new Near account already has a <code>Wallet Contract</code> deployed on it, which can <strong>translate ethereum transactions</strong> into <strong>account actions</strong>.</p>
<div class="theme-admonition theme-admonition-tip admonition_xJq3 alert alert--success"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>提示</div><div class="admonitionContent_BuS1"><p>In Near, smart contracts can do anything an account can do, including sending tokens and calling other contracts!</p></div></div>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="using-your-account">Using your Account<a href="https://goffxnca.github.io/docs/zh-CN/blog/hello-ethereum-wallets#using-your-account" class="hash-link" aria-label="Using your Account的直接链接" title="Using your Account的直接链接">​</a></h3>
<p>Once you have logged in, you can start interacting with the application. If at some point the application needs to interact with the blockchain, Metamask will ask you to sign a transaction.</p>
<p>Under the hood, Metamask will create an Ethereum transaction and send it to the <code>Translator API</code>, deployed at <code>https://eth-rpc.mainnet.near.org</code>.</p>
<p>The <code>Translator API</code> will then translate the Ethereum transaction into a <strong>function call</strong> into the <code>Wallet Contract</code> deployed in your account. Particularly, it will call the <code>rlp_execute</code> function, passing the Ethereum transaction as an argument.</p>
<img src="https://goffxnca.github.io/docs/blog/web3wallets/function-call.png" style="width:auto;display:block;margin:0 auto">
<p>The <code>Wallet Contract</code> will then execute the function call, and the application will receive the result.</p>
<div class="theme-admonition theme-admonition-tip admonition_xJq3 alert alert--success"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>提示</div><div class="admonitionContent_BuS1"><p>Check <a href="https://testnet.nearblocks.io/txns/GrVGFVFmGBcNP5xkoA21gEJ7d5bUGVxtmkfHAzyUW895#enhanced" target="_blank" rel="noopener noreferrer">this transaction</a> in our explorer to see the full execution path</p></div></div>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="updating-your-application">Updating your Application<a href="https://goffxnca.github.io/docs/zh-CN/blog/hello-ethereum-wallets#updating-your-application" class="hash-link" aria-label="Updating your Application的直接链接" title="Updating your Application的直接链接">​</a></h2>
<p>In order to support Ethereum wallets, you only need to update your version of <code>wallet-selector</code>, and configure it to include the new <code>ethereum-wallets</code> module.</p>
<p>Do not worry! it is very simple, check our <a href="https://goffxnca.github.io/docs/zh-CN/tools/ethereum-wallets"><strong>tutorial</strong></a> and working example <a href="https://github.com/near-examples/hello-near-examples/tree/main/frontend" target="_blank" rel="noopener noreferrer"><strong>hello world frontend</strong></a>.</p>
<hr>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="resources">Resources<a href="https://goffxnca.github.io/docs/zh-CN/blog/hello-ethereum-wallets#resources" class="hash-link" aria-label="Resources的直接链接" title="Resources的直接链接">​</a></h2>
<ol>
<li>
<p><a href="https://goffxnca.github.io/docs/zh-CN/tools/ethereum-wallets"><strong>Integration Tutorial</strong></a></p>
</li>
<li>
<p><a href="https://github.com/near-examples/hello-near-examples/blob/main/frontend/" target="_blank" rel="noopener noreferrer">Hello World Example</a></p>
</li>
<li>
<p><a href="https://drive.google.com/file/d/1xGWN1yRLzFmRn1e29kbSiO2W1JsxuJH-/view?usp=sharing" target="_blank" rel="noopener noreferrer">Recording of the Ethereum Wallet Presentation</a></p>
</li>
<li>
<p><a href="https://github.com/near/NEPs/issues/518" target="_blank" rel="noopener noreferrer">NEP-518</a>, the proposal that started it all</p>
</li>
</ol>]]></content>
        <author>
            <name>Guille</name>
            <uri>https://github.com/gagdiez</uri>
        </author>
        <author>
            <name>Slava Karkunov</name>
        </author>
        <category label="updates" term="updates"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[New Tutorial - Master Applications on NEAR]]></title>
        <id>https://goffxnca.github.io/docs/zh-CN/blog/2024-10-24-new-tutorial</id>
        <link href="https://goffxnca.github.io/docs/zh-CN/blog/2024-10-24-new-tutorial"/>
        <updated>2024-10-24T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[You might have noticed that a new tutorial has been added to the docs! This multi-part series is all about learning to build full applications on NEAR; you will see how to build an on-chain auction from start to finish, including the smart contract, deploying it on-chain, and creating a frontend to interact with it.]]></summary>
        <content type="html"><![CDATA[<p>You might have noticed that a <a href="https://docs.near.org/tutorials/auction/introduction" target="_blank" rel="noopener noreferrer">new tutorial</a> has been added to the docs! This multi-part series is all about learning to build full applications on NEAR; you will see how to build an on-chain auction from start to finish, including the smart contract, deploying it on-chain, and creating a frontend to interact with it.</p>
<p>Along the way you will learn several key concepts and how to use many key primitives along the way:</p>
<ul>
<li>Creating a simple smart contract</li>
<li>Writing tests for a contract</li>
<li>Deploying a contract to <code>testnet</code></li>
<li>Locking a contract</li>
<li>Creating a frontend to interact with the contract</li>
<li>Using an indexing API to view historical bids</li>
<li>Making cross-contract calls</li>
<li>Using Non-Fungible Tokens</li>
<li>Using Fungible Tokens</li>
<li>Modifying a factory contract to deploy your own contracts</li>
</ul>
<p>This tutorial is a great for beginners to follow all the way through, but each section can also be used as a reference guide for different concepts. If you have any feedback or any questions regarding the tutorial please feel free to reach out in the <a href="https://t.me/neardev" target="_blank" rel="noopener noreferrer">Developer Telegram Channel</a>.</p>
<p><strong>Start the tutorial <a href="https://docs.near.org/tutorials/auction/introduction" target="_blank" rel="noopener noreferrer">here</a></strong></p>
<p>Let's keep building! 🚀</p>]]></content>
        <author>
            <name>Owen Hassall</name>
            <uri>https://github.com/PiVortex</uri>
        </author>
        <category label="updates" term="updates"/>
        <category label="tutorial" term="tutorial"/>
        <category label="getting-started" term="getting-started"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Future of Pagoda Services]]></title>
        <id>https://goffxnca.github.io/docs/zh-CN/blog/2024-08-13-pagoda-services</id>
        <link href="https://goffxnca.github.io/docs/zh-CN/blog/2024-08-13-pagoda-services"/>
        <updated>2024-08-13T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[As the NEAR ecosystem continues to decentralize, Pagoda will cease operations within the next six months and decentralize its functions into NEAR ecosystem teams and committees.  This document describes the transition plan for each of the services, activities, and tools that Pagoda develops or operates.]]></summary>
        <content type="html"><![CDATA[<p>As the NEAR ecosystem continues to decentralize, Pagoda will cease operations within the next six months and decentralize its functions into NEAR ecosystem teams and committees.  This document describes the transition plan for each of the services, activities, and tools that Pagoda develops or operates.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="critical-near-services">Critical NEAR Services<a href="https://goffxnca.github.io/docs/zh-CN/blog/2024-08-13-pagoda-services#critical-near-services" class="hash-link" aria-label="Critical NEAR Services的直接链接" title="Critical NEAR Services的直接链接">​</a></h3>
<p>The critical services below will continue to be operated and maintained by Pagoda until they are smoothly transitioned to new operators in the NEAR ecosystem during the second half of 2024:</p>
<ul>
<li><a href="https://docs.near.org/api/rpc/providers" target="_blank" rel="noopener noreferrer">near.org RPC</a> (<a href="https://dev.near.org/infrastructure-committee.near/widget/app?page=rfp&amp;id=2" target="_blank" rel="noopener noreferrer">Request for Proposals</a>)</li>
<li><a href="https://docs.near.org/concepts/advanced/near-lake-framework" target="_blank" rel="noopener noreferrer">NEAR Lake</a> (<a href="https://dev.near.org/infrastructure-committee.near/widget/app?page=rfp&amp;id=3" target="_blank" rel="noopener noreferrer">Request for Proposals</a>)</li>
<li><a href="https://docs.near.org/build/data-infrastructure/big-query" target="_blank" rel="noopener noreferrer">BigQuery Public Dataset</a> (<a href="https://dev.near.org/infrastructure-committee.near/widget/app?page=rfp&amp;id=4" target="_blank" rel="noopener noreferrer">Request for Proposals</a>)</li>
<li><a href="https://near-nodes.io/intro/node-data-snapshots" target="_blank" rel="noopener noreferrer">Node Snapshots</a></li>
<li><a href="https://near-nodes.io/rpc/state-sync" target="_blank" rel="noopener noreferrer">State Sync</a></li>
<li>Undocumented but critical services:<!-- -->
<ul>
<li>KitWallet Indexer API (<a href="https://dev.near.org/infrastructure-committee.near/widget/app?page=rfp&amp;id=1" target="_blank" rel="noopener noreferrer">Request for Proposals</a>)</li>
<li>near-cli Testnet Faucet</li>
</ul>
</li>
</ul>
<p>Each transition will be independently planned and communicated on its own timeline and this page will be updated accordingly.</p>
<p>The NEAR <a href="https://dev.near.org/infrastructure-committee.near/widget/near-prpsls-bos.components.pages.app?page=about" target="_blank" rel="noopener noreferrer">Infrastructure Committee</a> will manage this transition process by soliciting proposals from the community for continued operation of these services, then will select, fund, and oversee the new operator.</p>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="a-note-about-nearorg-rpc">A Note About near.org RPC<a href="https://goffxnca.github.io/docs/zh-CN/blog/2024-08-13-pagoda-services#a-note-about-nearorg-rpc" class="hash-link" aria-label="A Note About near.org RPC的直接链接" title="A Note About near.org RPC的直接链接">​</a></h4>
<p>The Infrastructure Committee feels that Pagoda's fully-subsidized near.org RPC service is getting in the way of decentralization efforts and is preventing high-quality commercial RPC offerings from gaining traction. If a NEAR core team continues to support a free-to-use near.org RPC service, it will be required to gradually lower its rate limits over the coming months to prevent abuse. More details on this plan will be communicated by the end of September 2024. In light of this proposed change, <strong>high-traffic near.org RPC users should start making plans to switch to other RPC providers</strong>.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="chain-abstraction-services">Chain Abstraction Services<a href="https://goffxnca.github.io/docs/zh-CN/blog/2024-08-13-pagoda-services#chain-abstraction-services" class="hash-link" aria-label="Chain Abstraction Services的直接链接" title="Chain Abstraction Services的直接链接">​</a></h3>
<p><a href="https://docs.near.org/concepts/abstraction/chain-signatures" target="_blank" rel="noopener noreferrer">Chain Signatures</a>, Multichain Gas Relayer, and <a href="https://docs.near.org/build/chain-abstraction/fastauth-sdk" target="_blank" rel="noopener noreferrer">FastAuth</a> will continue to be developed by Pagoda, then will be taken over by the new Chain Abstraction / Multichain spinout from Pagoda and Proximity. More information will be shared in September or October 2024.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="pagoda-operations--ecosystem-services">Pagoda Operations &amp; Ecosystem Services<a href="https://goffxnca.github.io/docs/zh-CN/blog/2024-08-13-pagoda-services#pagoda-operations--ecosystem-services" class="hash-link" aria-label="Pagoda Operations &amp; Ecosystem Services的直接链接" title="Pagoda Operations &amp; Ecosystem Services的直接链接">​</a></h3>
<p>Pagoda’s ecosystem services will transition as follows:</p>
<ul>
<li><a href="https://dev.near.org/infrastructure-committee.near/widget/near-prpsls-bos.components.pages.app?page=about" target="_blank" rel="noopener noreferrer">Infrastructure Committee</a> administration, the recently rebooted Security Assessment Program, and management of the <a href="http://near.org/" target="_blank" rel="noopener noreferrer">near.org</a> website will move under the purview of NEAR Foundation.</li>
<li><a href="https://hackenproof.com/company/near/programs" target="_blank" rel="noopener noreferrer">Bug bounty</a> triage will be transitioned to the protocol team at NEAR One.</li>
<li>The <a href="https://help.near.org/" target="_blank" rel="noopener noreferrer">NEAR Helpdesk</a> will be turned into self-service documentation.</li>
<li>Pagoda's informal technical / smart contract advisory services for other ecosystem companies will wind down over the next few months.</li>
</ul>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="open-source-libraries">Open-Source Libraries<a href="https://goffxnca.github.io/docs/zh-CN/blog/2024-08-13-pagoda-services#open-source-libraries" class="hash-link" aria-label="Open-Source Libraries的直接链接" title="Open-Source Libraries的直接链接">​</a></h3>
<p>These open-source libraries and tools will be developed by Pagoda until they reach a logical completion or stopping point:</p>
<ul>
<li><a href="https://github.com/near/pagoda-relayer-rs" target="_blank" rel="noopener noreferrer">Pagoda Metatransaction Relayer</a></li>
<li><a href="https://github.com/near/chain-hosted-ui" target="_blank" rel="noopener noreferrer">Chain Hosted UI</a></li>
<li><a href="https://t.me/neardev/53280" target="_blank" rel="noopener noreferrer">Modularization and Refactor</a> of near-api-js</li>
</ul>
<p>Once active development by Pagoda has ceased, it doesn't mean these tools have to languish. We encourage the NEAR community to continue this work. If you need funding to do so, you can submit proposals to <a href="https://dev.near.org/devhub.near/widget/app" target="_blank" rel="noopener noreferrer">DevHub</a> or the <a href="https://dev.near.org/infrastructure-committee.near/widget/near-prpsls-bos.components.pages.app?page=about" target="_blank" rel="noopener noreferrer">Infrastructure Committee</a>.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="deprecated-services">Deprecated Services<a href="https://goffxnca.github.io/docs/zh-CN/blog/2024-08-13-pagoda-services#deprecated-services" class="hash-link" aria-label="Deprecated Services的直接链接" title="Deprecated Services的直接链接">​</a></h3>
<p>Between now and February 2025, Pagoda's development work will slow down or stop on the following products and services:</p>
<ul>
<li>QueryAPI</li>
<li><a href="https://docs.near.org/pagoda/rpc/api" target="_blank" rel="noopener noreferrer">Enhanced API</a></li>
<li><a href="https://docs.near.org/pagoda/alerts/intro" target="_blank" rel="noopener noreferrer">Alerts &amp; Triggers</a></li>
</ul>
<p>These are open-source services and we encourage the community to continue with their development and operation. If we can't identify new operators quickly, we will encourage remaining users of these services to switch to alternative solutions, then communicate a timeline for these services to be turned off.</p>]]></content>
        <author>
            <name>Eric Winer</name>
            <uri>https://github.com/ewiner</uri>
        </author>
        <category label="updates" term="updates"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[An update on the near.org / RPC outage on July 11, 2024]]></title>
        <id>https://goffxnca.github.io/docs/zh-CN/blog/2024-07-11-near-org-outage</id>
        <link href="https://goffxnca.github.io/docs/zh-CN/blog/2024-07-11-near-org-outage"/>
        <updated>2024-07-18T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[From Thursday, July 11 to Saturday, July 13, many visitors to near.org and its subdomains (like dev.near.org and docs.near.org) were unable to reach those websites. Also, NEAR applications that rely on RPC services hosted on near.org were affected. This was due to a security incident followed by an outage from one of our vendors, Squarespace. During this period, the NEAR protocol & blockchain was unaffected by this incident, as it does not rely on any centralized services.]]></summary>
        <content type="html"><![CDATA[<p>From Thursday, July 11 to Saturday, July 13, many visitors to <a href="https://near.org/" target="_blank" rel="noopener noreferrer">near.org</a> and its subdomains (like <a href="https://dev.near.org/" target="_blank" rel="noopener noreferrer">dev.near.org</a> and <a href="https://docs.near.org/" target="_blank" rel="noopener noreferrer">docs.near.org</a>) were unable to reach those websites. Also, NEAR applications that rely on <a href="https://docs.near.org/api/rpc/providers" target="_blank" rel="noopener noreferrer">RPC services</a> hosted on near.org were affected. This was due to a security incident followed by an outage from one of our vendors, Squarespace. During this period, the NEAR protocol &amp; blockchain was unaffected by this incident, as it does not rely on any centralized services.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="our-use-of-squarespace-dns">Our Use of Squarespace DNS<a href="https://goffxnca.github.io/docs/zh-CN/blog/2024-07-11-near-org-outage#our-use-of-squarespace-dns" class="hash-link" aria-label="Our Use of Squarespace DNS的直接链接" title="Our Use of Squarespace DNS的直接链接">​</a></h3>
<p>The near.org domain is operated by <a href="https://www.pagoda.co/" target="_blank" rel="noopener noreferrer">Pagoda</a>, an engineering arm of the NEAR Foundation. An important part of operating a domain like near.org is choosing a DNS provider; to learn more about DNS and how it operates, please see <a href="https://www.cloudflare.com/learning/dns/what-is-dns/" target="_blank" rel="noopener noreferrer">this introduction</a>. For years, we happily used Google’s domain name registration &amp; DNS service to manage near.org, as part of our broad usage of Google Cloud services. In June 2023, Google announced it had <a href="https://support.google.com/domains/answer/13689670?hl=en" target="_blank" rel="noopener noreferrer">sold its Domains business to Squarespace</a>, and that our account would be transitioned to Squarespace “in the next few months.” We expected that the new service from Squarespace would closely match the feature set, reliability, and security we had enjoyed while using Google Domains, and if there were any problems then we could easily switch from Squarespace to another DNS provider after the transition.</p>
<p>Our first domain, near.wiki, was automatically moved over to Squarespace in May 2024. As we explored the new offering, our Security &amp; IT teams quickly had concerns about the feature set, security controls, and level of enterprise support we could get from Squarespace. After some meetings with Squarespace sales and support failed to assuage our concerns, we decided to explore other DNS providers and to start migrating our domains off of Squarespace, starting with the ‘simpler’ ones and ending with near.org, our most complex and important domain name. As of last week, when this incident began, we had not yet begun migrating near.org to our new provider, Amazon Web Services, so it was still using Squarespace as its DNS provider.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="the-squarespace-security-incident">The Squarespace Security Incident<a href="https://goffxnca.github.io/docs/zh-CN/blog/2024-07-11-near-org-outage#the-squarespace-security-incident" class="hash-link" aria-label="The Squarespace Security Incident的直接链接" title="The Squarespace Security Incident的直接链接">​</a></h3>
<p>Unbeknownst to us, Squarespace had a major security vulnerability. You can read about the problem in <a href="https://securityalliance.notion.site/A-Squarespace-Retrospective-or-How-to-Coordinate-an-Industry-Wide-Incident-Response-fead693b66c14543a48283d85aec19ad" target="_blank" rel="noopener noreferrer">this in-depth blog post from Security Alliance</a>. In short, when each domain was migrated from Google to Squarespace, all existing users on the Google Domains account were sent an email inviting them to create a new Squarespace account. But not everybody clicked on that email right away – some people, e.g. managers or our accounting team, only needed to log into the DNS service rarely or in emergencies. From what we can tell, all the attacker needed to do was identify one of those email addresses and sign up for a new Squarespace account using that email address, and they would be instantly granted full access to change or delete DNS entries for near.org. From our investigation, Squarespace did not require the attacker to verify ownership of the email address before letting them have full control on our account. In fact, we see no evidence that Squarespace even sent a “welcome” email to that address upon account creation, which might have raised warning flags.</p>
<p>On July 11, an attacker gained access to our Squarespace account. They deleted the DNS entries for near.org and its subdomains, causing the outage described above. But unlike some other domains affected by this attack, the impact on near.org seems limited to an outage; we have seen no evidence that the attacker put in place an ‘imposter’ site to try and phish or scam users.</p>
<p>Through a combination of our actions and Squarespace’s actions behind the scenes, we were able to quickly regain control of the account. However, due to other issues with Squarespace, it took another two days for near.org and its subdomains and services to get fully back online.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="the-squarespace-outage">The Squarespace Outage<a href="https://goffxnca.github.io/docs/zh-CN/blog/2024-07-11-near-org-outage#the-squarespace-outage" class="hash-link" aria-label="The Squarespace Outage的直接链接" title="The Squarespace Outage的直接链接">​</a></h3>
<p>Even with full and exclusive access to our Squarespace, we were unable to restore service on near.org. The attacker had deleted our DNS entries, and when we re-added them, Squarespace failed to propagate those new entries to other DNS providers around the world. We attempted to quickly execute a switch to Amazon Web Service’s DNS provider, but the feature to switch to a different DNS service was also broken on the Squarespace site.</p>
<p>The next morning, on Friday July 12, on a hunch we deleted and re-added all of our DNS entries once again. This time, it did take effect and DNS providers around the world quickly saw the new information. That resolved the outage for many users, but not for everyone. near.org had been set up with an additional security feature, DNSSEC, in which Squarespace was supposed to digitally sign our DNS entries to prove that the entries had not been forged by another DNS provider. But Squarespace wasn’t properly updating and signing new DNSSEC entries, so any other DNS provider that validates DNSSEC was detecting near.org’s DNS entries as a forgery and refusing to allow access to near.org. This affected <a href="https://stats.labs.apnic.net/dnssec" target="_blank" rel="noopener noreferrer">approximately 34% of users</a>, especially in Europe. There is a button on the Squarespace site to turn off DNSSEC, but unsurprisingly, that button also just showed an error message.</p>
<p>Finally, on Saturday July 13, we were able to make contact with a specialist on the Squarespace team, and later that day they were able to fix the DNSSEC issue. Once that change propagated to other DNS providers around the world over the next few hours, near.org and the RPC service was restored for everyone.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="reflections-on-this-incident">Reflections on this Incident<a href="https://goffxnca.github.io/docs/zh-CN/blog/2024-07-11-near-org-outage#reflections-on-this-incident" class="hash-link" aria-label="Reflections on this Incident的直接链接" title="Reflections on this Incident的直接链接">​</a></h3>
<p>You may have noticed that we made a few assumptions in this blog post, saying “from what we can tell” and “we see no evidence of…” a few times. Ideally, almost a week after the incident began, we would have more hard truths and solid information about what happened.</p>
<p>Unfortunately, we’ve seen little to no communication from Squarespace throughout this period. We tried multiple support tickets, chat, personal contacts, LinkedIn messages, and going through our Google support team, and still didn’t hear anything back from Squarespace until late on Friday July 12, about 36 hours after the incident began. Other affected companies also reported total silence from the Squarespace team. As far as we know, Squarespace has still not acknowledged this incident publicly, let alone shared details of the issue and how they remediated it, and their <a href="https://status.squarespace.com/" target="_blank" rel="noopener noreferrer">status page</a> showed no outages or issues during this time.</p>
<p>I personally find this lack of support, communication, and forthrightness to be unacceptable for any service provider. I’m also somewhat disappointed in Google for transitioning a security-critical service to a new provider without proper vetting. We are accelerating our plans to move near.org and other domains out of Squarespace to Amazon Web Services’s domain registrar and DNS provider, which has a great track record of reliability and security.</p>
<p>DNS is a core part of internet infrastructure, but it’s far from a perfect system. Every domain name owner must rely on one centralized DNS provider to maintain their DNS entries, and every user and application must rely on one or more centralized DNS providers to look up entries as they navigate the internet. Various projects in the blockchain industry have created non-custodial on-chain alternatives to DNS, such as <a href="https://unstoppabledomains.com/" target="_blank" rel="noopener noreferrer">Unstoppable Domains</a> and <a href="https://3dns.box/" target="_blank" rel="noopener noreferrer">3DNS</a> (FYI: neither have sponsored or were made aware of this post), but the existing DNS system is so entrenched that adoption has been a challenge. Hopefully as an industry we can make headway on a more decentralized, trustless open web before further incidents like this happen.</p>
<p>I’m deeply sorry to anyone affected by this outage, especially people exploring NEAR for the first time during the EthCC conference and EthGlobal hackathon. We will be more vigilant about using high-quality vendor services going forward – and, where possible, moving to decentralized on-chain solutions.</p>
<p>-Eric Winer<br>
CTO &amp; Managing Director, Pagoda</p>]]></content>
        <author>
            <name>Eric Winer</name>
            <uri>https://github.com/ewiner</uri>
        </author>
        <category label="updates" term="updates"/>
        <category label="postmortems" term="postmortems"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Pagoda Pauses the B.O.S. Web Engine R&D Project]]></title>
        <id>https://goffxnca.github.io/docs/zh-CN/blog/bos-web-engine-sunset</id>
        <link href="https://goffxnca.github.io/docs/zh-CN/blog/bos-web-engine-sunset"/>
        <updated>2024-07-01T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[After careful consideration, Pagoda has decided to discontinue its active efforts to improve the B.O.S. Web Engine]]></summary>
        <content type="html"><![CDATA[<p><em>After careful consideration, Pagoda has decided to discontinue its active efforts to improve the B.O.S. Web Engine</em></p>
<p><img src="https://goffxnca.github.io/assets/images/protocol-b73c2a3ace3307226ee7eb2149ee432f.png"></p>
<p>After many discussions with NEAR’s B.O.S. component developers and careful consideration, Pagoda has decided to discontinue its active development for <a href="https://github.com/near/bos-web-engine" target="_blank" rel="noopener noreferrer">B.O.S. Web Engine R&amp;D </a>for an improved execution layer for NEAR B.O.S. Components. (also known as “BWE” &amp; “VM2”)</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="background">Background<a href="https://goffxnca.github.io/docs/zh-CN/blog/bos-web-engine-sunset#background" class="hash-link" aria-label="Background的直接链接" title="Background的直接链接">​</a></h2>
<p>Last year, <a href="https://near.org/blog/near-announces-the-blockchain-operating-system" target="_blank" rel="noopener noreferrer">NEAR introduced the Blockchain Operating System</a>, demonstrating how NEAR’s performant tech stack could support a full-stack decentralized development platform that was multi-chain compatible. A core feature of this system consisted of composable decentralized front-ends (B.O.S. Components) paired with a user-centric data storage contract (social-db). This model, <a href="https://thewiki.near.page/PastPresentAndFutureOfNearSocial" target="_blank" rel="noopener noreferrer">pioneered by NEAR Social</a>, aimed to continue NEAR’s mission of empowering users to own their data as well as eliminate reliance on centralized, single-entity-controlled web applications. The potential of a fully decentralized web and the creation of real dApps became closer to reality with these inherently open and customizable experiences.</p>
<p>As the community started to adopt B.O.S. it soon became clear that, while devs loved how fast it was to go from an idea to a product, its intrinsic technical limitations made it hard to use B.O.S. for any real-world application. This consistent feedback from multiple members of the community prompted Pagoda to start an R&amp;D effort to improve B.O.S. such that:</p>
<ul>
<li>It was as close to vanilla React as possible</li>
<li>Supported npm package imports</li>
<li>Unlocked multi-chain scalability limitations</li>
<li>Improved performance</li>
<li>Improved security</li>
</ul>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="bos-web-engine">B.O.S. Web Engine<a href="https://goffxnca.github.io/docs/zh-CN/blog/bos-web-engine-sunset#bos-web-engine" class="hash-link" aria-label="B.O.S. Web Engine的直接链接" title="B.O.S. Web Engine的直接链接">​</a></h2>
<p>In order to act on this feedback and accomplish these goals, improvements had to be made to the execution layer that makes this all possible. At its core, a virtual machine, (<a href="https://github.com/NearSocial/VM" target="_blank" rel="noopener noreferrer">NEAR Social VM</a>) renders front-end code that developers store in a smart contract onchain (social-db). It was determined that a new approach to the original VM solution was needed, and the B.O.S. Web Engine project was created. Countless hours of hard work and dedication have gone into this project, yielding many significant achievements along the way. However, one major challenge still stands in the way of a production-ready beta release: expanding support for npm packages, particularly UI libraries.</p>
<p>During the alpha testing phase of this project, we anticipated a fairly straightforward path in resolving wider npm support but unfortunately, the team discovered a more complex scenario. While standard JavaScript packages work well, React UI libraries frequently encounter difficulties. These challenges stem from the unique packaging methods of each library and the complexities involved in synchronizing changes between the iframe and the outer DOM. Although we have identified several theoretical solutions, each requires further research and development to assess their practicality and effectiveness. This has been more fully detailed in <a href="https://github.com/near/react-on-chain/discussions/425" target="_blank" rel="noopener noreferrer">a GitHub discussion within the BWE Repo</a>.</p>
<p>We reached out to leading B.O.S. component contributors to determine whether this limitation would be unnegotiable and to learn what features they value most. Do they prioritize unrestricted NPM support over secure iframe composability? How important is composability, and how would they define it? (considering our approach dissects it down to the atomic level of every element)</p>
<p>This revealed some interesting findings, one of which was that secure composability on an atomic level was not at the top of the list. Most favored the ease of quick prototyping, deployment, and onboarding with managed infra and wallet connections. Many valued social-db features and the ability to create custom gateways (websites) using code and user data publicly available to them.</p>
<p>In short, there were three camps:</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="true-believers">True Believers<a href="https://goffxnca.github.io/docs/zh-CN/blog/bos-web-engine-sunset#true-believers" class="hash-link" aria-label="True Believers的直接链接" title="True Believers的直接链接">​</a></h3>
<ul>
<li>Decentralize all the things!</li>
<li>Love bleeding-edge unique tech</li>
<li>Love inherent open-source</li>
<li>Love social-db and its features</li>
</ul>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="quick-builders">Quick Builders<a href="https://goffxnca.github.io/docs/zh-CN/blog/bos-web-engine-sunset#quick-builders" class="hash-link" aria-label="Quick Builders的直接链接" title="Quick Builders的直接链接">​</a></h3>
<ul>
<li>Love the speed of development, prototyping, remixing</li>
<li>Love reverse engineering existing components</li>
<li>Quick onboarding with managed infra and wallet connections</li>
<li>Great for hackathons</li>
</ul>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="detractors">Detractors<a href="https://goffxnca.github.io/docs/zh-CN/blog/bos-web-engine-sunset#detractors" class="hash-link" aria-label="Detractors的直接链接" title="Detractors的直接链接">​</a></h3>
<ul>
<li>Don't like anything about B.O.S. components</li>
<li>DevX is poor and UI is slow</li>
<li>Value convenience over decentralization</li>
</ul>
<p>After reviewing our findings and engaging extensively with developers using this platform, it became clear that continuing with the release of the B.O.S. web engine as currently planned could potentially have a net negative impact. The majority of developers indicated that they do not favor a version of the BWE with limited npm support, even if it means enhanced secure composability. Additionally, while a minority of builders prioritize decentralization over performance and convenience, those who truly value decentralized frontends might find simpler ways to achieve their objectives once the need for secure composability is eliminated.</p>
<p>For those who may disagree with this perspective, the B.O.S. Web Engine remains, and will always be an open-source project. Anyone who sees value in the work we have done and wishes to advance this initiative is welcome to carry this torch and continue the development. <a href="https://github.com/near/bos-web-engine" target="_blank" rel="noopener noreferrer">https://github.com/near/bos-web-engine</a></p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="what-does-this-mean-for-bos-components--the-current-vm">What does this mean for B.O.S. components &amp; the current VM?<a href="https://goffxnca.github.io/docs/zh-CN/blog/bos-web-engine-sunset#what-does-this-mean-for-bos-components--the-current-vm" class="hash-link" aria-label="What does this mean for B.O.S. components &amp; the current VM?的直接链接" title="What does this mean for B.O.S. components &amp; the current VM?的直接链接">​</a></h2>
<p>During the development of the B.O.S. Web Engine, a large focus was placed on addressing the security aspects of the existing VM and B.O.S. component architecture. The primary concern is with the composability and attack vectors that are exposed when importing components authored by third parties. Despite numerous patches to address discovered exploits, the inherent complexities of JavaScript and the current VM’s architecture suggest that such vulnerabilities may continue to persist. Pagoda has diligently monitored and addressed these issues to date but we anticipate challenges in continuing to proactively discover and mitigate future vulnerabilities.</p>
<p><em>For examples of previously discovered vulnerabilities, view the <a href="https://github.com/NearSocial/VM/releases" target="_blank" rel="noopener noreferrer">VM changelog</a> going back to <code>v2.5.1</code>, paying attention to lines tagged as <code>FIX</code> on issues Reported by <code>BrunoModificato</code> from OtterSec.</em></p>
<p>If you find value in creating B.O.S. components and leveraging the features of the social-db smart contract, rest assured that this framework will remain open-source and permanently accessible on-chain. However, we urge caution when incorporating and using third-party components. Due to the current virtual machine's limitations, we cannot guarantee protection against potential future exploits.</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="should-i-migrate-my-project-off-of-bos">Should I migrate my project off of B.O.S.?<a href="https://goffxnca.github.io/docs/zh-CN/blog/bos-web-engine-sunset#should-i-migrate-my-project-off-of-bos" class="hash-link" aria-label="Should I migrate my project off of B.O.S.?的直接链接" title="Should I migrate my project off of B.O.S.?的直接链接">​</a></h2>
<p>If your application relies on community-contributed or unreviewed third-party components, then <strong>yes</strong>. As described above, we cannot guarantee protection against future security vulnerabilities in the VM and B.O.S. component architecture. However, you can mitigate (but not eliminate) these security risks by reviewing all third-party components and either forking them or locking down dependencies to the specific version that you reviewed.</p>
<p>If you are not relying on any untrusted component code, then <strong>maybe</strong>. You are not being forced to migrate and there are still teams actively building new applications leveraging B.O.S. Additionally, there are no plans to deprecate main B.O.S. gateways at <a href="https://dev.near.org/" target="_blank" rel="noopener noreferrer">dev.near.org</a>, <a href="https://near.social/" target="_blank" rel="noopener noreferrer">near.social</a>, <a href="https://dapdap.net/" target="_blank" rel="noopener noreferrer">dapdap</a> or <a href="https://bos.gg/" target="_blank" rel="noopener noreferrer">bos.gg</a>. However, the underlying framework and virtual machine are no longer actively developed or maintained by the original team. Consequently, the pace at which new features are introduced and existing bugs or vulnerabilities are addressed may be slower than expected. We openly welcome new maintainers for <a href="https://github.com/nearsocial" target="_blank" rel="noopener noreferrer">this codebase</a>. However, as previously mentioned, we anticipate that additional security vulnerabilities may still be discovered.</p>
<p>We have updated <a href="https://docs.near.org/build/web3-apps/frontend" target="_blank" rel="noopener noreferrer">“Frontends for Web3 dApps” in docs.near.org</a>  to help you choose a solution that is right for you. If you need help, please reach out to one of our support channels on <a href="https://t.me/neardev" target="_blank" rel="noopener noreferrer">Telegram</a> or <a href="https://near.chat/" target="_blank" rel="noopener noreferrer">Discord</a> and we will be happy to assist you or answer any questions you have.</p>]]></content>
        <author>
            <name>Josh Ford</name>
            <uri>https://github.com/thisisjoshford</uri>
        </author>
        <category label="updates" term="updates"/>
        <category label="BWE" term="BWE"/>
        <category label="VM2" term="VM2"/>
        <category label="BOS" term="BOS"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[One place for all Smart Contracts Docs]]></title>
        <id>https://goffxnca.github.io/docs/zh-CN/blog/sdks-unified</id>
        <link href="https://goffxnca.github.io/docs/zh-CN/blog/sdks-unified"/>
        <updated>2024-06-28T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[We have consolidated all our documentation in a single section, so you don't need to go searching around for it]]></summary>
        <content type="html"><![CDATA[<p><em>We have consolidated all our documentation in a single section, so you don't need to go searching around for it</em></p>
<p><img src="https://goffxnca.github.io/assets/images/contracts-landing-5a9c76a78e71b0e5f9a96033f1f23d23.png"></p>
<p>Smart contracts are small pieces of logic that can live on every NEAR account. To build a contract you use the NEAR SDKs, which comes in two flavours: Rust and JavaScript.</p>
<p>Until today, we had multiple docs explaining how to build smart contracts:</p>
<ul>
<li><code>/sdk/rust</code> dedicated to explain how to use the Rust SDK</li>
<li><code>/sdk/js</code> dedicated to explain how to use the JS SDK</li>
<li><a href="https://goffxnca.github.io/docs/zh-CN/build/smart-contracts/what-is"><code>/build/smart-contracts/what-is</code></a> - that explains general concepts, and how to implement them using both SDKs</li>
</ul>
<p>Today, this is over, as all the information on how to build smart contracts is located in a single area: <a href="https://goffxnca.github.io/docs/zh-CN/build/smart-contracts/what-is"><code>/build/smart-contracts/what-is</code></a>.</p>
<p>Meanwhile, we have transformed the <a href="https://goffxnca.github.io/docs/zh-CN/tools/sdk">SDK page</a> to be a simple landing page with links to:</p>
<ul>
<li>The <a href="https://docs.rs/near-sdk/latest/near_sdk/" target="_blank" rel="noopener noreferrer">Rust SDK reference docs</a></li>
<li>The <a href="https://near.github.io/near-api-js/" target="_blank" rel="noopener noreferrer">JS SDK reference docs</a></li>
<li>The <a href="https://goffxnca.github.io/docs/zh-CN/build/smart-contracts/what-is">Smart Contract Section</a></li>
</ul>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="why-did-we-have-3-sections-explaining-the-same-topic">Why did we have 3 sections explaining the same topic?<a href="https://goffxnca.github.io/docs/zh-CN/blog/sdks-unified#why-did-we-have-3-sections-explaining-the-same-topic" class="hash-link" aria-label="Why did we have 3 sections explaining the same topic?的直接链接" title="Why did we have 3 sections explaining the same topic?的直接链接">​</a></h2>
<p>The reason we had 3 different sections was that, historically, the engineers of each SDK were working on their own docs in isolation. To help mitigate this, we created a section on NEAR docs, meant to consolidate all the external documentation.</p>
<p>One day, the individual SDK pages were deleted - if I remember correctly, it was because we wanted to have fewer domains - and we had to migrate everything in a rush.</p>
<p>This left us in a very weird situation: we already had a section explaining how to build a smart contract... and now we had 3.</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="a-single-source-of-truth">A single source of truth<a href="https://goffxnca.github.io/docs/zh-CN/blog/sdks-unified#a-single-source-of-truth" class="hash-link" aria-label="A single source of truth的直接链接" title="A single source of truth的直接链接">​</a></h2>
<p>Luckily, this is now fixed! We have finally conquered the original dream of having a single section for <a href="https://goffxnca.github.io/docs/zh-CN/build/smart-contracts/what-is">Smart Contracts</a>, with all the information consolidated in there.</p>
<p>Now, we can focus on maintaining a single section, thus making it easier to keep it updated and relevant.</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="whats-next">What's next?<a href="https://goffxnca.github.io/docs/zh-CN/blog/sdks-unified#whats-next" class="hash-link" aria-label="What's next?的直接链接" title="What's next?的直接链接">​</a></h2>
<p>We are currently undergoing a process of <strong>consolidating</strong> all the documentation. This means that we are looking at all the sections that have overlapping information, and trying to merge them into a single place.</p>
<p>This will not only improve the quality of our docs, but also make it easier for you to find the information you need. In fact, improving search is one of the main motors of this change, since we noticed that our search tool (<a href="https://www.algolia.com/" target="_blank" rel="noopener noreferrer">Algolia</a>) gets confused when the same concept is spread all over the place.</p>
<p>Moreover, having consistent and coherent documentation will allow us to further expand our search capabilities using AI! This is something we are very excited about, as it will allow us to provide you with even more relevant information.</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="if-you-dont-like-this-change-please-let-us-know">If you don't like this change, please let us know!<a href="https://goffxnca.github.io/docs/zh-CN/blog/sdks-unified#if-you-dont-like-this-change-please-let-us-know" class="hash-link" aria-label="If you don't like this change, please let us know!的直接链接" title="If you don't like this change, please let us know!的直接链接">​</a></h2>
<p>As always, we are more than open to feedback. If you think that this change is not good, or that we are missing something, please let us know! You can reach out to us through the blue feedback button you see at the side of the screen.</p>
<p>We are looking forward to hearing your thoughts and feedback, and hope you enjoy the content we'll be sharing.</p>
<p>Happy coding, and see you in the next post! 🚀</p>]]></content>
        <author>
            <name>Guille</name>
            <uri>https://github.com/gagdiez</uri>
        </author>
        <category label="updates" term="updates"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Getting Started on NEAR Using Windows]]></title>
        <id>https://goffxnca.github.io/docs/zh-CN/blog/getting-started-on-windows</id>
        <link href="https://goffxnca.github.io/docs/zh-CN/blog/getting-started-on-windows"/>
        <updated>2024-06-05T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[In this article, we will cover how to install WSL and setup a NEAR development environment on Windows.]]></summary>
        <content type="html"><![CDATA[<p>In this article, we will cover how to install WSL and setup a NEAR development environment on Windows.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="wsl">WSL<a href="https://goffxnca.github.io/docs/zh-CN/blog/getting-started-on-windows#wsl" class="hash-link" aria-label="WSL的直接链接" title="WSL的直接链接">​</a></h3>
<p>WSL, or Windows Subsystem for Linux, is a compatibility layer for running Linux binary executables natively on Windows. It allows us to run a GNU/Linux environment directly on Windows without the overhead of a traditional virtual machine or dual-boot setup.</p>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="enable-wsl-from-windows-features">Enable WSL from <code>Windows Features</code><a href="https://goffxnca.github.io/docs/zh-CN/blog/getting-started-on-windows#enable-wsl-from-windows-features" class="hash-link" aria-label="enable-wsl-from-windows-features的直接链接" title="enable-wsl-from-windows-features的直接链接">​</a></h4>
<p>First of all, make sure that WSL is enabled, for this go to:
<code>Control Panel &gt; Programs &gt; Turn Windows Features on or off</code>
Scrolling down will reveal the option <code>Windows Subsystem for Linux</code>. Make sure it is enabled and press OK to confirm (you will be asked to reboot your computer).</p>
<p><img decoding="async" loading="lazy" alt="Windows Features WSL Enabled" src="https://goffxnca.github.io/docs/zh-CN/assets/images/windows-features-wsl-enabled-a1476cedd8df0e961ba21dd9af59374a.jpg" width="908" height="792" class="img_ev3q"></p>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="start-wsl-and-install-ubuntu">Start WSL and Install Ubuntu<a href="https://goffxnca.github.io/docs/zh-CN/blog/getting-started-on-windows#start-wsl-and-install-ubuntu" class="hash-link" aria-label="Start WSL and Install Ubuntu的直接链接" title="Start WSL and Install Ubuntu的直接链接">​</a></h4>
<p>Now we will spend some time in either <code>PowerShell</code> or <a href="https://apps.microsoft.com/detail/9n0dx20hk701" target="_blank" rel="noopener noreferrer">Windows Terminal</a>, which is a modern terminal application that supports various command-line tools and shells.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#bfc7d5;background-color:#292d3e"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic"># may be desirable for seamless integration between WSL2 distros of linux and docker with WSL backend </span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">wsl --set-default-version </span><span class="token number" style="color:rgb(247, 140, 108)">2</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#bfc7d5;background-color:#292d3e"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token plain">wsl --install --d Ubuntu</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<p><strong>Read more on WSL:</strong>
<a href="https://learn.microsoft.com/en-us/windows/wsl/install" target="_blank" rel="noopener noreferrer">https://learn.microsoft.com/en-us/windows/wsl/install</a>
<a href="https://learn.microsoft.com/en-us/windows/wsl/setup/environment" target="_blank" rel="noopener noreferrer">https://learn.microsoft.com/en-us/windows/wsl/setup/environment</a>
<a href="https://learn.microsoft.com/en-us/windows/wsl/" target="_blank" rel="noopener noreferrer">https://learn.microsoft.com/en-us/windows/wsl/</a></p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="install-required-packages">Install Required Packages<a href="https://goffxnca.github.io/docs/zh-CN/blog/getting-started-on-windows#install-required-packages" class="hash-link" aria-label="Install Required Packages的直接链接" title="Install Required Packages的直接链接">​</a></h3>
<p>Once the installation is completed you will have Ubuntu installed as any other application on Windows. Open it from the start menu and you will be dropped into the <a href="https://ubuntu.com/tutorials/command-line-for-beginners#1-overview" target="_blank" rel="noopener noreferrer">Ubuntu bash shell</a></p>
<p>Enter the following commands to install all the packages that Rust and Node might need later:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#bfc7d5;background-color:#292d3e"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token function" style="color:rgb(130, 170, 255)">apt-get</span><span class="token plain"> update</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token function" style="color:rgb(130, 170, 255)">apt-get</span><span class="token plain"> </span><span class="token function" style="color:rgb(130, 170, 255)">install</span><span class="token plain"> gcc </span><span class="token function" style="color:rgb(130, 170, 255)">make</span><span class="token plain"> libudev-dev openssl pkg-config </span><span class="token function" style="color:rgb(130, 170, 255)">unzip</span><span class="token plain"> </span><span class="token parameter variable" style="color:rgb(191, 199, 213)">-y</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<div class="theme-admonition theme-admonition-tip admonition_xJq3 alert alert--success"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>Permission Denied?</div><div class="admonitionContent_BuS1"><p>Depending on your setup, you might need to run the commands with <code>sudo</code>. This temporarily grants your user elevated privileges to perform tasks that require higher permissions.</p></div></div>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="setup-developer-environment">Setup Developer Environment<a href="https://goffxnca.github.io/docs/zh-CN/blog/getting-started-on-windows#setup-developer-environment" class="hash-link" aria-label="Setup Developer Environment的直接链接" title="Setup Developer Environment的直接链接">​</a></h3>
<p>Now that we have WSL enabled and running Ubuntu, it is time to setup our developer environment. At NEAR we currently support using JS/TS and Rust to develop smart contracts, and JS/TS to develop web applications.</p>
<p>Bellow we will explain how to install both <code>Node.js</code> and <code>Rust</code>. If you want, you can install only one of them (e.g. if you are only planning to create a Rust contract, you don't need Node.js). However, we do recommend to install both so your environment is ready if you want to try something different later.</p>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="node-jsts">Node (JS/TS)<a href="https://goffxnca.github.io/docs/zh-CN/blog/getting-started-on-windows#node-jsts" class="hash-link" aria-label="Node (JS/TS)的直接链接" title="Node (JS/TS)的直接链接">​</a></h4>
<p>Node.js is a JavaScript runtime environment that executes code outside a web browser, enabling the development of server-side applications. In NEAR development, it can be used to write smart contracts in <a href="https://www.typescriptlang.org/" target="_blank" rel="noopener noreferrer">TypeScript</a>, as well as to create Web applications that interact with NEAR.</p>
<div class="codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#bfc7d5;background-color:#292d3e"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token plain"># installs nvm (Node Version Manager)</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"># download and install Node.js</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">nvm install 20</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"># verifies the right Node.js version is in the environment</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">node -v # should print `v20.14.0`</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"># verifies the right NPM version is in the environment</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">npm -v # should print `10.7.0`</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<p><strong>Read more:</strong>
<a href="https://nodejs.org/" target="_blank" rel="noopener noreferrer">NodeJS Website</a></p>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="rust">Rust<a href="https://goffxnca.github.io/docs/zh-CN/blog/getting-started-on-windows#rust" class="hash-link" aria-label="Rust的直接链接" title="Rust的直接链接">​</a></h4>
<p><a href="https://www.rust-lang.org/" target="_blank" rel="noopener noreferrer">Rust</a> is a programming language known for its safety and performance. It's used in NEAR development to write secure and efficient smart contracts.</p>
<p>Next, we need to add the <code>wasm32-unknown-unknown</code> toolchain. This toolchain is required because the contracts we build will be compiled to <a href="https://webassembly.org/" target="_blank" rel="noopener noreferrer">WASM</a> to run on the NEAR blockchain.</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#bfc7d5;background-color:#292d3e"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token function" style="color:rgb(130, 170, 255)">curl</span><span class="token plain"> </span><span class="token parameter variable" style="color:rgb(191, 199, 213)">--proto</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">'=https'</span><span class="token plain"> </span><span class="token parameter variable" style="color:rgb(191, 199, 213)">--tlsv1.2</span><span class="token plain"> </span><span class="token parameter variable" style="color:rgb(191, 199, 213)">-sSf</span><span class="token plain"> https://sh.rustup.rs </span><span class="token operator" style="color:rgb(137, 221, 255)">|</span><span class="token plain"> </span><span class="token function" style="color:rgb(130, 170, 255)">sh</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic"># When prompted, press enter for default install options</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">.</span><span class="token plain"> </span><span class="token builtin class-name" style="color:rgb(255, 203, 107)">source</span><span class="token plain"> </span><span class="token environment constant" style="color:rgb(130, 170, 255)">$HOME</span><span class="token plain">/.cargo/env</span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">rustup target </span><span class="token function" style="color:rgb(130, 170, 255)">add</span><span class="token plain"> wasm32-unknown-unknown</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<p><strong>Read more:</strong>
<a href="https://www.rust-lang.org/learn/get-started" target="_blank" rel="noopener noreferrer">Getting Started with Rust</a></p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="thats-it">That's It<a href="https://goffxnca.github.io/docs/zh-CN/blog/getting-started-on-windows#thats-it" class="hash-link" aria-label="That's It的直接链接" title="That's It的直接链接">​</a></h3>
<p>At this point, we are ready to install the relevant tooling and start building on NEAR. Head over to the <a href="http://docs.near.org/build/smart-contracts/quickstart" target="_blank" rel="noopener noreferrer">Quickstart</a> section of the docs for more information or jump right into the <a href="https://github.com/near-examples" target="_blank" rel="noopener noreferrer">examples</a>.</p>]]></content>
        <author>
            <name>Lyudmil</name>
            <uri>https://github.com/flmel</uri>
        </author>
        <category label="windows" term="windows"/>
        <category label="tutorial" term="tutorial"/>
        <category label="getting-started" term="getting-started"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[It's gonna be Legen... wait for it...]]></title>
        <id>https://goffxnca.github.io/docs/zh-CN/blog/yield-resume</id>
        <link href="https://goffxnca.github.io/docs/zh-CN/blog/yield-resume"/>
        <updated>2024-05-30T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[dary! Legendary! NEAR protocol is getting updated with the ability to yield and resume computations]]></summary>
        <content type="html"><![CDATA[<p><em>dary! Legendary! NEAR protocol is getting updated with the ability to yield and resume computations</em></p>
<p><img decoding="async" loading="lazy" alt="waiting on a loop" src="https://goffxnca.github.io/docs/zh-CN/assets/images/legendary-c6675258ceadd49e3a9be41e3681b136.jpg" width="798" height="347" class="img_ev3q"></p>
<div class="theme-admonition theme-admonition-tip admonition_xJq3 alert alert--success"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>🎉 September Update 🎉</div><div class="admonitionContent_BuS1"><p>We now have an <a href="https://github.com/near-examples/yield-resume" target="_blank" rel="noopener noreferrer">example of how to use <code>yield</code> and <code>resume</code></a> in your contracts. Check it out!</p><p>There is also a new documentation page on <a href="https://goffxnca.github.io/docs/zh-CN/build/smart-contracts/anatomy/yield-resume">Yield and Resume</a> that explains how to use this feature</p></div></div>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="the-problem-of-waiting">The problem of waiting<a href="https://goffxnca.github.io/docs/zh-CN/blog/yield-resume#the-problem-of-waiting" class="hash-link" aria-label="The problem of waiting的直接链接" title="The problem of waiting的直接链接">​</a></h2>
<p>Currently, smart contracts have no way to wait for an external event to happen. This can be a problem when the contract relies on an external service to provide a result.</p>
<p>We encountered this issue while implementing <a href="https://goffxnca.github.io/docs/zh-CN/concepts/abstraction/chain-signatures">Chain Signatures</a>, which work by requiring an external service to provide a signature.</p>
<p>Until now, the only workaround has been to make the contract call itself in a loop, checking on each iteration if the result is ready. Each call delays the result by one block (~1 second), allowing the contract to wait almost a minute before running out of gas.</p>
<p><img decoding="async" loading="lazy" alt="waiting on a loop" src="https://goffxnca.github.io/docs/zh-CN/assets/images/contract-wait-loop-c7b128ab1982ad80e9f40a7dfe4ddaea.png" width="1346" height="842" class="img_ev3q">
<em>Until now, contracts had to wait by calling themselves until a external service replies... more often than not the contract will run out of gas waiting</em></p>
<p>While this method works, it's far from ideal. It wastes a lot of gas on looping and - more often than not - runs out of gas, forcing the user to retry the transaction.</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="yield-and-resume">Yield and Resume<a href="https://goffxnca.github.io/docs/zh-CN/blog/yield-resume#yield-and-resume" class="hash-link" aria-label="Yield and Resume的直接链接" title="Yield and Resume的直接链接">​</a></h2>
<p>Starting from version <code>1.40</code> of the protocol, developers can <strong>delay the execution</strong> of a function until certain conditions are met (e.g. an external service provides a result).</p>
<p>This way, instead of the contract calling itself on a loop waiting, the contract can simply <strong>yield</strong> calling the function that gives the result. When an external response is provided, the contract will <strong>resume</strong> and return the result.</p>
<p><img decoding="async" loading="lazy" alt="waiting on a yield" src="https://goffxnca.github.io/docs/zh-CN/assets/images/contract-wait-yield-6820c700955fe4e6942fb9fdc619aa77.png" width="1355" height="842" class="img_ev3q">
<em>Contracts can now yield the execution of a function until an external service signals that the result is ready</em></p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="what-is-exactly-being-yielded">What is exactly being yielded?<a href="https://goffxnca.github.io/docs/zh-CN/blog/yield-resume#what-is-exactly-being-yielded" class="hash-link" aria-label="What is exactly being yielded?的直接链接" title="What is exactly being yielded?的直接链接">​</a></h3>
<p>It is important to notice that the contract is not <strong>halting</strong> or <strong>blocking</strong> its ability to execute, nor <strong>halting in the middle of a function</strong> to later resume it.</p>
<p>In the same way that a function can return a promise to call another contract, now a function can return a <strong>yield</strong> to call another function.</p>
<p>Indeed, the contract is not halting, but simply <strong>delaying the execution of a callback</strong> until an external agent signals that it is ok to resume.</p>
<p>If the contract does not trigger a resume after 200 blocks - around 4 minutes - the yielded function will resume receiving a "timeout error" as input.</p>
<div class="theme-admonition theme-admonition-warning admonition_xJq3 alert alert--warning"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"></path></svg></span>State Changes</div><div class="admonitionContent_BuS1"><p>People can keep calling functions on the contract between a <code>yield</code>/<code>resume</code>, and the function that creates the <code>yield</code> can be called multiple times.</p><p>The state <strong>can change</strong> between the <code>yield</code> and the <code>resume</code>, since people can keep interacting with the contract.</p><p>Moreover, since the function used to signal is public, developers must make sure to guard it properly to avoid unwanted calls. This can be done by simply checking the caller of the function.</p></div></div>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="how-does-it-change-for-the-user">How does it change for the user?<a href="https://goffxnca.github.io/docs/zh-CN/blog/yield-resume#how-does-it-change-for-the-user" class="hash-link" aria-label="How does it change for the user?的直接链接" title="How does it change for the user?的直接链接">​</a></h3>
<p>Between the <code>yield</code> and <code>resume</code> the user will simply be waiting to receive the result. But, in contrast with waiting on a loop, the user will not pay GAS just for having the contract waiting!</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="how-i-can-use-yieldresume-in-my-contract">How I can use yield/resume in my contract?<a href="https://goffxnca.github.io/docs/zh-CN/blog/yield-resume#how-i-can-use-yieldresume-in-my-contract" class="hash-link" aria-label="How I can use yield/resume in my contract?的直接链接" title="How I can use yield/resume in my contract?的直接链接">​</a></h2>
<p>While we have not created any official <code>yield/resume</code> example, you can refer to <a href="https://github.com/near/near-sdk-rs/pull/1133/files" target="_blank" rel="noopener noreferrer">Saketh Are's example</a>, who has been working on the <code>yield/resume</code> implementation.</p>
<p>The basic idea is that the SDK now exposes two functions:</p>
<ul>
<li>A <code>yield(function_to_yield)</code> that returns a <code>yield_ID</code> which identifies the yield</li>
<li>A <code>resume(yield_ID)</code> that signals which instance of <code>function_to_yield</code> can now execute</li>
</ul>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="simplified-example">Simplified Example<a href="https://goffxnca.github.io/docs/zh-CN/blog/yield-resume#simplified-example" class="hash-link" aria-label="Simplified Example的直接链接" title="Simplified Example的直接链接">​</a></h4>
<div class="language-rust codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#bfc7d5;--prism-background-color:#292d3e"><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-rust codeBlock_bY9V thin-scrollbar" style="color:#bfc7d5;background-color:#292d3e"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#bfc7d5"><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic">// const DATA_ID_REGISTER: u64 = 0;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token keyword" style="font-style:italic">pub</span><span class="token plain"> </span><span class="token keyword" style="font-style:italic">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:rgb(130, 170, 255)">request_weather</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token operator" style="color:rgb(137, 221, 255)">&amp;</span><span class="token keyword" style="font-style:italic">mut</span><span class="token plain"> </span><span class="token keyword" style="font-style:italic">self</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> city</span><span class="token punctuation" style="color:rgb(199, 146, 234)">:</span><span class="token plain"> </span><span class="token class-name" style="color:rgb(255, 203, 107)">String</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token keyword" style="font-style:italic">let</span><span class="token plain"> index </span><span class="token operator" style="color:rgb(137, 221, 255)">=</span><span class="token plain"> </span><span class="token keyword" style="font-style:italic">self</span><span class="token punctuation" style="color:rgb(199, 146, 234)">.</span><span class="token plain">next_available_request_index</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token keyword" style="font-style:italic">self</span><span class="token punctuation" style="color:rgb(199, 146, 234)">.</span><span class="token plain">next_available_request_index </span><span class="token operator" style="color:rgb(137, 221, 255)">+=</span><span class="token plain"> </span><span class="token number" style="color:rgb(247, 140, 108)">1</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token keyword" style="font-style:italic">let</span><span class="token plain"> yield_promise </span><span class="token operator" style="color:rgb(137, 221, 255)">=</span><span class="token plain"> </span><span class="token namespace" style="color:rgb(178, 204, 214)">env</span><span class="token namespace punctuation" style="color:rgb(199, 146, 234)">::</span><span class="token function" style="color:rgb(130, 170, 255)">promise_yield_create</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">        </span><span class="token string" style="color:rgb(195, 232, 141)">"callback_return_result"</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">        </span><span class="token operator" style="color:rgb(137, 221, 255)">&amp;</span><span class="token namespace" style="color:rgb(178, 204, 214)">serde_json</span><span class="token namespace punctuation" style="color:rgb(199, 146, 234)">::</span><span class="token function" style="color:rgb(130, 170, 255)">to_vec</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token operator" style="color:rgb(137, 221, 255)">&amp;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token plain">index</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">.</span><span class="token function" style="color:rgb(130, 170, 255)">unwrap</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">        </span><span class="token constant" style="color:rgb(130, 170, 255)">SIGN_ON_FINISH_CALL_GAS</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">        </span><span class="token class-name" style="color:rgb(255, 203, 107)">GasWeight</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token number" style="color:rgb(247, 140, 108)">0</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">        </span><span class="token constant" style="color:rgb(130, 170, 255)">DATA_ID_REGISTER</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic">// Store the request, so an external service can easily fetch it</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic">// This is optional, as an indexer could simply observe it in the receipts</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token keyword" style="font-style:italic">let</span><span class="token plain"> data_id</span><span class="token punctuation" style="color:rgb(199, 146, 234)">:</span><span class="token plain"> </span><span class="token class-name" style="color:rgb(255, 203, 107)">CryptoHash</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">=</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">        </span><span class="token namespace" style="color:rgb(178, 204, 214)">env</span><span class="token namespace punctuation" style="color:rgb(199, 146, 234)">::</span><span class="token function" style="color:rgb(130, 170, 255)">read_register</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token constant" style="color:rgb(130, 170, 255)">DATA_ID_REGISTER</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">.</span><span class="token function" style="color:rgb(130, 170, 255)">expect</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token string" style="color:rgb(195, 232, 141)">""</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">.</span><span class="token function" style="color:rgb(130, 170, 255)">try_into</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">.</span><span class="token function" style="color:rgb(130, 170, 255)">expect</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token string" style="color:rgb(195, 232, 141)">""</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token keyword" style="font-style:italic">self</span><span class="token punctuation" style="color:rgb(199, 146, 234)">.</span><span class="token plain">requests</span><span class="token punctuation" style="color:rgb(199, 146, 234)">.</span><span class="token function" style="color:rgb(130, 170, 255)">insert</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token operator" style="color:rgb(137, 221, 255)">&amp;</span><span class="token plain">index</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token class-name" style="color:rgb(255, 203, 107)">WeatherRequest</span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token operator" style="color:rgb(137, 221, 255)">&amp;</span><span class="token plain">data_id</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">&amp;</span><span class="token plain">city</span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic">// The return will be the result of "callback_return_result" (defined below)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token namespace" style="color:rgb(178, 204, 214)">env</span><span class="token namespace punctuation" style="color:rgb(199, 146, 234)">::</span><span class="token function" style="color:rgb(130, 170, 255)">promise_return</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token plain">yield_promise</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic">/// Called by external participants to submit a response</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token keyword" style="font-style:italic">pub</span><span class="token plain"> </span><span class="token keyword" style="font-style:italic">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:rgb(130, 170, 255)">respond</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token operator" style="color:rgb(137, 221, 255)">&amp;</span><span class="token keyword" style="font-style:italic">mut</span><span class="token plain"> </span><span class="token keyword" style="font-style:italic">self</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> data_id</span><span class="token punctuation" style="color:rgb(199, 146, 234)">:</span><span class="token plain"> </span><span class="token class-name" style="color:rgb(255, 203, 107)">String</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> weather</span><span class="token punctuation" style="color:rgb(199, 146, 234)">:</span><span class="token plain"> </span><span class="token class-name" style="color:rgb(255, 203, 107)">String</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token keyword" style="font-style:italic">let</span><span class="token plain"> </span><span class="token keyword" style="font-style:italic">mut</span><span class="token plain"> data_id_buf </span><span class="token operator" style="color:rgb(137, 221, 255)">=</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">[</span><span class="token number" style="color:rgb(247, 140, 108)">0u8</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"> </span><span class="token number" style="color:rgb(247, 140, 108)">32</span><span class="token punctuation" style="color:rgb(199, 146, 234)">]</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token namespace" style="color:rgb(178, 204, 214)">hex</span><span class="token namespace punctuation" style="color:rgb(199, 146, 234)">::</span><span class="token function" style="color:rgb(130, 170, 255)">decode_to_slice</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token plain">data_id</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">&amp;</span><span class="token keyword" style="font-style:italic">mut</span><span class="token plain"> data_id_buf</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">.</span><span class="token function" style="color:rgb(130, 170, 255)">expect</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token string" style="color:rgb(195, 232, 141)">""</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token keyword" style="font-style:italic">let</span><span class="token plain"> data_id </span><span class="token operator" style="color:rgb(137, 221, 255)">=</span><span class="token plain"> data_id_buf</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic">// check that caller is allowed to respond, weather is valid, etc.</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic">// ...</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token macro property">log!</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token string" style="color:rgb(195, 232, 141)">"submitting response {} for data id {:?}"</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">&amp;</span><span class="token plain">weather</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">&amp;</span><span class="token plain">data_id</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token namespace" style="color:rgb(178, 204, 214)">env</span><span class="token namespace punctuation" style="color:rgb(199, 146, 234)">::</span><span class="token function" style="color:rgb(130, 170, 255)">promise_yield_resume</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token operator" style="color:rgb(137, 221, 255)">&amp;</span><span class="token plain">data_id</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">&amp;</span><span class="token namespace" style="color:rgb(178, 204, 214)">serde_json</span><span class="token namespace punctuation" style="color:rgb(199, 146, 234)">::</span><span class="token function" style="color:rgb(130, 170, 255)">to_vec</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token operator" style="color:rgb(137, 221, 255)">&amp;</span><span class="token plain">weather</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">.</span><span class="token function" style="color:rgb(130, 170, 255)">unwrap</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic">/// Callback receiving the external data (or a PromiseError in case of timeout)</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token keyword" style="font-style:italic">pub</span><span class="token plain"> </span><span class="token keyword" style="font-style:italic">fn</span><span class="token plain"> </span><span class="token function-definition function" style="color:rgb(130, 170, 255)">callback_return_result</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token operator" style="color:rgb(137, 221, 255)">&amp;</span><span class="token keyword" style="font-style:italic">mut</span><span class="token plain"> </span><span class="token keyword" style="font-style:italic">self</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    request_index</span><span class="token punctuation" style="color:rgb(199, 146, 234)">:</span><span class="token plain"> </span><span class="token keyword" style="font-style:italic">u64</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token attribute attr-name" style="color:rgb(255, 203, 107)">#[callback_result]</span><span class="token plain"> weather</span><span class="token punctuation" style="color:rgb(199, 146, 234)">:</span><span class="token plain"> </span><span class="token class-name" style="color:rgb(255, 203, 107)">Result</span><span class="token operator" style="color:rgb(137, 221, 255)">&lt;</span><span class="token class-name" style="color:rgb(255, 203, 107)">String</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"> </span><span class="token class-name" style="color:rgb(255, 203, 107)">PromiseError</span><span class="token operator" style="color:rgb(137, 221, 255)">&gt;</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">-&gt;</span><span class="token plain"> </span><span class="token class-name" style="color:rgb(255, 203, 107)">String</span><span class="token plain"> </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token comment" style="color:rgb(105, 112, 152);font-style:italic">// Clean up the local state</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token keyword" style="font-style:italic">self</span><span class="token punctuation" style="color:rgb(199, 146, 234)">.</span><span class="token plain">requests</span><span class="token punctuation" style="color:rgb(199, 146, 234)">.</span><span class="token function" style="color:rgb(130, 170, 255)">remove</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token operator" style="color:rgb(137, 221, 255)">&amp;</span><span class="token plain">request_index</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">;</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain" style="display:inline-block"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token keyword" style="font-style:italic">match</span><span class="token plain"> weather </span><span class="token punctuation" style="color:rgb(199, 146, 234)">{</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">        </span><span class="token class-name" style="color:rgb(255, 203, 107)">Ok</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token plain">weather</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">=&gt;</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">"weather received: "</span><span class="token punctuation" style="color:rgb(199, 146, 234)">.</span><span class="token function" style="color:rgb(130, 170, 255)">to_owned</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">+</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">&amp;</span><span class="token plain">weather</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">        </span><span class="token class-name" style="color:rgb(255, 203, 107)">Err</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token plain">_</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token plain"> </span><span class="token operator" style="color:rgb(137, 221, 255)">=&gt;</span><span class="token plain"> </span><span class="token string" style="color:rgb(195, 232, 141)">"request timed out"</span><span class="token punctuation" style="color:rgb(199, 146, 234)">.</span><span class="token function" style="color:rgb(130, 170, 255)">to_string</span><span class="token punctuation" style="color:rgb(199, 146, 234)">(</span><span class="token punctuation" style="color:rgb(199, 146, 234)">)</span><span class="token punctuation" style="color:rgb(199, 146, 234)">,</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain">    </span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><span class="token plain"></span><br></span><span class="token-line" style="color:#bfc7d5"><span class="token plain"></span><span class="token punctuation" style="color:rgb(199, 146, 234)">}</span><br></span></code></pre><div class="buttonGroup__atx"><button type="button" aria-label="复制代码到剪贴板" title="复制" class="clean-btn"><span class="copyButtonIcons_eSgA" aria-hidden="true"><svg viewBox="0 0 24 24" class="copyButtonIcon_y97N"><path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"></path></svg><svg viewBox="0 0 24 24" class="copyButtonSuccessIcon_LjdS"><path fill="currentColor" d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"></path></svg></span></button></div></div></div>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="conclusion">Conclusion<a href="https://goffxnca.github.io/docs/zh-CN/blog/yield-resume#conclusion" class="hash-link" aria-label="Conclusion的直接链接" title="Conclusion的直接链接">​</a></h2>
<p>The ability to <code>yield</code> and <code>resume</code> computations is a big step forward for the NEAR protocol, as it enables developers to create contracts that rely on external services.</p>
<p>Currently, the feature is only <strong>available on testnet</strong>, and we are looking for feedback on how to improve it.</p>
<p>We expect to have a more user-friendly way to use <code>yield</code> and <code>resume</code> in the future, so stay tuned!</p>]]></content>
        <author>
            <name>Guille</name>
            <uri>https://github.com/gagdiez</uri>
        </author>
        <category label="protocol" term="protocol"/>
        <category label="updates" term="updates"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Use cases for Chain Signatures]]></title>
        <id>https://goffxnca.github.io/docs/zh-CN/blog/chain-signatures-use-cases</id>
        <link href="https://goffxnca.github.io/docs/zh-CN/blog/chain-signatures-use-cases"/>
        <updated>2024-05-15T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Chain signatures enable you to implement multichain and cross-chain workflows in a simple way. Let's take a look at a few possible use cases]]></summary>
        <content type="html"><![CDATA[<p><em>Chain signatures enable you to implement multichain and cross-chain workflows in a simple way. Let's take a look at a few possible use cases</em></p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="trade-blockchain-assets-without-transactions">Trade Blockchain assets without transactions<a href="https://goffxnca.github.io/docs/zh-CN/blog/chain-signatures-use-cases#trade-blockchain-assets-without-transactions" class="hash-link" aria-label="Trade Blockchain assets without transactions的直接链接" title="Trade Blockchain assets without transactions的直接链接">​</a></h2>
<p>Trading assets across different blockchains usually requires using a bridge that supports them, bringing longer settlement times as the trades are not atomic and require confirmation on both blockchains.</p>
<p>Using Chain signatures, you can trade assets across chains simply swapping the ownership of NEAR accounts that control funds on different blockchains. For example, you could trade a NEAR account that controls a Bitcoin account with <code>X BTC</code> for another NEAR account that controls an Ethereum account with <code>Y ETH</code>.</p>
<p>This way, you can keep native tokens on their native blockchain (e.g., <code>BTC</code> on Bitcoin, <code>ETH</code> on Ethereum, <code>ARB</code> on Arbitrum) and trade them without bridges.
As an added bonus, trades are atomic across chains, settlement takes just 2 seconds, and supports any token on any chain.</p>
<div class="theme-admonition theme-admonition-tip admonition_xJq3 alert alert--success"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>Keep in mind</div><div class="admonitionContent_BuS1"><p>There are transactions happening on different blockchains.
The difference is that a <a href="https://goffxnca.github.io/docs/zh-CN/concepts/abstraction/chain-signatures#multi-party-computation-service">Multi-Party Computation service</a> (MPC) signs a transaction for you, and that transaction is then broadcast to another blockchain RPC node or API.</p></div></div>
<p>For example, a basic trade flow could be:</p>
<ol>
<li>Users create an account controlled by NEAR chain signatures</li>
<li>Users funds these accounts on the native blockchains (depositing)</li>
<li>Place orders by funding a new account for the total amount of the order</li>
<li>Another user accepts the order</li>
<li>Users swap control of the keys to fulfill the order</li>
</ol>
<p><img decoding="async" loading="lazy" alt="docs" src="https://goffxnca.github.io/docs/zh-CN/assets/images/native-cross-chain-2454256fad26d63241b5d3caeb6d9e9a.png" width="2464" height="1140" class="img_ev3q"></p>
<details class="details_lb9f alert alert--info details_b_Ee" data-collapsed="true"><summary>Details</summary><div><div class="collapsibleContent_i85q"><ul>
<li>User A has <code>ETH</code> on the Ethereum blockchain, and wants to buy native Bitcoin</li>
<li>User B wants to sell Bitcoin for Ethereum</li>
</ul><p><strong>Steps</strong></p><ol>
<li>User B, using NEAR, creates and funds a new account on Bitcoin with 1 <code>BTC</code></li>
<li>User B, using the spot marketplace smart contract, signs a transaction to create a limit order. This transfers control of the Bitcoin account to the smart contract</li>
<li>User A creates a batch transaction with two steps<!-- -->
<ul>
<li>Creating and funding a new Ethereum account with 10 <code>ETH</code></li>
<li>Accepting the order and atomically swapping control of the accounts</li>
</ul>
</li>
<li>User A takes ownership of the Bitcoin account with 1 <code>BTC</code>, and User B takes ownership of the Ethereum account with 10 <code>ETH</code></li>
<li>User A and B can <em>"withdraw"</em> their asset from the order by transferring the assets to their respective <em>"main"</em> accounts</li>
</ol></div></div></details>
<hr>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="oauth-controlled-blockchain-accounts">Oauth-controlled Blockchain accounts<a href="https://goffxnca.github.io/docs/zh-CN/blog/chain-signatures-use-cases#oauth-controlled-blockchain-accounts" class="hash-link" aria-label="Oauth-controlled Blockchain accounts的直接链接" title="Oauth-controlled Blockchain accounts的直接链接">​</a></h2>
<p>On-boarding is a huge problem for decentralized applications. If you want widespread adoption you can't expect people to keep seed phrases safe in order to use an application.</p>
<p>An attractive way of managing Web3 accounts is to use existing Web2 accounts to on-board users. This can be done in the following way:</p>
<ol>
<li>Deploy a NEAR contract that allows the bearer of a user's <a href="https://jwt.io/" target="_blank" rel="noopener noreferrer">JWT token</a> to sign a blockchain transaction (Ethereum, Polygon, Avalanche, and others)</li>
<li>The user validates their identity with a third-party receiving a JWT Token</li>
<li>The user holding that token can interact with blockchain applications on Ethereum/Polygon/+++ via the NEAR contract for the duration of its validity</li>
</ol>
<p>Any method of controlling a NEAR account can also be used to control a cross-chain account.</p>
<div class="theme-admonition theme-admonition-info admonition_xJq3 alert alert--info"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>About JWT tokens</div><div class="admonitionContent_BuS1"><p>JSON Web Tokens are a standard RFC 7519 method for representing claims securely between two parties. They are used in this example to represent the claim that someone is the owner of an Oauth account.</p></div></div>
<hr>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="cross-chain-zero-friction-onboarding">Cross-chain Zero-friction onboarding<a href="https://goffxnca.github.io/docs/zh-CN/blog/chain-signatures-use-cases#cross-chain-zero-friction-onboarding" class="hash-link" aria-label="Cross-chain Zero-friction onboarding的直接链接" title="Cross-chain Zero-friction onboarding的直接链接">​</a></h2>
<p>Using unique features of the NEAR account model, <a href="https://docs.keypom.xyz/" target="_blank" rel="noopener noreferrer">Keypom</a> provides zero-friction onboarding and transactions on NEAR. They are generally used for NFT drops, FT drops, and ticketing.</p>
<p>A generic Keypom user-flow could be:</p>
<ol>
<li>The developer creates a restricted NEAR account</li>
<li>The account is funded with <code>NEAR</code></li>
<li>The user receives a key with limited control of the account</li>
<li>The user uses the funded account to call controlled endpoints on NEAR</li>
<li>The user returns the remaining funds to the developer and their account is unlocked</li>
</ol>
<div class="theme-admonition theme-admonition-tip admonition_xJq3 alert alert--success"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>提示</div><div class="admonitionContent_BuS1"><p>This allows easy onboarding to decentralized apps. The accounts are initially restricted to prevent the user being able to simply withdraw the <code>NEAR</code> from the account.</p></div></div>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="defi-on-bitcoin-and-other-non-smart-contract-chains">DeFi on Bitcoin (and other non-smart contract chains).<a href="https://goffxnca.github.io/docs/zh-CN/blog/chain-signatures-use-cases#defi-on-bitcoin-and-other-non-smart-contract-chains" class="hash-link" aria-label="DeFi on Bitcoin (and other non-smart contract chains).的直接链接" title="DeFi on Bitcoin (and other non-smart contract chains).的直接链接">​</a></h2>
<p>Using chain signatures, smart contracts on NEAR can control externally-owned accounts on non-smart contract chains like Bitcoin, Dogecoin, XRP Ledger, Bittensor, Cosmos Hub, etc. This enables developers to use NEAR as a smart contract “layer” for chains that do not support this functionality natively.</p>
<p>For example, a developer can build a decentralized exchange for Bitcoin Ordinals, using a smart contract on NEAR to manage deposits (into Bitcoin addresses controlled by the contract) and to verify and execute swaps when two users agree to trade BTC for an Ordinal or BRC20 token.</p>
<p>Example:</p>
<ol>
<li>Seller generates a deposit address on Bitcoin that is controlled by the marketplace smart contract on NEAR via chain signatures</li>
<li>Seller deposits a Bitcoin Ordinal to the deposit address</li>
<li>The Ordinal is listed for sale with a price and a pre-commitment signature from the seller</li>
<li>Buyer accepts the order, deposits USDC</li>
<li>The control of the Bitcoin Ordinal address is given to the buyer, USDC on NEAR is transferred to the seller</li>
</ol>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="using-chain-signatures">Using Chain Signatures<a href="https://goffxnca.github.io/docs/zh-CN/blog/chain-signatures-use-cases#using-chain-signatures" class="hash-link" aria-label="Using Chain Signatures的直接链接" title="Using Chain Signatures的直接链接">​</a></h4>
<p>With Chain Signatures you can do the same but across many chains, for example Polygon:</p>
<ol>
<li>The developer creates a restricted NEAR account with a key</li>
<li>The account is funded with <code>NEAR</code> and <code>MATIC</code></li>
<li>The user receives a key with limited control of the account</li>
<li>The user uses the funded account to sign payloads calling controlled endpoints on Polygon</li>
<li>The user returns the remaining funds to the developer and their account is unlocked</li>
</ol>
<p>This allows developers to pay for users to use arbitrary contracts on arbitrary chains.</p>
<hr>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="decentralized-clients">Decentralized Clients<a href="https://goffxnca.github.io/docs/zh-CN/blog/chain-signatures-use-cases#decentralized-clients" class="hash-link" aria-label="Decentralized Clients的直接链接" title="Decentralized Clients的直接链接">​</a></h2>
<p>A big problem in decentralized applications is that while the smart contracts are tamper-proof, the clients that access them generally are not. This allows practically complete control over any user account provided they are using the frontend assets that you serve. This has security, trust, and regulatory implications.</p>
<p>When smart contracts can sign payloads you can start using <a href="https://wicg.github.io/webpackage/draft-yasskin-http-origin-signed-responses.html#name-introduction" target="_blank" rel="noopener noreferrer">signed exchanges</a> (or polyfills) to require HTTP exchanges to be signed by a certain key. If it is not signed with this key the SSL certificate is considered invalid. This means that individual users cannot be served invalid frontends without it being generally observable and non repudiable.</p>
<hr>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="communication-with-private-near-shards">Communication with private NEAR Shards<a href="https://goffxnca.github.io/docs/zh-CN/blog/chain-signatures-use-cases#communication-with-private-near-shards" class="hash-link" aria-label="Communication with private NEAR Shards的直接链接" title="Communication with private NEAR Shards的直接链接">​</a></h2>
<p>Companies like <a href="https://www.calimero.network/" target="_blank" rel="noopener noreferrer">Calimero</a> offer private NEAR shards. Currently, sending messages to and from these NEAR shards is troublesome. If each shard had the ability to sign their message queues, they could be securely sent from one shard to another. Thus you could communicate bidirectionally with any shard as easily as you can with a contract on your own shard.</p>
<div class="theme-admonition theme-admonition-tip admonition_xJq3 alert alert--success"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>提示</div><div class="admonitionContent_BuS1"><p>This could also simplify NEAR's sharding model, by treating each NEAR shard like one would a private shard.</p></div></div>]]></content>
        <author>
            <name>Damian</name>
            <uri>https://github.com/bucanero</uri>
        </author>
        <category label="docusaurus" term="docusaurus"/>
        <category label="updates" term="updates"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Reorganizing our docs]]></title>
        <id>https://goffxnca.github.io/docs/zh-CN/blog/reorganizing-docs</id>
        <link href="https://goffxnca.github.io/docs/zh-CN/blog/reorganizing-docs"/>
        <updated>2024-04-24T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[We released a mayor reorganization of our repository, so we can improve docs for everyone... including us]]></summary>
        <content type="html"><![CDATA[<p><em>We released a mayor reorganization of our repository, so we can improve docs for everyone... including us</em></p>
<p><img src="https://img.freepik.com/free-photo/ancient-books-adorn-library-carefully-arranged-with-classics-rare-gems_157027-2332.jpg"></p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="organic-growth">Organic growth<a href="https://goffxnca.github.io/docs/zh-CN/blog/reorganizing-docs#organic-growth" class="hash-link" aria-label="Organic growth的直接链接" title="Organic growth的直接链接">​</a></h2>
<p>Our documentation is the result of multiple people collaborating across the span of four very active years, and it has seen a lot of changes: <a href="https://github.com/near/docs/commits/master/" target="_blank" rel="noopener noreferrer">2942 commits and counting</a>.</p>
<p>In the beginning, our docs only needed to explain how to create <a href="https://goffxnca.github.io/docs/zh-CN/build/smart-contracts/what-is">smart contracts</a>, and how to <a href="https://goffxnca.github.io/docs/zh-CN/build/web3-apps/quickstart">interact with them through a frontend</a>. Fast forward to today, and we have more than 200 pages of documentation, covering topics such as <a href="https://goffxnca.github.io/docs/zh-CN/build/chain-abstraction/what-is">chain abstraction</a>, <a href="https://goffxnca.github.io/docs/zh-CN/build/near-components/what-is">on-chain components</a>, <a href="https://goffxnca.github.io/docs/zh-CN/build/data-infrastructure/what-is">data infrastructure</a>, and <a href="https://goffxnca.github.io/docs/zh-CN/build/primitives/what-is">primitives such as NFT, FT</a>.</p>
<p>The best thing is that new features are released every single month. However, all progress comes at a cost, and as our ecosystem grew, so did the disorganization of our documentation.</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="what-link-was-that-again">What link was that again?<a href="https://goffxnca.github.io/docs/zh-CN/blog/reorganizing-docs#what-link-was-that-again" class="hash-link" aria-label="What link was that again?的直接链接" title="What link was that again?的直接链接">​</a></h2>
<p>Let's briefly explain how <a href="https://docusaurus.io/" target="_blank" rel="noopener noreferrer">docusaurus</a> (the framework we use in our docs) works so you can understand the problem.</p>
<p>In docusaurus, all the pages are written as simple markdown files. These files go inside the <code>./docs</code> folder, and can be organized in folders. Each file has a unique ID on its header that identifies it (e.g. <code>id: what-is</code>), and this ID, alongside its folder path, is used to generate the URL.</p>
<blockquote>
<p>For example, the document <a href="https://github.com/near/docs/blob/master/docs/2.build/2.smart-contracts/what-is.md" target="_blank" rel="noopener noreferrer"><code>docs/build/smart-contracts/what-is.md</code></a> has the <code>id: what-is</code>, so it ends being served in the URL <a href="https://docs.near.org/build/smart-contracts/what-is" target="_blank" rel="noopener noreferrer">https://docs.near.org/build/smart-contracts/what-is</a>.</p>
</blockquote>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="the-problem">The problem<a href="https://goffxnca.github.io/docs/zh-CN/blog/reorganizing-docs#the-problem" class="hash-link" aria-label="The problem的直接链接" title="The problem的直接链接">​</a></h3>
<p>About a year ago, we noticed that our organic growth had left us with a very inconsistent URL structure. Basically, we had a lot of folders, and the files related to the same topic (e.g. NEAR components) would be all over the place.</p>
<p>For example, you would be in the "Build" section reading about "What is a NEAR Component?" and the URL was <code>/bos/tutorial/quickstart</code>. The next page was "Setup an Environment" located at <code>/bos/dev/intro</code>, followed by "Anatomy of a Component -&gt; State" at <code>/bos/api/state</code>. Talk about consistency!</p>
<p>Of course, we did not do this on purpose, it is just how things evolved. You might even notice that we are now talking about "NEAR Components" but the URL talks about "BOS". This is because when we started, "BOS" (Blockchain Operating System) felt like a good name, but community feedback made us know that, indeed, it was not.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="the-migration">The migration<a href="https://goffxnca.github.io/docs/zh-CN/blog/reorganizing-docs#the-migration" class="hash-link" aria-label="The migration的直接链接" title="The migration的直接链接">​</a></h3>
<p>We <a href="https://github.com/near/docs/pull/1890/files" target="_blank" rel="noopener noreferrer">re-organized more than 200 files</a> to a new structure that is more consistent. This makes it easier for users to remember the URLs, improves our SEO, and makes it easier for contributors to find where to add new content. No more need to search across multiple folders trying to find the right file!</p>
<p>In the process, we updated all <strong>internal links</strong>, aided by our <a href="https://github.com/near/docs/blob/master/website/test-links.sh" target="_blank" rel="noopener noreferrer">link-checker script</a> to make sure we left <strong>no broken links</strong>. We also added <strong>URL redirects</strong> in our server, so all users coming from an external site are redirected to the correct URLs.</p>
<p>Besides checking broken links, we took the time to make sure all the <strong>translations were correctly migrated</strong>. The system Docusaurus uses (called <a href="https://crowdin.com/" target="_blank" rel="noopener noreferrer">Crowdin</a>) is not very good at detecting changes in a file, so migrating all the translations was a huge effort in itself.</p>
<p>We could write a blog post just about migrating translations in docusaurus + crowdin... but we will spare you the pain.</p>
<div class="theme-admonition theme-admonition-tip admonition_xJq3 alert alert--success"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>Missing URL</div><div class="admonitionContent_BuS1"><p>If you come across a URL that is not working, please let us know by using the <code>Feedback</code> button on the right side of the page, or by opening an <a href="https://github.com/near/docs/issues" target="_blank" rel="noopener noreferrer">issue in our repository</a></p></div></div>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="whats-next">What's next<a href="https://goffxnca.github.io/docs/zh-CN/blog/reorganizing-docs#whats-next" class="hash-link" aria-label="What's next的直接链接" title="What's next的直接链接">​</a></h2>
<p>Now that most of our documentation is in a better shape, we can focus on improving the content itself. We have a lot of ideas on how to make the docs more interactive, and we are excited to start working on them.</p>
<p>Stay tuned for more updates, and remember that if you have any feedback or ideas, you can always reach out to us. We are always happy to hear from you!</p>
<p>See you in the next post! 🚀</p>]]></content>
        <author>
            <name>Guille</name>
            <uri>https://github.com/gagdiez</uri>
        </author>
        <category label="docusaurus" term="docusaurus"/>
        <category label="updates" term="updates"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[We have a blog now!]]></title>
        <id>https://goffxnca.github.io/docs/zh-CN/blog/we-have-a-blog</id>
        <link href="https://goffxnca.github.io/docs/zh-CN/blog/we-have-a-blog"/>
        <updated>2024-04-23T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Check check check. Is this thing on? Hello, world!]]></summary>
        <content type="html"><![CDATA[<p><em>Check check check. Is this thing on? Hello, world!</em></p>
<p><img src="https://goffxnca.github.io/assets/images/protocol-b73c2a3ace3307226ee7eb2149ee432f.png"></p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="hello-there">Hello there!<a href="https://goffxnca.github.io/docs/zh-CN/blog/we-have-a-blog#hello-there" class="hash-link" aria-label="Hello there!的直接链接" title="Hello there!的直接链接">​</a></h2>
<p>Welcome to the new NEAR documentation blog! We're excited to inaugurate this new space where we can share news and updates. We know what you are thinking — why a blog? Well, it allows us to interact with you in a different way!</p>
<p>When writing documentation, it is important for us to keep the content focused and concise. This way, when you read it, you have nothing to distract you, and you can focus on learning a new concept.</p>
<p>The problem with this is that many times, we want to share ideas, thoughts, or insights into why some things are the way they are. However, this would imply going off on a tangent and explaining why some decisions were made, which will probably add noise to the document. Most of the time, users just want a link to an example or working code. Also, people don't like to read long texts.</p>
<p>Besides that, sometimes we just want to share what we did during the week. For example, did you notice that we fixed the nightmare that was the URL structure, or that we added new landing pages for all concepts? We want to share these things with you, but they don't really belong in the Docs.</p>
<div class="theme-admonition theme-admonition-tip admonition_xJq3 alert alert--success"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>提示</div><div class="admonitionContent_BuS1"><p>You would not believe the number of times we said during a review <em>"let's remove that, we are writing technical documentation, not a blog post"</em> ... well, now we can make the blog post!</p></div></div>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="what-to-expect">What to expect<a href="https://goffxnca.github.io/docs/zh-CN/blog/we-have-a-blog#what-to-expect" class="hash-link" aria-label="What to expect的直接链接" title="What to expect的直接链接">​</a></h2>
<p>We will be using this space to share updates about our docs, as well as <strong>complement them</strong> with additional information that we think you'll find interesting.</p>
<p>Our aim is to keep the blog updated at least once a week, but given the limited amount of time we have, we will see how that goes.</p>
<p>Moreover, we want to remind you that our Docs are an open source and <strong>collaborative project</strong>. If you feel like you have something to share, or want to contribute to the blog, feel free to reach out. And by reaching out, we mean <a href="https://github.com/near/docs/pulls" target="_blank" rel="noopener noreferrer">opening a PR</a>!</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="a-new-era-for-near-docs">A new era for NEAR docs<a href="https://goffxnca.github.io/docs/zh-CN/blog/we-have-a-blog#a-new-era-for-near-docs" class="hash-link" aria-label="A new era for NEAR docs的直接链接" title="A new era for NEAR docs的直接链接">​</a></h2>
<p>We are super excited to start this new section and hope it helps us to connect with all of you in a better way. We are looking forward to hearing your thoughts and feedback, and hope you enjoy the content we'll be sharing.</p>
<p>See you in the next post! 🚀</p>]]></content>
        <author>
            <name>Guille</name>
            <uri>https://github.com/gagdiez</uri>
        </author>
        <category label="updates" term="updates"/>
    </entry>
</feed>