jcarbonnell/NEAR-preTrainedStarCoder2
Text Generation
•
Updated
•
9
text
stringlengths 46
74.6k
|
---|
# Messages
All message sent in the network are of type `PeerMessage`. They are encoded using [Borsh](https://borsh.io/) which allows a rich structure, small size and fast encoding/decoding. For details about data structures used as part of the message see the [reference code](https://github.com/nearprotocol/nearcore).
## Encoding
A `PeerMessage` is converted into an array of bytes (`Vec<u8>`) using borsh serialization. An encoded message is conformed by 4 bytes with the length of the serialized `PeerMessage` concatenated with the serialized `PeerMessage`.
Check [Borsh specification](https://github.com/nearprotocol/borsh#specification) details to see how it handles each data structure.
## Data structures
### PeerID
The id of a peer in the network is its [PublicKey](https://github.com/nearprotocol/nearcore/blob/master/core/crypto/src/signature.rs).
```rust
struct PeerId(PublicKey);
```
### PeerInfo
```rust
struct PeerInfo {
id: PeerId,
addr: Option<SocketAddr>,
account_id: Option<AccountId>,
}
```
`PeerInfo` contains relevant information to try to connect to other peer. [`SocketAddr`](https://doc.rust-lang.org/std/net/enum.SocketAddr.html) is a tuple of the form: `IP:port`.
### AccountID
```rust
type AccountId = String;
```
### PeerMessage
```rust
enum PeerMessage {
Handshake(Handshake),
HandshakeFailure(PeerInfo, HandshakeFailureReason),
/// When a failed nonce is used by some peer, this message is sent back as evidence.
LastEdge(Edge),
/// Contains accounts and edge information.
Sync(SyncData),
RequestUpdateNonce(EdgeInfo),
ResponseUpdateNonce(Edge),
PeersRequest,
PeersResponse(Vec<PeerInfo>),
BlockHeadersRequest(Vec<CryptoHash>),
BlockHeaders(Vec<BlockHeader>),
BlockRequest(CryptoHash),
Block(Block),
Transaction(SignedTransaction),
Routed(RoutedMessage),
/// Gracefully disconnect from other peer.
Disconnect,
Challenge(Challenge),
}
```
### AnnounceAccount
Each peer should announce its account
```rust
struct AnnounceAccount {
/// AccountId to be announced.
account_id: AccountId,
/// PeerId from the owner of the account.
peer_id: PeerId,
/// This announcement is only valid for this `epoch`.
epoch_id: EpochId,
/// Signature using AccountId associated secret key.
signature: Signature,
}
```
### Handshake
```rust
struct Handshake {
/// Protocol version.
pub version: u32,
/// Oldest supported protocol version.
pub oldest_supported_version: u32,
/// Sender's peer id.
pub peer_id: PeerId,
/// Receiver's peer id.
pub target_peer_id: PeerId,
/// Sender's listening addr.
pub listen_port: Option<u16>,
/// Peer's chain information.
pub chain_info: PeerChainInfoV2,
/// Info for new edge.
pub edge_info: EdgeInfo,
}
```
<!-- TODO: Make diagram about handshake process, since it is very complex -->
### Edge
```rust
struct Edge {
/// Since edges are not directed `peer0 < peer1` should hold.
peer0: PeerId,
peer1: PeerId,
/// Nonce to keep tracking of the last update on this edge.
nonce: u64,
/// Signature from parties validating the edge. These are signature of the added edge.
signature0: Signature,
signature1: Signature,
/// Info necessary to declare an edge as removed.
/// The bool says which party is removing the edge: false for Peer0, true for Peer1
/// The signature from the party removing the edge.
removal_info: Option<(bool, Signature)>,
}
```
### EdgeInfo
```rust
struct EdgeInfo {
nonce: u64,
signature: Signature,
}
```
### RoutedMessage
```rust
struct RoutedMessage {
/// Peer id which is directed this message.
/// If `target` is hash, this a message should be routed back.
target: PeerIdOrHash,
/// Original sender of this message
author: PeerId,
/// Signature from the author of the message. If this signature is invalid we should ban
/// last sender of this message. If the message is invalid we should ben author of the message.
signature: Signature,
/// Time to live for this message. After passing through some hop this number should be
/// decreased by 1. If this number is 0, drop this message.
ttl: u8,
/// Message
body: RoutedMessageBody,
}
```
### RoutedMessageBody
```rust
enum RoutedMessageBody {
BlockApproval(Approval),
ForwardTx(SignedTransaction),
TxStatusRequest(AccountId, CryptoHash),
TxStatusResponse(FinalExecutionOutcomeView),
QueryRequest {
query_id: String,
block_id_or_finality: BlockIdOrFinality,
request: QueryRequest,
},
QueryResponse {
query_id: String,
response: Result<QueryResponse, String>,
},
ReceiptOutcomeRequest(CryptoHash),
ReceiptOutComeResponse(ExecutionOutcomeWithIdAndProof),
StateRequestHeader(ShardId, CryptoHash),
StateRequestPart(ShardId, CryptoHash, u64),
StateResponse(StateResponseInfo),
PartialEncodedChunkRequest(PartialEncodedChunkRequestMsg),
PartialEncodedChunkResponse(PartialEncodedChunkResponseMsg),
PartialEncodedChunk(PartialEncodedChunk),
Ping(Ping),
Pong(Pong),
}
```
## CryptoHash
`CryptoHash` are objects with 256 bits of information.
```rust
pub struct Digest(pub [u8; 32]);
pub struct CryptoHash(pub Digest);
```
|
---
title: 3.7 Prediction Market Design
description: Theory and use-cases of Prediction Markets, and the re-application of the mechanism design behind prediction markets for a wide variety of use-cases
---
# 3.7 Prediction Market Design
The final lecture in our DeFi series is titled ‘Prediction-Market Design’ - and very clearly not only prediction markets. Why would this be the case? Because despite prediction markets being a quiet and slowly growing DeFi product in its own right, there is much more opportunity and interest from leveraging the mechanism design surrounding ‘prediction-markets’ for a wide variety of on-chain verification use cases. This lecture as such is broken up into two parts: The ‘boring’ theory and use-cases of prediction markets, and second, the much more interesting re-application of the mechanism design behind prediction markets for a wide variety of use-cases.
## Prediction Market Mechanism Design: What Is The Value?
‘Validation’ typically refers to validation of the L1 blockchain itself, done relatively automatically through node operators running software, and delegators allocating tokens to node operators. The specific type of data that is being validated, is thus digital data, and relatively uncontroversial insofar as all of the data is being created with the next block created on-chain. Any working explorer or indexer can show the same story to all of the validator nodes, such that it is quite automated to maintain the node on the network.
One step slightly more advanced than this, would be Oracles attempting to bring data on-chain for specific things like price-feeds, from APIs of real world events. Centralized Oracles, guarantee the accuracy of these price-feeds by synchronizing multiple APIs - decentralized oracles however require their own validation mechanism.
One step even more advanced than this, would refer to the data that is collected from the physical world, and uploaded on-chain either manually, via a sensor, or even from a human being. How is such a system verifiable at scale?
Herein lies the means by which the logic of a ‘prediction market’ can be utilized: As verification of data moving on chain becomes less quantitative, and more qualitative - that is to say, more ambiguous - and less mathematically verifiable from digital-only data - there is a need for a mechanism by which such data could be verified in a decentralized manner.
_Put another way, the closer to attempting to track the physical state of a specific asset or event, the more difficult it is to verify that physical state, in a decentralized manner._
To date, prediction market mechanics are the most promising foundation, from which one could construct a decentralized, on-chain mechanism for ‘validating’ such data.
## Traditional Prediction Market Design
_“Prediction markets: these have been a niche but stable pillar of decentralized finance since the launch of Augur in 2015. Since then, they have quietly been growing in adoption. Prediction markets [showed their value and their limitations](https://vitalik.eth.limo/general/2021/02/18/election.html) in the 2020 US election, and this year in 2022, both crypto prediction markets like [Polymarket](https://polymarket.com/) and play-money markets like [Metaculus](https://www.metaculus.com/questions/) are becoming more and more widely used. Prediction markets are valuable as an epistemic tool, and there is a genuine benefit from using cryptocurrency in making these markets more trustworthy and more globally accessible. I expect prediction markets to not make extreme multibillion-dollar splashes, but continue to steadily grow and become more useful over time.” ([Vitalik](https://vitalik.eth.limo/general/2022/12/05/excited.html))_
As Vitalik explains, prediction markets refer to open-markets, in which users can ‘stake’ or ‘bet’ on the outcome of a binary, ‘yes’ or ‘no’ question. The ‘decentralized’ nature of predict markets are twofold:
1. First, any user, from anywhere in the world is eligible to participate, such that there is no KYC, discrimination, or localization of participants. This, by extension, enables ‘the wisdom of the crowds’ to provide realistic predictions and foresight towards the future. See Superforcasters or the Foresight Institute for more information on this front. The ‘wisdom of the crowds’ on a particular outcome could have the CIA and the KGB betting on one outcome based on the intel they know - without even knowing it.
2. Second, the resolution and validation of the market is done by a decentralized suite of participants, all following the same incentive scheme. This is usually designed in the following manner, using the native token of the protocol:
* Validators stake the native token affirming one of the two binary outcomes.
* After X period of time, there is the opportunity to challenge the outcome.
* After Y period of time, there is the opportunity to escalate the challenge.
* Each escalation requires higher and higher amounts of tokens to be staked on an outcome.
* When there is no longer an escalation, the side with the majority stake is deemed the correct outcome, and the side with the losing stake is slashed.
The implicit premise in prediction market design, is that the binary outcome is clearly evident once the event has passed, and as such it is straightforward or self-evident as to what the correct outcome actually is. A non-binary question would prove to be more difficult to resolve especially if there is any room for controversy.
At the end of the validation - challenge - and escalation sequence, there is typically a resolution period, in which the market resolves, and prepares to payout rewards to the correct validators. Those who have staked value on an outcome, are also rewarded for the outcome that is deemed correct.
## Augur
Augur was the first dApp ever built on Ethereum, and was used briefly before the mechanism design was hijacked by an anonymous hacker by the name of _[Poyo](https://medium.com/sunrise-over-the-merkle-trees/meet-poyo-an-interview-with-augurs-most-controversial-cat-a6bccae9ffe7)_ . Poyo’s strategy was based on a loophole in the protocol design in which an infinite escalation would eventually resolve as ‘invalid’ and payout both sides of the binary market an equal amount of value (regardless of how clear the correct outcome might be). This initial flaw in the prediction market set back the development of Augur significantly, and demonstrated to many the absolute importance of sound mechanism design.
On the whole the fundamental issues with Augur beyond its mechanism design also centered on the cost of fees on the Ethereum network, specifically when it came to resolving markets or bidding on outcomes. High costs and slow resolution times made the system scalability limited and painful especially for users.
## Seda Protocol & Stake GG
Fast forward two years, and Seda protocol (formerly Flux), originally sought to re-test the Augur prediction market design on a cheaper, and more scalable network - our own NEAR Protocol. With the same essential mechanism design minus the fundamental flaws in Augur V1, the logic was that an affordable and quick resolution period could sustain liquid and scalable markets for decentralized forecasting. The resultant product, known as Stake.gg struggled to find active users and venture backing, so with the same mechanism design, the Seda team pivoted into a new cluster: [Decentralized Oracle design](https://docs.seda.xyz/seda-network/introduction/the-oracle-problem), using the same prediction market mechanism design.
The underlying value proposition is as follows:
_Unlike existing oracles, that are largely managed in a centralized manner to decide which data is connected to a specific dApp or blockchain, Flux [Seda] purports to leverage the decentralized market resolution design of Augur, in order to secure the correct amount of price and data feeds, connected to a dApp on-chain._
This design is slightly modified, as instead of a user placing value on a future outcome, it is used to whitelist _requesters_, capable of connecting Seda Oracles to on-chain mechanisms.
_Requesters →_ Request a data feed from a Seda oracle, and in return for receiving this service, post a fee to validator nodes.
_Validators →_ Mirror the Augur validation mechanism in staking on outcomes and competing for a share in the fee paid by requesters.
_Token Holders →_ Curate the list of requesters, via DAO vote, to decide who is allowed to post validation requests.
The resolution windows are meanwhile set to resolve on a recurring basis, with the fee increasing with each escalation. The design fixes Augur’s ‘Invalid’ status bug, by bringing in a final arbitrator, once 2.5% of the token supply is utilized in a resolution.
_The value in understanding Flux [Seda], centers upon how the same mechanism for resolving prediction markets, can equally be utilized for ‘economically securing’ data requests as an Oracle._
## Campground
While [Campground ](https://www.campground.co/)remains in its infancy, the thesis of the project was to create a decentralized content management system, in which wrapped content, would be validated by a decentralized community of curators. Users would stake tokens, to place ‘emojis’ on certain pieces of content, with the thesis being that a nuanced conclusion could be achieved on any specific piece of content with sufficient emojis’ placed on the content over time. Content creators would then develop reputations based on the aggregate judgments placed on the content of a creator by the community of curators. The specific mechanism by which curators would ‘validate’ the quality of a content piece, would be by a prediction market mechanism of validation, challenge, and escalation from a (whitelisted) group of curators.
_The value in this approach, centers upon the prospect of leveraging a prediction market mechanism, for creating a decentralized content management system surrounding reactions to content, and quality and reputation being attributed to a specific author or work over time._
## Open Forest Protocol
Last but not least, [Open Forest Protocol (OFP)](https://www.openforestprotocol.org/), leverages a similar prediction market mechanism for resolving data uploads, uploaded from forest projects seeking to generate carbon credits on the platform. However, unlike Flux Oracles and Campground curators, OFP validators have a 30 day window to validate data uploads, and a maximum of three escalations. Any validator in its current state, must be whitelisted to participate based upon their qualifying criteria.
## So what is really going on here? Modification Variables
The prediction market mechanism is ultimately a mechanism from which any type of decentralized verification mechanism can be created based upon (1) The types of participants allowed to validate, (2) the timeframes for validating the ‘market’ or ‘data request’, (3) The penalties or rewards for successfully resolving an outcome.
In addition, there are a number of modification variables that could add further mechanistic complexity:
* (1) Visibility - between participants: Are validators allowed to see who, when, and how other validators have validated an outcome, or is this only visible after the market has resolved?
* (2) Timeframes on Resolution of Market: Recurring, expanded time frames, or set timeframes for the type of request in question.
* (3) Gating who can validate: Is it open to the public or are only specific parties eligible to validate based upon their background, KYC, or other criteria?
* (4) Validator requirements: Are validators all using the same software, API, or price feed, or is their flexibility in terms of how a validator may come to their conclusion on the state of the data request.
* (5) Penalties and Rewards for Validators: How are validators compensated for each data request? Are validators slashed, penalized or barred from the platform if they consistently resolve data requests on the wrong side of the outcome?
* (6) Validator Communication: Are validators able to discuss the ongoing data request in real-time or are they intentionally siloed from one another in order to prevent collusion?
It is likely in the future there will be a number of decentralized network designs that will originate based upon the prediction market logic of Augur. The variety and applicability of such a mechanism is a ‘hidden’ gem across network verticals that should be kept in mind for struggling products or industries specifically difficult to bring on-chain.
|
# Bridge Wallets
## Summary
Standard interface for bridge wallets.
## Motivation
Bridge wallets such as [WalletConnect](https://docs.walletconnect.com/2.0/) and [Nightly Connect](https://connect.nightly.app/) are powerful messaging layers for communicating with various blockchains. Since they lack an opinion on how payloads are structured, without a standard, it can be impossible for dApps and wallets to universally communicate without compatibility problems.
## Rationale and alternatives
At its most basic, a wallet manages key pairs which are used to sign messages. The signed messages are typically then submitted by the wallet to the blockchain. This standard aims to define an API (based on our learning from [Wallet Selector](https://github.com/near/wallet-selector)) that achieves this requirement through a number of methods compatible with a relay architecture.
There have been many iterations of this standard to help inform what we consider the best approach right now for NEAR. You can find more relevant content in the [Injected Wallet Standard](#).
## Specification
Bridge wallets use a relay architecture to forward signing requests between dApps and wallets. Requests are typically relayed using a messaging protocol such as WebSockets or by polling a REST API. The concept of a `session` wraps this connection between a dApp and a wallet. When the session is established, the wallet user typically selects which accounts that the dApp should have any awareness of. As the user interacts with the dApp and performs actions that require signing, messages are relayed to the wallet from the dApp, those messages are signed by the wallet and submitted to the blockchain on behalf of the requesting dApp. This relay architecture decouples the 'signing' context (wallet) and the 'requesting' context (dApp, which enables signing to be performed on an entirely different device than the dApp browser is running on.
To establish a session, the dApp must first pair with the wallet. Pairing often includes a QR code to improve UX. Once both clients are paired, a request to initialize a session is made. During this phase, the wallet user is prompted to select one or more accounts (previously imported) to be visible to the session before approving the request.
Once a session has been created, the dApp can make requests to sign transactions using either [`signTransaction`](#signtransaction) or [`signTransactions`](#signtransactions). These methods accept encoded [Transactions](https://nomicon.io/RuntimeSpec/Transactions) created with `near-api-js`. Since transactions must know the public key that will be used as the `signerId`, a call to [`getAccounts`](#getaccounts) is required to retrieve a list of the accounts visible to the session along with their associated public key. Requests to both [`signTransaction`](#signtransaction) and [`signTransactions`](#signtransactions) require explicit approval from the user since [`FullAccess`](https://nomicon.io/DataStructures/AccessKey) keys are used.
For dApps that regularly sign gas-only transactions, Limited [`FunctionCall`](https://nomicon.io/DataStructures/AccessKey#accesskeypermissionfunctioncall) access keys can be added/deleted to one or more accounts by using the [`signIn`](#signin) and [`signOut`](#signout) methods. While the same functionality could be achieved with [`signTransactions`](#signtransactions), that contain actions that add specific access keys with particular permissions to a specific account, by using `signIn`, the wallet receives a direct intention that a user wishes to sign in/out of a dApp's smart contract, which can provide a cleaner UI to the wallet user and allow convenient behavior to be implemented by wallet providers such as 'sign out' automatically deleting the associated limited access key that was created when the user first signed in.
Although intentionally similar to the [Injected Wallet Standard](#), this standard focuses on the transport layer instead of the high-level abstractions found in injected wallets. Below are the key differences between the standards:
- [Transactions](https://nomicon.io/RuntimeSpec/Transactions) passed to `signTransaction` and `signTransactions` must be encoded.
- The result of `signTransaction` and `signTransactions` are encoded [SignedTransaction](https://nomicon.io/RuntimeSpec/Transactions#signed-transaction) models.
- Accounts contain only a string representation of public keys.
### Methods
#### `signTransaction`
Sign a transaction. This request should require explicit approval from the user.
```ts
import { transactions } from "near-api-js";
interface SignTransactionParams {
// Encoded Transaction via transactions.Transaction.encode().
transaction: Uint8Array;
}
// Encoded SignedTransaction via transactions.SignedTransaction.encode().
type SignTransactionResponse = Uint8Array;
```
#### `signTransactions`
Sign a list of transactions. This request should require explicit approval from the user.
```ts
import { providers, transactions } from "near-api-js";
interface SignTransactionsParams {
// Encoded Transaction via transactions.Transaction.encode().
transactions: Array<Uint8Array>;
}
// Encoded SignedTransaction via transactions.SignedTransaction.encode().
type SignTransactionsResponse = Array<Uint8Array>;
```
#### `signIn`
For dApps that often sign gas-only transactions, `FunctionCall` access keys can be created for one or more accounts to greatly improve the UX. While this could be achieved with `signTransactions`, it suggests a direct intention that a user wishes to sign in to a dApp's smart contract.
```ts
import { transactions } from "near-api-js";
interface Account {
accountId: string;
publicKey: string;
}
interface SignInParams {
permission: transactions.FunctionCallPermission;
accounts: Array<Account>;
}
type SignInResponse = null;
```
#### `signOut`
Delete one or more `FunctionCall` access keys created with `signIn`. While this could be achieved with `signTransactions`, it suggests a direct intention that a user wishes to sign out from a dApp's smart contract.
```ts
interface Account {
accountId: string;
publicKey: string;
}
interface SignOutParams {
accounts: Array<Account>;
}
type SignOutResponse = null;
```
#### `getAccounts`
Retrieve all accounts visible to the session. `publicKey` references the underlying `FullAccess` key linked to each account.
```ts
interface Account {
accountId: string;
publicKey: string;
}
interface GetAccountsParams {}
type GetAccountsResponse = Array<Account>;
```
## Flows
**Connect**
1. dApp initiates pairing via QR modal.
2. wallet establishes pairing and prompts selection of accounts for new session.
3. wallet responds with session (id and accounts).
4. dApp stores reference to session.
**Sign in (optional)**
1. dApp generates a key pair for one or more accounts in the session.
2. dApp makes `signIn` request with `permission` and `accounts`.
3. wallet receives request and executes a transaction containing an `AddKey` Action for each account.
4. wallet responds with `null`.
5. dApp stores the newly generated key pairs securely.
**Sign out (optional)**
1. dApp makes `signOut` request with `accounts`.
2. wallet receives request and executes a transaction containing a `DeleteKey` Action for each account.
3. wallet responds with `null`.
4. dApp clears stored key pairs.
**Sign transaction**
1. dApp makes `signTransaction` request.
2. wallet prompts approval of transaction.
3. wallet signs the transaction.
4. wallet responds with `Uint8Array`.
5. dApp decodes signed transaction.
6. dApp sends signed transaction.
**Sign transactions**
1. dApp makes `signTransactions` request.
2. wallet prompts approval of transactions.
3. wallet signs the transactions.
4. wallet responds with `Array<Uint8Array>`.
5. dApp decodes signed transactions.
6. dApp sends signed transactions.
|
NEAR Bringing Chainlink’s Leading Oracle Solution to its Open Web Ecosystem
COMMUNITY
July 30, 2020
We are excited to announce that Chainlink’s decentralized oracle network is launching on NEAR. You can view the TestNet repository and instructions, and in a few weeks developers can start building applications that are integrating real-world data into their smart contracts contracts.
Our goal is to be the leading computing platform for the Open Web by providing developers with the best infrastructure for building future applications (including dApps). Chainlink is the most versatile off-chain connectivity in Web3; we recommend it as it is the industry leading oracle solution used by top DeFi teams such as Synthetix, AAVE and many others. We’re excited to collaborate with Chainlink to make decentralized oracles available to NEAR developers. Integrating Chainlink provides developers access to a large decentralized collection of security-reviewed nodes, an integration framework for connecting to any premium data source derived from credentialed APIs, multiple proven data solutions that can be quickly deployed on the NEAR blockchain, and much more.
One of the first use cases for Chainlink on NEAR will be providing pricing data for DeFi applications by leveraging their Price Reference Data framework. Other use cases include Open Web applications connecting to Chainlink’s Web2 counter-parties to query their data (e.g., marketplace data for real estate, insurance, music, etc). Applications can ask for any generic data by creating a contract with the data provider nodes.
The Benefits of Chainlink for NEAR Developers
Without oracles, smart contracts can only be written about data generated within the blockchain (on-chain) which is largely about ownership of various pieces of data (like tokens, NFTs, digital assets or data provided from outside).
Expanding to include off-chain data opens up a plethora of new applications and use cases, whether it be building crop insurance agreements for developing countries using satellite weather data, triggering options contracts based on stock market prices, or constructing trade finance automation applications that are connected to IoT and customs data.
However, with this expansion in connectivity comes new attack surface area that must be secured. Fully decentralized blockchains interacting with data from centralized oracles introduces large risks to the end-to-end security and reliability of the smart contract.
To prevent such centralization issues, Chainlink provides a framework for building decentralized oracle networks that source and deliver off-chain data for smart contracts in a secure and reliable manner. It allows dApps to know what’s happening in the real world while retaining the decentralized, permissionless, and deterministic guarantees of the blockchain.
There are many ways NEAR developers can use Chainlink to augment the value of their dApps, including the following:
Access to secure node operators – The Chainlink Network contains a large and growing number of independent, security reviewed, and Sybil-resistant node operators that can be commissioned to provide specific oracle services, many of which are operated by leading blockchain DevOps and blockchain infrastructure teams.
Retrieve data from credentialed APIs – Chainlink’s modular external adapter technology gives your smart contract access to data from any paid or password protected API, enabling connections to premium data providers and permissioned enterprise backend systems.
Framework for decentralization – Chainlink provides a generalized framework for deploying decentralization at both the node operator and data source levels, ensuring high availability and redundant validation to the delivery and sourcing of external data to your application.
Proven solutions – Chainlink’s existing oracle design patterns already secure hundreds of millions and can be easily deployed on NEAR to allow contracts to obtain Price Reference Data and on-chain verifiable randomness, avoiding the pitfalls of trying to provision your own oracle infrastructure.
TLS Verification – Chainlink is pioneering TLS verification solutions through its well-known work on TownCrier, making oracles available that preserve privacy and provide integrity to any data source.
Everyone who has worked on getting NEAR to this point is extremely excited to see the community and partners get more involved in every aspect of the network’s development, operation, and ecosystem growth. This includes creating decentralized applications that are aware of off-chain events happening in everyday life and then reacting to these events through a variety of on-chain actions. The possibilities are truly limitless when combining on-chain and off-chain worlds, so we encourage developers to get creative as this field has so much untapped potential.
Illia Polosukhin, Co-Founder at NEAR Protocol, explained the importance of the Chainlink integration:
“Chainlink integration provides NEAR with most versatile oracle network in the market, as well as the ability to connect to any off-chain API. These are key building blocks for connecting Web2 and Open Web environments, which ultimately allows our developers to build a much wider range of applications, ranging from decentralized financial products and NFTs, to asset tokenization and insurance contracts.”
About NEAR Protocol
NEAR’s mission is to enable community-driven innovation to benefit people around the world. The NEAR platform is 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.
Technically speaking, NEAR Protocol is a public, proof-of-stake blockchain which is built using a novel consensus mechanism called Doomslug. NEAR Protocol uses a technique called “sharding” which splits the network into multiple pieces so that the computation is done in parallel. Parallelism radically increases throughput and allows the network to scale up as the number of nodes on it increases. With NEAR, there isn’t a theoretical limit on the network’s capacity.
NEAR core contributors have won multiple world championships in competitive programming and worked at major tech companies such as Google, Facebook, and Niantic. Find out more about NEAR Protocol on our website, follow us on Twitter, or join our community onDiscord. If you are curious about how to integrate with NEAR or whether it might be a good fit for your business needs, reach out to [email protected].
About Chainlink
If you’re a developer and want to connect your smart contract to off-chain data and systems, visit thedeveloper documentation and join the technical discussion onDiscord. If you want to schedule a call to discuss the integration more in-depth, reach out here.
Chainlink is an open source blockchain abstraction layer for building and running decentralized oracle networks that give your smart contract access to secure and reliable data inputs and outputs. It provides oracles to leading DeFi applications like Synthetix, Aave, and Kyber Network; numerous blockchains such as Ethereum, Polkadot, and Tezos; as well as large enterprises including Google, Oracle, and SWIFT. |
# RuntimeFeesConfig
Economic parameters for runtime
## action_receipt_creation_config
_type: Fee_
Describes the cost of creating an action receipt, `ActionReceipt`, excluding the actual cost
of actions.
## data_receipt_creation_config
_type: [DataReceiptCreationConfig](RuntimeFeeConfig/DataReceiptCreationConfig.md)_
Describes the cost of creating a data receipt, `DataReceipt`.
## action_creation_config
_type: [ActionCreationConfig](RuntimeFeeConfig/ActionCreationConfig.md)_
Describes the cost of creating a certain action, `Action`. Includes all variants.
## storage_usage_config
_type: [StorageUsageConfig](RuntimeFeeConfig/StorageUsageConfig.md)_
Describes fees for storage rent
## burnt_gas_reward
_type: [Fraction](RuntimeFeeConfig/Fraction.md)_
Fraction of the burnt gas to reward to the contract account for execution.
|
---
title: 4.3 Social Tokens
description: Understanding the social value of Non-Fungible tokens
---
# 4.3 Social Tokens
The focus of this lecture centers on the social value of Non-Fungible tokens, as already achieved across the crypto verse through token-gated communities (social tokens) and Profile Picture communities (PFPs). However, in order to thoroughly understand the relationship between NFT’s and communities, we need to also understand the indirect effects generated by such communities. This leaves us with an interesting question we will try to answer at the end: _Are token gated communities necessary for the development of a non-fungible token market in an L1 ecosystem?_
## What is a Token-Gated Community?
To start, let’s define what is a ‘social token’: Technically, a social token could be a fungible token or a non-fungible token, that provides special access to specific benefits in which other owners of the token or NFT are also entitled to. Originally, social tokens began as being for a specific artist or creator, then they morphed into more general communities like _Seed Club_ or _Friends with Benefits._ Then they caught hold with the launch of Non-Fungible Token Profile Picture Collections (PFPs) to provide exclusive access to a specific community server - discord, telegram, or something launched by the project itself.
_Token Gated Community, are an encompassing term referring to both social tokens and non-fungible tokens. The premise of a token gated community is that it ‘gates’ access to a community or individual, such that only someone in possession of the token would be able to access and participate in the community._
Two well known and highly successful token-gated communities include:
![](@site/static/img/bootcamp/mod-em-4.3.1.png)
* **[Seed Club:](https://www.seedclub.xyz/)** Seed club is one of the OG token gated communities designed to create a network of builders, DAOs, and crypto-natives. It is rooted in offering builders a 12 week accelerators on the fundamentals of community building and capital formation.
_“We work intensively with you over the 12 week program to refine your plans and prepare you for your capital and community formation milestones. The program culminates with Demo Day, where you get to present your project to 1,000+ prospective contributors and community members._
_We’ve run four successful cohorts to date, and currently support 60+ alumni DAOs. Our next cohort SC05 kicks off mid-September.” ([Seed Club](https://www.seedclub.xyz/))_
The interesting nature of seed club, lies in its ability to connect capital allocators (VC’s) with fresh crypto-native talent, all beneath the umbrella of its token gated community.
* **[Friends with Benefits DAO: ](https://www.fwb.help/)** Friends with Benefits is one of the most successful social tokens and DAO communities. While FWB is not built around an NFT collection, they are a token gated community [providing business, lifestyle, and networking opportunities to their members](https://www.youtube.com/watch?v=38C5-9RZE7w).
![](@site/static/img/bootcamp/mod-em-4.3.2.png)
FwB has grown to over 2,000 members, and 8 full time managers. As CoinDesk Reports, it is pushing the boundaries of what a ‘token gated community’ is able to offer:
_“It’s still also a group chat, but its ambit is much broader: FWB is a music discovery platform, an online publication, a startup incubator and a kind of Bloomberg terminal for crypto investors. It’s setting up community hubs in major cities across the globe; it throws parties with [Yves Tumor](https://www.youtube.com/watch?v=YnZLqtNXbAM) and [Erykah Badu](https://youtu.be/YY2-mrsXgMM). And maybe most crucially, it raised $10 million in financing from the powerhouse venture capital firm Andreessen Horowitz, cementing its position as one of today’s most powerful online crypto communities. Also, it’ll cost you anywhere between $5,000 and $10,000 to join.”_
* **[VeeFriends: ](https://veefriends.com/)** Gary V’s very own NFT community build around experimenting with and understanding business models and opportunities surrounding Non-Fungible Tokens.
The evolution of token gated communities has been much discussed in crypto, especially when considering how they will most likely evolve over time. In line with Balaji’s thesis on Network States discussed in Module 5, it is highly likely that the most valuable and popular token gated communities are in position to grow beyond their discord server or telegram group into a physical location somewhere (or in many parts of the world), from which they would eventually morph into entire towns or cities.
## PFP communities: Tools of Speculation or the First Step in Unlocking Non-fungible Value?
Profile Picture communities (PFP) refer to communities that have all purchased the same NFT (usually art, and the size of a profile picture). Ownership of the NFT is the access key into the community discord, office space, or special events. Importantly, PFP’s differ radically from social tokens insofar as they are far more representative and public facing and to date, far less focused on special perks or enhanced benefits from being inside of the community.
This has led many to take divergent opinions on PFP communities.
* _Are PFPs hyped speculation on value less assets?_
* _Is there any value in PFP communities?_
* _How do PFP Communities fit into the development of an ecosystem?_
* _Can an ecosystem succeed without PFP communities?_
Below are three interesting examples of different PFP gated communities and the value inherent to them:
**Bored Ape Yacht Club (BAYC)** - The Bored Ape Yacht club was originally incubated by Yuga Labs on Ethereum. As a community designed for rich people to simply hangout it has attracted interest from the highest order of celebrities including: Stephen Curry, Pipa Malmgren, Jimmy Kimmel and Justin Beiber. Notably, BAYC has an all-time sales volume of close [to $2 billion dollars](https://beincrypto.com/bored-ape-yacht-club-2-billion-sales/).
![](@site/static/img/bootcamp/mod-em-4.3.3.png)
**CryptoPunks** - ETH OG’s. CryptoPunks are the oldest NFT project on Ethereum, and have been used as a status signal from other crypto OG’s. With [more than $200 million in volume from sales](https://techcrunch.com/2021/04/08/the-cult-of-cryptopunks/?guccounter=1&guce_referrer=aHR0cHM6Ly93d3cuZ29vZ2xlLmNvbS8&guce_referrer_sig=AQAAAEkzFXhp4OVpKbOCJzLwkDiqNy1DUjl35jRZAmLCna8itK95eyCMlWdae91szbOYrS7SDvmlyjtMbovtC6oWKDTXHf5vQ90NLvMGfe_I6nsZ1cJPTgy9GcxI2HCkiObX85RRir7ErvspJu40By8h-UF9sZSzMBWj9E7MGf4Xw5ux), CryptoPunks are established as a lasting and blue-chip sub-culture on Ethereum.
![](@site/static/img/bootcamp/mod-em-4.3.4.png)
**Full-Send MetaCard Collection:** While not an official profile picture, the Nelk boys collection deserves special attention as one of the most successful value creation and community building transitions from Web2 into Web3. Founders of the Full Send Podcast launched the MetaCard collection as a way of providing fans with exclusive access to their platform and themselves - and to have a say in who gets interviewed on the podcast. According to [NFT Now](https://nftnow.com/podcasts/how-the-nelk-boys-made-nearly-25m-on-their-first-nft-drop/) this has been one of the most successful Web2 influencer transitions into Web3 to date:
_“They explained that the purpose of the project was to launch a number of branded ventures in both the physical world and metaverse, with the ultimate aim of creating a multi-faceted Full Send brand. Some of the ventures they outlined for Full Send include lounges, gyms, festivals, casinos, and restaurants. The Discord server for the collection quickly gained a massive following, bringing in [121,000 members in just about 12 hours](https://www.dexerto.com/entertainment/nelk-boys-are-making-their-own-nft-and-its-already-doing-crazy-numbers-1743039/). The project went live on January 19, and the collection sold out in minutes. The Full Send NFT was available for mint for 0.75 ETH, which was roughly equivalent to $2300 at the time of launch. With 10,000 Full Send Metacards available, the project sold for close to $25 million in total value.”_
## How Should We Think of Communities?
### Tools for Network development, Culture Creation, and Indirect Capital Flows Into An Ecosystem
One of the most important and least understood facets of token-gated communities, is their indirect and often-times unquantifiable impacts on the growth of the ecosystems they launch within. Many crypto-natives, originally turned off by the loose and unclear value proposition of profile picture NFTs, have taken significant amounts of time to realize that PFP and other forms of token gated communities can bring the following to their mothership L1 ecosystem:
**Identity:** Membership in a community provides a notion of being a part of an in-group, during a time when many are isolated and lacking in community. It is a way of ‘paying your way’ into a group of people who are interested in connecting with you.
**Culture:** Collaboration across a community creates a specific culture that is not only present inside of the community but also outside of the community in the surrounding ecosystem. This refers to events hosted in person, projects created by core members, and high level visibility into the community from mainstream media.
**Network:** A well designed community is a combination of an alumni network, a group of like minded friends, and a group of aligned and talented individuals looking to collaborate on a vision of the future. PFP communities and token-gated social tokens - with proper management - can offer exclusive and life-changing networking opportunities - especially in an emergent industry with lots of money floating around.
**Signaling:** The belief that a certain community is ‘special’ or bringing together some of the best minds, signals to the larger industry and to other like-minded individuals that there is an incentive and opportunity to benefit from joining the community. This then creates a network effect that can often translate into _a migration_ into an ecosystem - from builders to socialites. In many ways this is a kin to the _brain drain_ discussed in geopolitics.
**Capital Inflows:** Last but not least, a highly successful PFP or token gated community brings significant amounts of value into the ecosystem it was launched in. This may be because membership is a coveted social symbol, or it may be over-hyped FOMO leading to significant price appreciation. Yet as BAYC has demonstrated, it has been largely new and old money that contributed to its peak volume of 500mm traded for the collection since its inception. In this sense a successful collection can put an entire ecosystem on the map.
## PFPs as the first step in the evolution of NFTs VS. The Same Problem As Governance Tokens
To conclude this lecture, I would like to leave everyone with an interesting dilemma. We have said in prior lectures on the nature of governance tokens the following:
_The inherent problems with governance tokens, is that they seek to tokenize a value proposition, that usually does not exist on a protocol due to its early nature, and lack of product market fit, or revenue. In short, governance tokens put the cart before the horse, insofar as they seek to offer the value of governance up to the public, for a system that has not accrued any value and by extension has no value to be governed!_
The question can now be applied to PFP and token gated communities:
_Does the value of a PFP or token gated community come from the creation of the community itself? Or should the community already exist in order for a PFP or token-gated community to be successful?_
Most likely, the answer resides somewhere in the middle. Whereby the prospect of a new community with speculation attached, has the attention to increase interest and value, yet an existent base of talented and involved people who are not only in it for the speculation can ground it and keep members entertained in order for the community to grow over time.
|
deadmau5 Launches NFT Partnership with Mintbase and NEAR
COMMUNITY
December 3, 2021
deadmau5, the DJ and Producer has teamed up with rockband Portugal. the Man, Mintbase, and NEAR to release a single as an NFT.
The song, titled “this is fine” is being sold as a collection of one million NFTs exclusively on the Mintbase NFT marketplace, which runs on the carbon neutral NEAR blockchain, with tokens now on sale.
By releasing the song as an NFT, deadmau5 and Portugal. the Man could be the first artists to reach platinum status — selling one million copies in the US — with an NFT single release.
The announcement took place in Miami during the Art Basel art fair, an annual event which draws thousands of tastemakers from the art-world, entertainment, fashion and tech.
Half of the NFTs (500,000) are being sold on Mintbase for 0.25 $NEAR per piece, which is $2.19 at the time of writing. The remaining half million will be sold as additional awards with groundbreaking benefits. The ‘Ultimate Bundle’ includes 50,000 NFTs, artwork, a limited edition NFT, a merchandise pack and a highly-prized spot on the guest-list for a forthcoming deadmau5 show.
The lucky fan who collects a pack of 1,000 NFTs will receive a unique, alternate color single cover art for ‘this is fine’, that was created via a generative algorithm.
“NFTs aren’t really that complicated. What we are doing here is giving our millions of fans and people interested in NFT’s an easy way to get on board for an extremely reasonable price. The song is cool too,” said deadmau5.
The single release kicked off with one deadmau5-wrapped bus and two NEAR-wrapped buses circling Miami for a month, inviting art week visitors and locals alike to buy the track using the QR code on its side. The buses will then go ‘on tour’ in New York and San Francisco in December and January to reach music fans and the tech curious on both coasts.
For most people, buying NFTs has been a complex experience, involving additional fees, delays and multiple wallets. With NEAR and Mintbase, users will be able to buy NFTs using fiat cash instantly, with super low fees, thanks to an integration with payment rail provider, Stripe.
The announcement forms part of a wider series NEAR has launched to help people get to grips with Web3 technology around the world.
NEAR is on a mission to make blockchain and crypto a simpler experience that anyone can take part in. From buying NFTs, creating a DAO or joining a Guild, at NEAR it’s a simple as clicking a mouse. Find out how. |
:::info
Remember about fungible token precision. You may need this value to show a response of balance requests in an understandable-to-user way in your app. How to get precision value (decimals) you may find [above](#get-token-metadata).
:::
```js
const tokenContract = "token.v2.ref-finance.near";
const userTokenBalance = Near.view(tokenContract, "ft_balance_of", {
account_id: "bob.near",
});
```
<details>
<summary>Example response</summary>
<p>
```json
"3479615037675962643842"
```
</p>
</details> |
# AccessKeyCreationConfig
Describes the cost of creating an access key.
## full_access_cost
_type: Fee_
Base cost of creating a full access access-key.
## function_call_cost
_type: Fee_
Base cost of creating an access-key restricted to specific functions.
## function_call_cost_per_byte
_type: Fee_
Cost per byte of method_names of creating a restricted access-key.
|
---
sidebar_label: "Credentials"
---
# Credentials
:::info DevConsole
Please, keep in mind, currently using the AWS Credentials is the only way to access the data provided by [NEAR Lake](/tools/realtime#near-lake-indexer) ecosystem. But it is about to change with Pagoda DevConsole release. Stay tuned!
:::
To access the data provided by [NEAR Lake](/tools/realtime#near-lake-indexer) you need to provide valid AWS credentials in order to be charged by the AWS for the S3 usage.
### AWS S3 Credentials
To be able to get objects from the AWS S3 bucket you need to provide the AWS credentials.
AWS default profile configuration with aws configure looks similar to the following:
```
~/.aws/credentials
```
```
[default]
aws_access_key_id=AKIAIOSFODNN7EXAMPLE
aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
```
[AWS docs: Configuration and credential file settings](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html)
#### Environment varibales
Alternatively, you can provide your AWS credentials via environment variables with constant names:
```
$ export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
$ AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
$ AWS_DEFAULT_REGION=eu-central-1
```
|
---
id: running-a-node
title: Run a Node on Linux and MacOS
sidebar_label: Run a Node (Linux and MacOS)
sidebar_position: 3
description: How to run a NEAR node using nearup on Linux and MacOS, with or without using Docker
---
*If this is the first time for you to setup a validator node, head to our [Validator Bootcamp 🚀](/validator/validator-bootcamp). We encourage you to set up your node with Neard instead of Nearup as Nearup is not used on Mainnet. Please head to [Run a node](/validator/compile-and-run-a-node) for instructions on how to setup a RPC node with Neard.*
This doc is written for developers, sysadmins, DevOps, or curious people who want to know how to run a NEAR node using `nearup` on Linux and MacOS, with or without using Docker.
## `nearup` Installation {#nearup-installation}
You can install `nearup` by following the instructions at https://github.com/near-guildnet/nearup.
<blockquote class="info">
<strong>Heads up</strong><br /><br />
The README for `nearup` (linked above) may be **all you need to get a node up and running** in `testnet` and `localnet`. `nearup` is exclusively used to launch NEAR `testnet` and `localnet` nodes. `nearup` is not used to launch `mainnet` nodes. See [Deploy Node on Mainnet](deploy-on-mainnet.md) for running a node on `mainnet`.
</blockquote>
The steps in the rest of this document will require `nearup`
## Running a Node using Docker {#running-a-node-using-docker}
### Install Docker {#install-docker}
By default we use Docker to run the client.
Follow these instructions to install Docker on your machine:
* [MacOS](https://docs.docker.com/docker-for-mac/install/)
* [Ubuntu](https://docs.docker.com/install/linux/docker-ce/ubuntu/)
### Running `nearup` with Docker {#running-nearup-with-docker}
<blockquote class="warning">
Note: `nearup` and `neard` are running inside the container. You have to mount the ~/.near folder to ensure you don't lose your data which should live on the host.
</blockquote>
Once `nearup` and Docker are installed (by following instructions in previous section), run:
```sh
docker run -v $HOME/.near:/root/.near -p 3030:3030 --name nearup nearup/nearprotocol run testnet
```
_(If you prefer to use `localnet` then just replace `testnet` with `localnet` in the command above)_
You might be asked for a validator ID; if you do not want to validate, simply press enter. For validation, please follow the [Validator Bootcamp](/validator/validator-bootcamp).
```text
Enter your account ID (leave empty if not going to be a validator):
```
#### Running in detached mode {#running-in-detached-mode}
To run `nearup` in docker's detached (non-blocking) mode, you can add `-d` to the `docker run` command,
```
docker run -v $HOME/.near:/root/.near -p 3030:3030 -d --name nearup nearup/nearprotocol run testnet
```
#### Execute `nearup` commands in container {#execute-nearup-commands-in-container}
To execute other `nearup` commands like `logs`, `stop`, `run`, you can use `docker exec`,
```
docker exec nearup nearup logs
docker exec nearup nearup stop
docker exec nearup nearup run {testnet/localnet}
```
(The container is running in a busy wait loop, so the container won't die.)
#### `nearup` logs {#nearup-logs}
To get the `neard` logs run:
```
docker exec nearup nearup logs
```
or,
```
docker exec nearup nearup logs --follow
```
To get the `nearup` logs run:
```
docker logs -f nearup
```
![text-alt](/images/docker-logs.png)
| Legend | |
| :------- | :--------------------------------------------------------- |
| `# 7153` | BlockHeight |
| `V/1` | `V` (validator) or `—` (regular node) / Total Validators |
| `0/0/40` | connected peers / up to date peers / max peers |
## Compiling and Running a Node without Docker {#compiling-and-running-a-node-without-docker}
Alternatively, you can build and run a node without Docker by compiling `neard` locally and pointing `nearup` to the compiled binaries. Steps in this section provide details of how to do this.
If [Rust](https://www.rust-lang.org/) isn't already installed, please [follow these instructions](https://docs.near.org/docs/tutorials/contracts/intro-to-rust#3-step-rust-installation).
For Mac OS, make sure you have developer tools installed and then use `brew` to install extra tools:
```text
brew install cmake protobuf clang llvm
```
For Linux, install these dependencies:
```text
sudo apt update
sudo apt install -y git binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev cmake gcc g++ python docker.io protobuf-compiler libssl-dev pkg-config clang llvm
```
Then clone the repo:
```text
git clone https://github.com/near/nearcore.git
cd nearcore
```
Checkout the version you wish to build:
```bash
git checkout <version>
```
You can then run:
```bash
make neard
```
This will compile the `neard` binary for the version you have checked out, it will be available under `target/release/neard`.
Note that compilation will need over 1 GB of memory per virtual core
the machine has. If the build fails with processes being killed, you
might want to try reducing number of parallel jobs, for example:
`CARGO_BUILD_JOBS=8 make neard`.
NB. Please ensure you build releases through `make` rather than `cargo
build --release`. The latter skips some optimisations (most notably
link-time optimisation) and thus produces a less efficient executable.
If your machine is behind a firewall or NAT, make sure port 24567 is
open and forwarded to the machine where the node is going to be
running.
Finally, execute:
```bash
nearup run testnet --binary-path path/to/nearcore/target/release
```
If you want to run `localnet` instead of `testnet`, then replace
`testnet` with `localnet` in the command above. (If you’re running
`localnet` you don’t need to open port 24567).
You might be asked for a validator ID; if you do not want to validate, simply press enter. For validation, please follow the [Validator Bootcamp](/validator/validator-bootcamp).
```text
Enter your account ID (leave empty if not going to be a validator):
```
## Running a Node on the Cloud {#running-a-node-on-the-cloud}
Create a new instance following the [Hardware
requirements](hardware.md).
Add firewall rules to allow traffic to port 24567 from all IPs
(0.0.0.0/0).
SSH into the machine. Depending on your cloud provider this may
require different commands. Often simple `ssh hosts-external-ip`
should work. Cloud providers may offer custom command to help with
connecting to the instances: GCP offers [`gcloud compute
ssh`](https://cloud.google.com/sdk/gcloud/reference/compute/ssh), AWS
offers [`aws emr
ssh`](https://docs.aws.amazon.com/cli/latest/reference/emr/ssh.html)
and Azure offers [`az
ssh`](https://docs.microsoft.com/en-gb/cli/azure/ssh?view=azure-cli-latest).
Once connected to the instance, follow [the steps listed
above](#compiling-and-running-a-node-without-docker).
## Success Message {#success-message}
Once you have followed the steps for running a node with Docker or of Compiling without Docker, you should see messages similar to as shown below:
```text
Using local binary at path/to/nearcore/target/release
Our genesis version is up to date
Starting NEAR client...
Node is running!
To check logs call: `nearup logs` or `nearup logs --follow`
```
or
```text
Using local binary at path/to/nearcore/target/release
Our genesis version is up to date
Stake for user 'stakingpool.youraccount.testnet' with 'ed25519:6ftve9gm5dKL7xnFNbKDNxZXkiYL2cheTQtcEmmLLaW'
Starting NEAR client...
Node is running!
To check logs call: `nearup logs` or `nearup logs --follow`
```
## Starting a node from backup {#starting-a-node-from-backup}
Using data backups allows you to sync your node quickly by using public tar backup files. There are two types of backups for available for both `testnet` and `mainnet`:
- regular
- archival
### Archive links {#archive-links}
Download the latest snapshots from [Node Data Snapshots](/intro/node-data-snapshots).
Starting node using `neard` backup data
```bash
./neard init --chain-id <chain-id> --download-genesis
mkdir ~/.near/data
wget -c <link-above> -O - | tar -xC ~/.near/data
./neard run
```
Starting node using `nearup` backup data:
```bash
nearup run <chain-id> && sleep 30 && nearup stop
dir=$HOME/.near/<chain-id>/data
rm -r -- "$dir" # clean up old DB files to avoid corruption
mkdir -- "$dir"
wget -c <link-above> -O - | tar -xC "$dir"
nearup run <chain-id>
```
In both examples, `<chain-id>` corresponds to `testnet` or `mainnet`.
**Note:** Default location for `neard` data is `~/.near/data`. `nearup` stores data by default in `~/.near/<chain-id>/data.`
>Got a question?
<a href="https://stackoverflow.com/questions/tagged/nearprotocol">
<h8>Ask it on StackOverflow!</h8></a>
|
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
<Tabs className="file-tabs">
<TabItem value="Keypom API" label="Keypom API">
```js
const dropsNumber = "2";
const keysGeneratorUrl = "https://keypom.sctuts.com/keypair/";
const rootEntrophy = "my-password"; //If not provided, the keypair will be completely random. see: https://docs.keypom.xyz/docs/next/keypom-sdk/Core/modules
asyncFetch(keysGeneratorUrl + dropsNumber + "/" + rootEntrophy).then((res) => {
const keyPairs = JSON.parse(res.body);
const pubKeys = [];
const privKeys = [];
keyPairs.forEach((e) => {
pubKeys.push(e.pub);
privKeys.push(e.priv);
});
const obj = {
publicKeys: pubKeys,
privKeys: privKeys,
};
State.update(obj);
});
```
</TabItem>
</Tabs>
|
NEAR and Grupo Nutresa Partner for Customer Experience Innovations in Web3
UNCATEGORIZED
December 1, 2022
In a groundbreaking and innovative move, NEAR has partnered with Grupo Nutresa, one of the most important processors of food in South America, to bring Web3 to the grocery industry. This will see Grupo Nutresa building one of the first open-source loyalty points programs on NEAR with long-term aspirations to reach a million users in Colombia and Latin America. The partnership was established through the support of tech firm Peersyst.
Grupo Nutresa customers will in turn gain more autonomy and control of their rewards. Customers will also get additional security and the reassurance that points will not be stolen or denied, and can be transferred more efficiently. Leveraging NEAR’s technology will also increase usability and accessibility of the rewards system as a whole, saving customers from having to create multiple accounts or different logins for multiple platforms — they just need their easy to use NEAR wallet.
“We are excited to partner with one of the biggest multinationals in Latin America and help it to lead the way through its first Web3 loyalty programme,” says NEAR Foundation CEO Marieke Flament. “Leveraging NEAR’s first-rate technology, the partnership will redefine what is possible when combining retail with the latest blockchain innovation, not just in Latin America but throughout the rest of the world.”
Usability is key to loyalty
Rewarding customers for their support has always been a priority for the world’s top brands. Such programs not only engage customers and deliver incentives for them to return but also act as analytical tools, giving businesses insights into customers’ behaviour and preferences.
With 87% of shoppers reporting they want brands to have loyalty programs and over 70% of consumers more likely to recommend a brand with a robust loyalty program, Web3 and digital wallets are pushing forward-thinking brands to explore new opportunities on platforms that are easy to use.
As one of the biggest multinationals in Colombia, Grupo Nutresa manages several loyalty programs for its customers, collaborators, and providers. Those loyalty programs are now coming together into a single easy-to-use platform underpinned by blockchain technology, through support from Spanish technology company Peersyst Technology.
Onboarding the masses into NEAR and Web3
Grupo Nutresa sees NEAR as the ideal partner for these types of loyalty programs. NEAR Foundation sees the Grupo Nutresa partnership as a great opportunity to onboard the masses into the NEAR and Web3 ecosystems.
“Our purpose is to make people feel recognized and valued by brands. Above all, what interests us most is that this is an opportunity to help build their dreams, through a service that provides them with significant redemption options and value,” says Fabián Andrés Restrepo, Digital Transformation Leader at Grupo Nutresa. “This invitation is also addressed to companies that want to help make people’s dreams come true and reward their loyal customers, by becoming an ally of Grupo Nutresa and its portfolio of businesses. We see in NEAR an important ally for developing and implementing Grupo Nutresa’s loyalty strategy.”
NEAR’s sustainability credentials also align with Grupo Nutresa’s own business strategy and deep commitment to create value for society as a whole. According to the 2021 Dow Jones Sustainability Indices, Grupo Nutresa has been voted as the most sustainable food company in the world for two consecutive years, thanks to its effective implementation of social, environmental, and economic practices. |
NEAR Wallet Update: Staking and Withdrawing Tokens
COMMUNITY
October 12, 2020
On the journey to make blockchain-based apps accessible to everyday people, the NEAR Wallet plays a vital role for usability in the community. Usability for developers has been our priority in architecting the platform from day one, but as the MainNet gets closer to completing its final launch phase, it is important to consider usability of the tooling and user interfaces needed to support a thriving ecosystem of exchanges, applications, and integrations for NEAR users. The NEAR Wallet will make using applications and managing tokens easier than ever before.
Our previous release for the NEAR Wallet this summer announced NEAR Drops, a much simpler way to onboard new users to NEAR by making it possible to send links with $NEAR attached to them so app developers can seamlessly create accounts without their users having to worry about having a $NEAR token balance.
Today, we’re excited to announce a new release from the Wallet Team which makes it easier for the community to stake with NEAR Validators using a new User Interface in the NEAR Wallet.
If you have a NEAR Wallet (only locked tokens supported for now), try it out!
A New User Interface for Staking
Key to the Proof-of-Stake model is how Validators are supported by the community via Staking. Validators earn NEAR token rewards for operating the nodes which run the network in the form of a static inflation rate of 5% each year, creating new tokens for Validators every epoch (~12 hours) as rewards.
Validators must maintain a minimum amount of Stake to keep their Validator seat. Token holders are able to stake with a particular Validator they believe is performing well for the network and earn a portion of Token rewards generated by the network too. This incentivizes Token holders to stay involved with the community!
With this release, the NEAR Wallet now has a staking user interface built directly into the web app.
To Stake:
Select “Staking” from the navigation bar (or dropdown on mobile)
Click the “Select Validator” button
Choose a validator
Confirm your choice and select “Stake with Validator”
Enter the amount of NEAR you would like to stake, and click “Submit Stake”
You will need to confirm two transactions, one to select the validator, and another to deposit and stake with the validator.
To Unstake:
On the staking dashboard (/staking), select your current validator
Click “Unstake” and confirm the transaction
After 36 to 48 hours (3 full epochs), you will be able to withdraw your stake. To do so, return to the validator page, and click “Withdraw”.
Monitoring Key Staking Information
Not only does this interface allows you to choose Validators to stake with and see key information you need to make a staking decision like:
Total Amount Staked: NEAR tokens your account has currently staked with Validators. These tokens are accumulating rewards. To access these tokens once again, you must first unstake and then withdraw them from the staking pool.
Unclaimed Rewards: Token rewards that have been earned, but not withdrawn from the staking pool. Unclaimed rewards are automatically restaked, which means your “Total Amount Staked” automatically increases over time, and your rewards are compounding.
Tokens Available for Withdrawal: These tokens have been unstaked and are ready to be withdrawn.
Tokens Pending Release: These tokens have been unstaked, but are not yet ready to withdraw. Tokens are ready to withdraw 36 to 48 hours after unstaking.
Validator Fee: This is the fee paid to the validator to stake on your behalf. This fee is only charged on your rewards earned not your total token balance staked to the Validator. Each Validator can set their own fees, so take this into consideration when deciding who to stake to.
Staking features in the NEAR Wallet are new and should still be considered beta. If you have any concerns or questions about staking, check out the docs, or pose the question to the community in our Discord chat.
Join the Community
Join us on the journey to make blockchain accessible to everyday people who are excited for the future of the Open Web with NEAR. If you’re a developer, be sure to sign up for our developer program and join the conversation in our Discord chat. You can also keep up to date on future releases, announcements, and event invitations by subscribing to our newsletter for the latest news on NEAR. |
---
slug: /
sidebar_position: 1
---
# BWE Alpha Test
## Welcome 🎉
Thank you for participating in the alpha test for BOS Web Engine **(actual release name TBD)**; an improved execution layer for NEAR's decentralized front-end components.
Significant effort has been dedicated to this project, reaching a stage where most of the essential features are established, laying the groundwork for the development of more sophisticated and refined applications. BWE is on the verge of achieving complete parity with the former VM, while also providing substantial additional functionalities.
That being said, this is an **alpha** so rough edges and bugs should be expected. We appreciate your help in identifying these issues so we can quickly move towards a stable release. 🙏
:::danger Warning
Please use **non-vital NEAR accounts** during the alpha test since we have not yet initiated our security audit program. Avoid using accounts with significant balances, elevated permissions, or sentimental addresses.
:::
---
## Timeline
BWE alpha test begins on Feb 26, 2024 and runs for several weeks as we perform rigorous testing both internally and with community members such as yourself. 🙏
---
## How to get involved
- [Test](#test)
- [Ask Questions & Get Support](#support)
- [Give Feedback](#give-feedback)
---
### Test
Using the [BWE Sandbox IDE](https://bwe-sandbox.near.dev), try any of the following:
- Write components that aren't possible to build using the current VM
- Write components that test the limits of BWE
- Migrate your existing components from the VM to BWE
- Migrate vanilla React components to BWE
- Test npm package imports
:::tip npm Package Support
A wide variety of npm packages should work out of the box with BWE, especially non-UI packages. See the [npm section of our imports documentation](/alpha/building-decentralized-frontends/imports#npm) for full details.
**Note:** You can attempt to import any npm package, but not all will work due to the sand boxed environment. We are using this testing period to determine which packages will work and cataloging them in docs.
:::
:::warning Not Supported Yet
- `useRef` (refs not exposed to outer application)
- `useContext`
- `<canvas>` and other Web APIs
- development with local code editor and bos-loader
:::
:::info Not Planned to be Supported
- Direct DOM manipulation
- Interoperability between BWE and the previous VM
:::
We'd love to see what you build and hear about your experience! Please share what you build with us and the community! 🙏
---
### Support
The BWE team will be available in Telegram and GitHub Discussions to answer any questions you might have and assist in troubleshooting.
- [Telegram Group](https://t.me/+IlVl5uEsGH83YTEx)
- [GitHub Discussions](https://github.com/near/bos-web-engine/discussions)
---
### Give Feedback
There are three main avenues for giving feedback. Please choose whichever is most convenient for you:
- [BWE Feedback Form](https://forms.gle/5w16G5wix4ezWx4y5) - Easy google feedback form
- [GitHub Discussions](https://github.com/near/bos-web-engine/discussions/new?category=alpha-test-feedback) - Alpha feedback section of BWE's GH Discussions
- [GitHub Issues](https://github.com/near/bos-web-engine/issues/new) - Found a bug, performance issue, or have a feature request? [File it here.](https://github.com/near/bos-web-engine/issues) The more info the better, but don't let that be a blocker from filing one! If you only have time to file something quick, please do so and we can follow up for more details later 🙂
:::tip
We are looking for feedback in the following areas:
- Performance
- Syntax
- Documentation
- Level of effort to migrate components to BWE
- Missing capabilities
- Overall developer experience (DevX)
:::
|
---
sidebar_position: 2
title: Callbacks
---
# Callbacks
NEAR Protocol is a sharded, proof-of-stake blockchain that behaves differently than proof-of-work blockchains. When interacting with a native Rust (compiled to Wasm) smart contract, cross-contract calls are asynchronous. Callbacks are used to either get the result of a cross-contract call or tell if a cross-contract call has succeeded or failed.
## Calculator Example
A callback method can be declared in your contract class as a regular method decorated with the `call({})` decorator. Be sure to pass in the `privateFunction: true` option to the decorator. This will ensure that the method is only callable by the contract itself.
For example, let's assume the calculator is deployed on `calc.near`, we can use the following:
```js
@NearBindgen({})
export class CalculatorCallerContract {
@call({})
sum_a_b({ a, b }) {
let calculatorAccountId = "calc.near";
// Call the method `sum` on the calculator contract.
// Any unused GAS will be attached since the default GAS weight is 1.
// Attached deposit is defaulted to 0.
return NearPromise
.new(calculatorAccountId)
.functionCall("sum", { a, b }, BigInt(0), BigInt(100000000000000));
}
@call({ privateFunction: true })
sum({ a, b }) {
return a + b;
}
}
```
## Allowlist Example
Next we'll look at a simple cross-contract call that is made to an allowlist smart contract, returning whether an account is in the list or not.
The common pattern with cross-contract calls is to call a method on an external smart contract, use `.then` syntax to specify a callback, and then retrieve the result or status of the promise. The callback will typically live inside the same, calling smart contract. There's a special decorator parameter used for protecting the callback function, which is [`privateFunction: true`](https://docs.rs/near-sdk-core/latest/near_sdk_core/struct.AttrSigInfo.html#structfield.is_private). We'll see this pattern in the example below.
The following example demonstrates two common approaches to callbacks using the high-level cross-contract approach with `NearPromise`.
```js
@NearBindgen({})
export class ExtAllowlist {
// ...
@call({})
is_allowlisted({ staking_pool_account_id }) {
return this.allowlist.get(staking_pool_account_id) != null;
};
}
```
After creating the class, we'll show a simple flow that will make a cross-contract call to the allowlist smart contract, asking if the account `idea404.testnet` is allowlisted.
```js
@NearBindgen({})
export class Contract {
@call({})
xcc_query_allowlist() {
// Call the method `is_allowlisted` on the allowlisted contract. Static GAS is only attached to the callback.
// Any unused GAS will be split between the function call and the callback since both have a default unused GAS weight of 1
// Attached deposit is defaulted to 0 for both the function call and the callback.
return NearPromise
.new("allowlist.near")
.functionCall("is_allowlisted", { staking_pool_account_id: "idea404.testnet" }, BigInt(0), BigInt(100000000000000))
.then("internalCallbackMethod", {}, BigInt(0), BigInt(100000000000000));
}
@call({ privateFunction: true })
internalCallbackMethod() {
assert(near.promiseResultsCount() === BigInt(1), "Error: expected 1 promise result");
let result = JSON.parse(near.promiseResult(0));
return result;
}
```
The syntax begins with `NearPromise.new(<someAccountId>)` which initializes the async call to the designated `<someAccountId>`. Subsequent calls to this program in this account are invoked using `.functionCall()`. The `.functionCall()` method takes in the following parameters:
- `functionName`: the name of the method to call on the contract
- `args`: the arguments to pass to the method
- `amount`: the amount of Ⓝ to attach to the call
- `gas`: the amount of GAS units to attach to the call
There are a couple things to note when doing these function calls:
1. You can attach a deposit of Ⓝ, in yoctoⓃ to the call by specifying the `amount` parameter. This value is defaulted to 0 (1 Ⓝ = 1000000000000000000000000 yoctoⓃ, or 1^24 yoctoⓃ).
2. You can attach an amount of GAS units by specifying the `gas` method. This value is defaulted to 0.
|
---
id: introduction
title: Chain Abstraction
sidebar_label: Introduction
---
Do you know how your favorite apps are built and which database they use?. Chances are not, since we choose apps based on their functionality, and not their underlying tech.
We believe that **same should be true for blockchain apps**, users should be able to enjoy an application, without the underlying tech hampering their experience. The user experience should be so good, that they don't realize they're using a blockchain.
![img](/docs/assets/welcome-pages/chain-abstraction-landing.png)
To help make this a reality, NEAR provides a set of services that allow to **abstract away** the blockchain from the user experience. This means that users can use blockchain-based application - both in NEAR and **other chains** - without needing to understand the technical details.
---
## Abstraction services
Through a combination of multiple technologies, NEAR allows to create a seamless flow, in which users can use their email to create an account, use such account without acquiring funds, and even control accounts across multiple chains.
This is achieved through a combination of multiple services:
- **Relayers**: A service that allows developers to subsidize gas fees for their users.
- **FastAuth**: A service that allows users to create and recover accounts using their email address through multi-party computation (MPC).
- **Multi-chain signatures**: A service that allows users to use their NEAR account to sign transactions in other chains.
---
## A holistic view
The combination of these services allows to create a **seamless** user experience, in which users can use blockchain-based applications without realizing they are using a blockchain.
Users will simply login with an email, and a **zero-fund** account will be created for them. No seed phrases to remember, no private keys to safe keep, and no need to acquire funds.
Once having their account, apps can ask the user to create meta-transactions and send them to any relayer. The relayer will pass the transaction to the network, attaching NEAR to pay for the execution fees. The transaction will then be executed as if the user had sent it, since the relayer is only there to attach NEAR to the submission.
If the user wants to interact with other blockchain, they can use their account to interact with a multi-chain signature relayer, which will relay the transaction to the right network, covering GAS fees.
As an example, this would allow users to collect NFTs across different chains, without ever needing to explicitly create an account or acquire crypto. All with just a single email login.
|
---
sidebar_position: 1
sidebar_label: "Setup"
---
# Setup Alerts & Triggers
:::warning
Please be advised that these tools and services will be discontinued soon.
:::
## Setting up E-mail alerts
1. Navigate to [console.pagoda.co](https://console.pagoda.co) and log-in
2. Navigate to the <kbd>Alerts</kbd> tab
<img width="20%" src="/docs/pagoda/setup1.png" />
3. Select a target address for the alert to listen to
<img width="60%" src="/docs/pagoda/setup2.png" />
4. Select one of the following conditions to listen for
<img width="60%" src="/docs/pagoda/setup3.png" />
5. Select email as the destination to send alerts to and enter an email address to send the alert to
<img width="60%" src="/docs/pagoda/setup4.png" />
6. This email address will need to be verified before it can be used as a valid alert destination.
<img width="60%" src="/docs/pagoda/setup5.png" />
7. Be sure that the email destination is toggled on as shown below and click "Create Alert" to finish setting up your email alert
<img width="60%" src="/docs/pagoda/setup6.png" />
## Setting up Telegram alerts
Follow the steps above to begin setting-up telegram alerts. When selecting the destination select Telegram and follow these steps to authorize Alerts
<img width="60%" src="/docs/pagoda/setup7.png" />
### Private Message Alerts
1. On the device that is logged into the telegram aclick "Open Telegram" or scan the QR code.
<img width="60%" src="/docs/pagoda/setup8.png" />
2. by Telegram. Hit "Send Message" to continue
<img width="40%" src="/docs/pagoda/setup9.png" />
3. Once inside the chat, hit "Start" to begin receiving alerts at this destination
<img width="60%" src="/docs/pagoda/setup10.png" />
### Group message alerts
For group chats, add `PagodaDevConsoleBot` and copy the message you see in your on-screen modal and send it in the chat that includes`PagodaDevConsoleBot` to authorize the group chat destination
<img width="70%" src="/docs/pagoda/setup11.png" />
## Setting up Event Log Alerts
You can listen to on-chain events occurring to contracts that follow NEPs standards like NEP-171 (NFTs), NEP-141 (fungible tokens), or NEP-145 (storage management). All NEAR NEPs can be found on the [Nomicon NEAR site](https://nomicon.io/Standards/).
To set-up an alert for an event, for example `nft_transfer` from [NEP-171 version 1.1.0](https://nomicon.io/Standards/Tokens/NonFungibleToken/Core):
1. Follow the steps above to begin setting up an alert.
2. Select the "Event Logged" condition,
3. Type the event name `nft_transfer`,
4. The standard `nep171`, and
5. Add the version `1.1.0` as seen below
<img width="80%" src="/docs/pagoda/setup12.png" />
> Note that input fields are case sensitive, and the standards field must be written in the format `nep123` not `NEP-123`
## Setting up Function Call Specific Alerts
More generally, Pagoda Console makes it easy to generate alerts based on specific function calls. Simply follow the steps above, select the "Function Called" condition, and type the method name **exactly** as it appears in the contract code or the contract's [ABI](https://github.com/near/abi)
<img width="80%" src="/docs/pagoda/setup13.png" />
|
Project Spotlight: TessaB- Blockchain for the Mobile Phone Industry
CASE STUDIES
March 3, 2021
Hi NEARverse, we’d like to introduce you to the TessaB project solving a real world problem within the secondhand mobile phone industry with blockchain via the Glyde Marketplace.
Below is a Q&A with TessaB’s CEO, Flavio Mansi.
TessaB CEO Flavio Mansi
Background
Tell us a few things about your company. What inspired you to start it?
PCS Wireless founded TessaB in 2018 to enable a new, innovative ecosystem for pre-owned mobile devices and related services backed by a blockchain technology platform. I was part of the PCS Wireless team and previously served as President of its subsidiary IGWT Block. Today, as CEO of TessaB Corp. my goal is to leverage the TessaB blockchain platform we have built, as well as PCS Wireless’s proven track record in the secondary wireless market, to develop a more transparent and secure ecosystem for new and pre-owned phones and related services starting with our newly launched platform: The Glyde Marketplace (Glyde).
Who is on your team?
We have a robust and multi-faceted team. Please check them out on our website: https://www.tessab.com/the-team/
Have you received outside funding from notable investors or advisors?
Up until this point we have self-funded this project but expect to attract external capital in the next quarter or two, once the business units we are building on top of our TessaB blockchain platform continue gaining traction.
The Blockchain Factor
Why did you decide to build your project with blockchain technology?
TessaB is using a blockchain technology stack to solve the issues of trust and transparency. Blockchain provides a more transparent, and secure ecosystem for new and pre-owned phones and related services. The biggest barrier to purchasing a used phone is lack of confidence in the condition of the phone the buyer will receive. That is why we have selected blockchain and other innovative technologies to create a more efficient and trustworthy marketplace for used phones.
Enter NEAR
Why did you choose to build on NEAR?
We teamed up with NEAR Protocol for layer one of the blockchain to provide the foundation for a fairer marketplace for both individual consumers and businesses, one in which transactions are more transparent and, as a result, prices more accurately reflect the quality and value of the device.
With Glyde, business rules programmed into smart contracts to guide dispute mediation when the condition of a phone a buyer receives does not match the condition the seller posted to a phone listing, minimizing the need for subjective decision-making.
How did NEAR help you solve some of your key challenges?
The two biggest challenges with any main chain protocols for blockchain eg. Bitcoin, Ethereum right now is scalability and cost to record transactions. NEAR protocol helps a lot in both of those problems via the sharding concept. NEAR is 100 times faster than Ethereum and more than 1000 times cheaper.
There were a few more factors we were looking for such as:
Popularity: Number of dApps on the platform and developers in their community
Contract Complexity: How robust is their development infrastructure?
WASM compatibility: Web-Assembly was another important factor for reuse and compatibility with other languages in future development. The wallet is mobile & web compatible, custodial & non-custodial options. Since we had plans for our own Token for our ecosystem, the protocol needed to be compatible with various wallet solutions.
Cost of creating a user account: Since we had to create an account for every user, the cost of creating an account was also very important.
NEAR was at the top of our selection matrix.
On the Personal Side
What is your motto / favorite quote?
“Parco en la adulación y abundante en la crítica” which roughly translates to “limited on adulation and extensive on criticism”.
What is your current state of mind?
We are delighted with the official launch of The Glyde Marketplace this past November with a mission of solving issues within the used mobile phone market. Right now, there is an average of seven middlemen between a customer who trades in a phone and its next owner. Our goal is to eliminate these inefficiencies and also instill trust between buyers and sellers.
Looking to the Future
What are your plans for the future? What’s the next big milestone you want to achieve?
Our goal is for Glyde to usher in the future of buying and selling used phones. We do this by harnessing new technologies to provide buyers and sellers a higher level of transparency and security, thereby allowing consumers to cut out the many industry middlemen who needlessly drive up prices. TessaB is disrupting a massive industry. The global market for used phones is huge, forecast to be worth $67 billion by 2023 according to William Stofega, Program Director, Mobile Device Technology and Trends at IDC and we hope to be a part of that market as the industry for second hand phones grows.
What is it that excites you the most about blockchain and the Open Web?
I’m most excited about Blockchain’s ability to revolutionize industries, societies, and create new communities. Blockchain enables programmable digital agreements (eliminating the need for human intermediaries), provides verifiable data, and facilitates a new level of trust and transparency to various industry markets.
With our new Glyde marketplace, we’re combining the power of Blockchain with mobile diagnostics, machine learning, and artificial intelligence to revolutionize an industry plagued by lack of transparency and ambiguity. The fusion of these emerging technologies will cultivate a fully transparent, trustworthy peer-to-peer marketplace. Our diagnostics benefit consumers tremendously as we are harnessing the power of smart contracts to ensure transactions include verifiable data for both parties. This act of good faith via the blockchain, will create a historical record of each device any time diagnostics are run.
This will allow for us to assess and predict the value and lifespan of devices more accurately, providing cost-efficiency and more transparency around what devices should really be bought and sold. Overall, our goal is to provide more value for a phone you are selling and more insights for a second-hand phone you may be looking to purchase.
TessaB and NEAR
Keep up to date with TessaB and The Glyde Marketplace on our socials via LinkedIn and don’t forget our Twitter.
NEAR invites you to join us on the journey to make blockchain accessible to everyday people who are excited for the future of the Open Web. If you’re a developer, be sure to sign up for our developer program and join the conversation in our Discord chat. You can also keep up to date on future releases, announcements, and event invitations by subscribing to our newsletter or following us on our Twitter for the latest news on NEAR. |
---
id: how-it-works
title: How QueryAPI works
sidebar_label: How it works
---
QueryApi is a streaming indexer implementation that executes custom indexing logic written by developers on the NEAR blockchain.
QueryApi allows hosted execution of complex queries (ones that can’t be answered by a [simple RPC](../../../5.api/rpc/introduction.md) or [Enhanced API](https://docs.pagoda.co/api) call), data hosting, and its exposure via GraphQL endpoints.
## Components involved
The QueryApi implementation integrates many different components in a single and streamlined solution.
In a high-level overview, the main components are:
:::info Components
`NEAR Protocol` -> `NEAR Lake` -> `Coordinator` -> `Runner` -> `Database` -> `API`
:::
### Detailed overview
An in-depth, detailed overview of the QueryApi components:
[![QueryAPI](/docs/qapi-components.png)](/docs/qapi-components.png)
### Description
- **Protocol:** the underlying NEAR Layer-1 Blockchain, where data `Blocks` and `Chunks` are produced.
- **NEAR Lake:** an indexer which watches the Layer-1 network and stores all the events as JSON files on AWS S3. Changes are indexed as new `Blocks` arrive.
- **Coordinator:** the QueryApi coordinator indexer filters matching data `Blocks`, runs historical processing threads, and queues developer's JS code to be indexed with these matched blocks.
- **Runner:** executes the user's indexer code, which outputs the data to the database.
- **Database:** a Postgres database where the developer's indexer data is stored, using a logical DB per user, and a logical schema per indexer function.
- **API:** a Hasura server running on Google Cloud Platform exposes a GraphQL endpoint so users can access their data from anywhere.
## Historical backfill
When an indexer is created, two processes are triggered:
- real-time - starts from the block the indexer was registered (`block_X`), and will execute the indexer function on every matching block from there on.
- historical - starts from the configured `start_from_block` height, and will execute the indexer function for all matching blocks up until `block_X`.
The historical backfill process can be broken down in to two parts: _indexed_, and _unindexed_ blocks.
**Indexed** blocks come from the `near-delta-lake` bucket in S3. This bucket is populated via a DataBricks job which streams blocks from NEAR Lake, and for every account, stores the block heights that contain transactions made against them. This processed data allows QueryAPI to quickly fetch a list of block heights that match the contract ID defined on the Indexer, rather than filtering through all blocks.
NEAR Delta Lake is not updated in real time, so for the historical process to close the gap between it and the starting point of the real-time process, it must also manually process the remaining blocks. This is the **unindexed** portion of the backfill.
## Provisioning
In summary, QueryAPI provisioning consists of the following steps:
1. Create `database` in [Postgres](#postgres), named after account, if necessary
2. Add `database` to Hasura
3. Create `schema` in `database`
4. Run DDL in `schema`
5. Track all tables in `schema` in [Hasura](#hasura)
6. Track all foreign key relationships in `schema` in [Hasura](#hasura)
7. Add all permissions to all tables in `schema` for account
:::note
This is the workflow for the initial provisioning. Nothing happens for the remaining provisions, as QueryAPI checks if it has been provisioned, and then skips these steps.
:::
:::info
To check if an Indexer has been provisioned, QueryAPI checks if both the `database` and `schema` exist. This check is what prevents the app from attempting to provision an already provisioned indexer.
:::
### Low level details
There are two main pieces to provisioning: [Postgres](#postgres) and [Hasura](#hasura).
#### Postgres
The dynamic piece in this process is the user-provided `schema.sql` file, which uses Data Definition Language (DDL) to describe the structure of the user's database. The `schema` DDL will be executed within a new Postgres Schema named after the account + function name. For example, if you have an `account.near` and `my_function`, the schema's name will be `account_near_my_function`. Each schema exists within a separate virtual database for that account, named after the account, i.e. `account_near`.
#### Hasura
After creating the new schema, Hasura is configured to expose this schema via a GraphQL endpoint. First, the database is added as a data source to Hasura. By default, all tables are hidden, so to expose them they must be "tracked".
Foreign keys in Postgres allow for nested queries via GraphQL, for example a `customer` table may have a foreign relationship to an `orders` table, this enables the user to query the orders from a customer within a single query. These are not enabled by default, so they must be "tracked" too.
Finally, necessary permissions are added to the tables. These permissions control which GraphQL operations will be exposed. For example, the `SELECT` permission allows all queries, and `DELETE` will expose all delete mutations. A role, named after the account, is used to group these permissions. Specifying the role in the GraphQL request applies these permissions to that request, preventing access to other users data.
## Who hosts QueryAPI
[Pagoda Inc.](https://pagoda.co) runs and manages all the infrastructure of QueryAPI, including NEAR Lake nodes to store the data in JSON format on AWS S3.
- NEAR Lake indexing is hosted on AWS S3 buckets.
- Coordinator and Runners are hosted on GCP.
- Hasura GraphQL API server is hosted on GCP.
:::caution Pricing
QueryAPI is currently free. Pagoda doesn't charge for storage of your indexer code and data as well as running the indexer, but usage pricing will be introduced once QueryApi is out of beta.
:::
|
NEAR, MetaBUILD 2, and Brave Head to ETHDenver
COMMUNITY
February 15, 2022
NEAR will be at ETHDenver, as will our MetaBUILD 2 Hackathon, and the Brave browser. The mission: support the global community of developers in building a multi-bridge, multi-chain world!
The NEAR community, in partnership with Brave, will give attendees at ETHDenver, the world’s largest and longest-running Ethereum event, the chance to take part in MetaBUILD to reimagine gaming on the world’s biggest crypto browser.
Brave currently has over 54 million monthly active users and recently launched the Brave Wallet, a browser-native crypto wallet. The team is challenging ETHDenver and MetaBUILD hackers to formulate new ways of issuing game skins for the simple, yet addictive, Dino game, available on the Brave browser. Hackers have the choice to either use one of NEAR’s ecosystem’s NFT platforms or develop their own smart contract to complete the task.
For this MetaBUILD 2 challenge, Brave is putting up a bounty of $20,000 $BAT. This $BAT Match is just one of many fun and creative MetaBUILD 2 challenges driving applicant demand. Both MetaBUILD and ETHDenver empower the global developer community to build leading decentralized Web3 technologies, so we encourage hackers to submit their projects to both hackathons.
When MetaBUILD 2 launched on December 22, 2021, there were 300 participants. To inspire and reward MetaBUILD 2 hackers, we announced $1,000,000 in prize money across 35 sponsor challenges to be awarded to winning projects and development teams—from building decentralized storage and game development to NFT marketplaces and more!
As of today, there are over 3,500 applications—all taking advantage of NEAR’s easy-to-build infrastructure, and bringing their own unique ideas and skills to the task of building with NEAR and the cross-chain Open Web and Metaverse.
To satisfy hackathon applicant demand, we’re extending MetaBUILD 2 until February 21st, which coincides with the last day of ETHDenver. That means you’ve got more time to submit your ideas for NEAR, the Open Web, or the Metaverse.
More MetaBUILD Hacking at ETHDenver Means More Cross-Chain Collabs
For the Open Web to be fully realized, cross-chain collaborations are absolutely vital. With blockchain platforms working as allies, the future is bright and anything is possible.
Most crucially, users and developers will be able to move assets, projects, and experiences without friction back and forth across blockchain platforms. By collaborating, tools and products like atomic swaps will preserve privacy across blockchains, instead of exposing identities in transit.
More upsides to collaboration between NEAR, Ethereum, and other blockchains include efficiency gains in areas like transaction speeds, security, and sustainability.
In other words, cross-chain collaboration will help expand and supercharge decentralized app ecosystems, changing the Internet as we know it—for the better.
Reimagine Gaming, DeFi, and NFTs for Cross-Chain Future
NEAR is designed to be simple to use, no matter what ecosystem you’re coming from. This simplicity also makes it an ideal platform for cross-chain collaboration projects.
For MetaBUILD, participants can use Rust, Web Assembly, or other familiar programming languages to build DeFi, Web3, Gaming, Digital Art/Collectibles, as well as infrastructure apps and tools. You can even migrate an existing Ethereum Virtual Machine (EVM) app to the NEAR ecosystem.
Gaming will be a big focus for the NEAR ecosystem in 2022. After the successful rollout of sharding last year—and an aggressive roadmap designed to increase speed, scalability, and security this year—the gaming ecosystem has flourished.
With some 30 gaming titles either launched or due to launch in the coming months, it’s never been a better time to jump into the space. And what better way of taking part in NEAR’s gaming ecosystem than by entering NEAR and Brave’s $BAT Match?
Or maybe you want to build an NFT marketplace? Aurora, an Ethereum scaling solution on NEAR, is challenging MetaBUILD 2 participants to hack together an NFT marketplace on its platform. Aurora has experienced massive growth since launching in May 2021, which makes this one of the most popular MetaBUILD challenges. Migrate your ETH project onto NEAR using Aurora and the Rainbow Bridge.
NFT marketplaces Paras and Mintbase are also offering NFT challenges. And lastly, but not leastly, there are opportunities for hackers to build solutions for blockchain oracles, governance, or even for The Graph’s explorer.
Check out the full list of MetaBUILD 2 sponsor challenges and get hacking for a cross-chain future!
You can visit NEAR and Brave at ETHDenver during the main conference at the Sports Castle (Shill Zone, Floor 2, Booth P5). Also, don’t miss talks by Sampson, Senior Developer Relations Specialist at Brave, and Luke Mulks, VP of Business Operations at Brave, at the NEAR Lounge, located on the 3rd floor of the Jonas Bros Building on February 15-17th during BUILD week. Talks will also be livestreamed. |
NEAR at NVIDIA GTC 2024: A Recap of Illia’s Appearance
COMMUNITY
March 25, 2024
At NVIDIA GTC 2024––the flagship conference of the AI hardware supercompany in San Jose, California––the spotlight was on the intersection of AI, blockchain, and the next era of open web innovation. Among the distinguished speakers was Illia Polosukhin, co-founder of NEAR Protocol, who contributed his insights into how AI models will evolve and how blockchain and token economies can play key roles. Polosukhin is the only blockchain industry founder to speak at the NVIDIA event.
The “Transforming AI” panel was hosted by Jensen Huang, CEO and co-founder of NVIDIA. Appearing on the panel were all but one of the co-authors of the landmark 2017 research paper “Attention is All You Need,” which introduced the Transformer architecture that revolutionized natural language processing. That lineup of coauthors has gone on to work on projects such as OpenAI, Inceptive, and Essential AI.
The group’s conversation explored the practical applications of blockchain technology, with Illia touching on programmable money and its impact on both the current and future states of digital economies. By addressing the challenges and opportunities presented by the convergence of AI and blockchain, Illia offered a grounded perspective on the potential for these technologies to facilitate a more decentralized and efficient open web.
Illia’s insights also highlighted NEAR’s commitment to leveraging Web3 technologies for broader adoption and innovation across a range of future tech use cases. Jensen himself noted that he thinks “NEAR is very cool.”
From Accelerated Computing to AI and the Blockchain
Jensen kicked off the panel by providing context around the evolution of computing power and the potential of generative AI as the next industrial revolution. After a round of introductions, Illia dove into the beginnings of his research at Google and the unique challenges that brought AI to the forefront during that time.
“The team and I were working on simple question answering. You’d go to Google, you ask a question, and it should give you an answer,” Illia recounted. “But Google has very low latency requirements, so if you want to ship actual models that read search results, like tons of documents, you need something that can process that quickly. And models at the time just couldn’t do that.”
After publishing the paper and leaving Google to explore new opportunities, Illia first worked on NEAR as an AI startup, then pivoted when he and co-founder Alex Skidanov recognized an opportunity in the blockchain space they first encountered as users. They recognized a clear need in the space back in 2018: to make blockchain technology accessible and intuitive for everyday use. Illia discussed with the panel how that realization led him to the concept of programmable money, and subsequently built NEAR Protocol to address blockchain scalability and usability challenges, creating a shift towards a more user-friendly open web economy.
The Genesis of NEAR and Programmable Money
Illia further discussed how his shift from pure AI research to Web3 was driven by the concept of programmable money, not just for cross-border payments but for a range of powerful use cases. This was a direct response to the challenges of coordinating on complex networks and the increasing demand for scalable blockchain solutions. The result is a platform that can handle large transaction volumes without compromising speed or security.
“NEAR has the most users in the world in the blockchain space,” Illia explained. “We’re talking about multiple millions of daily users who don’t even know they’re using blockchain. But they’re actually interfacing with programmable money and programmable value. And now we’re bringing back some of those AI tools to generate more data.”
He then highlighted the need for a shift in how creators are rewarded in an emerging age of generative AI, suggesting that the century-old copyright system must evolve. With artists and creators now leveraging tools like Midjourney and OpenAI for everything from visual art to storytelling, the panel agreed that copyright laws will need an overhaul sooner than later.
Integrating AI for Fairer User and Creator Economies
With the generative age already underway, Illia further unpacked how NEAR will be central to this new AI-enabled creator economy.
“The way we’re rewarding creators right now is broken,” Illia continued. “And the only way to fix that is to leverage programmable money, programmable value, and blockchain. You need the basic primitive of programmable money because it’s what allows users and groups to coordinate people at scale.”
Illia’s vision extends to building a version of the open web where programmable value underpins a positive feedback loop, fostering a novel economy enriched by equitable participation. For example, he noted that NEAR is exploring ways for users to contribute their own data, which can help improve AI models. These initiatives demonstrate how tomorrow’s AI economy could benefit both creators and users by allowing more participation and collaboration underpinned by Web3 infrastructure and incentives.
“I strongly believe that the way we’re going to make progress towards software eating the world to machine learning is eating software,” Illia argued. “And the most direct way is to teach machines to code, so you’re able to actually generate software and transform everyone’s access.”
Throughout his appearance at NVIDIA GTC 2024, Illia underscored NEAR’s pivotal role in bridging the gap between the open web, programmable money, and AI. By advocating for a reimagined copyright framework and more equitable creator compensation models, Illia presented an accessible and compelling vision for NEAR at the forefront of tomorrow’s user and creator centric AI economy. While this was just a brief glimpse of the emerging AI+Web3 ecosystem on NEAR, it was met with a wave of excitement from the NEAR community and served as a reminder for the whole Web3 space about Illia’s and NEAR’s early roots in the world of AI.
|
---
title: 2.8 Legal Pathways and Project Design
description: Pragmatic expectations on the implications of different legal pathways
---
# 2.8 Legal Pathways and Project Design
This final lecture is a practical lecture at root, that seeks to ground expectations on the implications of different legal pathways taken by projects building in an L1 ecosystem. It is an understatement to say that crypto is a gray zone area. The focus however is not legal council nor legal advice: It is practical insights that must be considered based upon the type of project in question, and the different legal jurisdictions that a project might choose. In this sense, the goal is to be able to understand the _implications_ of the different legal decisions a project might take - from a crypto perspective.
## Initial Considerations: Location and Fundraise Structure
While many entrepreneurs are quick to understand traditional equity raise strategies, crypto challenges cross-over entrepreneurs (from Web2 or whatever other industry into Web3) with its complex legal framework. If a company is intending to launch a token as a part of their project, they must either clarify the status of their token with the SEC _or_ file for an exemption (under a Reg. D filing) - this is if the project is launching from the United States or if it intends to raise in relation to USA investors. The problem from a glance is actually twofold:
1. What happens if a project is not sure if they would like to launch a token or not?
2. Does the type of vehicle impact a project’s ability to get investors to be able to participate in their project?
Both of these questions must be carefully considered _before a project moves forward with a specific approach_. To date there are three primary legal raise strategies that most projects fall into: (1) SAFT - or simple agreement for future tokens, (2) Token SAFE and Warrant → Simple Agreement for Future Equity (capable of being converted into tokens), and (3) Equity.
## SAFT
A Simple Agreement for Future Tokens (SAFT) is a investment contract that was originally popular from 2017 to 2021, used to sell tokens to investors in the pre-sale of a project, prior to its public launch (ICO).
A SAFT is a type of agreement between an investor and a project or company that is issuing a cryptocurrency or token. The SAFT is designed to provide investors with the rights to receive tokens at a future date, once the token is fully developed and released on the market. The terms of the SAFT typically outline the rights and obligations of both the investor and the issuing company, as well as the conditions under which the tokens will be delivered to the investor. The SAFT is intended to provide a simple and straightforward way for investors to participate in a pre-sale or ICO, while also ensuring that the issuing company is able to develop and release its tokens in a responsible and compliant manner.
In practice, a SAFT is a guarantee for tokens, and only tokens. There is no control an investor may possess over the behavior of the company, the management of funds, and so forth unless it is specified in a side letter or in the SAFT itself. This type of vehicle is ideal for protocols, or projects whereby the team intends to cede ultimate control over to the community later in time, and whereby they have a clear crypto-economics already developed.
When compared with a token SAFE and warrant, a SAFT is less constraining for a project, but requires a clearer and more sophisticated crypto-economic design.
The danger of a SAFT is that if the company structures offshore or through a Swiss Foundation (with a relevant token categorization from its regulatory body FINMA), then the project could in principle launch a token with limited responsibility in the long term, and then proceed to refuse to cede ownership of the private keys controlling the core facets of the protocol.
## Token SAFE and Warrant
A SAFE (simple agreement for future equity) is a type of investment contract that is often used in crowdfunding campaigns, particularly in the tech industry. A SAFE is similar to a convertible note in that it provides investors with the right to receive equity in a company at a later date, typically when the company raises a certain amount of funding or reaches a specific valuation. However, unlike a convertible note, a SAFE does not accrue interest or have a maturity date.
A warrant is a financial instrument that gives the holder the right, but not the obligation, to purchase a specified number of shares of stock at a specified price within a specified time period. In the context of a crypto fundraising, a token warrant would be issued to an investor along with a SAFE for the right to tokens at a future date - if such a token would be launched. Technically, the warrant would give the investor the right to purchase additional tokens of the company's stock at a future date, typically at a discounted or fixed price. In practice, the company transfers the money ahead of time, and owns the right to a certain amount of tokens, whenever they are to be created.
The combination of a token SAFE and a warrant can provide investors with an attractive investment opportunity from a tax and legal perspective, as the investing entity does not actually control or own the tokens themselves - but rather they ability to redeem their investment for tokens at a later date (should a token be launched).
A token SAFE and Warrant structure can, however, be a danger for investors, despite its tax and legal benefits: Because crypto is centered upon the fundamental design of monetary systems built into smart contracts, the nature of the token is extremely important from an investment perspective. With a token SAFE and Warrant however, teams have the ability to sell investors on a vision or product _without specifying how that product or vision will be connected to a clear token-economic design_. As such, investors often create massive blunders insofar as they invest in a promising concept or prototype, and then come to find the token design is not able to accrue any of its value!
For projects, a token SAFE and Warrant is sometimes (sadly) used to kick the can down the road for the design of their crypto-economic system: A project can quickly and easily raise funds without needing to get into the nitty-gritty of how their open, permissionless system is leveraged to accrue value.
## Traditional Equity Vehicles Holding Tokens Offshore
Last but not least, there is the option of creating a traditional equity investment vehicle. This is characteristically used for infrastructure, security, custody, and on-ramp projects that may or may not intend to launch a token. This is similar to traditional tech investing, and largely depends on the jurisdiction in which the entity intends to operate. Popular destinations include the Cayman Islands, Switzerland, Hong Kong, Singapore, as well as Antigua and Barbuda. If there is a potential for the nature of the project to intersect with the regulation of the United States as it pertains to token design and functionality, it is best for the company to be structured offshore.
From an investment perspective, traditional equity vehicles are often-times used to allow more legacy investors or corporations to invest or participate in a token sale, by holding the tokens inside of an offshore company, and selling equity of that company to the corporation in question.
**Hypothetical Example:** KDDI is a Japanese corporation that has set up an offshore entity. A protocol then would sign a SAFT or SAFE with that offshore entity, from which it could deploy tokens. These tokens would then be owned (once-removed) by KDDI, such that they would be able to control them through the Cayman Entity. However on KDDI’s balance sheet it simply shows an equity investment in a Cayman entity.
## Token Considerations and Jurisdictions
Without touching too much upon the field of crypto-economics, projects and investors must also always consider the legal implications and designation of a token that a project launches. According to Swiss regulation there are three types of tokens:
1. Utility Tokens.
2. Payment Tokens.
3. Security Tokens.
To receive this designation, a project would need to structure an LLC or Foundation inside of Switzerland and register their supposed token design for approval from FINMA.
Any entity launching a token from offshore, would not need to worry about their token designation, unless they intended to sell or launch to the United States market of investors and retail users (discussed below). Offshore entities would only be limited by the jurisdiction they launch within - which to date has zero regulations on token designations. It would then be a question for exchanges or custodians wishing to list that token if it is acceptable within specific jurisdictions.
From an investor’s point of view, the investor must understand the roadmap and development timeline of the project, as well as the utility of the token they may be investing in. This is surprisingly not done frequently or well.
## Governance Tokens and their Critics
One strategy that has been leveraged by founders revolves around ‘governance tokens’. The strategy is quite straightforward: If a token is going to be receiving value from an external source, it is most likely to be considered a security token. This would apply to most fee-sharing protocols relevant to Decentralized Finance and NFT marketplaces. Teams then do the following:
* Launch Governance Token Offshore (or as Anonymous Team).
* ‘Decentralize’ the protocol after the token has been launched (and even listed on an exchange).
* Add fee accrual to the governance token, as a protocol wide decision or vote, such that it functions as a security token, even though it is considered as being created for governance.
Often times, however, this strategy is not developed fully or to its completion, resulting in the launch of a token that merely has rights to vote on mechanical changes to the protocol over time. Vitalik as been outspoken on the silly nature of value capture in these token designs:
![](@site/static/img/bootcamp/mod-em-2.8.1.png)
## Regulation D filing and sales in the United States
Regulation D is a rule under the Securities Act of 1933 that provides an exemption from the registration requirements of the Act. This allows a company to raise capital from investors without having to register their securities with the Securities and Exchange Commission (SEC). In the context of token offerings, a company would use a Regulation D to offer and sell tokens without having to register the offering with the SEC. This can be a useful way for companies to raise capital while still complying with the law.
However, it's important to note that there are limitations and requirements that must be met in order to qualify for the exemption under Regulation D. For example, the tokens being offered must be offered only to accredited investors, and there are limits on the amount of money that can be raised through a Regulation D offering.
Details aside, a Regulation D filing is necessary for most projects intending to offer their token to accredited investors inside of the United States. If a project is selling to USA investors, they have a choice to comply with the Reg D filing requirements, or to simply launch as an anonymous team. In the former case, the project is responsible (despite most likely being structured offshore), in the latter case the investors are taking on additional risk, investing in a protocol or project that is not legally structured or compliant in the USA.
## Takeaways
Amidst all of the legal mumbo-jumbo there are some very practical takeaways from investors and projects to understand:
1. If your project has a token, you must think carefully about (1) If you are launching it offshore or through some regulated jurisdiction (like Switzerland), (2) If you will raise as SAFT, Token SAFE and Warrant, or Equity - and the implications of that for your crypto-economics. (3) If you are selling to USA investors, and you intend to comply with the minimum registration requirements from the SEC.
2. Investors need to look carefully at the crypto-economic design, rights to the company, and designation of the token. Otherwise they may be investing in vaporware!
3. Projects must understand the timeframes and implications of (1). Certain types of tokens cannot be listed on certain exchanges, while selling to USA investors under a Reg. D filing may have a limitation on where and when the token can be offered to retail at a later point.
4. At the end of the day, there is no ‘global jurisdiction’. The FTX fallout, 3AC going to Dubai, and limited reach from governments, shows that in the crypto space, a lack of global regulation and coordination leaves the door open to maneuverability on behalf of projects and founders, that has been hitherto unprecedented.
|
---
title: Developer Enablement
description: Overview of the Development Platform on NEAR BOS
sidebar_position: 4
---
# Developer Enablement: The Developer Platform
## Highlights:
* The BOS development platform removes complexity enabling any developer interested in open-source and decentralization, to build, deploy, and host serverless backend services for web apps.
* The BOS development platform creates an accessible entry point for BOS with a comprehensive set of tools and capabilities to get developers started quickly agnostic of underlying smart contract blockchain
### What it is:
Developer enablement is responsible for the developer platform; A set of tools and capabilities that help remove the barriers around Web3 and make it possible for developers of all backgrounds to start building on the BOS. Created for every developer who values open-source and decentralization, the BOS offers developers a way to quickly build composable apps, build complete projects using current workflows, seamlessly onboard users, get feedback from real users, and increase discoverability. The development platform allows anyone with coding experience to start building on the BOS from day one, providing a more accessible space for Web3 development.
### Why it matters:
The current Web3 space can feel like a walled garden, with access being limited to those already in the know. Getting up to speed on blockchain development can feel intimidating, complex, and time-consuming, particularly for people who are new to the field, but also for those trying to move between projects or chains. This complexity keeps many developers from working in the space, limiting the development of new apps and experiences and the overall adoption of Web3.
By providing a full suite of easy-to-use development tools and capabilities, including the ability to build full projects in Javascript, the developer platform solution helps overcome these challenges. Developers can compose applications with confidence using community-generated and validated components, as well as build their own reputations by publishing their own components and applications. They can also build complete projects locally using their current workflows with the VS Code extension, and seamlessly deliver projects using decentralized front-ends with low fees and transparent policies. Both NEAR and Ethereum blockchains are supported.
### Who it’s for:
* Component developers - Anyone interested in building reusable components that can be shared with other developers and facilitate the growth of an open web can get started creating from day one.
* Application developers - Developers, and anyone curious about Web3 who has some coding experience, can quickly build applications by remixing components for specific use cases and unique audiences.
### How it works:
* Developer Workflow
* Discover a component via search, understand the component from the component details, fork the component, remix and modify the component in the sandbox, and save and publish the component on-chain to the community.
* Components
* Built by developers for other developers or end users, components can range in size from a tiny button all the way to large applications composed of many other components that solve a detailed end-user use case. Components are stored on the NEAR blockchain and written using JSX (JavaScript with ReactJS).
* Viewer
* Responsible for the UI (the gateway) which exposes the ability to log in, build, and interact with components. Including injecting into components the needed RPC libraries (e.g Pagoda or ETH RPCs).
* VM
* This enables developers with modules, functions, pure javascript, and select javascript APIs.
* Gateways
* A specific implementation of the virtual machine for building an application that requires functionality not currently supported by the near.org VM & viewer. In order to deliver their specific use case, they can fork or reference the VM/Viewer, make changes, and serve their own gateway at their own URL. Current Gateways include bos.gg, near.org, near.social, and cantopia.pages.dev
* Sandbox
* The in-browser IDE where a developer builds, modifies, saves, and publishes their components, allowing for a quick time to delight for new developers looking to decentralize front ends and remix components.
* Cross-Chain Ethereum Support
* Read and write to Ethereum smart contracts from a decentralized front-end running on the BOS using ethers.js. Using remote NEAR accounts, developers can use their existing funded Ethereum accounts to deploy components.
### What’s coming next
* Design system (component library, frontend development stack, documentation, and pattern library)
* Reputation, badges, and rewards |
---
NEP: 0418
Title: Remove attached_deposit view panic
Author: Austin Abell <[email protected]>
DiscussionsTo: https://github.com/nearprotocol/neps/pull/418
Status: Approved
Type: Standards Track
Category: Tools
Version: 1.0.0
Created: 18-Oct-2022
Updated: 27-Jan-2023
---
## Summary
This proposal is to switch the behavior of the `attached_deposit` host function on the runtime from panicking in view contexts to returning 0. This results in a better devX because instead of having to configure an assertion that there was no attached deposit to a function call only for transactions and not view calls, which is impossible because you can send a transaction to any method, you could just apply this assertion without the runtime aborting in view contexts.
## Motivation
This will allow contract SDK frameworks to add the `attached_deposit == 0` assertion for every function on a contract by default. This behavior matches the Solidity/Eth payable modifier and will ensure that funds aren't sent accidentally to a contract in more cases than currently possible.
This can't be done at a contract level because there is no way of checking if a function call is within view context to call `attached_deposit` conditionally. This means that there is no way of restricting the sending of funds to functions intended to be view only because the abort from within `attached_deposit` can't be caught and ignored from inside the contract.
Initial discussion: https://near.zulipchat.com/#narrow/stream/295306-pagoda.2Fcontract-runtime/topic/attached_deposit.20view.20error
## Rationale and alternatives
The rationale for assigning `0u128` to the pointer (`u64`) passed into `attached_deposit` is that it's the least breaking change.
The alternative of returning some special value, say `u128::MAX`, is that it would cause some unintended side effects for view calls using the `attached_deposit`. For example, if `attached_deposit` is called within a function, older versions of a contract that do not check the special value will return a result assuming that the attached deposit is `u128::MAX`. This is not a large concern since it would just be a view call, but it might be a bad UX in some edge cases, where returning 0 wouldn't be an issue.
## Specification
The error inside `attached_deposit` for view calls will be removed, and for all view calls, `0u128` will be set at the pointer passed in.
## Reference Implementation
Currently, the implementation for `attached_deposit` is as follows:
```rust
pub fn attached_deposit(&mut self, balance_ptr: u64) -> Result<()> {
self.gas_counter.pay_base(base)?;
if self.context.is_view() {
return Err(HostError::ProhibitedInView {
method_name: "attached_deposit".to_string(),
}
.into());
}
self.memory_set_u128(balance_ptr, self.context.attached_deposit)
}
```
Which would just remove the check for `is_view` to no longer throw an error:
```rust
pub fn attached_deposit(&mut self, balance_ptr: u64) -> Result<()> {
self.gas_counter.pay_base(base)?;
self.memory_set_u128(balance_ptr, self.context.attached_deposit)
}
```
This assumes that in all cases, `self.context.attached_deposit` is set to 0 in all cases. This can be asserted, or just to be safe, can check if `self.context.is_view()` and set `0u128` explicitly.
## Security Implications
This won't have any implications outside of view calls, so this will not affect anything that is persisted on-chain. This only affects view calls. This can only have a negative side effect if a contract is under the assumption that `attached_deposit` will panic in view contexts. The possibility that this is done _and_ has some value connected with a view call result off-chain seems extremely unlikely.
## Drawbacks
This has a breaking change of the functionality of `attached_deposit` and affects the behavior of some function calls in view contexts if they use `attached_deposit` and no other prohibited host functions.
## Future possibilities
- The Rust SDK, as well as other SDKs, can add the `attached_deposit() == 0` check by default to all methods for safety of use.
- Potentially, other host functions can be allowed where reasonable values can be inferred. For example, `prepaid_gas`, `used_gas` could return 0.
## Decision Context
### 1.0.0 - Initial Version
The initial version of NEP-418 was approved by Tools Working Group members on January 19, 2023 ([meeting recording](https://youtu.be/poVmblmc3L4)).
#### Benefits
- This will allow contract SDK frameworks to add the `attached_deposit == 0` assertion for every function on a contract by default.
- This behavior matches the Solidity/Eth payable modifier and will ensure that funds aren't sent accidentally to a contract in more cases than currently possible.
- Given that there is no way of checking if a function call is within view context to call `attached_deposit` conditionally, this NEP only changes a small surface of the API instead of introducing a new host function.
#### Concerns
| # | Concern | Resolution | Status |
| - | - | - | - |
| 1 | Proposal potentially triggers the protocol version change | It does not trigger the protocol version change. Current update could be considered a client-breaking change update. | Resolved |
| 2 | The contract can assume that `attached_deposit` will panic in view contexts. | The possibility that this is done _and_ has some value connected with a view call result off-chain seems extremely unlikely. | Won't Fix |
| 3 | Can we assume that in all view calls, the `attached_deposit` in the VMContext always zero? | Yes, there is no way to set `attached_deposit` in view calls context | Resolved |
## Copyright
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
|
NEAR Tasks Launches AI Marketplace on NEAR to Revolutionize the Future of Work
NEAR FOUNDATION
November 16, 2023
The convergence of AI and Web3 captured the tech industry’s imagination in 2023 — but few ideas have actually become a working reality. An exciting exception is NEAR Tasks, a global gigs marketplace poised to reshape AI training while leveraging the power of NEAR blockchain. Officially launched at NEARCON 2023 with its first product beta launching this week, NEAR Tasks is a self-service platform where anyone can easily list and complete AI requests, setting a new standard for quality data labeling.
Unlocking the Power of AI and Web3
NEAR Tasks envisions a future where AI and Web3 technologies complement each other, fostering an ecosystem driven by transparency and efficiency. This symbiotic relationship aims to streamline task matching, review processes, and manage data quality more effectively at scale.
Implemented on the NEAR Protocol, NEAR Tasks utilizes on-chain tasker IDs, smart contracts for automated payments, and $NEAR transactions for global payments with minimal fees. This ensures accountability, motivates high-quality outcomes, and addresses the challenge of underpaid workers in the AI sector.
NEAR Tasks in a Nutshell
In the age of AI, despite popular narratives about LLMs replacing a range of human jobs, human intelligence actually becomes even more important: as models get more complex, they need human expertise for fine-tuning models and increasing subject matter specialization. This user-friendly platform seamlessly connects task listing, work review, and crypto rewards, propelling AI model training into a new era through direct human feedback loops and a flexible self-service marketplace.
For business clients and AI builders, NEAR Tasks provides a self-service, plug-and-play solution, liberating users from the constraints of costly managed service options. Blockchain integration on NEAR facilitates efficient data labeling by verified human experts, who can build reputation and get paid in real time for contributing quality work to the platform.
For taskers, the NEAR Tasks marketplace offers a transparent path to monetizing their skills and knowledge, unlocking new revenue streams in the ever-evolving AI labor frontier, and changing the future of digital work. There are more than a billion participants in the global on-demand gig economy today, showing the need for more opportunities as well as greater specialization for those with particular training or expertise. With more reliable identity verification for accounts, faster work review, and the ability to pay taskers with crypto, taskers can get paid more reliably and work at the pace they wish — making the gig economy more supportive to specialized workers.
In his introduction to NEAR Tasks at NEARCON in Lisbon, Senior Engineer Momo Araki pointed out: “There’s an interdependence for the system to work properly. You have to reform the central inspection principle wielded by task providers, and maintain sybil-resistance so workers can’t spoof the platform. It’s loosely analogous to a ‘proof-of-work’ model, where work performed well also translates to earning reputation, which leads to accessing further opportunities.” Incorporating more trust into a tasks marketplace in this way also produces better results for the AI builders and businesses trying to refine their models.
A Fair and Transparent Platform for AI Training
In an AI landscape where autonomy often overshadows human involvement, NEAR Tasks recognizes the vital role of a global workforce responsible for data labeling and validation. The platform introduces on-chain digital IDs for taskers, ensuring transparency and accountability.
Transactions exclusively conducted in $NEAR guarantee rapid global payments with minimal fees, directly confronting the issue of underpaid AI workers in what is known in the industry as “AI sweatshops.”
“Human intelligence forms the base of artificial intelligence, and it’s time we give AI tasks the recognition they deserve as legitimate jobs in the AI economy,” says Catherine Yushina, Head of Operations at NEAR Tasks.
AI Is NEAR
At NEARCON 2023, NEAR Co-Founder Illia Polosukhin — an AI researcher himself and co-creator of transformers, the architecture powering today’s major LLMs like ChatGPT — named AI as one of the core verticals for the NEAR ecosystem heading into 2024. From transforming governance and business operations with AI agents to provable provenance for data and content, as well as novel marketplaces like NEAR Tasks and hybrid human-AI working environments, we’re at the very beginning of an exciting revolution that will change the ways we work, collaborate, transact, research, and govern ourselves. More news is coming before the end of 2023 to position NEAR as the leader at the intersection of AI and Web3.
Join the AI + Blockchain Movement
If you want to be part of this transformative AI and blockchain convergence shaping the human intelligence market, sign up for the NEAR Tasks waitlist — currently at more than 48,000 applicants. The marketplace opens for public access in Q1 of 2024. You can also reach out to the team directly to request entry into the current Beta. Drop them an email at [email protected] to express your interest by Monday, November 20.
For more information about NEAR Tasks, please visit https://neartasks.ai/.
Follow along on social media:
Twitter: https://twitter.com/near_tasks
LinkedIn: https://www.linkedin.com/company/98907399
|
The NEAR Foundation’s Vision for the Future
NEAR FOUNDATION
June 24, 2022
The past several weeks have been challenging for many within crypto. This downturn is also very different from the previous 2018/2019 crypto winter as it is occurring against the backdrop of surging inflation, rising interest rates and global instability.
Crypto isn’t immune to these shocks, but the crypto ecosystem is more robust than it was three years ago. There is more capital than ever flowing into projects, an increasing amount of top talent, and a maturing of the infrastructure that provides a better foundation for more projects to flourish.
The NEAR Foundation has always focused on diligent and conservative treasury management, and as an ecosystem, we are therefore well-positioned to weather this storm. There has never been a better time to build on NEAR. A bear market is not a time to pause, it is a time to build, invest and organize to succeed – it is a time to put our best foot forward and execute at pace.
To better serve and address the needs of the growing NEAR ecosystem we have made a couple of structural changes to the NEAR Foundation organization, which are described below.
NEAR Foundation Mission
The mission of the Foundation is to foster the conditions by which an ecosystem can flourish, assisting and aiding others to reimagine business, creativity, and community in their own ways. The Foundation exists to help inspire and empower people to join the ecosystem, by acting as a trusted party and gateway into this new world. It is one part of a larger puzzle.
To help visualize how the Foundation interacts with the NEAR ecosystem we have developed a new mental model which is the basis for our internal OKRs, priority settings, and team priorities.
NEAR Foundation is a centralized organization championing decentralization as part of a decentralized ecosystem. Over time, NEAR Foundation’s role will continue to evolve as new funds emerge via ecosystem and regional funds, and as the community takes on more and more.
NEAR Foundation Changes
To best foster the conditions needed for the NEAR Ecosystem to continue its tremendous growth, we are reorganizing our teams alongside our key principles:
Adopting a functionally aligned organizational structure across the Foundation, operating in a more streamlined way.
Combining all our efforts on growing and supporting our community under one “Community Team”, to continuously focus and help address the needs of our growing ecosystem.
Creating a product/engineering organization under new Product and Engineering leadership, which will enable us not only to re-purpose our website (the key entry point to the NEAR ecosystem) but also to have more perspective on products built in the ecosystem and be able to address technical queries for our partners more effectively.
To achieve this, we have created 16 new open positions for roles that help the Foundation achieve its mission. If you want to join us, or our ecosystem please check out – https://careers.near.org/jobs
As part of this reorganization, 17 team members will be leaving the NEAR Foundation. Most of these will move their skills into the NEAR ecosystem, joining one of the 600+ projects building the future of the web. Others will join NEAR hub and other community-led projects. Seeing friends and colleagues leave an organization is never easy. We are extremely grateful for their immense contribution, continued support, and participation in the NEAR ecosystem.
This is not a downsize, but a reorganization to better serve the needs of the ecosystem. We are very well positioned to succeed in the bear market. NEAR Foundation has always focused on diligent and conservative treasury management, and as an ecosystem we are therefore well-positioned to weather the storm. No better time to build on NEAR!
We are confident that being well organized is the first step in that direction and we are confident that our new structure is setting us up for success.
|
---
sidebar_label: "Python tutorial"
---
# NEAR Lake indexer basic tutorial
:::info Source code for the tutorial
[`frolvanya/near-lake-raw-printer`](https://github.com/frolvanya/near-lake-raw-printer): source code for the tutorial on how to create an indexer that prints block height and number of shards
:::
Recently we have [published a Python version of the NEAR Lake Framework](https://pypi.org/project/near-lake-framework/) on pypi.org
We want to empower you with a basic tutorial on how to use the Python Package. Let's get started!
## Create a project
Create an indexer project:
```bash
mkdir near-lake-raw-printer && cd near-lake-raw-printer
touch main.py
```
## Install dependencies
Install `near-lake-framework`
```bash
pip3 install near-lake-framework
```
## Import `near-lake-framework`
In the `main.py` file let's import the necessary dependencies:
```python title=main.py
from near_lake_framework import near_primitives, LakeConfig, streamer
```
We've imported the main function `streamer` which will be called to actually run the indexer, `near_primitives` and `LakeConfig` type we need to contruct.
## Create a config
Add the instantiation of `LakeConfig` below:
```python title=main.py
config = LakeConfig.mainnet()
config.start_block_height = 69030747
config.aws_access_key_id = os.getenv("AWS_ACCESS_KEY_ID")
config.aws_secret_key = os.getenv("AWS_SECRET_ACCESS_KEY")
```
Just a few words on the config, function `mainnet()` has set `s3_bucket_name`, `s3_region_name` for mainnet.
You can go to [NEAR Explorer](https://nearblocks.io) and get **the most recent** block height to set `config.start_block_height`.
## Starting the stream
Let's call `streamer` function with the `config`:
```python title=main.py
stream_handle, streamer_messages_queue = streamer(config)
while True:
streamer_message = await streamer_messages_queue.get()
print(f"Block #{streamer_message.block.header.height} Shards: {len(streamer_message.shards)}")
```
And an actual start of our indexer in the end of the `main.py`
```python title=main.py
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
```
## All together
```python title=main.py
import asyncio
import os
from near_lake_framework import LakeConfig, streamer, near_primitives
async def main():
config = LakeConfig.mainnet()
config.start_block_height = 69030747
config.aws_access_key_id = os.getenv("AWS_ACCESS_KEY_ID")
config.aws_secret_key = os.getenv("AWS_SECRET_ACCESS_KEY")
stream_handle, streamer_messages_queue = streamer(config)
while True:
streamer_message = await streamer_messages_queue.get()
print(f"Block #{streamer_message.block.header.height} Shards: {len(streamer_message.shards)}")
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
```
That's it. Now we run `main.py`
```bash
python3 main.py
```
You should see something like the following:
```bash
Received 400 blocks from S3
Block #69030747 Shards: 4
Block #69030748 Shards: 4
Block #69030749 Shards: 4
Block #69030750 Shards: 4
Block #69030751 Shards: 4
Block #69030752 Shards: 4
Block #69030753 Shards: 4
Block #69030754 Shards: 4
```
You can stop the indexer by pressing CTRL+C
:::danger Credentials
To be able to access the data from [NEAR Lake](/tools/realtime#near-lake-indexer) you need to provide credentials. Please, see the [Credentials](../../lake-framework/running-near-lake/credentials.md) article
:::
You can find the [source code for this tutorial on the GitHub](https://github.com/frolvanya/near-lake-raw-printer).
|
NEAR Foundation Launches NEAR DA to Offer Secure, Cost-Effective Data Availability for ETH Rollups and Ethereum Developers
NEAR FOUNDATION
November 8, 2023
NEAR Foundation just announced the rollout of the NEAR Data Availability (NEAR DA) layer. Part of the NEAR Open Web Stack, NEAR DA is a groundbreaking innovation that offers robust, cost-efficient data availability for ETH rollups and Ethereum developers.
NEAR DA is set to launch with a number of first users, including Madara by StarkNet, Caldera, Fluent, Vistara, Dymension RollApps, and Movement Labs.
Let’s take a brief look at NEAR DA to explore why it’s such an exciting and significant development for NEAR, Ethereum, and the larger effort to build a truly open web.
NEAR DA — paving the way for modular blockchain development
With NEAR DA, ETH rollups and Ethereum developers get cost-effective, reliable data availability. 100kB of calldata on NEAR will cost $0.0033 as of September 2023, while the same calldata on Ethereum L1 will run users $26.22. That’s 8,000 times cheaper!
NEAR DA will help developers reduce costs and enhance the reliability of their rollups, while keeping the security of Ethereum. High quality projects launching an app-chain or L2 will also be able to get NEAR DA support.
Illia Polosukhin, co-founder of NEAR Protocol, and newly announced CEO of NEAR Foundation said: “Offering a data availability layer to Ethereum rollups highlights the versatility of NEAR’s tech while also helping founders from across Web3 deliver great products that bring us closer to mainstream adoption of the Open Web.”
“NEAR’s L1 has been live with 100% uptime for more than three years, so it can offer true reliability to projects looking for secure DA while also being cost-effective,” Polosukhin added. “NEAR provides great solutions to developers no matter which stack they’re building on and now that includes the Ethereum modular blockchain landscape.”
Expanding NEAR’s Open Web Stack
By opening up its blockchain for data availability, NEAR Protocol is expanding its offerings to deliver a modular blockchain development framework. This will let Web3 developers and founders continue building on Ethereum while leveraging NEAR’s state-of-the-art tech for one part of the stack, depending on their requirements.
NEAR DA expands the capabilities of NEAR’s Open Web Stack, a common entry point where developers and users alike can easily build, browse, and discover Web3 products and platforms. This includes FastAuth onboarding to an account in seconds with zero crypto or seed phrases required, as well as the ability to create decentralized frontends from a library of thousands of components.
Developers and founders building on Ethereum rollups interested in using NEAR DA can visit near.org/data-availability to get started. |
Astro Launches on NEAR To Supercharge DAO Communities
COMMUNITY
October 11, 2021
Astro, the platform for online communities to gather, vote, and govern has launched on NEAR. Astro is the next evolution of SputnikDAO, the hub for decentralized autonomous organizations (DAOs) operating on NEAR with a host of new features, more flexibility, and a friendly UI.
If you’re a community looking to create, collaborate, and govern, Astro is the tool for you.
What is Astro?
Astro is a platform for On Chain Communities (OCC). OCC are groups of people that prove their membership and coordinate decisions through a series of smart contracts. Each vote is verified by the blockchain, and funds are distributed based on voting decisions.
With Astro, DAOs will be able to retain more autonomy and, importantly, cast the net further in regards to governance through increased flexibility and the introduction of governance tokens.
Curious to know more about Astro? We’re hosting an AMA on October 12, 2021 at 7 am PST / 10 am EST / 4pm CEST. Register for the AMA and submit your questions to the Astro team. Find out more about it here.
What is a DAO?
A DAO is a business structure where control is spread out, across the team members instead of being centered around one authority figure. Think of a DAO as being a machine with one purpose, to carry out a set of instructions determined by pre-written smart contracts.
A community can adapt a DAO and program it according to its own goals. So the code can be used to create a set of rules, or a governance structure by which the community agrees to abide by. Tokens are used to help people vote on topics such as fund allocation.
The more a member contributes to a community, the more his/her/their vote can be increased.
Why start a DAO?
Think of DAOs as a toolbox that allows anyone to create a business structure that is designed to be simple and flexible. As a result, DAOs come in all shapes and sizes. From flat to hierarchical, from open to anyone to members-only; you get to decide how you want to govern your community.
For example:
Grants Giving – Vote and collectively decide what people and projects to fund.
For businesses – Keep track of owners’ equity and elect managers to make day-to-day decisions.
For investors – Pool funds and vote on strategy and transactions.
For clubs of any kind – Elect leaders and decide where to spend group funds.
Astro makes DAOs simple.
DAOs are quick to set up, global, customisable and transparent. Astro can help you create your own DAO in minutes. |
---
id: contribute-faq
title: Contributor FAQ
sidebar_label: Contributor FAQ
sidebar_position: 6
---
### How can I get involved? {#how-can-i-get-involved}
It depends what you are excited about doing! Do you want to develop on NEAR? Build tutorials? Answer questions? Expand our documentation?
We recommend you to have a look at our [NEAR Community Page](https://near.org/ecosystem/community). If you are looking for something a little different, or you have questions, please reach out to the team on [Discord](http://near.chat/).
### How do I report a security vulnerability? {#how-do-i-report-a-security-vulnerability}
The most up-to-date information about security vulnerability reporting is provided [in the core repo](https://github.com/near/nearcore/blob/master/SECURITY.md).
### Does NEAR have a bug bounty program available? {#does-near-have-a-bug-bounty-program-available}
While we currently do not have a bug bounty program, you can contribute to our development of resources through the [NEAR Community](https://near.org/ecosystem/community). Additionally, we have hosted several hackathons; for future events sign-up to our newsletter and follow us on Discord.
### Are articles (not NEAR specific) allowed to be shared on Discord or Telegram? {#are-articles-not-near-specific-allowed-to-be-shared-on-discord-or-telegram}
Links to educational content are allowed to be shared in the channels. If you are uncertain, please message an admin or somebody from the Team first; either on Telegram or [Discord](http://near.chat/).
### How are you building your community? {#how-are-you-building-your-community}
We are actively working on expanding our community. If you have any suggestions, or you want to help out, please get in touch on [Discord](http://near.chat/). For long-term engagement, please have a look at our Contributor Program. If you want to build on NEAR, please check out our [contribution guidelines](https://github.com/near/nearcore/blob/master/CONTRIBUTING.md).
:::note Got a question?
**[Ask it on StackOverflow!](https://stackoverflow.com/questions/tagged/nearprotocol)**
::: |
---
sidebar_position: 2
---
# Styling (CSS)
## CSS Modules
You can currently style BWE components with CSS modules. Each component has an associated CSS file which is saved on-chain alongside component source code.
In the sandbox, a CSS module is created automatically for every component.
Two syntaxes are supported for CSS modules imports. In the component `Foo.tsx`, you can use either of the following:
```tsx
import s from './Foo.module.css';
```
```tsx
import s from './styles.module.css';
```
:::warning
Although the second example above is what you will find in our starter code, we recommend using the pattern from the first example since it may be the only version that is allowed once local code editor support is implemented.
:::
### Features
#### CSS Nesting
CSS Nesting is supported. Here is an example of using it to style child elements and pseudo-classes:
```css
.entry {
padding: 1rem;
> input {
width: 20rem;
}
> button {
background-color: #33b074;
&:hover {
background-color: #2f7c57;
}
&:active {
background-color: #174933;
}
}
}
```
### Learn from Our Examples
From the sandbox, use the search icon in left sidebar to pull up `webengine.near` components like `webengine.near/SocialFeedPage`
## CSS-in-JS
We have CSS-in-JS support [on our roadmap](https://github.com/near/bos-web-engine/issues/7), but it is not yet available. |
Music and Blockchain: The Future of Decentralized Streaming Music
COMMUNITY
April 22, 2022
As the decentralized economy expands, it’s no surprise that musicians are turning to the blockchain. NFTs, digital autonomous organizations (DAOs), Metaverse events, and more are transforming artistic visions into new and immersive experiences. On NEAR, decentralized streaming music platforms will be one part of the future music industry landscape.
Community-driven instead of centralized like Spotify and YouTube, these platforms give artists more freedom to express themselves with built-in legal infrastructure support. But what does this decentralized streaming future look like for musicians?
Establishing better streaming rights for musicians
In a Web3 world, artists have more control over what they create. With decentralized streaming music, that will mean fewer intermediaries taking a cut of a musician’s revenue.
“Artists who release through DAOrecords hold 100% of their IP—meaning that they can do anything they want with it,” says Jason “Vandal” Schadt, CEO at DAOrecords.
“We have acted primarily as a distributor, helping to facilitate the release of Audio NFTs through our storefronts across a variety of chains,” he adds. “What I find very exciting is that we’re able to minimize the friction and need for legal contracts through the use of automated royalty splits built into the smart contracts we deploy.”
DAOrecords has begun designing smart contracts with an approach similar to artists registering their songs officially, then sharing the revenue like they would with the performing rights societies that distribute royalties.
“As we do this, it’s important that we only work with the rights holders directly in order to ensure that there is no infringement happening,” says Vandal.
And if artists are part of DAO-based labels, like DAORecords, other interesting possibilities emerge with decentralized streaming.
“The artists under the DAO label would actually own a slice of the label and have voting rights in where the [streaming] money goes,” says Amber Stoneman, CEO of Minting Music. “The label hasn’t ever been transparent, so blockchain is a way for that to happen on the ground level with producers and label owners.”
At its core, decentralization is about using smart contracts to create the platforms, tools, resources, and legal structures for art to flourish on its own terms. This vision inspired Stoneman to create Minting Music, which brings blockchain to the music industry in a practical way.
“I saw a lot of flaws in the platform transparency and gatekeeping that connects fans and artists,” says Stoneman. “After diving into NFTs, Web3 and crypto, I started to see how blockchain could solve a lot of music industry problems.”
One of Stoneman’s goals is to enable a world where fans can buy and trade music via NFTs to create long-term revenue for the artists.
“I see streaming being on-chain, payments being made to artists based on actual listeners and streams instead of the current Spotify model,” she says. “We see real royalty payments happening in real time.”
Bringing transparency to royalty splits
Clarian North, Founder of Tamago, a decentralized streaming music platform building on NEAR, also sees blockchain tackling royalty transparency.
“Transparency is a big problem musicians and content creators are faced with when it comes to royalty payouts,” says North. “The digital age has made it exponentially harder for artists, managers, and labels to track every play and purchase.”
For North, it’s clear how smart contracts can play a pivotal role in the streaming music future. Musicians will be able to track all transactions related to material in a transparent and immutable format. This will help to fairly balance and unblock the monetization flow back to content creators.
Remix royalties will be no different. When a producer takes on a remix, North says, it creates a different perspective, audience, and sound than the original recording. Remixers generally earn a flat fee and occasionally get a royalty, although this is rare. The more hands original material goes through, the better chance it has to be consumed by larger audiences. But then tracking the royalties becomes more complex. Smart contracts could change this by simplifying royalty payments.
“Having a network of data which is universally accessible and cannot be manipulated is therefore extremely beneficial for keeping exponential and viral pathways clean and unblocked in terms of making sure the content creators of the original material get their fair and transparent share,” he adds.
Strangeloop Studios, which just launched Spirit Bomb, a label for decentralized virtual artists, is also hopeful about royalty transparency. Ian Simon, Co-founder of Strangeloop Studios, believes that NFTs will be a key ingredient in decentralized streaming music.
“I think we’re still in the early stages of seeing all the ways that Web3 could disrupt some of the anachronistic practices of the music industry,” says Simon. “A lot of very smart people are focusing on royalty structures and overall transparency, and forcing a lot of obfuscated backroom deals out into the open. The NFT space assumes co-ownership, which is a philosophical sea change in acknowledging the value of all creative contributors, and one I’m very excited about.”
Dismantling the artist-fan divide
When music isn’t completely dictated by centralized forces, like major labels, mainstream media, and Web2 streaming platforms, artists are free to pursue the aesthetics that matter to them. This gives birth to genres and cultures like Hip Hop, Techno, Indie Rock, and more. As such, it forms the basis for collaborations, remix culture, and continued creativity into new media and forms.
This thinking led to the inception of Endlesss.fm, a music software platform with NEAR integration. Endless enables artists and audiences to connect in a more spontaneous and visceral way.
“Endlesss transforms media from a product we consume alone into a journey we undertake together with those we resonate with,” says Tim Shaw, also known as Tim Exile, who is a passionate, lifelong musician. “Immediately this will provide a more lean-forward engaged experience for fans.”
“In the long run, this will dismantle the artist-fan divide,” he adds. “We will all become participants in communities. Some will be more involved in cultural production than others. But, we won’t think of it as a metaphorical barrier between the crowd and the artists.”
Web3 will also enable musicians (and other creatives) to own and control the way their work shows up online.
“Web3 inverts the relationship between platforms and individuals,” says Exile. “In Web2, we all rent our relationship with platforms. Platforms can throw us out at any point and we lose everything with no recourse. In Web3, platforms rent their relationship with us sovereign digital individuals. If platforms cease to add value to our digital lives, we can take our identities elsewhere.”
Ultimately, Exile envisions a future in which Web2 and Web3 co-exist.
“The streaming model works very well in a Web2 world where you pay for convenient access to media,” he says. “In Web3, the value proposition for media is about association. Which media do you choose to put your time, effort, and money into creating, collecting and trading? What does the aggregation of all the media you’ve associated with say about you? How can you experience the visceral sense of who you are by experiencing the things you’ve decided to align yourself with?”
Supporting an expansive and authentic music industry
The pandemic and other global crises have triggered a shift in the way humans engage with the physical world. This transition inspired the formation of Muti Collective, a Portugal-based community that helps artists blend the digital and physical worlds. Co-founded by Tabea and smokedfalmon, but operated collectively as a DAO, one of the group’s objectives is to incentivize a cultural movement in rural Portugal.
“Given that most venues closed during the pandemic, it was the main resource to promote arts in the digital space,” says smokedfalmon. “It brought up a lot of questions regarding streaming revenues and how little the creators are actually paid on [Web2] streaming platforms.”
By using Web3 spaces like Cryptovoxels and NEARhub, people can actually interact with the event while seeing the stream. DAOs give the group a better handle over collective finances, transparency, and democracy within the community.
“People are generally skeptical in the beginning but curious, and need 1:1 onboarding to really get into it,” says Tabea. “Once they receive support for one of their projects, they engage a lot more.”
“Also, the system of a DAO is not very common yet in the groups we are working with,” she adds. “But, once they understand how it works, they get more engaged. They discover more of the ecosystem and create their own path.”
The road ahead
Music in Web3 is all about creating, experimenting, and pushing boundaries. It’s also about pursuing long-term visions and continually manifesting the infrastructure to get there. With NEAR, musicians have a super fast, low-cost, and secure platform to get them to where they want to be.
What artists and musicians need most is the power of ownership, which creates choice and enables self expression. Beyond decentralized streaming music’s freedom, it empowers creators with the tools they need to release their works on their terms.
Blockchain, and DAOs in particular, facilitate an ecosystem experience in which parties can collaborate fairly and specify terms. Participants ranging from artists to record labels, fans, buyers, and secondary buyers are all welcome in this space.
Decentralization has the potential to bring the music industry into a more enhanced state. The future of music on the blockchain is already in motion.
Check out the complete series on Blockchain Music:
Part 1: Music and Blockchain: Introducing the Future of Sound
Part 2: Music and Blockchain: Building a Record Label on the Blockchain
Part 3: Music and Blockchain: The Rise of the New Musician
Part 4: Music and Blockchain: The Future of Decentralized Streaming Music |
---
id: serialization
title: Notes on Serialization
---
Smart contracts need to be able to **communicate complex data** in a simple way, while
also **reading and storing** such data into their states efficiently.
To achieve such simple communication and efficient storage, smart contracts morph the data
from their complex representation into simpler ones.
This process of translating **complex objects into simpler single-value** representations is called
**serialization**. NEAR uses two serialization formats: [JSON](https://www.json.org/json-en.html) and
[Borsh](https://borsh.io/).
1. [JSON](https://www.json.org/json-en.html) is used to serialize the contract's input/output during a function call
2. [Borsh](https://borsh.io/) is used to serialize the contract's state.
---
## Overview of Serialization Formats
Lets give a quick overview of both serialization formats, including their pros and cons, as well as
an example on how their serializations look like.
<hr className="subsection" />
### [JSON](https://www.json.org/json-en.html): Objects to Strings
#### Features
- Self-describing format
- Easy interoperability with JavaScript
- Multiple implementations readily available
- But... it is not efficient both in computational times and resulting size
#### Example
```js
Example{
number: i32 = 2;
arr: Vector<i32> = [0, 1];
}
// serializes to
"{\"number\": 2, \"arr\": [0, 1]}"
```
<hr className="subsection" />
### [Borsh](https://borsh.io/): Objects to Bytes
#### Features
- Compact, binary format built to be efficiently (de)serialized
- Strict and canonical binary representation
- Less overhead: it does not need to store attributes names
- But... it is necessary to know the schema to (de)serialize the data
#### Example
```js
Example{
number: i32 = 2;
arr: Vector<i32> = [0, 1];
}
// serializes into
[2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0]
```
---
## Serializing Input & Output
NEAR contracts can implement methods that both take and return complex objects.
In order to handle this data in a simple way, JSON serialization is used.
Using JSON makes it easier for everyone to talk with the contracts, since most
languages readily implement a JSON (de)serializer.
#### Example
Let's look at this example, written only for educational purposes:
```rust
#[derive(Serialize)]
#[serde(crate = "near_sdk::serde")]
pub struct A {
pub a_number: i32,
pub b_number: u128
}
#[derive(Serialize)]
#[serde(crate = "near_sdk::serde")]
pub struct B {
pub success: bool,
pub other_number: i32
}
pub fn method(&self, struct_a: A): B {
return B{true, 0}
}
```
#### Receiving Data
When a user calls the `method`, the contract receives the arguments encoded as a JSON string
(e.g. `"{\"a_number\":0, \"b_number\":\"100\"}"`), and proceed to (de)serialize them into
the correct object (`A{0, 100}`) .
#### Returning Data
When returning the result, the contract will automatically encode the object `B{true, 0}`
into its JSON serialized value: `"{\"success\":true, \"other_number\":0}"` and return this
string.
:::caution JSON Limitations
Since JSON is limited to `52 bytes` numbers, you cannot use `u64`/`u128` as input
or output. JSON simply cannot serialize them. Instead, you must use `Strings`.
The `NEAR SDK RS` currently implements the `near_sdk::json_types::{U64, I64, U128, I128}`
that you can use for input / output of data.
:::
---
## Borsh: State Serialization
Under the hood smart contracts store data using simple **key/value pairs**. This means that
the contract needs to translate complex states into simple key-value pairs.
For this, NEAR contracts use [borsh](https://borsh.io) which is optimized for (de)serializing
complex objects into smaller streams of bytes.
:::tip SDK-JS still uses json
The JavaScript SDK uses JSON to serialize objects in the state, but the borsh implementation
should arrive soon
:::
#### Example
Let's look at this example, written only for educational purposes:
```rust
#[near_bindgen]
#[derive(BorshDeserialize, BorshSerialize, PanicOnDefault)]
pub struct Contract {
string: String,
vector: Vector<u8>
}
#[near_bindgen]
impl Contract {
#[init]
pub fn init(string: String, first_u8: u8) -> Self {
let mut vector: Vector<u8> = Vector::new("prefix".as_bytes());
vector.push(&first_u8);
Self { string, vector }
}
pub fn change_state(&mut self, string: String, number: u8) {
self.string = string;
self.vector.push(&number);
}
}
```
#### Empty State On Deploy
If we deploy the contract into a new account and immediately ask for the state we will see
it is empty:
```bash
near view-state $CONTRACT --finality optimistic
# Result is: []
```
#### Initializing the State
If we initialize the state we can see how Borsh is used to serialize the state
```bash
# initialize with the string "hi" and 0
near call $CONTRACT init '{"string":"hi", "first_u8":0}' --accountId $CONTRACT
# check the state
near view-state $CONTRACT --utf8 --finality optimistic
# Result is:
# [
# {
# key: 'STATE',
# value: '\x02\x00\x00\x00hi\x01\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00prefix'
# },
# { key: 'prefix\x00\x00\x00\x00\x00\x00\x00\x00', value: '\x00' }
# ]
```
The first key-value is:
```js
key: 'STATE'
value: '\x02\x00\x00\x00hi\x01\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00prefix'
```
Since the `Contract` has a structure `string, Vector<u8>` the value is interpreted as:
```bash
[2, 0, 0, 0, "h", "i"] -> The `string` has 2 elements: "h" and "i".
[1, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, "prefix"] -> The Vector has 1 element, and to see the values search for keys that start with (the 6 bytes prefix): "prefix"
```
Then, the second key-value shows the entries of the `Vector` denoted by the `"prefix"` string:
```js
key: 'prefix\x00\x00\x00\x00\x00\x00\x00\x00'
value: '\x00'
```
#### Modifying the State
If we modify the stored string and add a new number, the state changes accordingly:
```bash
near call $CONTRACT change_state '{"string":"bye", "number":1}' --accountId $CONTRACT
# Result is
# [
# {
# key: 'STATE',
# value: '\x03\x00\x00\x00bye\x02\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00prefix'
# },
# { key: 'prefix\x00\x00\x00\x00\x00\x00\x00\x00', value: '\x00' },
# { key: 'prefix\x01\x00\x00\x00\x00\x00\x00\x00', value: '\x01' }
# ]
```
We can see that the `STATE` key changes to reflect the storage of the new string (`bye`), and that
the vector now has 2 elements.
At the same time, a new key-value was added adding the new vector entry: the `1u8` we just added.
<hr className="subsection" />
<!-- We should see where to move/replicate this -->
### Deserialization Error
When somebody invokes a smart contract method, the first step for the contract is to deserialize
its own state.
In the example used above, the contract will start by reading the `STATE` key and
try to deserialize its value into an object `Contract{string: String, vector: Vector<u8>}`.
If you deploy a contract into the account with a different Contract structure, then the
contract will fail to deserialize the `STATE` key and panic `Cannot deserialize the contract state`.
To solve this, you can either:
1. Rollback to the previous contract code
2. Implement a method to [migrate the contract's state](../release/upgrade.md)
|
---
id: deploy
title: NEAR CLI - Basics
sidebar_label: Deploying and Using
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
After your contract is ready you can deploy it in the NEAR network for everyone to use it.
Let us guide you on how to use the [NEAR CLI](../../../4.tools/cli.md) to deploy your contract
and call its methods.
:::info
On this page, we will only cover the basics of NEAR CLI. For more information visit the
[NEAR CLI documentation page](../../../4.tools/cli.md).
:::
---
## Deploying the Contract
Thanks to the `NEAR CLI` deploying a contract is as simple as:
1. Compiling the contract to wasm (done automatically through `yarn build` in our templates).
2. [Create an account](../../../4.tools/cli.md#near-create-account) and [deploy the contract](../../../4.tools/cli.md#near-deploy) into it using `NEAR CLI`.
#### Create an Account and Deploy
<Tabs className="language-tabs" groupId="code-tabs">
<TabItem value="near-cli">
```bash
# Create a new account pre-funded by a faucet & deploy
near create-account <accountId> --useFaucet
near deploy <accountId> <route_to_wasm>
# Get the account name
cat ./neardev/dev-account
```
</TabItem>
<TabItem value="near-cli-rs">
```bash
# Automatically deploy the wasm in a new account
near account create-account sponsor-by-faucet-service <my-new-dev-account>.testnet autogenerate-new-keypair save-to-keychain network-config testnet create
near contract deploy <my-new-dev-account>.testnet use-file <route_to_wasm> without-init-call network-config testnet sign-with-keychain
```
</TabItem>
</Tabs>
#### Deploy in an Existing Account
<Tabs className="language-tabs" groupId="code-tabs">
<TabItem value="near-cli">
```bash
# login into your account
near login
# deploy the contract
near deploy <accountId> <route_to_wasm>
```
</TabItem>
<TabItem value="near-cli-rs">
```bash
# login into your account
near account import-account using-web-wallet network-config testnet
# deploy the contract
near contract deploy <accountId> use-file <route_to_wasm> without-init-call network-config testnet sign-with-keychain send
```
</TabItem>
</Tabs>
:::tip
You can overwrite a contract by deploying another on top of it. In this case, the account's logic
will change, but the state will persist
:::
:::info
By default `near-cli` uses the `testnet` network. Define `NEAR_ENV=mainnet` to deploy into `mainnet`.
:::
:::info Naming Convention for Public-Facing Methods
Once the contract is deployed to the network, anyone and any other contract (i.e., any other account on NEAR) can interact with it by calling its methods. Furthermore, any transactions involving the contract will also be included in the network's data stream, which means its activity can also be visible to any who listens to particular events.
Considering this, we advise to name methods using `snake_case` in all SDKs as this is compatible with the remainder of the NEAR ecosystem which is predominantly comprised of Rust contracts.
:::
---
## Initializing the Contract
If your contract has an [initialization method](../anatomy/anatomy.md#initialization-functions) you can call it to
initialize the state. This is not necessary if your contract implements `default` values for the state.
<Tabs className="language-tabs" groupId="code-tabs">
<TabItem value="near-cli">
```bash
# Call the initialization method (`init` in our examples)
near call <contractId> <initMethod> [<args>] --accountId <accountId>
```
</TabItem>
<TabItem value="near-cli-rs">
```bash
# Call the initialization method (`init` in our examples)
near contract call-function as-transaction <contractId> <initMethod> json-args [<args>] prepaid-gas '30 TeraGas' attached-deposit '0 NEAR' sign-as <accountId> network-config testnet sign-with-keychain send
```
</TabItem>
</Tabs>
:::info
You can initialize your contract [during deployment](#deploying-the-contract) using the `--initFunction` & `--initArgs` arguments.
:::
---
## Calling the Contract
Once your contract is deployed you can interact with it right away using [NEAR CLI](../../../4.tools/cli.md).
<hr className="subsection" />
### View methods
View methods are those that perform **read-only** operations. Calling these methods is free, and do not require to specify which account is being used to make the call:
<Tabs className="language-tabs" groupId="code-tabs">
<TabItem value="near-cli">
```bash
near view <contractId> <methodName>
```
</TabItem>
<TabItem value="near-cli-rs">
```bash
near contract call-function as-read-only <contractId> <methodName> text-args '' network-config testnet now
```
</TabItem>
</Tabs>
:::tip
View methods have by default 200 TGAS for execution
:::
<hr className="subsection" />
### Change methods
Change methods are those that perform both read and write operations. For these methods we do need to specify the account being used to make the call,
since that account will expend GAS in the call.
<Tabs className="language-tabs" groupId="code-tabs">
<TabItem value="near-cli">
```bash
near call <contractId> <methodName> <jsonArgs> --accountId <yourAccount> [--deposit <amount>] [--gas <GAS>]
```
</TabItem>
<TabItem value="near-cli-rs">
```bash
near contract call-function as-transaction <AccountId> <MethodName> json-args <JsonArgs> prepaid-gas <PrepaidGas> attached-deposit <AttachedDeposit> sign-as <AccountId> network-config testnet sign-with-keychain send
```
</TabItem>
</Tabs>
|
---
title: 5.1 Decentralized Autonomous Organizations (DAOs)
description: The DAO revolution and its promise of change for data, users, and value
---
# 5.1 Decentralized Autonomous Organizations (DAOs)
_“A DAO is a capitalized organization in which a software protocol informs its operation, placing automation at its center and humans at its edges like how DeFi is programmable money, and NFTs are programmable media, DAOs are programmable organizations of people. The promise of DAOs and crypto-economics more generally is to be able to establish collective intelligences at scale. The defining attribute that makes DAO’s different from past organizations is the use of the blockchain as a root of trust such that the inputs and outputs from decisions that matter are immutable and auditable.” - [Riva Tez on Vitalik on DAOs ](https://www.youtube.com/watch?v=Srl9tHz9OQA)_
We have seen up until this point, how the systematic inversion of crypto is applicable to the very nature of value, fungible value and by extension decentralized science, as well as non-fungible value for creators, communities, and artists (among others. The focus of this module, outlines another field that is ripe for disruption from the web3 paradigm - namely - Governance - and to be specific, coordination and collaboration mechanisms.
This was originally subsumed under the heading of Decentralized Autonomous Organizations or (DAOs) but as time has gone on, new terms like On-Chain Organizations, and Network States have also emerged in this area. Now, an entire sub-industry focused on governance has emerged: This encapsulates tooling for DAOs (to allow users and builders to create their own), protocol governance, treasury governance, and community governance. In parallel to these developments, there is avid interest from legacy industries on how on-chain governance can be used to disrupt and re-create a number of processes - from politics, to scientific funding decisions, to institutional governance.
## The What and How of DAOs
For our purposes the DAO revolution has the promise of changing the manner in which data, users, value, and systems are managed - outside of the usual legal and institutional wrappers. With DAO’s we outsource governance and management itself into the domain of software.
**Let’s start with the _What:_**
**What is governed on-chain?**
* **Communities of Users:** Organize together to make decisions together, share capital, work on common projects, or engage in some other activity (RAID DAO, DCD).
* **Treasuries and Pooled Value:** To manage value, revenue, investments.
* **Protocols including token issuance:** To manage emissions, rates, access, open-sourcing, and gating of assets or code bases.
* **Rules and Mechanics for dApps and Systems - Games, Network States:** For allowing engagement with a system be it a game, country, or agency (similar to community but more structured).
So in essence, the _what_ encompasses broadly things like human systems, revenue, stored value, and mechanics or levers of on-chain systems.
And now we get to the really incredible benefit of DAOs and OO’s which is the _How_. If we get a little technical, on NEAR DAOs are created according to a specific set of rules and logic, encompassed by the term ‘DAO Factory’. What this means is that it is up to the user to program their organization with specific rules, policies, and procedures as they see fit. We are only at the very beginning of this product’s emergence.
If you are familiar with Vitalik and his writings, DAOs used to be token weighted - meaning the more tokens an account held the more its vote weight would be. Those rules have now been superseded. On NEAR we can design a DAO or an Organization to an increasingly complex logic:
**Vote Policy:**
* Token Weight
* Role Weight
**Permissions:**
* Councils with specific permissions.
** Approve
** Deny
** Move to Vote
** Call a specific function
![](@site/static/img/bootcamp/mod-em-5-multiple.png)
And as an open-source library these functions are naturally growing by the day!
Okay so we have spoken on a high level about the what and the how of DAOs - as an equally powerful product that is entirely complementary and different to NFTs.
What, simply put, is the improvement or promise of DAOs and OO’s?
* **Simplification -** Creating a new channel to move value or coordinate a process that has become bureaucratic. Molecule DAO for investing in BioTech.
* **Velocity of value -** Automating the flow into and from a DAO, using software. So that fees from one exchange can automatically go into a DAO to finance a forest project.
* **Transparency of fund distribution -** Organizations, political parties, governments, budgets are all done transparently on-chain. Value flows are visible.
* **Co-ownership -** Building ownership and management power into the organization itself.
* **Access (this is akin to people getting more financial access than ever via Crypto vs accredited investor rules → i.e. to a sports team, or a scouting agency).** Retail participation in any type of process - globally.
* **Organize, Act, Coordinate in Networks.** Global participation, non-discrimination, minimal rules and bureaucracy, easy access, and streamlined value flows.
![](@site/static/img/bootcamp/mod-em-5.1.2.png)
## The Evolution of DAOs and the DAO Landscape Today
_“A DAO is a capitalized organization in which a software protocol informs its operation, placing automation at its center and humans at its edges like how DeFi is programmable money, and NFTs are programmable media, DAOs are programmable organizations of people.”_
As we circle this overarching definition of a DAO and the promise it holds for governance, we are also going to be looking at the evolution of DAOs themselves as a tech stack. This starts, first and foremost with the original DAO as launched (and hacked) by Ethereum. Early stage DAOs, were heavily token denominated in terms of voting power and decision making.
**Vertically:** In the past two years, we have seen DAOs evolve in the following ways:
* **Token-based voting**
* **Token Delegation-voting to protocol politicians**
* **Role based Voting**
In the future, if we are truly going to place automation at the center and humans at the edges, we are going to be also including:
* **Reputation Based Governance (Soul bound)**
* **Automated function calls**
* **Smart contract based tipping points and levers**
* **AI governed roles**
* **Legal Wrappers and Jurisdictional Compliance**
* **DAO to DAO governance **- System to System governance**
The point of this spectrum is to indicate where we are today, and where this is looking to evolve in the future. This is the vertical development of DAOs.
![](@site/static/img/bootcamp/mod-em-5.1.3.png)
**Horizontally:** The horizontal development of DAOs refers to the scope from which we believe DAOs will reach beyond its small niche of theory and cyberspace.
“_The promise of DAOs and crypto-economics more generally is to be able to establish collective intelligences at scale.”_
What have DAOs encompassed up until this point, and how do we see it evolving?
* **Protocol DAOs:** DAOs in charge of governing the mechanics of an L1 protocol, including inflation, gas fees, and so forth.
* **Treasury DAOs:** DAOs in charge of managing the treasury of a protocol and any revenue that may accrue into the treasury.
* **Investment DAOs:** DAOs devoted to collectively investing funds from a community or set of actors who have put funds into the DAO.
* **Community DAOs:** DAOs representative of a group of individuals engaging in common activities and sharing resources, time allocation, or rewards.
#### Where do we see this technology evolving into the future?
* **Network States.**
* **Institutional Governance via DAO.**
* **Scientific Research and Learning.**
The thesis here is that the businesses, organizations, and systems of tomorrow will be running this graphic on some type of on-chain organization.
## DAO Landscape and Tooling Today
![](@site/static/img/bootcamp/mod-em-5.1.4.png)
![](@site/static/img/bootcamp/mod-em-5.1.5.png)
_The promise of DAOs and crypto-economics more generally is to be able to establish collective intelligences at scale. The defining attribute that makes DAO’s different from past organizations is the use of the blockchain as a root of trust such that the inputs and outputs from decisions that matter are immutable and auditable.”_
What is important to understand, is that as a framework of DAOs is designed to harmonize with the existing product stack of crypto - meaning a successful DAO will most likely depend upon the quality of the account structure of the L1 chain it is built on, have the capacity to manage fungible token contracts, non-fungible access points, and other DAO communities. But the trend is clear: As the crypto product stack emerges, more users onboard to Web3, and more tools exist for plugging and playing with different governance frameworks, we will be moving towards this idea of _establishing collective intelligences at scale._
### Top DAO Tooling Infrastructures
This is a light overview of some of the most known DAO tooling infrastructures - if you are at a conference talking to someone they will probably ask if it is an Aragorn fork, if you are into Tendermint and the Cosmos ecosystem people will want to see if you know about DAO DAO, and then of course on NEAR, we have Pagoda’s incubated Astro DAO.
**Aragon (Ethereum / EVM) - the OG DAO tooling:** [https://aragon.org/how-to/build-your-dao-tooling-stack](https://aragon.org/how-to/build-your-dao-tooling-stack)
Aragon is the OG DAO tooling framework on Ethereum, that has shipped a number of innovative DAO related products, usually geared towards crypto-native and internet users (reddit communities). The list below is a quick overview of some of the spin-up products on Aragon today:
![](@site/static/img/bootcamp/mod-em-5.1.6.png)
The App and Client is specifically focused on governance and the ability to launch a DAO and token, as well as set parameters for users - whitelist, time delay, collateralize proposals, etc. and to set governance agreements. Aragon Voice meanwhile pertains to the nature of proposals - and how to create, pass, and set a vote policy for your DAO. Those interested in these topics further, and how Aragon is looking at the future of DAOs should refer [to their blog. ](https://blog.aragon.org/)
![](@site/static/img/bootcamp/mod-em-5.1.7.png)
![](@site/static/img/bootcamp/mod-em-5.1.8.png)
## Sputnik/Astro (NEAR)
The entire next lecture is devoted to the design of Sputnik and Astro as well as the opportunity present for DAO tooling on NEAR and Aurora. For now we can say the following: the power of Sputnik V2 is that it creates an extremely customizable set of governance parameters by leveraging the NEAR Account model, and a combination of highly customizable proposal-kinds (essentially what can be done by users in a governance framework on NEAR).
Astro meanwhile, is the dressed up and more User-friendly interface of Astro, that makes the Sputnik logic easy to interact with as a user. Astro has additionally added open-source libraries of ‘actions’ that any DAO could make use of, in a similar way to how Wordpress had ‘widgets’ that any person designing a website could leverage for their own.
This is such that remote accounts on NEAR, are in principle able to participate in DAO governance from another L1 ecosystem. Or, conversely, that an account with no access keys, could be automated to behave and fulfill certain function calls only when specific inputs are connected.
**DAO DAO(Cosmos) - [https://daodao.zone/](https://daodao.zone/) / [https://docs.daodao.zone/docs/recipes/diversify-treasury](https://docs.daodao.zone/docs/recipes/diversify-treasury)**
DAO DAO is a clever and necessary mention, largely because it is IBC enabled. So in reference to our earlier discussion on the Universe of Chains and the World of Dapps, DAO DAO is DAO tooling for the entire cosmos ecosystem - such that someone can manage a treasury on one Cosmos L1, and still engage with the token / governance of another chain in parallel.
And in a similar vein to how Astro has an open-source library, DAO DAO has so-called _recipes_, or existing ways of structuring your treasury.
![](@site/static/img/bootcamp/mod-em-5.1.9.png)
**Tribute Labs (Ethereum) - [https://tributelabs.xyz/](https://tributelabs.xyz/) / [https://tributedao.com/docs/tutorial/extensions/creating-an-extension](https://tributedao.com/docs/tutorial/extensions/creating-an-extension)**
We mention Tribute Labs in this very cursory overview, because of its integration of the OpenLaw stack with Ethereum governance tools. In short, Tribute Labs offers a DAO tooling kit that bridges the gap between existing regulatory frameworks, and the cyber-world of DAO tooling.
![](@site/static/img/bootcamp/mod-em-5.1.10.png)
What we see from all of these examples, is that DAO tooling today is such that it largely centers around vote policy, and proposals from which certain recipes or existing strategies can be easily implemented by someone building the DAO. What has not been done, is customizing these libraries around the ever expanding vertical and horizontal use-cases that we referenced above.
## Conclusion
We are at a point in the roll-out of DAOs, where only very early on infrastructure development has taken place, with the bulk of innovation depending on the state of the L1 Ecosystem (the account model, the oracle access, storage capacities, smart contract libraries), existing dApps and communities (protocols to govern, treasuries, investment DAOs, etc.) and new use-cases and designs that have yet to have been invented. Many are building what they believe to be _‘The Wordpress of DAOs?”_ but as we will see, there is much more customization available, that can be specified for specific verticals, libraries, and use-cases - both in a specific L1 ecosystem or for cross-chain use. We are only at the very beginning.
|
This dataset is a subset of the original nearData dataset, prepared for the continued pre-training of a pre-trained LLM. The idea behind the continued pre-training of pre-trained models is to further instruct them with specific information, in this case on the Near Protocol blockchain, before fine-tuning them.
The preTrainingNEAR dataset was prepared from local text files using the datasets library from Hugging Face. It includes: