text
stringlengths
46
74.6k
Introducing SeatlabNFT: The Web3 Startup Changing the Ticketing Game CASE STUDIES October 27, 2022 Music, sports, and entertainment ticketing is about to be completely reimagined. SeatlabNFT, an NFT ticketing platform built on the NEAR blockchain, is bringing fans closer to their favorite artists and sports teams, while also making the ticketing game a lot fairer by reducing scalping and touting. NFTs in sports and entertainment are becoming more widespread and high-profile. Professional athletes and musicians love flexing their profile pic NFTs these days. But there are more meaningful ways to use NFT technology in the Web3 space. This is precisely SeatlabNFT’s aim: use NFTs and the underlying technology to revolutionize ticketing. How NFTs can make ticketing fairer A major long-standing issue in the ticketing industry is control over the secondary market. Tickets to popular events often sell out in a matter of minutes—often due to scalpers and ticket wholesalers—only to reappear on the secondary market at a significant markup. It’s an unfortunate reality that many music and sports fans have come to accept. “While various ideas to beat scalpers have been tried in the past, Web2 lacks the tools required to provide genuine control over the secondary market,” wrote Ryan Kenny, CEO of SeatlabNFT, in a recent op-ed for City A.M. “The result, in many cases, is that fans are unable to see the performers they love without paying extortionate amounts of money,” he added. “And, with the profit falling into the hands of scalpers, artists miss out on any revenue generated by secondary sales.” The SeatlabNFT live event and ticketing platform, built on NEAR, has a clear plan to solve those issues. Artists will be able to mint and sell tickets directly to fans on SeatlabNFT, while those who purchase will avoid scalper markups. And unlike buying a ticket in today’s secondary market, NFT technology will ensure that the ticket they buy isn’t fraudulent. “With the arrival of Web3, there is a huge opportunity to change this dynamic by issuing tickets as NFTs,” wrote Kenny. “NFT technology is a natural fit for ticketing, as it solves many main problems plaguing the event ticketing industry.” But maintaining fair pricing and putting more revenue into the pockets of creators themselves is just the tip of the iceberg. SeatlabNFT has other ideas for how to use NFTs to change the ticketing landscape. Creating more profound relationships with fans SeatlabNFT has big plans to help artists and teams make the fan experience much more fun, immersive, and bi-directional. Fans and attendees will feel less like consumers being sold an experience, and more like active participants. SeatlabNFT’s NFT platform will open doors and opportunities to increase fan engagement and loyalty. For starters, artists will be able to create, issue, and sell NFT collectibles associated with various live events. This goes beyond images, as NFTs can also exist on the blockchain in the form of audio recordings, videos, and other forms of digital artwork. These event-associated NFTs could be airdropped on demand, displayed online, or traded with the same smart contracts used to control the secondary market for tickets. Creators can also airdrop event-based NFTs or collectibles using SeatlabNFT smart contracts, rewarding some of the best and most loyal fans who attend live events. For instance, a musical artist could airdrop NFTs to fans who have been to multiple live shows, with their attendance verified by the blockchain. This gives creators the chance to issue everything from digital collectibles to utility NFTs that grant things like discounts on merch, early access to future sales or even unlock on-site perks like access to restricted areas or free food and drink. Ticket royalty splits and price ceilings Underpinning all of these NFT ticketing value propositions is SeatlabNFT’s smart contracts that enable royalty splits (on NEAR, royalty splits are baked into smart contracts) and price ceilings. Royalty splits and price ceilings give artists and event organizers the tools they need to fight back against scalping. It allows creators to configure the tickets before they go on sale, and ensures that even on the secondary market, event creators can still capture the value they create. With these cutting-edge ticketing efforts, SeatlabNFT is working to create a fairer, more transparent, and equitable playing field for all parties. What’s next for SeatlabNFT SeatlabNFT is currently in Phase 2 of its roadmap, with a variety of features and functions already live. The SeatlabNFT app is downloadable on the Apple App Store and Google Play Store, with tickets to various events currently on sale. The SeatlabNFT membership card available on the app is also a precursor to the Immersive Fan Pass, an NFT-based fan membership card program exclusively on SeatlabNFT. These passes will be NFTs with various tiered utility and benefits that artists can offer as part of an immersive fan club package. Backstage passes, early access to demo tracks, and artist meet-and-greets are just a few potential ways the Immersive Fan Pass could be used. SeatlabNFT also just announced a new partnership with Elrow, one of the world’s biggest dance brands. At Elrow’s Dubai festival, scheduled for February 18, 2023 , SeatlabNFT technology will be used for exclusive VIP ticketing and immersive experiences. Elrow Dubai is taking place at D3 Dubai Design District, which can accommodate up to 10,000 people, making it a great opportunity to onboard many new people into both NEAR and Web3. The ticketing industry and experience are long overdue for disruption, and SeatlabNFT is well on the way to doing just that. Artists, creators, and sports teams can offer more fair pricing to their fans while receiving a greater share of the revenue via SeatlabNFT’s royalty split smart contracts. And fans get better pricing with the peace of mind that they’re purchasing an authentic ticket. And even more exciting, integrating NFT technology into the ticketing space opens the door for limitless possibilities in connecting fans with their favorite artists and teams. Linking exclusive digital NFT collectibles and airdrops with tickets is ripe for experimentation, and the Immersive Fan Pass will engage fans on a level never before seen.
Guild Program Launch COMMUNITY June 4, 2020 At the beginning of the year, we started our Contributor Program to directly work with community members on NEAR initiatives. Since we began, people around the world have been looking for ways to get more involved. Communities have spontaneously popped up, both online and in-person, to support the project. For instance, the Russian NEAR community has reached several hundred active members. The main goal of the next stages of our MainNet launch is to further decentralise the protocol. This does not only include technical power distribution but also community involvement. Building on the experience of our contributors, we would like to make it easier for organizers and leaders to get support for their communities and receive rewards for the work they do to drive the mission forward for all of us. We are thrilled to announce the launch of the NEAR Guild Program. Guilds date back to the Roman times, where they were connected groups of builders, makers or merchants. More recently, the term has transitioned into the gaming world to describe teams of players who unite to support each other on missions and quests. In our case, Guilds refer to community hubs with a common interest in supporting the open web ecosystem. Guilds are represented by a Guild Leader. The Guild Program gives Guild leaders and their communities rewards when their work is aligned with a healthy ecosystem. These rewards might include things like the number of active developers or apps associated with the Guild, referrals provided to other NEAR programs, running validating nodes or simply claiming bug bounties. Who Should Lead a Guild? Are you excited about the open-web space? Maybe you are currently building and nurturing a community or you are tired of standing on the sidelines and want to get involved yourself. Maybe you already have a vibrant community as part of your business or just a circle of friends who like to read white papers. Guilds are for the blockchain enthusiasts, the futurists wanting to create a better tomorrow, the early adopters and technical gurus. If this speaks to you, you can either start a new community or register your existing community as a Guild. This program is designed to empower those who want to take ownership of their community, to get developers engaged in the open-web space and set up community members for success. This is the second NEAR community program. The existing Contributor Program is focused on individual contributions to NEAR’s engineering efforts and it will continue. The Guild Program is focused on community contributions. In essence, the Contributor program is “Single-Player mode” and the Guild Program is “Multi-Player mode.” The Difference between Contributors and Guilds If you identify more with the contributor program, we would like to invite you to sign-up here. Cross-Guild Cooperation As a Guild Leader, you will be able to share resources with other Guilds so you can advance the skills of your community. This will allow us to advance as a global community. The exchange of resources, initiatives and idea generation will take place within the online portal. Think about it as a knowledge base. You can use the portal to: Connect with other Guilds and NEAR contributors Highlight your successes Receive rewards based on the initiatives you share Receive community support and participate in global initiatives Take the Community Into Your Own Hands What do we mean by this? In short: As a Guild Leader, you decide how you want to shape your Guild. Do you want to run online meetups? Have in person-events? Host workshops or invite external speakers? Where is your community going to interact? In-person, on Discord or Telegram? Do you want to shape your community around a project? Will it be focused on developer or validator education? The only thing we ask you is to share your local knowledge, initiatives and resources with the global team of Guild leaders. Rewards A fundamental belief of the Guild Program is that NEAR communities should be rewarded for contributing to the progress of the ecosystem. There are three ways this will occur in the Guild Program: one-time “Boosts”, ongoing “Rolling Rewards” and “League” rankings. Boosts apply to one-off activities, such as bounties, that a Guild can claim within a fixed time period. These are centred around engaging community members to participate in the NEAR ecosystem. Additional examples of Boosts include referring people to other NEAR programs or to use apps on the network. Rolling rewards will be offered based on the Health, Power and Contribution of the Guild’s members. In other words, these reflect how engaged Guild members are, how active they are in core ecosystem activities like developing apps or running nodes, and how many one-time rewards they have collected along the way. Finally, the League system provides a ranking of top Guilds based on their growth and effectiveness. An active and growing Guild community will advance to higher leagues and receive rewards. Here is the initial league structure and associated rewards: Note that the number of tokens listed here is subject to change over time. Additionally, citizens in some geographies (for example non-accredited US and Canadian citizens) may receive alternative rewards that are not in token form. Additional perks will work their way into the Guild Program over time. The goal of the program is to identify and reward communities who provide value to the ecosystem. Thus, incentives will be adjusted to make sure that’s the case. For Example: The Berry Club of Ukraine The Berry Club of Ukraine (“BCoU”) is a fictional Guild which engages its members by hosting educational workshops and occasional hackathons. They have an active Telegram community where they keep in touch with each other and many of their members are developers who build with NEAR. One team of developers won a Hackathon this month and their app has been a surprise success. They run a validating node as part of the Stake Wars program to play with the network and learn. The BCoU might receive the following rewards one month (which are purely for demonstration purposes and may not reflect actual reward structures): Boosts: 1,720 NEAR Boost this month: New referrals to the Developer Program: 34 @ 10 NEAR each = 340 N Boost this month: member participants in the NEARHacks online hackathon: 15 @ 20 NEAR each = 300 N Guild Bonus: Additional 5% of prize for NEARHacks first place rewarded to team from BCoU: 20,000 N @ 5% = 1,000 N Multi-month ongoing Boost: Members who fund their NEAR wallet for the first time: 8 @ 10 NEAR each = 80 N Rolling: 981 NEAR Currently active members of the Developer Program linked to BCoU: 55 @ 10 NEAR each = 550 N Bonus for successful apps deployed by BCoU members: 331 NEAR Running a node with 99% uptime on BetaNet as part of the Stake Wars program: 100 N League Ranking: 1,200 NEAR Silver: Based on last month’s Boost rewards of 1680 NEAR and Rolling rewards of 445 NEAR, BCoU was the #9 ranked Guild and thus earned a 1,200 N bonus this month. TOTAL: 3,901 NEAR Getting started Submit an application to become a Guild Leader. If selected, we will follow up with you about next steps, including Invitation to the NEAR contributor portal Resources to help you get started Do you want to start your own Guild and be part of our global network? Apply now. Undecided? Have questions? Feel free to reach out in our community channel.
```js const tokenContract = "token.v2.ref-finance.near"; const tokenPriceResult = fetch( `https://indexer.ref.finance/get-token-price?token_id=${tokenContract}` ).body; const tokenPriceValue = JSON.parse(tokenPriceResult); ``` <details> <summary>Example response</summary> <p> ```json { "token_contract_id": "token.v2.ref-finance.near", "price": "0.08153090" } ``` </p> </details> :::tip Ref Finance has a method to [get all token prices at once](https://indexer.ref.finance/list-token-price). :::
--- sidebar_position: 1 title: "NearBindgen" --- # NearBindgen The `@NearBindgen({})` decorator is used on the contract class to generate the necessary code to be a valid NEAR contract and expose the intended functions to be able to be called externally. For example, on a simple counter contract, the decorator will be applied as such: ```javascript import { NearBindgen, near, call, view } from 'near-sdk-js' @NearBindgen({}) class Counter { val: number = 0; @view({}) // Public read-only method: Returns the counter value. get_num(): number { return this.val } @call({}) // Public method: Increment the counter. increment() { this.val += 1; near.log(`Increased number to ${this.val}`) } @call({}) // Public method: Decrement the counter. decrement() { this.val -= 1; near.log(`Decreased number to ${this.val}`) } @call({}) // Public method - Reset to zero. reset() { this.val = 0; near.log(`Reset counter to zero`) } } ``` In this example, the `Counter` class represents the smart contract state and anything that implements serialization and deserialization methods can be included, such as `collections`, which will be covered in the next section. Whenever a function is called, the state will be loaded and deserialized, so it's important to keep this amount of data loaded as minimal as possible. The core interactions that are important to keep in mind: - Any `call` or `view` or `initialize` functions will be callable externally from any account/contract. - For more information, see [public methods](../contract-interface/public-methods.md) - `view` or `call` decorators can be used in multiple ways to control the mutability of the contract: - Functions that are decorated with `view` will be read-only and do not write the updated state to storage - Functions that are decorated with `call` allow for mutating state, and state will always be written back at the end of the function call - Exposed functions can omit reading and writing to state if class variables are not accessed in the function - This can be useful for some static functionality or returning data embedded in the contract code <!-- TODO include link to near_bindgen docs, when they aren't empty --> ## Initialization Methods By default, the `default()` implementation of a contract will be used to initialize a contract. There can be a custom initialization function which takes parameters or performs custom logic with the following `@initialize({})` decorator: ```javascript @NearBindgen({}) class Counter { @initialize({}) init(val): void { this.val = val; } } ``` ## Payable Methods `call` method decorators can be annotated with `{ payableFunction: true }` to allow tokens to be transferred with the method invocation. For more information, see [payable methods](../contract-interface/payable-methods.md). To declare a function as payable, use the annotation as follows: ```javascript @NearBindgen({}) class Counter { @call({ payableFunction: true }) increment(): void { this.val += 1; } } ``` ## Private Methods Some methods need to be exposed to allow the contract to call a method on itself through a promise, but want to disallow any other contract to call it. For this, use the `{ privateFunction: true }` annotation to throw an error when this method is called externally. See [private methods](../contract-interface/private-methods.md) for more information. This annotation can be applied to any method through the following: ```javascript @NearBindgen({}) class Counter { @call({ privateFunction: true }) private_increment(): void { this.val += 1; } } ```
--- id: relayer-gas-example title: Multichain Relayer and Gas Station example sidebar_label: Relayer + Gas Station --- import {CodeTabs, Language, Github} from "@site/src/components/codetabs" import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; In this article you'll learn how to run end-to-end tests on the entire Multichain Relayer system. :::info Required tools For this tutorial, you'll need to have installed: - [Multichain Relayer Server](https://github.com/near/multichain-relayer-server) - [Gas Station Event indexer](https://github.com/near/gas-station-event-indexer) - [NEAR CLI RS](https://github.com/near/near-cli-rs) ::: ## Setup Before you start testing, set up your local environment and install the Relayer server, the Event indexer and NEAR CLI. ### Multichain Relayer server The main function of this server is interfacing with foreign chain RPCs sending both pre-signed funding transactions to cover gas and the actual pre-signed transaction once the funding is done. To run the [Multichain Relayer Server](https://github.com/near/multichain-relayer-server): 1. Configure the Multichain Relayer by editing the [`config.toml`](https://github.com/near/multichain-relayer-server/blob/main/config.toml) file 2. Start the multichain relayer server: ```sh cargo run ``` :::tip Find the Multichain Relayer server source code in [this GitHub repository](https://github.com/near/multichain-relayer-server). ::: ### Gas Station Event indexer The event indexer picks up events emitted from the [gas station contract](gas-station.md) used for generating signed foreign chain transactions and calls the multichain relayer `/send_funding_and_user_signed_txns` endpoint locally. To run the [Gas Station indexer](https://github.com/near/gas-station-event-indexer): 1. Ensure you have the [Multichain Relayer Server](#multichain-relayer-server) running on `localhost:3030` 2. Create and activate a Python virtual environment: ```sh pip install requirements.txt ``` 3. Update the [`config.toml`](https://github.com/near/gas-station-event-indexer/blob/main/config.toml) configuration file with appropriate values ``` network = "testnet" # gas station contract account id contract_id = "canhazgas.testnet" ``` 4. Run the indexer: ```sh python3 gas-station-event-indexer.py ``` :::tip Find the Gas Station Event indexer source code in [this GitHub repository](https://github.com/near/gas-station-event-indexer). ::: ## Running tests The gas station contract supports EIP-1559 transactions. 1. Set the transaction details of the EVM transaction you want to send in [`generate_rlp_evm_txn.py`](https://github.com/near/multichain-relayer-server/blob/5b040611f2dc6c6b405b5ec00d5102e3cc27a65c/integration_tests/generate_rlp_evm_txn.py), run the script, and save the RLP hex string output. :::note Python and Rust output different hex RLP encoded transactions. - If you're using Rust, use [`generate_eip1559_rlp_hex()`](https://github.com/near/multichain-relayer-server/blob/5b040611f2dc6c6b405b5ec00d5102e3cc27a65c/tests/tests.rs#L24). - If you're using Python, use [`generate_rlp_encoded_transaction(is_eip_1559=true)`](https://github.com/near/multichain-relayer-server/blob/5b040611f2dc6c6b405b5ec00d5102e3cc27a65c/integration_tests/generate_rlp_evm_txn.py#L7) ::: <CodeTabs> <Language value="Python" language="python"> <Github fname="generate_rlp_evm_txn.py" url="https://github.com/near/multichain-relayer-server/blob/5b040611f2dc6c6b405b5ec00d5102e3cc27a65c/integration_tests/generate_rlp_evm_txn.py" start="7" end="13" /> </Language> <Language value="Rust" language="rust"> <Github fname="test.rs" url="https://github.com/near/multichain-relayer-server/blob/5b040611f2dc6c6b405b5ec00d5102e3cc27a65c/tests/tests.rs" start="24" end="38" /> </Language> </CodeTabs> 2. Ensure the [Multichain Relayer server](#multichain-relayer-server) is configured correctly and running. 3. Ensure the [Gas Station indexer](#gas-station-event-indexer) is running locally. 4. Construct the signed transaction using the [near-cli-rs](https://github.com/near/near-cli-rs). The receiver account ID should be the gas station contract. You will need 2 actions if you want the gas station to cover your gas cost on the foreign chain: - 1 action to send the NEAR equivalent - 1 function call to the gas station. You should transfer the amount of `NEAR` that's needed to cover gas both on NEAR and on the foreign chain. You also need to paste in the RLP generated hex for the EVM transaction you want on the other chain generated in step 1. When it asks you to _send_ or _display_, choose <kbd>send</kbd>. Example below: ```sh near contract call-function as-transaction canhazgas.testnet create_transaction json-args '{"transaction_rlp_hex":"eb80851bf08eb000825208947b965bdb7f0464843572eb2b8c17bdf27b720b14872386f26fc1000080808080","use_paymaster":true}' prepaid-gas '100.000 TeraGas' attached-deposit '0.5 NEAR' sign-as nomnomnom.testnet network-config testnet sign-with-keychain send ``` 5. Get the `"id"` from the receipts from the call in step 4, and use that to call `sign_next` twice: ```sh near contract call-function as-transaction canhazgas.testnet sign_next json-args '{"id":"16"}' prepaid-gas '300.0 Tgas' attached-deposit '0 NEAR' sign-as nomnomnom.testnet network-config testnet sign-with-keychain send ``` ## Options for testing purposes Instead of creating a signed transaction and calling the gas station contract to sign it, you can get the recently signed transactions by calling the contract while replacing the `blockheight` with a more recent block height: ```sh near contract call-function as-read-only canhazgas.testnet list_signed_transaction_sequences_after json-args '{"block_height":"157111000"}' network-config testnet now ``` This will return something like the output below. Take an individual entry in the list of JSONs and send that as the payload of a `POST` request to the `/send_funding_and_user_signed_txns` endpoint: ```jsx [ { "created_by_account_id": "b807806adcb73f6aecb5ed98bb8bd7bbe7bbf8ed342596ab700ef6b050abc4c3", "foreign_chain_id": "97", "signed_transactions": [ "0x02f873610385174876e80085174876e80082520894c89663ac6d169bc3e2e0a99d9fe96f2e82bcc307870eebe0b40e800080c080a0712d44ba4cd7567764231e21f054c5e7d008055222820e9d5ba148ede48755f7a06e8b812d37047593fc51fce7254ea7aef89927cada729bc903cd36fa9659dce4", "0x02f873618085174876e80085174876e80082520894ef55a8bdf4498ea0af88bc54efb29608bb25e130872aa1efb94e000080c080a017d7024fe9e32ad8da1181729fac7e6a45311c47bf59f2b5a8b5e9fe002c0617a04ad725b362cf12c6e066c5b0b7ecbbf08f5e4d0a240337e6ddc8076f0528e3e5" ] }, ... { "created_by_account_id": "b807806adcb73f6aecb5ed98bb8bd7bbe7bbf8ed342596ab700ef6b050abc4c3", "foreign_chain_id": "97", "signed_transactions": [ "0x02f873610185174876e80085174876e80082520894c89663ac6d169bc3e2e0a99d9fe96f2e82bcc307870eebe0b40e800080c001a0ff19fe769246de8483b986e5aeaa3360bfb74f238e2a91ea353dac9aad9e24a0a020485dcd2c64172b9bc058b7813646dafbf2f27d51aae388b074e514fdb6de05", "0x02f873618085174876e80085174876e80082520894ef55a8bdf4498ea0af88bc54efb29608bb25e130872e2f6e5e14800080c001a0dac67c383e8de3211f3c5d360cc2e9a21d160711fc3f80113ac525169317e2eca07140a1d0d1528b6eaf9fac4bb1bd44c1c4f63bb956292b0211a0dad1748e2eea" ] } ] ```
NEAR Community Update: January 11, 2019 COMMUNITY January 11, 2019 2019 promises to be a very interesting year. As an industry, we’re in a phase which will separate the projects which actually ship from those who instead languish in endless research and fundraising mode and those who win over the developer community from those who instead built pretty ideas with no utility. All of this plays to our strengths. ? Community and Events We’ll be busy in 2019 and should accrue a *lot* of frequent flyer miles. Prior to TestNet release, we’re keeping things fairly close to home but then all bets are off. You’ll see us speaking at conferences, running hackathons and hosting workshops around the world. Is there a conference or event in your city that we should make sure to attend or speak at? Let us know by forwarding a note to [email protected]. Recent Highlights [SF] Dec 19: Blockchain 101 Onramp: What are Decentralized Applications (DApps) and How Do They Work? (Video, Slides) [SF] Jan 9: Blockchain 101 Onramp: Using Blockchain in “Regular” Web and Mobile Apps (Slides) Upcoming Events [SF] Jan 15: NEAR Protocol with Illia Polosukhin @ SF Ethereum Developers [SF] Jan 16: Blockchain 101 Onramp: Design Best Practices for DApps [SF] Jan 23: Sprint Workshop: Design Charrette for Blockchain Mobile and Web Applications [SF] Jan 25: The Frontier of Sharding Research [Graph Day] (with Alex Skidanov) [Online] Jan 29–30: Decentralized Summit (with Erik Trautman) [SF] Feb 6: Blockchain 101 Onramp: DApp Development Basics [SF] Feb 13: Sprint Workshop: Building on a Blockchain TestNet [SF] Feb 27: Blockchain 101 Onramp: Best Practices for Developing DApps Writing and Content Cofounders Alex and Illia have started a new video series which puts technical leaders from two projects into the same room with a whiteboard to deep dive into their protocols. The first two videos, which feature Zaki Manian of Cosmos Network and Anatoly Yakovenko of Solana, are on our YouTube channel. Dr Max Zavershynskyi surfaced some of the knowledge and best practices that have come from our work with Rust in Understanding Rust Lifetimes. Teal is the color of #technology. Engineering Highlights We are now running regular internal hackathons to dogfood the protocol and focus on developer experience. The first of these christened our new devnet while the other focused on potential tutorial applications. We’ve become surprisingly good at repurposing Rock/Paper/Scissors logic… As for functionality, the last few weeks have seen a surge in new additions: The first version of NEARlib.js, which provides the interface in JavaScript to the network. Switched accounts to be keyed by readable names. Updated libraries, DevNet and AssemblyScript compiler to use JSON serialization of arguments and data structures. Removing the need for using an ABI and not requiring extra libraries. As part of hackathons, built 6 example applications on NEAR platform. We will open source them with tutorials next week. More templates in Studio. Added gas and mana (payment for cross-shard relaying) accounting for smart contract execution. In the process of assembling components for TestNet. How You Can Get Involved If you want to stay up to date with what we’re building at NEAR, follow us on Twitter for updates, join the conversation on Discord. https://upscri.be/633436/
NEAR Meet: Now Supporting Local and Regional Events Globally COMMUNITY December 15, 2021 The NEAR ecosystem is rapidly expanding on a truly global scale. Powered by Simple Nightshade’s super fast and low-gas fee transactions, developers are launching a wide variety of apps and experiences that will change the way we control our data, exchange money and goods, finance projects, and power the creator economy. NEARverse’s many virtual communities have been incredibly active and vital in sharing this vision. But to build a more successful, wide-reaching ecosystem, and to help users navigate the multiverse of blockchains, NEAR believes it’s also crucial to bring local IRL meetups to locations across the globe. Enter: NEAR Meet. With NEAR Meet, the Global Becomes Local NEAR Meet is NEAR’s global program for local and regional meetup events. Our vision for these meetups is that they become spaces where locals and digital nomads from cities across the world can meet, share ideas, network, and collaborate on making Web3 a reality. By the end of 2022, we hope to have over 100 monthly NEAR Meet events. These sessions will empower local and regional contributors to successfully organize in-person meetups involving NEAR community members from around the world. We will also develop guilds and DAOs in strategic areas with emerging potential for the NEAR ecosystem. To that end, we will be experimenting with a multi-DAO structure that should help bring local and regional guilds together without introducing unnecessary bottlenecks. If you’d like to attend a NEAR event, visit the NEAR Meet page. Become a NEAR Meet Organizer In the NEAR Meet program, local and regional meetups will be organized by individuals in the Guilds and wider NEAR community. We intend to provide necessary resources to these individuals so that they can organize meaningful IRL experiences around the world. If you’re interested in coordinating events near your city, join our community of Guild leaders and contributors on Discord. Also, head over to the NEAR Meets Wiki, where you can find a wealth of resources on planning meetups. Find a Meet Near You NEAR Meet is a great place to start organizing events near you. Currently, there are 10 different NEAR Meet groups across 6 countries. Local and regional event coordinators, of course, are not required to use our Meetup. You can find a NEAR Meet right now in the following cities: New York City, San Francisco, London, Geneva, Lausanne, Zürich, Shanghai, Nairobi, Mombasa, Bangalore, Goa, Tulum, and more! Watch the livestream from our first event in Switzerland: Read blog posts and reports from events in Africa, organized by the Sankore Guild: https://medium.com/sankore2-0 Want to bring a NEAR Meet to a city near you? Check out the 3-step process outlined in this forum post, and feel free to reply there with any ideas or questions. Write a Forum Post Fill out this form Host a Meetup! Definitely check out the NEAR Meetups wiki page for an evolving resource about organizing IRL events, and jump in our Discord to find support and get more involved. And please contact us at [email protected] if you need anything. To help anyone learn how to successfully organize a NEAR Meet, we are hosting a webinar on Discord Sunday, December 19, followed by interactive group sessions in the NEAR My City Discord community, at the request of participating event coordinators!
--- id: localization title: Translating Content on NEAR sidebar_label: Translating Content sidebar_position: 4 --- ## Introduction Welcome to the [NEAR Dev Docs](https://docs.near.org/) translation project. This article is aimed to community members that want to help in the localization of NEAR's documentation. If you feel comfortable translating from English into your local language, you're more than welcome to contribute with this project. ### Roles For simplicity, the translation project is hosted on [Crowdin](https://crowdin.com/project/near-docs) and anyone is free to register and join. There are 3 basic roles across the Crowdin project: 1. **Translator:** translates documentation 2. **Proof Reader:** helps proof reading localized documents 3. **Manager:** manages memberships and helps with technical issues ### How to become a Translator To become a certified NEAR docs translator, you need to pass a pre-translation test by working on a selected document translation. A proof reader will review your document, and if your translation proves to be high-quality, your application will be accepted and you'll be accepted as a NEAR Certified Translator. :::info To become a certified translator, please join our [Crowdin project](https://crowdin.com/project/near-docs) and [create a new topic](https://crowdin.com/project/near-docs/discussions) with your application. The NEAR team will review your request, assign a test, and follow up with you as needed. If you have questions, please contact us on [Discord](https://near.chat). ::: ## How to translate Before you start working on the translation of an article, you need to get pre-approval from the community first. The reason is to make sure the plans are transparent in the community, and the proof-readers can help to review and approve the translation once it's ready. You can check the current translation plans available for each language on the [Tasks section](https://crowdin.com/project/near-docs/tasks): ![image](@site/static/img/crowdin-tasks.png) If there's no active plan for your language, you can submit a proposal by opening a thread on the [Discussions section](https://crowdin.com/project/near-docs/discussions). Once your plan is pre-approved by the community, you can just go to the [Crowdin project](https://crwd.in/near-docs) and work on the translation of the specific markdown file. ### Translation plan For each language, the current plan is to translate all the documents with the following priorities. **Website** 1. `website` (except the `docusaurus-plugin-content-blog` folder) **Developer** 1. `concepts` 2. `develop` 3. `tools` 4. `api` 5. `tutorials` 6. `videos` **Community** 1. `community` **Exchanges & Integration** 1. `roles` 2. `faq` ![image](@site/static/img/crowdin-list.png) ### Proof reading and go-to Production For each document, expect no less than two proof readers to review the translations. The translator or proof reader can propose different translations if he/she doesn't agree the existing ones, the translations that receive the most votes will be accepted and displayed in the production version. :::tip Please pay attention to the maintainer's feedback, since its a necessary step to keep up with the standards NEAR attains to. ::: ## Questions? {#questions} If you have any questions feel free to post them to our [Discord channel](http://near.chat). Thanks for your time and translations! :::note Got a question? **[Ask it on StackOverflow!](https://stackoverflow.com/questions/tagged/nearprotocol)** :::
--- id: create-transactions title: Create Transactions sidebar_label: Create a Transaction --- To construct & process transactions you will need our API JavaScript library: [`near-api-js`](/build/web3-apps/integrate-contracts). There are many ways to create transactions but for this example we'll show you two ways to create a simple token transfer transaction. - [HIGH LEVEL](#high-level----create-a-transaction) - _easiest way to create a transaction_ - [LOW LEVEL](#low-level----create-a-transaction) - _performs the exact same transaction as above, but deconstructs the entire process for those curious about each step_ At the core, all transactions require the following: - `signerId` _(account ID of the transaction originator)_ - `signerPublicKey` - `receiverId` _(account ID of the transaction recipient)_ - `nonceForPublicKey` _(each time a key is used the nonce value should be incremented by 1)_ - `actions` _( [[click here]](/concepts/protocol/transactions#action) for supported arguments)_ - `blockHash` _(a current block hash (within 24hrs) to prove the transaction was recently created)_ See [Transaction Class](https://near.github.io/near-api-js/classes/near_api_js.transaction.Transaction.html) for a more in depth outline. --- ## HIGH LEVEL -- Create a transaction ### Setup 1. Clone the [transaction-examples](https://github.com/near-examples/transaction-examples) repository by running: ```bash git clone https://github.com/near-examples/transaction-examples.git ``` 2. Follow [setup instructions](https://github.com/near-examples/transaction-examples/blob/master/README.md#prerequisites) ### Imports In [`send-tokens-easy.js`](https://github.com/near-examples/transaction-examples/blob/9e999253aafa2c3e3b537810a0b8ce7596c3506c/send-tokens-easy.js#L1-L5) we use two dependencies: 1. [NEAR API JavaScript library](https://github.com/near/near-api-js) 2. [`dotenv`](https://www.npmjs.com/package/dotenv) (used to load environment variables for private key) ```js const nearAPI = require("near-api-js"); const { connect, KeyPair, keyStores, utils } = nearAPI; require("dotenv").config(); ``` The second line above deconstructs several utilities from nearAPI that you will use to interact with the blockchain. - `connect` - create a connection to NEAR passing configuration variables - `KeyPair` - creates a keyPair from the private key you'll provide in an `.env` file - `keyStores` - stores the keyPair that you will create from the private key and used to sign Transactions - `utils` - used to format NEAR amounts ### Accounts & Network Next, you'll need to enter the `accountId` of the `sender` and `receiver`, as well as the `networkId` (`betanet`, `testnet`, or `mainnet`). ```js const sender = "sender.testnet"; const receiver = "receiver.testnet"; const networkId = "testnet"; ``` ### Formatting Token Amounts When sending NEAR tokens (Ⓝ) during a transaction, the amount needs to be converted into [Yocto](https://en.wikipedia.org/wiki/Yocto-) Ⓝ or (10^-24). - To perform this you will use the [`near-api-js`](https://github.com/near/near-api-js) method [`parseNearAmount()`](https://github.com/near/near-api-js/blob/d4d4cf1ac3182fa998b1e004e6782219325a641b/src/utils/format.ts#L53-L63) (located in `utils/format`) ```js const amount = nearAPI.utils.format.parseNearAmount("1.5"); ``` ### Create a Key Store In order to sign transactions you will need to create a "Key Store" that will hold a [full access key](/concepts/protocol/access-keys#full-access-keys) to sign your transactions. There are several ways to accomplish this, but for this example we will use a private key stored in either an `.env` file in your project or an environment variable exported globally. - If you created the account using [`near-cli`](/tools/near-cli) or ran [`near login`](/tools/near-cli#for-accounts) in your terminal, your private key can be found in a `.json` file located in `/HOME/.near-credentials`. - If you created an account using [NEAR Wallet](https://testnet.mynearwallet.com/), your key will be found in your browser's `Local Storage`. - In your browser's dev tools... `Application` >> `Storage` >> `Local Storage` ```js // sets up an empty keyStore object in memory using near-api-js const keyStore = new keyStores.InMemoryKeyStore(); // creates a keyPair from the private key provided in your .env file const keyPair = KeyPair.fromString(process.env.SENDER_PRIVATE_KEY); // adds the key you just created to your keyStore which can hold multiple keys (must be inside an async function) await keyStore.setKey(networkId, sender, keyPair); ``` ### Setting up a connection to NEAR Now create a connection to NEAR using a configuration object that will contain your `networkId` setup earlier as well as your `keyStore`. ```js // configuration used to connect to NEAR const prefix = (networkId === "testnet") ? "testnet" : "www"; const config = { networkId, keyStore, nodeUrl: `https://rpc.${networkId}.near.org`, walletUrl: `https://wallet.${networkId}.near.org`, helperUrl: `https://helper.${networkId}.near.org`, explorerUrl: `https://${prefix}.nearblocks.io`, }; // connect to NEAR! :) const near = await connect(config); // create a NEAR account object const senderAccount = await near.account(sender); ``` You'll notice the last line uses your NEAR connection to create a `senderAccount` object that you'll use to perform the transaction. ### Create, Sign, & Send Transaction Now that everything is setup, creating the transaction is a single line of code. ```js const result = await senderAccount.sendMoney(receiver, amount); ``` This simple command constructs, signs, and sends a token transfer transaction on the NEAR blockchain. There is no need to create a `result` variable aside from inspecting the response details from your transaction and even create a link to [NearBlocks Explorer](https://testnet.nearblocks.io/) to view a GUI version of the transaction details. --- ## LOW LEVEL -- Create a Transaction ### Setup 1. Clone the [transaction-examples](https://github.com/near-examples/transaction-examples) repository by running: ```bash git clone https://github.com/near-examples/transaction-examples.git ``` 2. Follow [setup instructions](https://github.com/near-examples/transaction-examples/blob/master/README.md#prerequisites) --- ### Imports In [`send-tokens-deconstructed.js`](https://github.com/near-examples/transaction-examples/blob/master/send-tokens-deconstructed.js#L1-L4) we use three dependencies: 1. [NEAR API JavaScript library](https://github.com/near/near-api-js) 2. [`js-sha256`](https://www.npmjs.com/package/js-sha256) (cryptographic hashing algorithm) 3. [`dotenv`](https://www.npmjs.com/package/dotenv) (used to load environment variables) ```js const nearAPI = require("near-api-js"); const sha256 = require("js-sha256"); require("dotenv").config(); ``` --- ### Accounts & Network Next, you'll need to enter the `accountId` of the `sender` and `receiver`, as well as the `networkId` (`betanet`, `testnet`, or `mainnet`). ```js const sender = "sender.testnet"; const receiver = "receiver.testnet"; const networkId = "testnet"; ``` --- ### Formatting Token Amounts When sending NEAR tokens (Ⓝ) during a transaction, the amount needs to be converted into [Yocto](https://en.wikipedia.org/wiki/Yocto-) Ⓝ or (10^-24). - To perform this you will use the [`near-api-js`](https://github.com/near/near-api-js) method [`parseNearAmount()`](https://github.com/near/near-api-js/blob/d4d4cf1ac3182fa998b1e004e6782219325a641b/src/utils/format.ts#L53-L63) (located in `utils/format`) ```js const amount = nearAPI.utils.format.parseNearAmount("1.5"); ``` --- ### Setting up a connection to NEAR In this example, we will create a NEAR RPC `provider` that allows us to interact with the chain via [RPC endpoints](/api/rpc/introduction). ```js const provider = new nearAPI.providers.JsonRpcProvider( `https://rpc.${networkId}.near.org` ); ``` --- ### Access Keys To sign a transaction to send NEAR Ⓝ, we will need a `FullAccess` key to the sender's account. - If you created the account using [`near-cli`](/tools/near-cli) or ran [`near login`](/tools/near-cli#for-accounts) in your terminal, your private key can be found in a `.json` file located in `/HOME/.near-credentials`. - If you created an account using [NEAR Wallet](https://testnet.mynearwallet.com/), your key will be found in your browser's `Local Storage`. - In your browser's dev tools... `Application` >> `Storage` >> `Local Storage` Once you have access to the private key of the sender's account, create an environment variable `SENDER_PRIVATE_KEY` or hard code it as a string on [line 18](https://github.com/near-examples/transaction-examples/blob/master/send-tokens-deconstructed.js#L18) of `send-tokens.js`. - With this `privateKey`, we can now construct a `keyPair` object to sign transactions. ```js const privateKey = process.env.SENDER_PRIVATE_KEY; const keyPair = nearAPI.KeyPair.fromString(privateKey); ``` --- ### Transaction Requirements As stated before, all transactions require six parts: 1. [`signerId`](#1-signerid) 2. [`signerPublicKey`](#2-signerpublickey) 3. [`receiverId`](#3-receiverid) 4. [`nonceForPublicKey`](#4-nonceforpublickey) 5. [`actions`](/concepts/protocol/transactions#action) 6. [`blockHash`](#6-blockhash) ### 1 `signerId` - The `signerId` is the account ID of the transaction originator. - This value is passed as a string (ex. `'example.testnet'` or `'bob.near'`) ### 2 `signerPublicKey` - The `signerPublicKey` is required to be an object with two key value pairs: `keyType` and `data`. ```js PublicKey = { keyType: 0, data: Uint8Array(32)[ (190, 150, 152, 145, 232, 248, 128, 151, 167, 165, 128, 46, 20, 231, 103, 142, 39, 56, 152, 46, 135, 1, 161, 180, 94, 212, 195, 201, 73, 190, 70, 242) ], }; ``` - This can be constructed by calling `getPublicKey()` using the `keyPair` we [setup earlier](#access-keys). ```js const publicKey = keyPair.getPublicKey(); ``` ### 3 `receiverId` - The `receiverId` is the account ID of the transaction recipient. - This value is passed as a string (ex. `'example.testnet'` or `'bob.near'`) - The certain cases, the `signerId` and the `receiverId` can be the same account. ### 4 `nonceForPublicKey` - A unique number or `nonce` is required for each transaction signed with an access key. - To ensure a unique number is created for each transaction, the current `nonce` should be queried and then incremented by 1. - Current nonce can be retrieved using the `provider` we [created earlier](#setting-up-a-connection-to-near). ```js const accessKey = await provider.query( `access_key/${sender}/${publicKey.toString()}`, "" ); ``` - now we can create a unique number for our transaction by incrementing the current `nonce`. ```js const nonce = ++accessKey.nonce; ``` ### 5 `actions` - There are currently eight supported `Action` types. [[see here]](/concepts/protocol/transactions#action) - For this example, we are using `Transfer` - This transfer action can be created using the [imported `nearAPI` object](#imports) and the [formatted Ⓝ amount](#formatting-token-amounts) created earlier. ```js const actions = [nearAPI.transactions.transfer(amount)]; ``` [[click here]](https://github.com/near/near-api-js/blob/d4d4cf1ac3182fa998b1e004e6782219325a641b/src/transaction.ts#L70-L72) to view source for `transfer()`. ### 6 `blockHash` - Each transaction requires a current block hash (within 24hrs) to prove that the transaction was created recently. - Hash must be converted to an array of bytes using the `base_decode` method found in [`nearAPI`](#imports). ```js const recentBlockHash = nearAPI.utils.serialize.base_decode( accessKey.block_hash ); ``` [[click here]](https://github.com/near/near-api-js/blob/d4d4cf1ac3182fa998b1e004e6782219325a641b/src/utils/serialize.ts#L16-L17) to view source for `base_decode()`. --- ### Constructing the Transaction With all of our [required arguments](#transaction-requirements), we can construct the transaction. - Using [`nearAPI`](#imports), we call on `createTransaction()` to perform this task. ```js const transaction = nearAPI.transactions.createTransaction( sender, publicKey, receiver, nonce, actions, recentBlockHash ); ``` [[click here]](https://github.com/near/near-api-js/blob/d4d4cf1ac3182fa998b1e004e6782219325a641b/src/transaction.ts#L95-L110) to view source code for the Transaction class --- ### Sign Transaction Now that the transaction is created, we sign it before sending it to the NEAR blockchain. At the lowest level, there are four steps to this process. 1. Using [`nearAPI`](#imports), we call on `serialize()` to serialize the transaction in [Borsh](https://borsh.io/). ```js const serializedTx = nearAPI.utils.serialize.serialize( nearAPI.transactions.SCHEMA.Transaction, transaction ); ``` 2. Hash the serialized transaction using a `sha256` cryptographic hashing algorithm. ```js const serializedTxHash = new Uint8Array(sha256.sha256.array(serializedTx)); ``` 3. Create a signature with the `keyPair`. ```js const signature = keyPair.sign(serializedTxHash); ``` 4. Construct the signed transaction using `near-api-js` [SignedTransaction class](https://github.com/near/near-api-js/blob/d4d4cf1ac3182fa998b1e004e6782219325a641b/src/transaction.ts#L112-L123). ```js const signedTransaction = new nearAPI.transactions.SignedTransaction({ transaction, signature: new nearAPI.transactions.Signature({ keyType: transaction.publicKey.keyType, data: signature.signature, }), }); ``` ### Send Transaction Final step is to encode and send the transaction. - First we serialize transaction into [Borsh](https://borsh.io/), and store the result as `signedSerializedTx`. _(required for all transactions)_ - Then we send the transaction via [RPC call](/api/rpc/introduction) using the `sendJsonRpc()` method nested inside [`near`](#setting-up-connection-to-near). ```js // encodes transaction to serialized Borsh (required for all transactions) const signedSerializedTx = signedTransaction.encode(); // sends transaction to NEAR blockchain via JSON RPC call and records the result const result = await provider.sendJsonRpc("broadcast_tx_commit", [ Buffer.from(signedSerializedTx).toString("base64"), ]); ``` ### Transaction Results Detailed transaction results of the transaction are returned in the following format: ```bash { status: { SuccessValue: '' }, transaction: { signer_id: 'sender.testnet', public_key: 'ed25519:8RazSLHvzj4TBSKGUo5appP7wVeqZNQYjP9hvhF4ZKS2', nonce: 57, receiver_id: 'receiver.testnet', actions: [ [Object] ], signature: 'ed25519:2sK53w6hybSxX7qWShXz6xKnjnYRUW7Co3evEaaggNW6pGSCNPvx7urY4akwnzAbxZGwsKjx8dcVm73qbitntJjz', hash: 'EgGzB73eFxCwZRGcEyCKedLjvvgxhDXcUtq21SqAh79j' }, transaction_outcome: { proof: [ [Object] ], block_hash: 'J6cFDzAFkuknHMCEYW2uPQXDvCfSndkJmADVEWJbtTwV', id: 'EgGzB73eFxCwZRGcEyCKedLjvvgxhDXcUtq21SqAh79j', outcome: { logs: [], receipt_ids: [Array], gas_burnt: 223182562500, tokens_burnt: '22318256250000000000', executor_id: 'sender.testnet', status: [Object] } }, receipts_outcome: [ { proof: [Array], block_hash: 'FSS7UzTpMr4mUm6aw8MmzP6Q7wnQs35VS8vYm1R461dM', id: '3LjBxe2jq1s7XEPrYxihp4rPVdyHAbYfkcdJjUEVijhJ', outcome: [Object] }, { proof: [Array], block_hash: '4XBio5dM5UGYjJgzZjgckfVgMZ9uKGbTkt8zZi5webxw', id: 'AXFA4kwiYfruKQ4LkD1qZA8P7HoAvtFwGqwQYdWtWNaW', outcome: [Object] } ] } Transaction Results: { signer_id: 'sender.testnet', public_key: 'ed25519:8RazSLHvzj4TBSKGUo5appP7wVeqZNQYjP9hvhF4ZKS2', nonce: 57, receiver_id: 'receiver.testnet', actions: [ { Transfer: [Object] } ], signature: 'ed25519:2sK53w6hybSxX7qWShXz6xKnjnYRUW7Co3evEaaggNW6pGSCNPvx7urY4akwnzAbxZGwsKjx8dcVm73qbitntJjz', hash: 'EgGzB73eFxCwZRGcEyCKedLjvvgxhDXcUtq21SqAh79j' } ``` For detailed information on transaction receipts [[click here]](https://nomicon.io/RuntimeSpec/Receipts.html) - To view the transaction in [NearBlocks Explorer](https://testnet.nearblocks.io/), enter the `hash` located under `transaction` / `Transaction Results`. - In addition, you can create a link in JS using the `networkId` and `result.transaction.hash`. ```js const prefix = (networkId === "testnet") ? "testnet." : ""; const transactionLink = `https://${prefix}nearblocks.io/txns/${result.transaction.hash}`; ``` :::tip Got a question? <a href="https://stackoverflow.com/questions/tagged/nearprotocol"><h8>Ask it on StackOverflow!</h8></a> ::: Happy Coding! 🚀
NEAR Launches Simple Nightshade: The First Step Towards a Sharded Blockchain COMMUNITY September 23, 2021 NEAR is launching phase 0 of its roadmap towards a fully sharded blockchain. This phase, nicknamed Simple Nightshade, will kickstart a year of changes and additions to the NEAR blockchain that when complete, will make it super-fast, incredibly secure, and capable of onboarding millions of users into the world of Web3 without skipping a beat. Since NEAR released the design for the protocol back in 2019, it was always designed to be a sharded blockchain. However, when we were preparing for the launch in early 2020, we realized that there was no need to launch a completely sharded network. Sharding is a very complex piece of technology, and the network was brand new. It didn’t need to be capable of handling hundreds of millions of transactions at launch. We decided to focus on the stability of the network first and launch sooner, so developers and entrepreneurs can start building on the NEAR Mainnet as soon as possible. However, after a few months, demand shot up. We have seen the average number of daily transactions rising to 300k. With the emergence of more and more projects building on NEAR, the number of transactions is only going to increase in the coming months. While the network is still currently using only 5% of the total capacity, we wanted to start the transition to sharding now to avoid any unpleasant surprises and ensure we can support all the applications on NEAR. Like with our mainnet launch, we’ve taken a cautious and pragmatic approach to roll out any new features on NEAR to ensure our community is able to keep building without losing key functionality. As a result, we have created a four-stage rollout of sharding, which we’ve detailed below. Phase 0: Simple Nightshade Increasing the Throughput of the Network In this initial phase, we will shard the state, but not processing. We are going to split the current state into four shards while still having all validators track all shards. Nonetheless, the throughput of the Network will significantly increase. In this step, we have built a mechanism to split a shard into multiple parts through live upgrades, which will serve as the foundation for dynamic resharding in the future. Meanwhile, because every shard is still validated by all validators, the safety guarantees remain the same. We plan to launch phase 0 in November 2021. Phase 1: Chunk-Only Producers Further Decentralizing the Network In this phase, we introduce a new role: chunk-only producers, who only validate one shard. They produce chunks (shard blocks) for some specific shard and only need to run inexpensive hardware. Because they neither produce blocks nor contribute to the approvals, the security of the chain is not affected. The introduction of chunk-only producers also helps increase the total number of validators and improve the decentralization of NEAR as a whole. Once this phase is complete, we will have 200-400 validators and only a fraction of them (block producers) need to run more expensive hardware. We expect to deliver phase 1 in January 2022. Phase 2: Nightshade Increasing the Accessibility for Validators In this phase, we finish the implementation of challenges, thereby eliminating the need for any validators to track all the shards. Once this step is completed, both state and processing will be fully sharded. This will also further lower the hardware requirements of running a block producer on NEAR, making the network more accessible for validators. We expect to deliver phase 2 in Q3 2022. Phase 3: Dynamic Resharding Unlocking NEAR to Infinite Scale After phase 2 is complete, we will have a fully functional sharded mainnet with a fixed number of shards. In phase 3, we want to expand on that and create the ability for the network to dynamically split and merge shards based on resource utilization. This will make NEAR almost infinitely more scalable and resilient to short-term usage spikes. We expect to deliver phase 3 in Q4 2022. Sharding is not the final phase of evolution for NEAR Protocol. Rather, we hope it’s just the beginning. We are simultaneously working on a number of improvements on the protocol level to build a secure, developer-friendly, and scalable blockchain that can support mainstream usage and adoption. For more details, please check out the protocol development roadmap.
NEAR Community Update: December 14, 2018 COMMUNITY December 14, 2018 The team continues to grow rapidly. Last week we welcomed three new members: Leo Khan will lead growth. He comes directly from the blockchain-based real estate marketplace Propy and has grown projects from startups like Alpine Data to fortune 500 initiatives like IBM’s Watson. Jane Degtiareva is a senior engineer with 13 years of experience who has worked at Google, Logitech and Niantic, where she built the microtransactions backend for Pokémon GO. Jake Stutzman is a senior designer who has worked closely with established brands like HP, CAT, ESPN and VMWare and startups like InVision, Hudl and Boxee over the past 18 years. In a very tight marketplace, we continue to attract the best in the world on both the engineering and business teams. As we move towards the end of the year, our focus is on building and launching TestNet while mapping out our expansion into multiple markets. That collectively involves a website relaunch, the docs portal, a half-dozen developer tools, international events and a fanatical focus on developer experience. The team certainly isn’t bored. A little design goes a long way. Community and Events Our local event series on blockchain education is in full swing and we’ve specifically focused on the user experience side of blockchains for developers while continuing to help educate the market on the importance — and challenges — of sharding. Recent Highlights Blockchain 101 Onramp: Start Here! Deconstructing the Blockchain Ecosystem. Slides are available on Slideshare. Improving Blockchain Developer Experience: When UX Meets Developer Tools. Slides are available on Slideshare. The video of Cofounder Alex Skidanov’s sharding talk with the Stanford Blockchain Club is available here. The video for a panel at WDAS on Improving Scalability and Performance in Blockchain with Alex participating is available here. Upcoming Events [SF] Dec 19: What are Decentralized Applications (DApps) and How Do They Work? [SF] Jan 9: Using Blockchain in “Regular” Web and Mobile Apps Writing and Content Cofounder Alex Skidanov has published a 2-part series that does a deep dive into sharding approaches. It begins with The Authoritative Guide to Blockchain Sharding and continues with Unsolved Problems in Blockchain Sharding. Both feature figures from Jake. Engineering Highlights Since open sourcing on Nov 28th, we have merged 70+ pull requests to the NEAR Core and NEAR Studio repos: Implemented asynchronous messaging between smart contracts and shards. Added meaningful RPC calls (stake money, send money, deploy contract) to the Node with Python and JS libraries to interact with these RPCs. Automated contract method binding generation, thus removing the need in ABIs via handling arguments in BSON internally (implemented BSON encoder/decoder for AssemblyScript, and updated our fork of AssemblyScript compiler). Extended NEARStudio to build & deploy smart contracts to DevNet in one click. Continued work on TxFlow consensus and Beacon chain implementation. How You Can Get Involved If you want to stay up to date with what we build at NEAR, follow us on Twitter for updates, join the conversation at Discord. https://upscri.be/633436/
--- id: big-query title: BigQuery Public Dataset sidebar_label: BigQuery --- Blockchain data indexing in NEAR Public Lakehouse is for anyone wanting to understand blockchain data. This includes: - **Users**: create queries to track NEAR assets, monitor transactions, or analyze on-chain events at a massive scale. - **Researchers**: use indexed data for data science tasks, including on-chain activities, identifying trends, or feeding AI/ML pipelines for predictive analysis. - **Startups**: can use NEAR's indexed data for deep insights on user engagement, smart contract utilization, or insights across tokens and NFT adoption. Benefits: - **NEAR instant insights**: Historical on-chain data queried at scale. - **Cost-effective**: eliminate the need to store and process bulk NEAR protocol data; query as little or as much data as preferred. - **Easy to use**: no prior experience with blockchain technology is required; bring a general knowledge of SQL to unlock insights. ## Getting started 1. Login into your [Google Cloud Account](https://console.cloud.google.com/). 2. Open the [NEAR Protocol BigQuery Public Dataset](https://console.cloud.google.com/marketplace/product/bigquery-public-data/crypto-near-mainnet). 3. Click in the <kbd>[VIEW DATASET](https://console.cloud.google.com/bigquery?p=bigquery-public-data&d=crypto_near_mainnet_us&page=dataset)</kbd> button. 4. Click in the <kbd>+</kbd> to create a new tab and write your query, click in the <kbd>RUN</kbd> button, and check the `Query results` below the query. 5. Done :) :::info The [NEAR Public Lakehouse repository](https://github.com/near/near-public-lakehouse) contains the source code for ingesting NEAR Protocol data stored as JSON files in AWS S3 by [NEAR Lake Indexer](https://github.com/near/near-lake-indexer). ::: ### Example Queries - _How many unique signers and accounts have interacted with my smart contract per day?_ ```sql SELECT ra.block_date collected_for_day, COUNT(DISTINCT t.signer_account_id) as total_signers, COUNT(DISTINCT ra.receipt_predecessor_account_id) as total_accounts FROM `bigquery-public-data.crypto_near_mainnet_us.receipt_actions` ra JOIN `bigquery-public-data.crypto_near_mainnet_us.receipt_origin_transaction` ro ON ro.receipt_id = ra.receipt_id JOIN `bigquery-public-data.crypto_near_mainnet_us.transactions` t ON ro.originated_from_transaction_hash = t.transaction_hash WHERE ra.action_kind = 'FUNCTION_CALL' AND ra.receipt_receiver_account_id = 'social.near' -- change to your contract GROUP BY 1 ORDER BY 1 DESC; ``` ## How much it costs? - NEAR pays for the storage and doesn't charge you to use the public dataset. > To learn more about BigQuery public datasets [check this page](https://cloud.google.com/bigquery/public-data). - Google GCP charges for the queries that you perform on the data. For example, in today's price "Sep 1st, 2023" the On-demand (per TB) query pricing is $6.25 per TB where the first 1 TB per month is free. > Check [Google's pricing page](https://cloud.google.com/bigquery/pricing#analysis_pricing_models) for detailed pricing info, options, and best practices. :::tip You can check how much data it will query before running it in the BigQuery console UI. Again, since BigQuery uses a columnar data structure and partitions, it's recommended to select only the columns and partitions (`block_date`) needed to avoid unnecessary query costs. ::: ![Query Costs](/docs/BQ_Query_Cost.png "BQ Query Costs") ## Architecture The data is loaded in a streaming fashion using [Databricks Autoloader](https://docs.gcp.databricks.com/ingestion/auto-loader/index.html) into raw/bronze tables, and transformed with [Databricks Delta Live Tables](https://www.databricks.com/product/delta-live-tables) streaming jobs into cleaned/enriched/silver tables. The silver tables are also copied into the [GCP BigQuery Public Dataset](https://cloud.google.com/bigquery/public-data). ![Architecture](/docs/Architecture.png "Architecture") :::info [Databricks Medallion Architecture](https://www.databricks.com/glossary/medallion-architecture). ::: ## Available Data The current data that NEAR is providing was inspired by [NEAR Indexer for Explorer](https://github.com/near/near-indexer-for-explorer/). :::info NEAR plans to improve the data available in the NEAR Public Lakehouse making it easier to consume by denormalizing some tables. ::: The tables available in the NEAR Public Lakehouse are: - **blocks**: A structure that represents an entire block in the NEAR blockchain. `Block` is the main entity in NEAR Protocol blockchain. Blocks are produced in NEAR Protocol every second. - **chunks**: A structure that represents a chunk in the NEAR blockchain. `Chunk` of a `Block` is a part of a `Block` from a `Shard`. The collection of `Chunks` of the `Block` forms the NEAR Protocol Block. `Chunk` contains all the structures that make the `Block`: `Transactions`, [`Receipts`](https://nomicon.io/RuntimeSpec/Receipts), and `Chunk Header`. - **transactions**: [`Transaction`](../../2.build/6.data-infrastructure/lake-data-structures/transaction.mdx#definition) is the main way of interaction between a user and a blockchain. Transaction contains: Signer account ID, Receiver account ID, and Actions. - **execution_outcomes**: Execution outcome is the result of execution of `Transaction` or `Receipt`. In the result of the Transaction execution will always be a Receipt. - **receipt_details**: All cross-contract (we assume that each account lives in its own shard) communication in Near happens through Receipts. Receipts are stateful in a sense that they serve not only as messages between accounts but also can be stored in the account storage to await `DataReceipts`. Each receipt has a `predecessor_id` (who sent it) and `receiver_id` the current account. - **receipt_origin**: Tracks the transaction that originated the receipt. - **receipt_actions**: Action Receipt represents a request to apply actions on the `receiver_id` side. It could be derived as a result of a `Transaction` execution or another `ACTION` Receipt processing. Action kind can be: `ADD_KEY`, `CREATE_ACCOUNT`, `DELEGATE_ACTION`, `DELETE_ACCOUNT`, `DELETE_KEY`, `DEPLOY_CONTRACT`, `FUNCTION_CALL`, `STAKE`, `TRANSFER`. - **receipts (view)**: It's recommended to select only the columns and partitions (`block_date`) needed to avoid unnecessary query costs. This view join the receipt details, the transaction that originated the receipt and the receipt execution outcome. - **account_changes**: Each account has an associated state where it stores its metadata and all the contract-related data (contract's code + storage). :::note References - [Protocol documentation](../../1.concepts/welcome.md) - [Near Data flow](../../1.concepts/data-flow/near-data-flow.md) - [Lake Data structures](./lake-data-structures/toc.mdx) - [Protocol specification](https://nomicon.io/) :::note Additional information about the data - Skipped Blocks: NEAR Blockchain can contain skipped blocks, e.g. block `57730443`. For these cases we can find the block for the chunk data using the `prev_block_hash` column, e.g. `SELECT * FROM chunks c JOIN blocks b ON c.chunk.header.prev_block_hash = b.header.prev_hash`. :::
Zero to Hero NFT Series: Happy Holidays from DevRel! DEVELOPERS December 17, 2021 It’s been a great year for the NEAR ecosystem and our developer community. We’ve hosted our first MetaBUIDL hackathon, rocked the crypto-boat in Portugal with the NEARCON, enjoyed a daily dose of Q&A on our Office Hours, and had a coding rush with the NEARvember challenge. The DevRel team is simply amazed by our dev community, and we are thankful for the support and time every developer spends building projects on NEAR. So, as a humble way to say “Thank You”, we’ve prepared an NFT tutorial series so you can go from Zero to NFT Hero before the new year knocks on your door. If you are new to Rust and want to dive into smart contract development, this series is a great place to start, especially if you want to learn about non-fungible tokens. In this “NFT Zero to Hero” series, you’ll find a set of tutorials that will cover every aspect of a non-fungible token (NFT) smart contract. You’ll go from minting an NFT using a pre-deployed contract to building a fully-fledged NFT smart contract that supports every extension. NFT tutorials As a sneak peek, here’s a list of the NFT tutorials that will bring you from Zero to Hero in no time: Pre-deployed contract: Get introduced to minting an NFT without the need to code, create, or deploy a smart contract. Contract architecture: Learn the basic architecture of the NFT smart contract and you’ll compile this skeleton code with the Rust toolchain. Minting: Flesh out the skeleton so the smart contract can mint a non-fungible token. Upgrade a contract: Discover the process to upgrade an existing smart contract. Enumeration: Explore different enumeration methods that can be used to return the smart contract’s states. Core: Extend the NFT contract using the core standard, which will allow you to transfer non-fungible tokens. Approvals: Expand the contract allowing other accounts to transfer NFTs on your behalf. Royalty: Add the ability for non-fungible tokens to have royalties. This will allow people to get a percentage of the purchase price when an NFT is purchased. Next steps If you’re ready to start, jump into our Dev Docs and begin your Hero learning journey! If you already know about non-fungible tokens and smart contracts, feel free to skip and jump directly to the tutorial of your interest. These tutorials have been designed so you can start at any given point, so you don’t need to start from zero if you’re already a Hero. 🙂
NEAR Foundation Launches New Validator Program To Further Decentralize the Network COMMUNITY December 2, 2021 Since NEAR’s Mainnet launch in October 2020, the NEAR Foundation has helped foster the growth and decentralization of a vibrant validator community. Historically, to become a validator, you would apply to the Foundation Delegation Pilot Program, ensure you have the right amount of $NEAR, and meet the program requirements. While this process ensured the continued security of the network, the amount of $NEAR required to be eligible to become a validator was around 3.6 million, locking out many aspiring validators. NEAR Foundation is happy to announce we’re making some changes to increase the number of validators who can take part in securing the NEAR network. With the introduction of a validator selection algorithm change, set to go live in mid-December, 2021, we expect the seat price to decrease significantly, allowing more capable validators to join the NEAR validator community. Announcing the NEAR Foundation Delegation Program To support the growth and decentralization of the NEAR ecosystem, and to expand the validator set with the upcoming 1.23.0 Mainnet protocol upgrade, the NEAR Foundation is pleased to announce the NEAR Foundation Delegation Program. This delegation program is looking to support validators who have contributed to the ecosystem and are ready to join the NEAR Mainnet. To ensure that we select the best and most capable validators, we’re encouraging all existing validators and potential validators to apply. NEAR Foundation will make the decision process for the Foundation Delegation as transparent as possible. Validator Delegation Program Requirements Technical Requirements: We expect the validator to run a NEAR testnet node and a NEAR mainnet node, demonstrating that they are ready and able to maintain nodes on the NEAR network. For mainnet readiness, having a mainnet node with a staking pool ready and standing by December 13th (the nearcore 1.23.0 protocol upgrade date) is a prerequisite for an applicant to receive NEAR Foundation delegation. We expect all nodes to diligently participate during protocol upgrades. Each node should upgrade to the latest nearcore version within 12 hours of release if the protocol upgrade is labeled “CODE_RED” or “CODE_YELLOW”, and within 24 hours if the protocol upgrade is labeled “CODE_GREEN”. Additionally, nodes should show a high uptime on testnet and on mainnet. A monitoring period is implemented to ensure validator nodes have stable operations. Marketing Requirements: Beyond technical prowess and uptime, validators who could demonstrate exceptional customer service to delegators and provide the best educational content to delegators will be considered as prime candidates for receiving NEAR Foundation delegation. On the mainnet, we ask that validators present themselves to delegators and the NEAR community by providing metadata using the staking pool smart contract. Their name, description, and social media channels should be listed by providing the following metadata using the staking pool smart contract. The identifying information that we require the validators to provide are: Name Description URL Country and country code Email (for support) Telegram, Discord, or Twitter This information allows the NEAR community to connect with the validators for support, fostering a two-way communication between validators and delegators, as well as the wider NEAR Ecosystem. Hosting: Validators self-declare whether they operate nodes themselves or use a third party, as well as whether they run their own hardware or use cloud services. We may ask validators to share some information regarding their setup. As NEAR Protocol is carbon neutral, we ask validators to think through how they offset their validator operation’s CO2 footprint, and communicate any CO2 offsetting that they implement on their end, such as using a renewable energy source to operate the nodes. Commission Limit: We ask validators who would like to apply for a NEAR Foundation delegation to charge no more than 7% commission on delegation. Ecosystem Participation: Applicants are expected to actively participate in the NEAR Ecosystem. To further evaluate applicants, we ask the applicants to provide as much information as possible on the following questions: How have you contributed to the NEAR Ecosystem in the past? How will you contribute to the NEAR Ecosystem in the future? Have you helped to onboard any NEAR validator? Please specify the pool name of the validator you helped, and what did you do to help? What is your long term marketing plan to attract delegation? Application If you are interested in becoming a validator and apply to the NEAR Foundation delegation, please submit your NEAR Foundation Delegation Program Application as soon as possible. The applications will be reviewed on a rolling basis. December 13, 2021 is the deadline to submit your application. Existing Delegation: Given the expected reduction in seat price, the NEAR Foundation delegation will be smaller, compared to historical delegation, without jeopardizing decentralization of the network. For the validators who had historically received delegation from the NEAR Foundation, we encourage you to also apply in the same application process. It’s possible that the existing delegation may be reduced to enable additional validators to receive delegations. Validator Onboarding If you’re interested in becoming a validator and apply for delegation, we ask that you start by setting up Testnet and Mainnet nodes, then submit your application for delegation. We have collaborated with the Open Shard Alliance to build a bootcamp to help train new validators. To get started, please check out the Validator Bootcamp and join the Open Shards Alliance server for onboarding, as well as official validators announcement channels on Discord, Telegram and Twitter. As the NEAR Ecosystem rapidly scales to include new developers and users, we are working to quickly decentralize our organization and foster a vibrant validator community. These moves will be absolutely critical in reimagining the way NEAR’s community members can build, gather, innovate, and grow together.
--- title: NEAR Enhanced API language_tabs: - shell: Shell - http: HTTP - javascript: JavaScript - ruby: Ruby - python: Python - php: PHP - java: Java - go: Go toc_footers: [] includes: [] search: true highlight_theme: darkula headingLevel: 2 --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; <!-- Generator: Widdershins v4.0.1 --> :::warning Please be advised that these tools and services will be discontinued soon. ::: > Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu. Try out our newly released Enhanced APIs - Balances (in Beta) and get what you need for all kinds of balances and token information at ease. Call Enhanced APIs using the endpoint in the API URL box, varies by Network. - https://near-testnet.api.pagoda.co/eapi/v1 - https://near-mainnet.api.pagoda.co/eapi/v1 Grab your API keys and give it a try! We will be adding more advanced Enhanced APIs in our offering, so stay tuned. Get the data you need without extra processing, NEAR Blockchain data query has never been easier! We would love to hear from you on the data APIs you need, please leave feedback using the widget in the lower-right corner. Base URLs: * <a href="https://near-testnet.api.pagoda.co/eapi/v1">https://near-testnet.api.pagoda.co/eapi/v1</a> ## Authentication * API Key (apiKey) - Parameter Name: **x-api-key**, in: header. Use Pagoda DevConsole API key here ## Non Fungible Tokens ### Get NFT > Code samples <Tabs> <TabItem value="Shell"> ```shell # You can also use wget curl -X GET https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id} \ -H 'Accept: application/json' \ -H 'x-api-key: API_KEY' ``` </TabItem> <TabItem value="HTTP"> ```http GET https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id} HTTP/1.1 Host: near-testnet.api.pagoda.co Accept: application/json ``` </TabItem> <TabItem value="JS"> ```javascript const headers = { 'Accept':'application/json', 'x-api-key':'API_KEY' }; fetch('https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` </TabItem> <TabItem value="Ruby"> ```ruby require 'rest-client' require 'json' headers = { 'Accept' => 'application/json', 'x-api-key' => 'API_KEY' } result = RestClient.get 'https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}', params: { }, headers: headers p JSON.parse(result) ``` </TabItem> <TabItem value="Python"> ```python import requests headers = { 'Accept': 'application/json', 'x-api-key': 'API_KEY' } r = requests.get('https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}', headers = headers) print(r.json()) ``` </TabItem> <TabItem value="PHP"> ```php <?php require 'vendor/autoload.php'; $headers = array( 'Accept' => 'application/json', 'x-api-key' => 'API_KEY', ); $client = new \GuzzleHttp\Client(); // Define array of request body. $request_body = array(); try { $response = $client->request('GET','https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}', array( 'headers' => $headers, 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); } catch (\GuzzleHttp\Exception\BadResponseException $e) { // handle exception or api errors. print_r($e->getMessage()); } // ... ``` </TabItem> <TabItem value="Java"> ```java URL obj = new URL("https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` </TabItem> <TabItem value="Go"> ```go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ "Accept": []string{"application/json"}, "x-api-key": []string{"API_KEY"}, } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` </TabItem> </Tabs> `GET /NFT/{contract_account_id}/{token_id}` *Get NFT* This endpoint returns detailed information on the NFT for the given `token_id`, NFT `contract_id`, `timestamp`/`block_height`. <h3 id="get__nft_{contract_account_id}_{token_id}-parameters">Parameters</h3> |Name|In|Type|Required|Description| |---|---|---|---|---| |contract_account_id|path|string|true|none| |token_id|path|string|true|none| |block_height|query|string|false|none| |block_timestamp_nanos|query|string|false|none| > Example responses > 200 Response ```json { "block_height": "string", "block_timestamp_nanos": "string", "contract_metadata": { "base_uri": "string", "icon": "string", "name": "string", "reference": "string", "reference_hash": "string", "spec": "string", "symbol": "string" }, "nft": { "metadata": { "copies": 0, "description": "string", "extra": "string", "media": "string", "media_hash": "string", "reference": "string", "reference_hash": "string", "title": "string" }, "owner_account_id": "string", "token_id": "string" } } ``` <h3 id="get__nft_{contract_account_id}_{token_id}-responses">Responses</h3> |Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|[NftResponse](#schemanftresponse)| |500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|See the inner `code` value to get more details|None| <aside class="warning"> To perform this operation, you must be authenticated by means of one of the following methods: apiKey </aside> ### Get NFT history > Code samples <Tabs> <TabItem value="Shell"> ```shell # You can also use wget curl -X GET https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}/history \ -H 'Accept: application/json' \ -H 'x-api-key: API_KEY' ``` </TabItem> <TabItem value="HTTP"> ```http GET https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}/history HTTP/1.1 Host: near-testnet.api.pagoda.co Accept: application/json ``` </TabItem> <TabItem value="JS"> ```javascript const headers = { 'Accept':'application/json', 'x-api-key':'API_KEY' }; fetch('https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}/history', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` </TabItem> <TabItem value="Ruby"> ```ruby require 'rest-client' require 'json' headers = { 'Accept' => 'application/json', 'x-api-key' => 'API_KEY' } result = RestClient.get 'https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}/history', params: { }, headers: headers p JSON.parse(result) ``` </TabItem> <TabItem value="Python"> ```python import requests headers = { 'Accept': 'application/json', 'x-api-key': 'API_KEY' } r = requests.get('https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}/history', headers = headers) print(r.json()) ``` </TabItem> <TabItem value="PHP"> ```php <?php require 'vendor/autoload.php'; $headers = array( 'Accept' => 'application/json', 'x-api-key' => 'API_KEY', ); $client = new \GuzzleHttp\Client(); // Define array of request body. $request_body = array(); try { $response = $client->request('GET','https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}/history', array( 'headers' => $headers, 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); } catch (\GuzzleHttp\Exception\BadResponseException $e) { // handle exception or api errors. print_r($e->getMessage()); } // ... ``` </TabItem> <TabItem value="Java"> ```java URL obj = new URL("https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}/history"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` </TabItem> <TabItem value="Go"> ```go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ "Accept": []string{"application/json"}, "x-api-key": []string{"API_KEY"}, } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://near-testnet.api.pagoda.co/eapi/v1/NFT/{contract_account_id}/{token_id}/history", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` </TabItem> </Tabs> `GET /NFT/{contract_account_id}/{token_id}/history` *Get NFT history* This endpoint returns the transaction history for the given NFT and `timestamp`/`block_height`. **Note:** The result is centered around the history of the specific NFT and will return list of its passing owners and metadata. **Limitations** * For now, we only support NFT contracts that implement the Events NEP standard. * We currently provide the most recent 100 items. Full-featured pagination will be provided in later phases. <h3 id="get__nft_{contract_account_id}_{token_id}_history-parameters">Parameters</h3> |Name|In|Type|Required|Description| |---|---|---|---|---| |contract_account_id|path|string|true|none| |token_id|path|string|true|none| |limit|query|integer(int32)|false|none| > Example responses > 200 Response ```json { "block_height": "string", "block_timestamp_nanos": "string", "history": [ { "block_height": "string", "block_timestamp_nanos": "string", "cause": "string", "new_account_id": "string", "old_account_id": "string", "status": "string" } ], "nft": { "metadata": { "copies": 0, "description": "string", "extra": "string", "media": "string", "media_hash": "string", "reference": "string", "reference_hash": "string", "title": "string" }, "owner_account_id": "string", "token_id": "string" } } ``` <h3 id="get__nft_{contract_account_id}_{token_id}_history-responses">Responses</h3> |Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|[HistoryResponse](#schemahistoryresponse)| |500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|See the inner `code` value to get more details|None| <aside class="warning"> To perform this operation, you must be authenticated by means of one of the following methods: apiKey </aside> ### Get user's NFT collection overview > Code samples <Tabs> <TabItem value="Shell"> ```shell # You can also use wget curl -X GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT \ -H 'Accept: application/json' \ -H 'x-api-key: API_KEY' ``` </TabItem> <TabItem value="HTTP"> ```http GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT HTTP/1.1 Host: near-testnet.api.pagoda.co Accept: application/json ``` </TabItem> <TabItem value="JS"> ```javascript const headers = { 'Accept':'application/json', 'x-api-key':'API_KEY' }; fetch('https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` </TabItem> <TabItem value="Ruby"> ```ruby require 'rest-client' require 'json' headers = { 'Accept' => 'application/json', 'x-api-key' => 'API_KEY' } result = RestClient.get 'https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT', params: { }, headers: headers p JSON.parse(result) ``` </TabItem> <TabItem value="Python"> ```python import requests headers = { 'Accept': 'application/json', 'x-api-key': 'API_KEY' } r = requests.get('https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT', headers = headers) print(r.json()) ``` </TabItem> <TabItem value="PHP"> ```php <?php require 'vendor/autoload.php'; $headers = array( 'Accept' => 'application/json', 'x-api-key' => 'API_KEY', ); $client = new \GuzzleHttp\Client(); // Define array of request body. $request_body = array(); try { $response = $client->request('GET','https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT', array( 'headers' => $headers, 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); } catch (\GuzzleHttp\Exception\BadResponseException $e) { // handle exception or api errors. print_r($e->getMessage()); } // ... ``` </TabItem> <TabItem value="Java"> ```java URL obj = new URL("https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` </TabItem> <TabItem value="Go"> ```go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ "Accept": []string{"application/json"}, "x-api-key": []string{"API_KEY"}, } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` </TabItem> </Tabs> `GET /accounts/{account_id}/NFT` *Get user's NFT collection overview* For the given `account_id` and `timestamp` or `block_height`, this endpoint returns the number of NFTs grouped by `contract_id`, together with the corresponding NFT contract metadata. The NFT contract will be present in the response if the `account_id` has at least one NFT there. **Note:** `block_timestamp_nanos` helps you choose a moment in time, fixing the blockchain state at that time. **Limitations** * We currently provide the most recent 100 items. Full-featured pagination will be provided in later phases. <h3 id="get__accounts_{account_id}_nft-parameters">Parameters</h3> |Name|In|Type|Required|Description| |---|---|---|---|---| |account_id|path|string|true|none| |block_height|query|string|false|none| |block_timestamp_nanos|query|string|false|none| |limit|query|integer(int32)|false|Maximum available limit 100| > Example responses > 200 Response ```json { "block_height": "string", "block_timestamp_nanos": "string", "nft_counts": [ { "contract_account_id": "string", "contract_metadata": { "base_uri": "string", "icon": "string", "name": "string", "reference": "string", "reference_hash": "string", "spec": "string", "symbol": "string" }, "last_updated_at_timestamp_nanos": "string", "nft_count": 0 } ] } ``` <h3 id="get__accounts_{account_id}_nft-responses">Responses</h3> |Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|[NftCountsResponse](#schemanftcountsresponse)| |500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|See the inner `code` value to get more details|None| <aside class="warning"> To perform this operation, you must be authenticated by means of one of the following methods: apiKey </aside> ### Get user's NFT collection by contract > Code samples <Tabs> <TabItem value="Shell"> ```shell # You can also use wget curl -X GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT/{contract_account_id} \ -H 'Accept: application/json' \ -H 'x-api-key: API_KEY' ``` </TabItem> <TabItem value="HTTP"> ```http GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT/{contract_account_id} HTTP/1.1 Host: near-testnet.api.pagoda.co Accept: application/json ``` </TabItem> <TabItem value="JS"> ```javascript const headers = { 'Accept':'application/json', 'x-api-key':'API_KEY' }; fetch('https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT/{contract_account_id}', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` </TabItem> <TabItem value="Ruby"> ```ruby require 'rest-client' require 'json' headers = { 'Accept' => 'application/json', 'x-api-key' => 'API_KEY' } result = RestClient.get 'https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT/{contract_account_id}', params: { }, headers: headers p JSON.parse(result) ``` </TabItem> <TabItem value="Python"> ```python import requests headers = { 'Accept': 'application/json', 'x-api-key': 'API_KEY' } r = requests.get('https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT/{contract_account_id}', headers = headers) print(r.json()) ``` </TabItem> <TabItem value="PHP"> ```php <?php require 'vendor/autoload.php'; $headers = array( 'Accept' => 'application/json', 'x-api-key' => 'API_KEY', ); $client = new \GuzzleHttp\Client(); // Define array of request body. $request_body = array(); try { $response = $client->request('GET','https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT/{contract_account_id}', array( 'headers' => $headers, 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); } catch (\GuzzleHttp\Exception\BadResponseException $e) { // handle exception or api errors. print_r($e->getMessage()); } // ... ``` </TabItem> <TabItem value="Java"> ```java URL obj = new URL("https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT/{contract_account_id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` </TabItem> <TabItem value="Go"> ```go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ "Accept": []string{"application/json"}, "x-api-key": []string{"API_KEY"}, } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/NFT/{contract_account_id}", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` </TabItem> </Tabs> `GET /accounts/{account_id}/NFT/{contract_account_id}` *Get user's NFT collection by contract* This endpoint returns the list of NFTs with full details for the given `account_id`, NFT `contract_id`, `timestamp`/`block_height`. You can use the `token_id` from this response and then request the NFT history for that token. **Limitations** * We currently provide the most recent 100 items. Full-featured pagination will be provided in later phases. <h3 id="get__accounts_{account_id}_nft_{contract_account_id}-parameters">Parameters</h3> |Name|In|Type|Required|Description| |---|---|---|---|---| |account_id|path|string|true|none| |contract_account_id|path|string|true|none| |block_height|query|string|false|none| |block_timestamp_nanos|query|string|false|none| |limit|query|integer(int32)|false|Maximum available limit 100| > Example responses > 200 Response ```json { "block_height": "string", "block_timestamp_nanos": "string", "contract_metadata": { "base_uri": "string", "icon": "string", "name": "string", "reference": "string", "reference_hash": "string", "spec": "string", "symbol": "string" }, "nfts": [ { "metadata": { "copies": 0, "description": "string", "extra": "string", "media": "string", "media_hash": "string", "reference": "string", "reference_hash": "string", "title": "string" }, "owner_account_id": "string", "token_id": "string" } ] } ``` <h3 id="get__accounts_{account_id}_nft_{contract_account_id}-responses">Responses</h3> |Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|[NftsResponse](#schemanftsresponse)| |500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|See the inner `code` value to get more details|None| <aside class="warning"> To perform this operation, you must be authenticated by means of one of the following methods: apiKey </aside> ### Get NFT contract metadata > Code samples <Tabs> <TabItem value="Shell"> ```shell # You can also use wget curl -X GET https://near-testnet.api.pagoda.co/eapi/v1/nep171/metadata/{contract_account_id} \ -H 'Accept: application/json' \ -H 'x-api-key: API_KEY' ``` </TabItem> <TabItem value="HTTP"> ```http GET https://near-testnet.api.pagoda.co/eapi/v1/nep171/metadata/{contract_account_id} HTTP/1.1 Host: near-testnet.api.pagoda.co Accept: application/json ``` </TabItem> <TabItem value="JS"> ```javascript const headers = { 'Accept':'application/json', 'x-api-key':'API_KEY' }; fetch('https://near-testnet.api.pagoda.co/eapi/v1/nep171/metadata/{contract_account_id}', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` </TabItem> <TabItem value="Ruby"> ```ruby require 'rest-client' require 'json' headers = { 'Accept' => 'application/json', 'x-api-key' => 'API_KEY' } result = RestClient.get 'https://near-testnet.api.pagoda.co/eapi/v1/nep171/metadata/{contract_account_id}', params: { }, headers: headers p JSON.parse(result) ``` </TabItem> <TabItem value="Python"> ```python import requests headers = { 'Accept': 'application/json', 'x-api-key': 'API_KEY' } r = requests.get('https://near-testnet.api.pagoda.co/eapi/v1/nep171/metadata/{contract_account_id}', headers = headers) print(r.json()) ``` </TabItem> <TabItem value="PHP"> ```php <?php require 'vendor/autoload.php'; $headers = array( 'Accept' => 'application/json', 'x-api-key' => 'API_KEY', ); $client = new \GuzzleHttp\Client(); // Define array of request body. $request_body = array(); try { $response = $client->request('GET','https://near-testnet.api.pagoda.co/eapi/v1/nep171/metadata/{contract_account_id}', array( 'headers' => $headers, 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); } catch (\GuzzleHttp\Exception\BadResponseException $e) { // handle exception or api errors. print_r($e->getMessage()); } // ... ``` </TabItem> <TabItem value="Java"> ```java URL obj = new URL("https://near-testnet.api.pagoda.co/eapi/v1/nep171/metadata/{contract_account_id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` </TabItem> <TabItem value="Go"> ```go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ "Accept": []string{"application/json"}, "x-api-key": []string{"API_KEY"}, } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://near-testnet.api.pagoda.co/eapi/v1/nep171/metadata/{contract_account_id}", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` </TabItem> </Tabs> `GET /nep171/metadata/{contract_account_id}` *Get NFT contract metadata* This endpoint returns the metadata for a given NFT contract and `timestamp`/`block_height`. **Note:** This is contract-wide metadata. Each NFT also has its own metadata. <h3 id="get__nep171_metadata_{contract_account_id}-parameters">Parameters</h3> |Name|In|Type|Required|Description| |---|---|---|---|---| |contract_account_id|path|string|true|none| |block_height|query|string|false|none| |block_timestamp_nanos|query|string|false|none| > Example responses > 200 Response ```json { "block_height": "string", "block_timestamp_nanos": "string", "metadata": { "base_uri": "string", "icon": "string", "name": "string", "reference": "string", "reference_hash": "string", "spec": "string", "symbol": "string" } } ``` <h3 id="get__nep171_metadata_{contract_account_id}-responses">Responses</h3> |Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|[MetadataResponse](#schemametadataresponse)| |500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|See the inner `code` value to get more details|None| <aside class="warning"> To perform this operation, you must be authenticated by means of one of the following methods: apiKey </aside> --- ## NEAR ### Get user's NEAR balance > Code samples <Tabs> <TabItem value="Shell"> ```shell # You can also use wget curl -X GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/NEAR \ -H 'Accept: application/json' \ -H 'x-api-key: API_KEY' ``` </TabItem> <TabItem value="HTTP"> ```http GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/NEAR HTTP/1.1 Host: near-testnet.api.pagoda.co Accept: application/json ``` </TabItem> <TabItem value="JS"> ```javascript const headers = { 'Accept':'application/json', 'x-api-key':'API_KEY' }; fetch('https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/NEAR', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` </TabItem> <TabItem value="Ruby"> ```ruby require 'rest-client' require 'json' headers = { 'Accept' => 'application/json', 'x-api-key' => 'API_KEY' } result = RestClient.get 'https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/NEAR', params: { }, headers: headers p JSON.parse(result) ``` </TabItem> <TabItem value="Python"> ```python import requests headers = { 'Accept': 'application/json', 'x-api-key': 'API_KEY' } r = requests.get('https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/NEAR', headers = headers) print(r.json()) ``` </TabItem> <TabItem value="PHP"> ```php <?php require 'vendor/autoload.php'; $headers = array( 'Accept' => 'application/json', 'x-api-key' => 'API_KEY', ); $client = new \GuzzleHttp\Client(); // Define array of request body. $request_body = array(); try { $response = $client->request('GET','https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/NEAR', array( 'headers' => $headers, 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); } catch (\GuzzleHttp\Exception\BadResponseException $e) { // handle exception or api errors. print_r($e->getMessage()); } // ... ``` </TabItem> <TabItem value="Java"> ```java URL obj = new URL("https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/NEAR"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` </TabItem> <TabItem value="Go"> ```go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ "Accept": []string{"application/json"}, "x-api-key": []string{"API_KEY"}, } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/NEAR", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` </TabItem> </Tabs> `GET /accounts/{account_id}/coins/NEAR` *Get user's NEAR balance* This endpoint returns the NEAR balance of the given `account_id` at the given `timestamp`/`block_height`. <h3 id="get__accounts_{account_id}_coins_near-parameters">Parameters</h3> |Name|In|Type|Required|Description| |---|---|---|---|---| |account_id|path|string|true|none| |block_height|query|string|false|none| |block_timestamp_nanos|query|string|false|none| > Example responses > 200 Response ```json { "balance": "string", "block_height": "string", "block_timestamp_nanos": "string", "metadata": { "decimals": 0, "icon": "string", "name": "string", "symbol": "string" } } ``` <h3 id="get__accounts_{account_id}_coins_near-responses">Responses</h3> |Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|[NearBalanceResponse](#schemanearbalanceresponse)| |500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|See the inner `code` value to get more details|None| <aside class="warning"> To perform this operation, you must be authenticated by means of one of the following methods: apiKey </aside> ### Get user's NEAR history > Code samples <Tabs> <TabItem value="Shell"> ```shell # You can also use wget curl -X GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/NEAR/history \ -H 'Accept: application/json' \ -H 'x-api-key: API_KEY' ``` </TabItem> <TabItem value="HTTP"> ```http GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/NEAR/history HTTP/1.1 Host: near-testnet.api.pagoda.co Accept: application/json ``` </TabItem> <TabItem value="JS"> ```javascript const headers = { 'Accept':'application/json', 'x-api-key':'API_KEY' }; fetch('https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/NEAR/history', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` </TabItem> <TabItem value="Ruby"> ```ruby require 'rest-client' require 'json' headers = { 'Accept' => 'application/json', 'x-api-key' => 'API_KEY' } result = RestClient.get 'https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/NEAR/history', params: { }, headers: headers p JSON.parse(result) ``` </TabItem> <TabItem value="Python"> ```python import requests headers = { 'Accept': 'application/json', 'x-api-key': 'API_KEY' } r = requests.get('https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/NEAR/history', headers = headers) print(r.json()) ``` </TabItem> <TabItem value="PHP"> ```php <?php require 'vendor/autoload.php'; $headers = array( 'Accept' => 'application/json', 'x-api-key' => 'API_KEY', ); $client = new \GuzzleHttp\Client(); // Define array of request body. $request_body = array(); try { $response = $client->request('GET','https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/NEAR/history', array( 'headers' => $headers, 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); } catch (\GuzzleHttp\Exception\BadResponseException $e) { // handle exception or api errors. print_r($e->getMessage()); } // ... ``` </TabItem> <TabItem value="Java"> ```java URL obj = new URL("https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/NEAR/history"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` </TabItem> <TabItem value="Go"> ```go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ "Accept": []string{"application/json"}, "x-api-key": []string{"API_KEY"}, } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/NEAR/history", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` </TabItem> </Tabs> `GET /accounts/{account_id}/coins/NEAR/history` *Get user's NEAR history* This endpoint returns the history of operations with NEAR coins for the given `account_id`, `timestamp`/`block_height`. **Limitations** * We currently provide the most recent 100 items. Full-featured pagination will be provided in an upcoming update. <h3 id="get__accounts_{account_id}_coins_near_history-parameters">Parameters</h3> |Name|In|Type|Required|Description| |---|---|---|---|---| |account_id|path|string|true|none| |limit|query|integer(int32)|false|none| > Example responses > 200 Response ```json { "block_height": "string", "block_timestamp_nanos": "string", "history": [ { "block_height": "string", "block_timestamp_nanos": "string", "cause": "string", "new_account_id": "string", "old_account_id": "string", "status": "string" } ], "nft": { "metadata": { "copies": 0, "description": "string", "extra": "string", "media": "string", "media_hash": "string", "reference": "string", "reference_hash": "string", "title": "string" }, "owner_account_id": "string", "token_id": "string" } } ``` <h3 id="get__accounts_{account_id}_coins_near_history-responses">Responses</h3> |Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|[HistoryResponse](#schemahistoryresponse)| |500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|See the inner `code` value to get more details|None| <aside class="warning"> To perform this operation, you must be authenticated by means of one of the following methods: apiKey </aside> --- ## Fungible Tokens ### Get user's coin balances > Code samples <Tabs> <TabItem value="Shell"> ```shell # You can also use wget curl -X GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins \ -H 'Accept: application/json' \ -H 'x-api-key: API_KEY' ``` </TabItem> <TabItem value="HTTP"> ```http GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins HTTP/1.1 Host: near-testnet.api.pagoda.co Accept: application/json ``` </TabItem> <TabItem value="JS"> ```javascript const headers = { 'Accept':'application/json', 'x-api-key':'API_KEY' }; fetch('https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` </TabItem> <TabItem value="Ruby"> ```ruby require 'rest-client' require 'json' headers = { 'Accept' => 'application/json', 'x-api-key' => 'API_KEY' } result = RestClient.get 'https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins', params: { }, headers: headers p JSON.parse(result) ``` </TabItem> <TabItem value="Python"> ```python import requests headers = { 'Accept': 'application/json', 'x-api-key': 'API_KEY' } r = requests.get('https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins', headers = headers) print(r.json()) ``` </TabItem> <TabItem value="PHP"> ```php <?php require 'vendor/autoload.php'; $headers = array( 'Accept' => 'application/json', 'x-api-key' => 'API_KEY', ); $client = new \GuzzleHttp\Client(); // Define array of request body. $request_body = array(); try { $response = $client->request('GET','https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins', array( 'headers' => $headers, 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); } catch (\GuzzleHttp\Exception\BadResponseException $e) { // handle exception or api errors. print_r($e->getMessage()); } // ... ``` </TabItem> <TabItem value="Java"> ```java URL obj = new URL("https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` </TabItem> <TabItem value="Go"> ```go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ "Accept": []string{"application/json"}, "x-api-key": []string{"API_KEY"}, } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` </TabItem> </Tabs> `GET /accounts/{account_id}/coins` *Get user's coin balances* This endpoint returns all the countable coin balances (including NEAR, fungible tokens, and _multi-tokens_) of the given `account_id`, at the given `timestamp`/`block_height`. **Limitations** * For now, we only support the balance for NEAR and FT contracts that implement the Events NEP standard. We are working on a solution to support other FT contracts, including `wrap.near` and bridged tokens. * We are in the process of supporting Multi Token balances. * We currently provide the most recent 100 items. Full-featured pagination will be provided in an upcoming update. <h3 id="get__accounts_{account_id}_coins-parameters">Parameters</h3> |Name|In|Type|Required|Description| |---|---|---|---|---| |account_id|path|string|true|none| |block_height|query|string|false|none| |block_timestamp_nanos|query|string|false|none| |limit|query|integer(int32)|false|Maximum available limit 100| > Example responses > 200 Response ```json { "balances": [ { "balance": "string", "contract_account_id": "string", "metadata": { "decimals": 0, "icon": "string", "name": "string", "symbol": "string" }, "standard": "string" } ], "block_height": "string", "block_timestamp_nanos": "string" } ``` <h3 id="get__accounts_{account_id}_coins-responses">Responses</h3> |Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|[CoinBalancesResponse](#schemacoinbalancesresponse)| |500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|See the inner `code` value to get more details|None| <aside class="warning"> To perform this operation, you must be authenticated by means of one of the following methods: apiKey </aside> ### Get user's coin balances by contract > Code samples <Tabs> <TabItem value="Shell"> ```shell # You can also use wget curl -X GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_id} \ -H 'Accept: application/json' \ -H 'x-api-key: API_KEY' ``` </TabItem> <TabItem value="HTTP"> ```http GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_id} HTTP/1.1 Host: near-testnet.api.pagoda.co Accept: application/json ``` </TabItem> <TabItem value="JS"> ```javascript const headers = { 'Accept':'application/json', 'x-api-key':'API_KEY' }; fetch('https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_id}', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` </TabItem> <TabItem value="Ruby"> ```ruby require 'rest-client' require 'json' headers = { 'Accept' => 'application/json', 'x-api-key' => 'API_KEY' } result = RestClient.get 'https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_id}', params: { }, headers: headers p JSON.parse(result) ``` </TabItem> <TabItem value="Python"> ```python import requests headers = { 'Accept': 'application/json', 'x-api-key': 'API_KEY' } r = requests.get('https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_id}', headers = headers) print(r.json()) ``` </TabItem> <TabItem value="PHP"> ```php <?php require 'vendor/autoload.php'; $headers = array( 'Accept' => 'application/json', 'x-api-key' => 'API_KEY', ); $client = new \GuzzleHttp\Client(); // Define array of request body. $request_body = array(); try { $response = $client->request('GET','https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_id}', array( 'headers' => $headers, 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); } catch (\GuzzleHttp\Exception\BadResponseException $e) { // handle exception or api errors. print_r($e->getMessage()); } // ... ``` </TabItem> <TabItem value="Java"> ```java URL obj = new URL("https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` </TabItem> <TabItem value="Go"> ```go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ "Accept": []string{"application/json"}, "x-api-key": []string{"API_KEY"}, } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_id}", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` </TabItem> </Tabs> `GET /accounts/{account_id}/coins/{contract_account_id}` *Get user's coin balances by contract* This endpoint returns all the countable coin balances of the given `account_id`, for the given contract and `timestamp`/`block_height`. For FT contracts, the response has only 1 item in the list. For MT contracts, there could be several balances (MT support is still under development). **Limitations** * For now, we support only the balance for FT contracts that implement the Events NEP standard. We are working on a solution to support other FT contracts, including `wrap.near` and bridged tokens. * We are in the process of supporting Multi Token balances. <h3 id="get__accounts_{account_id}_coins_{contract_account_id}-parameters">Parameters</h3> |Name|In|Type|Required|Description| |---|---|---|---|---| |account_id|path|string|true|none| |contract_account_id|path|string|true|none| |block_height|query|string|false|none| |block_timestamp_nanos|query|string|false|none| > Example responses > 200 Response ```json { "balances": [ { "balance": "string", "contract_account_id": "string", "metadata": { "decimals": 0, "icon": "string", "name": "string", "symbol": "string" }, "standard": "string" } ], "block_height": "string", "block_timestamp_nanos": "string" } ``` <h3 id="get__accounts_{account_id}_coins_{contract_account_id}-responses">Responses</h3> |Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|[CoinBalancesResponse](#schemacoinbalancesresponse)| |500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|See the inner `code` value to get more details|None| <aside class="warning"> To perform this operation, you must be authenticated by means of one of the following methods: apiKey </aside> ### Get user's coin history by contract > Code samples <Tabs> <TabItem value="Shell"> ```shell # You can also use wget curl -X GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_id}/history \ -H 'Accept: application/json' \ -H 'x-api-key: API_KEY' ``` </TabItem> <TabItem value="HTTP"> ```http GET https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_id}/history HTTP/1.1 Host: near-testnet.api.pagoda.co Accept: application/json ``` </TabItem> <TabItem value="JS"> ```javascript const headers = { 'Accept':'application/json', 'x-api-key':'API_KEY' }; fetch('https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_id}/history', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` </TabItem> <TabItem value="Ruby"> ```ruby require 'rest-client' require 'json' headers = { 'Accept' => 'application/json', 'x-api-key' => 'API_KEY' } result = RestClient.get 'https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_id}/history', params: { }, headers: headers p JSON.parse(result) ``` </TabItem> <TabItem value="Python"> ```python import requests headers = { 'Accept': 'application/json', 'x-api-key': 'API_KEY' } r = requests.get('https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_id}/history', headers = headers) print(r.json()) ``` </TabItem> <TabItem value="PHP"> ```php <?php require 'vendor/autoload.php'; $headers = array( 'Accept' => 'application/json', 'x-api-key' => 'API_KEY', ); $client = new \GuzzleHttp\Client(); // Define array of request body. $request_body = array(); try { $response = $client->request('GET','https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_id}/history', array( 'headers' => $headers, 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); } catch (\GuzzleHttp\Exception\BadResponseException $e) { // handle exception or api errors. print_r($e->getMessage()); } // ... ``` </TabItem> <TabItem value="Java"> ```java URL obj = new URL("https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_id}/history"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` </TabItem> <TabItem value="Go"> ```go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ "Accept": []string{"application/json"}, "x-api-key": []string{"API_KEY"}, } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://near-testnet.api.pagoda.co/eapi/v1/accounts/{account_id}/coins/{contract_account_id}/history", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` </TabItem> </Tabs> `GET /accounts/{account_id}/coins/{contract_account_id}/history` *Get user's coin history by contract* This endpoint returns the history of coin operations (FT, other standards) for the given `account_id`, `contract_id`, `timestamp`/`block_height`. **Limitations** * For now, we support only FT contracts that implement the Events NEP standard. We are working on a solution to support other FT contracts, including `wrap.near` and bridged tokens. * We are in the process of supporting Multi Token history. * We currently provide the most recent 100 items. Full-featured pagination will be provided in an upcoming update. <h3 id="get__accounts_{account_id}_coins_{contract_account_id}_history-parameters">Parameters</h3> |Name|In|Type|Required|Description| |---|---|---|---|---| |account_id|path|string|true|none| |contract_account_id|path|string|true|none| |limit|query|integer(int32)|false|none| > Example responses > 200 Response ```json { "block_height": "string", "block_timestamp_nanos": "string", "history": [ { "block_height": "string", "block_timestamp_nanos": "string", "cause": "string", "new_account_id": "string", "old_account_id": "string", "status": "string" } ], "nft": { "metadata": { "copies": 0, "description": "string", "extra": "string", "media": "string", "media_hash": "string", "reference": "string", "reference_hash": "string", "title": "string" }, "owner_account_id": "string", "token_id": "string" } } ``` <h3 id="get__accounts_{account_id}_coins_{contract_account_id}_history-responses">Responses</h3> |Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|[HistoryResponse](#schemahistoryresponse)| |500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|See the inner `code` value to get more details|None| <aside class="warning"> To perform this operation, you must be authenticated by means of one of the following methods: apiKey </aside> ### Get FT contract metadata > Code samples <Tabs> <TabItem value="Shell"> ```shell # You can also use wget curl -X GET https://near-testnet.api.pagoda.co/eapi/v1/nep141/metadata/{contract_account_id} \ -H 'Accept: application/json' \ -H 'x-api-key: API_KEY' ``` </TabItem> <TabItem value="HTTP"> ```http GET https://near-testnet.api.pagoda.co/eapi/v1/nep141/metadata/{contract_account_id} HTTP/1.1 Host: near-testnet.api.pagoda.co Accept: application/json ``` </TabItem> <TabItem value="JS"> ```javascript const headers = { 'Accept':'application/json', 'x-api-key':'API_KEY' }; fetch('https://near-testnet.api.pagoda.co/eapi/v1/nep141/metadata/{contract_account_id}', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` </TabItem> <TabItem value="Ruby"> ```ruby require 'rest-client' require 'json' headers = { 'Accept' => 'application/json', 'x-api-key' => 'API_KEY' } result = RestClient.get 'https://near-testnet.api.pagoda.co/eapi/v1/nep141/metadata/{contract_account_id}', params: { }, headers: headers p JSON.parse(result) ``` </TabItem> <TabItem value="Python"> ```python import requests headers = { 'Accept': 'application/json', 'x-api-key': 'API_KEY' } r = requests.get('https://near-testnet.api.pagoda.co/eapi/v1/nep141/metadata/{contract_account_id}', headers = headers) print(r.json()) ``` </TabItem> <TabItem value="PHP"> ```php <?php require 'vendor/autoload.php'; $headers = array( 'Accept' => 'application/json', 'x-api-key' => 'API_KEY', ); $client = new \GuzzleHttp\Client(); // Define array of request body. $request_body = array(); try { $response = $client->request('GET','https://near-testnet.api.pagoda.co/eapi/v1/nep141/metadata/{contract_account_id}', array( 'headers' => $headers, 'json' => $request_body, ) ); print_r($response->getBody()->getContents()); } catch (\GuzzleHttp\Exception\BadResponseException $e) { // handle exception or api errors. print_r($e->getMessage()); } // ... ``` </TabItem> <TabItem value="Java"> ```java URL obj = new URL("https://near-testnet.api.pagoda.co/eapi/v1/nep141/metadata/{contract_account_id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` </TabItem> <TabItem value="Go"> ```go package main import ( "bytes" "net/http" ) func main() { headers := map[string][]string{ "Accept": []string{"application/json"}, "x-api-key": []string{"API_KEY"}, } data := bytes.NewBuffer([]byte{jsonReq}) req, err := http.NewRequest("GET", "https://near-testnet.api.pagoda.co/eapi/v1/nep141/metadata/{contract_account_id}", data) req.Header = headers client := &http.Client{} resp, err := client.Do(req) // ... } ``` </TabItem> </Tabs> `GET /nep141/metadata/{contract_account_id}` *Get FT contract metadata* This endpoint returns the metadata for a given FT contract and `timestamp`/`block_height`. **Limitations** * For now, we support only FT contracts that implement the Events NEP standard. We are working on a solution to support other FT contracts, including `wrap.near` and bridged tokens. <h3 id="get__nep141_metadata_{contract_account_id}-parameters">Parameters</h3> |Name|In|Type|Required|Description| |---|---|---|---|---| |contract_account_id|path|string|true|none| |block_height|query|string|false|none| |block_timestamp_nanos|query|string|false|none| > Example responses > 200 Response ```json { "block_height": "string", "block_timestamp_nanos": "string", "metadata": { "decimals": 0, "icon": "string", "name": "string", "reference": "string", "reference_hash": "string", "spec": "string", "symbol": "string" } } ``` <h3 id="get__nep141_metadata_{contract_account_id}-responses">Responses</h3> |Status|Meaning|Description|Schema| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|OK|[FtContractMetadataResponse](#schemaftcontractmetadataresponse)| |500|[Internal Server Error](https://tools.ietf.org/html/rfc7231#section-6.6.1)|See the inner `code` value to get more details|None| <aside class="warning"> To perform this operation, you must be authenticated by means of one of the following methods: apiKey </aside> --- ## Schemas ### CoinBalancesResponse <!-- backwards compatibility --> <a id="schemacoinbalancesresponse"></a> <a id="schema_CoinBalancesResponse"></a> <a id="tocScoinbalancesresponse"></a> <a id="tocscoinbalancesresponse"></a> ```json { "balances": [ { "balance": "string", "contract_account_id": "string", "metadata": { "decimals": 0, "icon": "string", "name": "string", "symbol": "string" }, "standard": "string" } ], "block_height": "string", "block_timestamp_nanos": "string" } ``` This response gives the information about all the available balances for the user. The answer gives the list of NEAR, FT balances, could be used for Multi Tokens. For MTs and other standards, balances could have multiple entries for one contract. ##### Properties |Name|Type|Required|Restrictions|Description| |---|---|---|---|---| |balances|[object]|true|none|none| |» balance|string|true|none|none| |» contract_account_id|string|false|none|null for NEAR, not null otherwise| |» metadata|object|true|none|This type describes general Metadata info, collecting the most important fields from different standards in the one format.<br /> `decimals` may contain `0` if it's not applicable (e.g. if it's general MT metadata)| |»» decimals|integer(int32)|true|none|none| |»» icon|string|false|none|none| |»» name|string|true|none|none| |»» symbol|string|true|none|none| |» standard|string|true|none|"nearprotocol" for NEAR, "nep141" for FT| |block_height|string|true|none|none| |block_timestamp_nanos|string|true|none|none| ### FtContractMetadataResponse <!-- backwards compatibility --> <a id="schemaftcontractmetadataresponse"></a> <a id="schema_FtContractMetadataResponse"></a> <a id="tocSftcontractmetadataresponse"></a> <a id="tocsftcontractmetadataresponse"></a> ```json { "block_height": "string", "block_timestamp_nanos": "string", "metadata": { "decimals": 0, "icon": "string", "name": "string", "reference": "string", "reference_hash": "string", "spec": "string", "symbol": "string" } } ``` ##### Properties |Name|Type|Required|Restrictions|Description| |---|---|---|---|---| |block_height|string|true|none|none| |block_timestamp_nanos|string|true|none|none| |metadata|object|true|none|The type for FT Contract Metadata. Inspired by<br /> https://nomicon.io/Standards/Tokens/FungibleToken/Metadata| |» decimals|integer(int32)|true|none|none| |» icon|string|false|none|none| |» name|string|true|none|none| |» reference|string|false|none|none| |» reference_hash|string|false|none|none| |» spec|string|true|none|none| |» symbol|string|true|none|none| ### HistoryResponse <!-- backwards compatibility --> <a id="schemahistoryresponse"></a> <a id="schema_HistoryResponse"></a> <a id="tocShistoryresponse"></a> <a id="tocshistoryresponse"></a> ```json { "block_height": "string", "block_timestamp_nanos": "string", "history": [ { "block_height": "string", "block_timestamp_nanos": "string", "cause": "string", "new_account_id": "string", "old_account_id": "string", "status": "string" } ], "nft": { "metadata": { "copies": 0, "description": "string", "extra": "string", "media": "string", "media_hash": "string", "reference": "string", "reference_hash": "string", "title": "string" }, "owner_account_id": "string", "token_id": "string" } } ``` ##### Properties |Name|Type|Required|Restrictions|Description| |---|---|---|---|---| |block_height|string|true|none|none| |block_timestamp_nanos|string|true|none|none| |history|[object]|true|none|none| |» block_height|string|true|none|none| |» block_timestamp_nanos|string|true|none|none| |» cause|string|true|none|none| |» new_account_id|string|false|none|none| |» old_account_id|string|false|none|none| |» status|string|true|none|none| |nft|object|true|none|The type for Non Fungible Token. Inspired by<br /> https://nomicon.io/Standards/Tokens/NonFungibleToken/Metadata| |» metadata|object|true|none|The type for Non Fungible Token Metadata. Inspired by<br /> https://nomicon.io/Standards/Tokens/NonFungibleToken/Metadata| |»» copies|integer(int64)|false|none|none| |»» description|string|false|none|none| |»» extra|string|false|none|none| |»» media|string|false|none|none| |»» media_hash|string|false|none|none| |»» reference|string|false|none|none| |»» reference_hash|string|false|none|none| |»» title|string|false|none|none| |» owner_account_id|string|true|none|none| |» token_id|string|true|none|none| ### MetadataResponse <!-- backwards compatibility --> <a id="schemametadataresponse"></a> <a id="schema_MetadataResponse"></a> <a id="tocSmetadataresponse"></a> <a id="tocsmetadataresponse"></a> ```json { "block_height": "string", "block_timestamp_nanos": "string", "metadata": { "base_uri": "string", "icon": "string", "name": "string", "reference": "string", "reference_hash": "string", "spec": "string", "symbol": "string" } } ``` ##### Properties |Name|Type|Required|Restrictions|Description| |---|---|---|---|---| |block_height|string|true|none|none| |block_timestamp_nanos|string|true|none|none| |metadata|object|true|none|The type for Non Fungible Token Contract Metadata. Inspired by<br /> https://nomicon.io/Standards/Tokens/NonFungibleToken/Metadata| |» base_uri|string|false|none|none| |» icon|string|false|none|none| |» name|string|true|none|none| |» reference|string|false|none|none| |» reference_hash|string|false|none|none| |» spec|string|true|none|none| |» symbol|string|true|none|none| ### NearBalanceResponse <!-- backwards compatibility --> <a id="schemanearbalanceresponse"></a> <a id="schema_NearBalanceResponse"></a> <a id="tocSnearbalanceresponse"></a> <a id="tocsnearbalanceresponse"></a> ```json { "balance": "string", "block_height": "string", "block_timestamp_nanos": "string", "metadata": { "decimals": 0, "icon": "string", "name": "string", "symbol": "string" } } ``` ##### Properties |Name|Type|Required|Restrictions|Description| |---|---|---|---|---| |balance|string|true|none|Sum of staked and nonstaked balances| |block_height|string|true|none|none| |block_timestamp_nanos|string|true|none|none| |metadata|object|true|none|This type describes general Metadata info, collecting the most important fields from different standards in the one format.<br /> `decimals` may contain `0` if it's not applicable (e.g. if it's general MT metadata)| |» decimals|integer(int32)|true|none|none| |» icon|string|false|none|none| |» name|string|true|none|none| |» symbol|string|true|none|none| ### NftCountsResponse <!-- backwards compatibility --> <a id="schemanftcountsresponse"></a> <a id="schema_NftCountsResponse"></a> <a id="tocSnftcountsresponse"></a> <a id="tocsnftcountsresponse"></a> ```json { "block_height": "string", "block_timestamp_nanos": "string", "nft_counts": [ { "contract_account_id": "string", "contract_metadata": { "base_uri": "string", "icon": "string", "name": "string", "reference": "string", "reference_hash": "string", "spec": "string", "symbol": "string" }, "last_updated_at_timestamp_nanos": "string", "nft_count": 0 } ] } ``` ##### Properties |Name|Type|Required|Restrictions|Description| |---|---|---|---|---| |block_height|string|true|none|none| |block_timestamp_nanos|string|true|none|none| |nft_counts|[object]|true|none|none| |» contract_account_id|string|true|none|none| |» contract_metadata|object|true|none|The type for Non Fungible Token Contract Metadata. Inspired by<br /> https://nomicon.io/Standards/Tokens/NonFungibleToken/Metadata| |»» base_uri|string|false|none|none| |»» icon|string|false|none|none| |»» name|string|true|none|none| |»» reference|string|false|none|none| |»» reference_hash|string|false|none|none| |»» spec|string|true|none|none| |»» symbol|string|true|none|none| |» last_updated_at_timestamp_nanos|string|true|none|none| |» nft_count|integer(int32)|true|none|none| ### NftResponse <!-- backwards compatibility --> <a id="schemanftresponse"></a> <a id="schema_NftResponse"></a> <a id="tocSnftresponse"></a> <a id="tocsnftresponse"></a> ```json { "block_height": "string", "block_timestamp_nanos": "string", "contract_metadata": { "base_uri": "string", "icon": "string", "name": "string", "reference": "string", "reference_hash": "string", "spec": "string", "symbol": "string" }, "nft": { "metadata": { "copies": 0, "description": "string", "extra": "string", "media": "string", "media_hash": "string", "reference": "string", "reference_hash": "string", "title": "string" }, "owner_account_id": "string", "token_id": "string" } } ``` ##### Properties |Name|Type|Required|Restrictions|Description| |---|---|---|---|---| |block_height|string|true|none|none| |block_timestamp_nanos|string|true|none|none| |contract_metadata|object|true|none|The type for Non Fungible Token Contract Metadata. Inspired by<br /> https://nomicon.io/Standards/Tokens/NonFungibleToken/Metadata| |» base_uri|string|false|none|none| |» icon|string|false|none|none| |» name|string|true|none|none| |» reference|string|false|none|none| |» reference_hash|string|false|none|none| |» spec|string|true|none|none| |» symbol|string|true|none|none| |nft|object|true|none|The type for Non Fungible Token. Inspired by<br /> https://nomicon.io/Standards/Tokens/NonFungibleToken/Metadata| |» metadata|object|true|none|The type for Non Fungible Token Metadata. Inspired by<br /> https://nomicon.io/Standards/Tokens/NonFungibleToken/Metadata| |»» copies|integer(int64)|false|none|none| |»» description|string|false|none|none| |»» extra|string|false|none|none| |»» media|string|false|none|none| |»» media_hash|string|false|none|none| |»» reference|string|false|none|none| |»» reference_hash|string|false|none|none| |»» title|string|false|none|none| |» owner_account_id|string|true|none|none| |» token_id|string|true|none|none| ### NftsResponse <!-- backwards compatibility --> <a id="schemanftsresponse"></a> <a id="schema_NftsResponse"></a> <a id="tocSnftsresponse"></a> <a id="tocsnftsresponse"></a> ```json { "block_height": "string", "block_timestamp_nanos": "string", "contract_metadata": { "base_uri": "string", "icon": "string", "name": "string", "reference": "string", "reference_hash": "string", "spec": "string", "symbol": "string" }, "nfts": [ { "metadata": { "copies": 0, "description": "string", "extra": "string", "media": "string", "media_hash": "string", "reference": "string", "reference_hash": "string", "title": "string" }, "owner_account_id": "string", "token_id": "string" } ] } ``` ##### Properties |Name|Type|Required|Restrictions|Description| |---|---|---|---|---| |block_height|string|true|none|none| |block_timestamp_nanos|string|true|none|none| |contract_metadata|object|true|none|The type for Non Fungible Token Contract Metadata. Inspired by<br /> https://nomicon.io/Standards/Tokens/NonFungibleToken/Metadata| |» base_uri|string|false|none|none| |» icon|string|false|none|none| |» name|string|true|none|none| |» reference|string|false|none|none| |» reference_hash|string|false|none|none| |» spec|string|true|none|none| |» symbol|string|true|none|none| |nfts|[object]|true|none|none| |» metadata|object|true|none|The type for Non Fungible Token Metadata. Inspired by<br /> https://nomicon.io/Standards/Tokens/NonFungibleToken/Metadata| |»» copies|integer(int64)|false|none|none| |»» description|string|false|none|none| |»» extra|string|false|none|none| |»» media|string|false|none|none| |»» media_hash|string|false|none|none| |»» reference|string|false|none|none| |»» reference_hash|string|false|none|none| |»» title|string|false|none|none| |» owner_account_id|string|true|none|none| |» token_id|string|true|none|none|
--- id: ds-components title: Design Components --- # Design System Components When building components, the NEAR VM provides a complete set of [Radix primitives](https://www.radix-ui.com/docs/primitives/overview/introduction) to simplify UI development. ## Radix UI Using embedded Radix primitives on the NEAR VM is simple and straight-forward. You don't need to import any files: ```js return ( <Label.Root className="LabelRoot"> Hello World! </Label.Root> ); ``` :::caution Limitations Currently, NEAR VM impose some limitations on the Radix UI framework: - `Form` component is not available. - You can't use `.Portal` definitions. - Using CSS is different. You'll have to use a `styled.div` wrapper. ::: ### Using CSS Here is an example on how to use CSS through the `styled.div` wrapper: ```js const Wrapper = styled.div` .SwitchRoot { ... } .SwitchThumb { ... } `; return ( <Wrapper> <Switch.Root className="SwitchRoot"> <Switch.Thumb className="SwitchThumb" /> </Switch.Root> </Wrapper> ); ``` :::tip Using Wrapper [Example widget using Wrapper](https://near.org/#/near/widget/ComponentDetailsPage?src=near/widget/RadixTooltipTest) ::: ### Using `styled-components` You can use [`styled-components`](../../2.build/3.near-components/anatomy/builtin-components.md) in combination with Radix UI primitives. Here's an example: ```js const SwitchRoot = styled("Switch.Root")` all: unset; display: block; width: 42px; height: 25px; background-color: var(--blackA9); border-radius: 9999px; position: relative; box-shadow: 0 2px 10px var(--blackA7); &[data-state="checked"] { background-color: black; } `; const SwitchThumb = styled("Switch.Thumb")` all: unset; display: block; width: 21px; height: 21px; background-color: white; border-radius: 9999px; box-shadow: 0 2px 2px var(--blackA7); transition: transform 100ms; transform: translateX(2px); will-change: transform; &[data-state="checked"] { transform: translateX(19px); } `; return ( <SwitchRoot> <SwitchThumb /> </SwitchRoot> ); ``` :::tip Using styled components [Example widget using styled components to style Radix UI](https://near.org/#/near/widget/ComponentDetailsPage?src=near/widget/RadixSwitchTest). ::: ### Forward references The NEAR VM re-implements [React's forwardRef](https://react.dev/reference/react/forwardRef#reference) as `ref="forwardedRef"`. You can use `ref="forwardedRef"` to forward references through `<Widget />` to support Radix's `asChild` property: ```js title='Dialog.jsx' <AlertDialog.Trigger asChild> <Widget src="near/widget/TestButton" props={{ label: "Click Me" }} /> </AlertDialog.Trigger> ``` ```js title='TestButton.jsx' const Button = styled.button` background: #f00; `; return ( <Button type="button" ref="forwardedRef"> {props.label}: Forwarded </Button> ); ``` ## DIG components These are the Design Interface Guidelines (DIG) components available on the NEAR VM: - [DIG.Button](https://near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.Button) - [DIG.Theme](https://near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.Theme) ### `DIG.Button` A fully featured button component that can act as a `<button>` or `<a>` tag. :::info DIG.Button properties [Click here](https://near.org/#/near/widget/ComponentDetailsPage?src=near/widget/DIG.Button&tab=about) for properties and details. ::: ### `DIG.Theme` This component wraps all of NEAR Components so you don't need to render it yourself. :::tip You can use any of the [CSS variables](https://near.org/near/widget/ComponentDetailsPage?src=near/widget/DIG.Theme&tab=source) defined inside `DIG.Theme`. :::
--- title: Gateways description: Overview of NEAR BOS Gateways and how they work sidebar_position: 9 --- # Gateways ## Highlights * Access points for web 3 apps that allow developers to quickly add, and easily maintain, new experiences and functionality to their apps. * It adds more value for end-users, simplifies development, and provides developers more entry points for their apps, increasing discoverability. ### What it is: Gateways are access points to web 3 apps that pull front-end code directly from the NEAR blockchain and render it for their users. Gateways can assume a variety of forms including wallets, portfolio management tools, and popular single use applications (e.g. SWEAT) that want to add additional functionality. The functionality available through gateways ranges from simple tasks like adding swap functionality, all the way to creating a decentralized app store, and offering bespoke experiences. This is all available by simply adding a JS library and choosing which app front-ends you want included. ### Why it matters: Web3’s decentralization has often translated into a complex environment where developers have a difficult time building and getting their apps discovered, and where users often need to switch between countless platforms to discover apps and experiences. Gateways help to overcome this by making it possible to meet users where they already are, while providing a broader range of apps and experiences. This brings more value to existing users, and makes it easier for new users to discover what’s available. Gateways make adding and maintaining new functionality and experiences for users simple by removing the complexity of every developer having to create and maintain everything themselves. Additionally, gateways also help developers overcome issues of discoverability by gaining more entry points for their apps. Developers can simply deploy once and make their app available across every gateway that has chosen to deploy it. ### Who it’s for: * End-user applications - Gateways simplify the process of adding new integrations and experiences, bringing more value to users, while simultaneously decreasing complexity and making apps easier to maintain. * Developers - By having an app directly integrated into gateways, developers gain more entry points for users to discover and engage with their apps, removing a major part of the challenge posed by decentralized development. * Users - Accessibility is an important element in making web3 truly available for users. They are something anyone can deploy, much like a website, lowering the threshold for participation, and they make discovering and using web3 apps and experiences easier. ### How it works: There are two aspects to the BOS: * The gateway * Developers run a specialized VM that can render JS components in the browser to users as UIs. * When a user wants to use an app, a view function is called on the NEAR Blockchain, the code is retrieved from the blockchain for the app they want to rendered, and it is then rendered via the VM. <!-- &lt; diagram > --> * Components - * JS, HTML, CSS are stored on the NEAR blockchain and can be rendered by the VM into UIs to users. * Components are composable and can be broken down into things as simple as buttons (single features), then composed into full applications. * Components can even be groups of applications, (e.g. an Ecosystem section for Aurora, that can let users directly interact with several Aurora apps on a single page, or discover/use on one gateway). <!-- &lt; diagram > --> ### What’s coming next: * Expanding the chains that gateways support * Making it even easier to implement the VM * Showcasing what gateways are capable of through partnerships
# Cross-Contract Call This guide assumes that you have read the [Financial Transaction](FinancialTransaction.md) section. Suppose Alice is a calling a function `reserve_trip(city: String, date: u64)` on a smart contract deployed to a `travel_agency` account which in turn calls `reserve(date: u64)` on a smart contract deployed to a `hotel_near` account and attaches a callback to method `hotel_reservation_complete(date: u64)` on `travel_agency`. <img src="/images/receipt_flow_diagram.svg" /> ## Pre-requisites It possible for Alice to call the `travel_agency` in several different ways. In the simplest scenario Alice has an account `alice_near` and she has a full access key. She then composes the following transaction that calls the `travel_agency`: ``` Transaction { signer_id: "alice_near", public_key: "ed25519:32zVgoqtuyRuDvSMZjWQ774kK36UTwuGRZMmPsS6xpMy", nonce: 57, receiver_id: "travel_agency", block_hash: "CjNSmWXTWhC3EhRVtqLhRmWMTkRbU96wUACqxMtV1uGf", actions: vec![ Action::FunctionCall(FunctionCallAction { method_name: "reserve_trip", args: "{\"city\": \"Venice\", \"date\": 20191201}", gas: 1000000, tokens: 100, }) ], } ``` Here the public key corresponds to the full access key of `alice_near` account. All other fields in `Transaction` were discussed in the [Financial Transaction](FinancialTransaction.md) section. The `FunctionCallAction` action describes how the contract should be called. The `receiver_id` field in `Transaction` already establishes what contract should be executed, `FunctionCallAction` merely describes how it should be executed. Interestingly, the arguments is just a blob of bytes, it is up to the contract developer what serialization format they choose for their arguments. In this example, the contract developer has chosen to use JSON and so the tool that Alice uses to compose this transaction is expected to use JSON too to pass the arguments. `gas` declares how much gas `alice_near` has prepaid for dynamically calculated fees of the smart contract executions and other actions that this transaction may spawn. The `tokens` is the amount of `alice_near` attaches to be deposited to whatever smart contract that it is calling to. Notice, `gas` and `tokens` are in different units of measurement. Now, consider a slightly more complex scenario. In this scenario Alice uses a restricted access key to call the function. That is the permission of the access key is not `AccessKeyPermission::FullAccess` but is instead: `AccessKeyPermission::FunctionCall(FunctionCallPermission)` where ``` FunctionCallPermission { allowance: Some(3000), receiver_id: "travel_agency", method_names: [ "reserve_trip", "cancel_trip" ] } ``` This scenario might arise when someone Alice's parent has given them a restricted access to `alice_near` account by creating an access key that can be used strictly for trip management. This access key allows up to `3000` tokens to be spent (which includes token transfers and payments for gas), it can be only used to call `travel_agency` and it can be only used with the `reserve_trip` and `cancel_trip` methods. The way runtime treats this case is almost exactly the same as the previous one, with the only difference on how it verifies the signature of on the signed transaction, and that it also checks for allowance to not be exceeded. Finally, in the last scenario, Alice does not have an account (or the existence of `alice_near` is irrelevant). However, alice has full or restricted access key directly on `travel_agency` account. In that case `signer_id == receiver_id` in the `Transaction` object and runtime will convert transaction to the first receipt and apply that receipt in the same block. This section will focus on the first scenario, since the other two are the same with some minor differences. ## Transaction to receipt The process of converting transaction to receipt is very similar to the [Financial Transaction](FinancialTransaction.md) with several key points to note: - Since Alice attaches 100 tokens to the function call, we subtract them from `alice_near` upon converting transaction to receipt, similar to the regular financial transaction; - Since we are attaching 1000000 prepaid gas, we will not only subtract the gas costs of processing the receipt from `alice_near`, but will also purchase 1000000 gas using the current gas price. ## Processing the `reserve_trip` receipt The receipt created on the shard that hosts `alice_near` will eventually arrive to the shard hosting `travel_agency` account. It will be processed in `Runtime::apply` which will check that receipt does not have data dependencies (which is the case because this function call is not a callback) and will call `Runtime::apply_action_receipt`. At this point receipt processing is similar to receipt processing from the [Financial Transaction](FinancialTransaction.md) section, with one difference that we will also call `action_function_call` which will do the following: - Retrieve the Wasm code of the smart contract (either from the database or from the cache); - Initialize runtime context through `VMContext` and create `RuntimeExt` which provides access to the trie when the smart contract call the storage API. Specifically `"{\"city\": \"Venice\", \"date\": 20191201}"` arguments will be set in `VMContext`. - Calls `near_vm_runner::run` which does the following: - Inject gas, stack, and other kinds of metering; - Verify that Wasm code does not use floats; - Checks that bindings API functions that the smart contract is trying to call are actually those provided by `near_vm_logic`; - Compiles Wasm code into the native binary; - Calls `reserve_trip` on the smart contract. - During the execution of the smart contract it will at some point call `promise_create` and `promise_then`, which will call method on `RuntimeExt` that will record that two promises were created and that the second one should wait on the first one. Specifically, `promise_create` will call `RuntimeExt::create_receipt(vec![], "hotel_near")` returning `0` and then `RuntimeExt::create_receipt(vec![0], "travel_agency")`; - `action_function_call` then collects receipts from `VMContext` along with the execution result, logs, and information about used gas; - `apply_action_receipt` then goes over the collected receipts from each action and returns them at the end of `Runtime::apply` together with other receipts. ## Processing the `reserve` receipt This receipt will have `output_data_receivers` with one element corresponding to the receipt that calls `hotel_reservation_complete`, which will tell the runtime that it should create `DataReceipt` and send it towards `travel_agency` once the execution of `reserve(date: u64)` is complete. The rest of the smart contract execution is similar to the above. ## Processing the `hotel_reservation_complete` receipt Upon receiving the `hotel_reservation_complete` receipt the runtime will notice that its `input_data_ids` is not empty which means that it cannot be executed until `reserve` receipt is complete. It will store the receipt in the trie together with the counter of how many `DataReceipt` it is waiting on. It will not call the Wasm smart contract at this point. ## Processing the `DataReceipt` Once the runtime receives the `DataReceipt` it takes the receipt with `hotel_reservation_complete` function call and executes it following the same execution steps as with the `reserve_trip` receipt.
Sweatcoin Partners with NEAR Foundation to Create a New Movement Economy COMMUNITY April 12, 2022 Sweatcoin, the London-based tech company on a mission to inspire a healthier planet by incentivizing people to move more, has partnered with the NEAR Foundation to launch SWEAT, a radical new token. Designed to truly unlock the power of movement, this revolutionary cryptocurrency is minted purely by steps. With more than 63 million users who’ve walked over 19 trillion steps and 600+ brand partners who provided over $200 million worth of goods in Q4’21 alone, SWEAT represents one of the most significant steps in mobilizing the new movement economy. “Sweatcoin was founded with a vision to create a new economy of wealth through health,” says Anton Derlyatka, Co-founder at Sweatcoin. “For every 1,000 steps you take, you earn a Sweatcoin that can be redeemed for goods and services in the app from brands including Sonos and Reebok, or to donate to important charities such as Save the Children via Sweatcoin for Good.” By building the token on top of NEAR’s super-fast, incredibly secure, and infinitely scalable blockchain, SWEAT will be a unique showcase of a blockchain working at scale without fuss. “From the start, there was also a greater ambition: to make a global, open cryptocurrency, to more tangibly realize the value of movement,” says Derlyatka. “Blockchain wasn’t sophisticated or fast enough back in 2015, but thanks to NEAR, it is now. SWEAT: the token turbocharges our mission to create an Open Economy of Movement for a billion people.” “One of NEAR’s core missions is to help onboard the world to Web3, collaborating with SweatCoin allows us to take a step closer to that mission.” says Marieke Flament, NEAR Foundation’s CEO. How SWEAT token works To get started, users download the Sweatcoin app, which allows them to assign value to their movement. As people walk, run, or otherwise move, the Sweatcoin app verifies steps as a Movement Validator. Eventually, the Sweatcoin Foundation will decentralize this movement verification process to enable other apps and wearables to verify new forms of movement. Users will then be able to earn SWEAT by swimming, cycling, hiking, working out, rowing, and more. Sweatcoin already has more than 63 million users who have walked over 20 trillion steps, which means SWEAT will become harder to mint over time. So, the earlier people walk, the more SWEAT they can receive, which can then be redeemed for goods and services in the app from 300+ brand partners, including Sonos, Reebok, and others. Why Sweatcoin is incentivizing movement The World Health Organization (WHO) is targeting 2025 as the year to halt obesity. However, recent global estimates suggest no country will meet this target—instead, obesity rates are expected to double to 1 billion people classified as “clinically obese” by 2030. Sweatcoin intends to change this troubling trend by incentivizing people’s health and well-being. In doing so, the app aims to create a societal shift where people feel empowered and motivated to improve their health through reward. “The inherent issue with traditional cryptocurrency is that you have to use your own money,” adds Oleg Fomenko, Co-founder at Sweatcoin. “While SWEAT will be available to purchase, the key difference is that for everyday users, you invest your steps, which we hope is going to encourage people around the world to want to be more active. We’re investing in the future wellness of our users and literally letting them walk into the world of crypto.” Sweat Foundation Ltd, in collaboration with Sweatcoin, will launch the SWEAT token this summer.
NEAR Query API Beta Is Now Open for Apps Building on B.O.S NEAR FOUNDATION October 12, 2023 Pagoda has officially opened the Beta version of NEAR Query API, a fully managed serverless infrastructure offering NEAR blockchain #indexers, storage, and GraphQL endpoints. Developers can now build indexers for any smart contract using JavaScript and the NEAR Lake Primitives library, and store data in custom SQL schemas, all without needing to manage any infrastructure. This approach significantly simplifies the way developers interact with blockchain data and empowers them to build B.O.S applications with great user experiences. NEAR Query API allows developers to store indexer code on-chain and receive an auto-provisioned database with GraphQL API and indexed historical data, continuously updated through an indexer service that closely tracks the blockchain. The GraphQL API supports paginated and aggregate queries such as count, avg, min, etc. It also enables subscriptions through web sockets, allowing you to create user interfaces that update data without page refresh. With QueryAPI, you can quickly get GraphQL endpoints and use them directly in your dApps to enrich the user experience and improve user interface performance. In the latest release, Pagoda moved to a more scalable and stable infrastructure and open-sourced the code to make it easy to run it yourself and contribute to future development. Sample Indexers Additionally, Pagoda introduced several sample indexers: A social feed indexer for posts, likes, and comments with a corresponding component. This API currently powers the activity feed on near.org. A B.O.S component indexer with a widget feed that updates automatically with every commit using WebSockets. User Interface The NEAR Query API’s user-friendly interface, built using B.O.S components, provides easy access to all indexers and key features of the platform that streamline the process of building indexers: Access to all indexers built on the platform. Developers can learn from practical examples as indexers’ code and schemas are stored on-chain. Edit code online with autocomplete for easy access to block data and SQL tables for efficient development. Debug indexers on any block using the browser console for a familiar debugging experience. Build GraphQL queries using the GraphiQL playground. Auto-generate JSX code for swift B.O.S component development. Monitor indexer status and access logs written from JavaScript code. Start historical indexing from any block. Documentation Pagoda created documentation for QueryAPI to help you get started. Take a look at how it works, read about indexer functions, the context object, and check out the tutorials. To provide more insight into the capabilities of the NEAR Query API, the product team has prepared a walkthrough video that you can watch here. Invitation to Beta Testing Pagoda invites developers to register their interest in closed Beta testing of NEAR Query API. If you are interested in indexing smart contracts on Mainnet with moderate transactions per day, the team is eager to engage with you and help you get started. Please use this link to register your interest. Build full-stack JavaScript dApps on NEAR On NEAR, JavaScript developers can build smart contracts with low gas fees, fast and decentralized user interfaces on the B.O.S and powered by QueryAPI, and all without needing to worry about cloud infrastructure. Pagoda will be working with B.O.S developers on improving the developer experience of building, debugging, using and maintaining indexers, as well as performance and scalability to prepare for general availability later this year. Join in this exciting new chapter of full-stack JavaScript dApps with NEAR B.O.S. and NEAR Query API!
Well hello, NEAR Academy! COMMUNITY March 24, 2021 We’re proud to announce the launch of near.academy, a keystone of our educational onramp at NEAR Protocol. Powered by the same team and technology behind Ocean Academy and Tezos Academy, NEAR Academy is purpose-built for web 2 developers looking for a hands-on introduction to blockchain concepts and code. 101Labs has done an incredible job of crafting an approachable narrative with a twist: The Meme Museum. The year is 2029. The new internet is running on top of public interoperable blockchains. It seems crazy to think how the perception towards these technologies has drastically changed. The Internet of Value is more tangible than ever. Knowing how blockchain works is not considered a competitive advantage nowadays. It is a must-have. Behind the welcoming facade of the meme museum are multiple smart contracts written specifically for this learning experience. These include a custom NFT token contract and an NFT generator. These contracts work together to create an immersive experience for developers learning about NEAR Protocol where anyone can enter and everyone leaves with an NFT. The learning platform is friendly and responsive, making it easy for developers to set their own pace through the learning materials. Along the way, developers must confirm their understanding of the material using a playful and inviting interface. Developers who complete this course will come to understand the basics of web 3, a high level overview of how NEAR Protocol works as well as an introduction to writing smart contracts for NEAR. The learning experience includes diagrams, code samples and links to resources for further study. A certificate of completion is issued for anyone who completes the course. This is just the first of many modules we expect to launch with 101Labs this year and we welcome your feedback. Our single mission is to educate the world about web 3 technologies using NEAR Protocol. Visit near.academy today for a tour of the future. NEAR’s mission is to enable community-driven innovation to benefit people around the world. The NEAR platform provides a decentralized application platform that is secure enough to manage high value assets like money or identity and performant enough to make them useful for everyday people, putting the power of Open Finance and the Open Web in their hands. The NEAR platform, NEAR Protocol, and associated tooling are being built by the NEAR Collective, a collection of the best engineers in the world who work across teams, companies and countries similar to other large scale open source projects. If you’re a developer who wants to see what building on NEAR is all about, check out the NEAR documentation to get started.
Interactive Polygon zkEVM App Dashboard Launches on the NEAR Blockchain Operating System NEAR FOUNDATION July 18, 2023 NEAR Foundation is excited to announce that an interactive Polygon zkEVM app dashboard, has just launched on the Blockchain Operating System (BOS). This debut of Polygon zkEVM on the BOS will not only increase accessibility and discoverability for zkEVM developers and users on the open web, but also vastly improve user experience. Polygon zkEVM is the first zero-knowledge scaling solution compatible with the Ethereum Virtual Machine to integrate smart contracts and developer tools. The Polygon ecosystem DEX QuickSwap will host the dashboard, which will include BOS components for Polygon’s zkEVEM bridge and several top Polygon decentralized applications (dApps) including QuickSwap, Gamma, PancakeSwap, and Balancer. With the interactive Polygon zkEVM app dashboard on the BOS, users can now discover and use zkEVM projects in a frictionless way. All of this can be done on one website, with users only needing to connect their wallet once to get started. The dashboard also simplifies access, making components uncensorable, highly available, and resilient. Users can also run their own version of the site since all code is open source and verifiable on-chain as a security feature. With this new dashboard on NEAR BOS, Polygon zkEVM developers will unlock a seamless onboarding experience and the quick-start components for which the BOS is known. The collaboration will accelerate the creation of dApps that will onboard billions of users into the open web. A major NEAR x Polygon ecosystem deployment The new Polygon zkEVM dashboard now combines the benefits of zero knowledge technology with the power of the BOS to unlock seamless onboarding to Web3. The NEAR and Polygon zkEVM collaboration brings a new suite of zero knowledge development capabilities to zkEVM developers and lets them build apps that can reach more users from day one. The Polygon-NEAR ecosystem deployment underscores the BOS’s utility in helping developers easily deploy their own dApps with on-chain frontend code. With the BOS, any zkEVM app can now benefit from greater accessibility for developers and users alike, easier discoverability for the apps they build, and powerful composability. “The interactive zkEVM app dashboard is an exciting tool to support developers and accelerate the pace of large-scale usage of Web3,” said Jack Melnick at Polygon Labs. “NEAR BOS powers the platform as a means to achieve an easy and reliable way to onboard, which is critical to improving the dApp user experience and giving greater infrastructure accessibility.” The BOS makes it faster and easier than ever for developers on NEAR, Polygon, and other open web platforms to build multi-chain apps and experiences. The BOS also empowers builders to focus more on creating great products for users than on managing infrastructure. “The Polygon ecosystem is achieving great traction in the blockchain space among developers and enterprises alike,” Illia Polosukhin, co-founder of NEAR. “We’re excited for this deployment to unlock discoverability for applications across the Polygon zkEVM ecosystem, powered by NEAR Blockchain Operating System. Developers on Polygon zkEVM will now be able to quickly bring applications to market by reusing thousands of decentralized components.” A common layer for browsing and discovering open web experiences, the BOS makes Web3 app development fast and easy, offering a comprehensive quick-start toolset for developers from any ecosystem. Developers can quickly build composable apps for the open web from thousands of flexible components, seamlessly onboard users, get real-time feedback from actual users, and increase discoverability across the open web, since all apps utilizing BOS are all visible on a common interface. With the shared mission of Polygon Labs and NEAR to accelerate mainstream adoption of the open web, and increase options for developers across blockchains and ecosystems, Polygon zkEVM’s integration on the NEAR BOS is a major step forward to empower more developers to scale Ethereum with the latest zero knowledge technology. Get started today with Polygon zkEVM on the BOS.