Skip to content

Commit

Permalink
Merge branch 'master' into patch-5
Browse files Browse the repository at this point in the history
  • Loading branch information
gagdiez authored Jan 31, 2024
2 parents 1cdc6cb + b3c7925 commit b3b1b6d
Show file tree
Hide file tree
Showing 59 changed files with 365 additions and 731 deletions.
4 changes: 2 additions & 2 deletions docs/1.concepts/basics/accounts/access-keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ When needed, that third-party component could trigger the recovery process, help

NEAR implements two types of access keys: `FullAccess` keys and `FunctionCall` keys.

<hr class="subsection" />
<hr className="subsection" />

### Full Access Keys {#full-access-keys}
As the name suggests, `FullAccess` keys have full control of an account, similar to having administrator privileges on your operating system.
Expand All @@ -58,7 +58,7 @@ If you hand a `FullAccess` to someone, they will have **total control over the a
You **add the first** Full Access Key of the account when [the account is created](creating-accounts.md).
:::

<hr class="subsection" />
<hr className="subsection" />

### Function Call Keys {#function-call-keys}

Expand Down
4 changes: 2 additions & 2 deletions docs/1.concepts/basics/actors.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ There are 3 main actors interacting to form the NEAR ecosystem:

<!-- To set the stage, we're building a "base-layer blockchain," or a layer-one, meaning that it's on the same level of the ecosystem as projects like Ethereum or Cosmos. That means everything in the ecosystem is built on the NEAR blockchain, including your application. -->

<hr class="subsection" />
<hr className="subsection" />

## Users
Users can have one or multiple [NEAR accounts](./accounts/introduction.md), which they can use to:
Expand All @@ -19,7 +19,7 @@ Users can have one or multiple [NEAR accounts](./accounts/introduction.md), whic
2. **Execute** [decentralized apps](https://awesomenear.com) stored in the network, known as [smart contracts](./accounts/smartcontract.md).
3. **Develop** their own decentralized app and store it in the network.

<hr class="subsection" />
<hr className="subsection" />

## Validators
Validators are people distributed around the world, running the infrastructure that underlies the NEAR network. They serve two main jobs:
Expand Down
6 changes: 3 additions & 3 deletions docs/1.concepts/basics/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ These accounts also have the permission to create subaccounts such as `nft.alice
For more information see the **[accounts section](/concepts/basics/accounts/model)**.
:::

<hr class="subsection" />
<hr className="subsection" />

## Keys

Expand All @@ -32,7 +32,7 @@ Full access keys allow for full control of the account. You can send funds, crea
For more information see the **[access keys section](/concepts/basics/accounts/access-keys)**.
:::

<hr class="subsection" />
<hr className="subsection" />

### Contracts

Expand All @@ -44,7 +44,7 @@ As an example, benji could have the root account `benji.near`. He then stores al
For more information see a guide on **[deploying contracts](/sdk/rust/promises/deploy-contract)**.
:::

<hr class="subsection" />
<hr className="subsection" />

### Storage

Expand Down
2 changes: 1 addition & 1 deletion docs/1.concepts/basics/protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ In technical terms, NEAR is a [layer one](https://blockchain-comparison.com/bloc

In simple terms, NEAR is **blockchain for everyone**.

<hr class="subsection" />
<hr className="subsection" />

## Why Choose NEAR? {#why-build-on-near}
NEAR has been developed with a focus on performance and usability, both for developers and users.
Expand Down
4 changes: 2 additions & 2 deletions docs/1.concepts/basics/transactions/gas-advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Given the general-purpose nature of NEAR, function calls win the award for most

With this level of complexity, it's no longer useful to walk through an example, enumerating each (see `ext_costs` under `wasm_config` using the [`protocol_config`](/api/rpc/protocol#protocol-config) RPC endpoint) of the gas calculations as we go (you can research this yourself, [if you want](https://github.com/near/nearcore/pull/3038)). Instead, let's approach this from two other angles: ballpark comparisons to Ethereum, and getting accurate estimates with automated tests.

<blockquote class="lesson">
<blockquote className="lesson">
**How much of the gas fee goes as a 30% reward to the smart contract account?**

The NEAR Whitepaper mentions that [30% of all gas fees](https://near.org/papers/the-official-near-white-paper/) go to smart contract accounts on which the fees are expensed.
Expand Down Expand Up @@ -188,7 +188,7 @@ The price of 1 unit of gas at this block was 5000 yoctoNEAR (10^-24 NEAR).

## Some closing thoughts from the whitepaper {#some-closing-thoughts-from-the-whitepaper}

<blockquote class="info">
<blockquote className="info">
Fundamentally, the NEAR platform is a marketplace between willing participants. On the supply side, operators of the validator nodes and other fundamental infrastructure need to be incentivized to provide these services which make up the “community cloud.” On the demand side, the developers and end-users of the platform who are paying for its use need to be able to do so in a way which is simple, clear and consistent so it helps them.

A blockchain-based cloud provides several specific resources to the applications which run atop it:
Expand Down
4 changes: 2 additions & 2 deletions docs/1.concepts/basics/transactions/gas.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ To give you a starting point for what to expect for costs on NEAR, the table bel
| Add Full Access Key | 0.42 | 0.042 | 4.2⨉10⁻⁵ |
| Delete Key | 0.41 | 0.041 | 4.1⨉10⁻⁵ |

<details class="info">
<details className="info">
<summary>Where do these numbers come from?</summary>

NEAR is [configured](https://github.com/near/nearcore/blob/master/core/primitives/res/runtime_configs/parameters.yaml) with base costs. An example:
Expand Down Expand Up @@ -145,7 +145,7 @@ Function calls are more complex and need you to attach an explicit amount of gas
This maximum value of prepaid gas is subject to change but you can query this value by using the [`protocol_config`](/api/rpc/protocol#protocol-config) RPC endpoint and search for `max_total_prepaid_gas`.
:::

<details class="warning">
<details className="warning">
<summary>How many tokens will these units cost?</summary>
Note that you are greenlighting a maximum number of gas _units_, not a number of NEAR tokens or yoctoNEAR.

Expand Down
4 changes: 2 additions & 2 deletions docs/1.concepts/basics/validators.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Since Validators validate all shards, high requirements are set for running them

The current active Validators are available on the Explorer. The minimum seat price to become a block-producing validator is based on the 300th proposal. (If more than 300 proposals are submitted, the threshold will simply be the stake of the 300th proposal, provided that it’s larger than the minimum threshold of 25,500 $NEAR.) The current seat price to become a block-producing validator is updated live on the Explorer. Any validator nodes with stakes higher than the seat price can join the active set of Validators.

<blockquote class="lesson">
<blockquote className="lesson">
<strong>Is there a plan to support GPU compute if certain validator nodes can offer that or is it just CPU?</strong><br /><br />

We don't need GPU support as we are a POS chain and we require very little compute power.
Expand All @@ -54,7 +54,7 @@ Like Validators, Chunk-Only Producers will receive, at minimum, 4.5% annual rewa

If you'd like to further explore Validators and Nodes in general, you can visit the [Dedicated Validator Documentation Site](https://near-nodes.io/).

<blockquote class="lesson">
<blockquote className="lesson">
<strong>If a developer writes a vulnerable or malicious dApp, is a validator implicitly taking on risk?</strong><br /><br />

No. We have handled the potential damages to the network on the protocol level. For example, we have a lot of limiters that constrain how much data you can pass into a function call or how much compute you can do in one function call, etc.
Expand Down
2 changes: 1 addition & 1 deletion docs/1.concepts/storage/storage-staking.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sidebar_label: Storage Staking
>
> In storage staking (sometimes called _state_ staking), the account that owns a smart contract must stake (or lock) tokens according to the amount of data stored in that smart contract, effectively reducing the balance of the contract's account.
<blockquote class="info">
<blockquote className="info">
<strong>Coming from Ethereum?</strong><br /><br />

If you’re familiar with Ethereum’s pricing model, you may know that, like NEAR, the protocol charges a fee (called "gas") for each transaction. Unlike NEAR, Ethereum's gas fee accounts for the amount of data stored via that transaction. This essentially means that anyone can pay once to store permanent data on-chain. This is a poor economic design for at least two reasons: 1. The people running the network (miners, in the case of Ethereum 1) are not appropriately incentivized to store large amounts of data, since a gas fee far charged in the distant past can increase storage costs forever, and 2. The users of a smart contract are charged for the data they send to store in it, rather than charging the owner of the smart contract.
Expand Down
2 changes: 1 addition & 1 deletion docs/2.develop/contracts/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ Sub-accounts are simply useful for organizing your accounts (e.g. `dao.project.n
When you create an account from within a contract, it has no keys by default. If you don't explicitly [add keys](#add-keys) to it or [deploy a contract](#deploy-a-contract) on creation then it will be [locked](../../1.concepts/basics/accounts/access-keys.md#locked-accounts).
:::

<hr class="subsection" />
<hr className="subsection" />

#### Creating Other Accounts
Accounts can only create immediate sub-accounts of themselves.
Expand Down
14 changes: 7 additions & 7 deletions docs/2.develop/contracts/anatomy.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Under the hood, the `NEAR Bindgen` decorator/macro traverses the class, generati
2. Expose public methods, so they can be called externally.
3. Serialize objects for internal storage and communication with external actors.

<hr class="subsection" />
<hr className="subsection" />

### The State
Each account has its own state (storage), which **only they can modify** but [anyone can see](../../4.tools/cli.md#near-view-state-near-view-state).
Expand Down Expand Up @@ -66,7 +66,7 @@ There are two ways to initialize the account's state, and they can co-exist:
2. A **default state**, which will be used until `init` is invoked, or a method writes into the state


<hr class="subsection" />
<hr className="subsection" />

### Initialization Method
To define an initialization method simply decorate it with the [initialization macro](#decorators--macros).
Expand Down Expand Up @@ -106,7 +106,7 @@ To make the initialization mandatory use `#[derive(PanicOnDefault)]` in the cont
</TabItem>
</Tabs>

<hr class="subsection" />
<hr className="subsection" />

### Default State
Contracts can define a **default state** to use if no initialize method is called. This is, if any method is invoked
Expand Down Expand Up @@ -189,7 +189,7 @@ All the **public methods** are exposed to the network as the contract's interfac
</TabItem>
</Tabs>

<hr class="subsection" />
<hr className="subsection" />

### Public Methods
Public methods can be categorized in three types: `init` methods, `view` methods, and `call` methods.
Expand All @@ -209,7 +209,7 @@ as `call` methods.
By default `init` methods are public, make sure to [decorate them as `private`](#private-methods), or [batch call the initialization on deploy](../deploy.md#initializing-the-contract)
:::

<hr class="subsection" />
<hr className="subsection" />

### Private Methods
Sometimes you will want some methods to remain public, but only be callable by the contract's
Expand Down Expand Up @@ -240,7 +240,7 @@ For this, you can use the `private` macro/decorator.
</TabItem>
</Tabs>

<hr class="subsection" />
<hr className="subsection" />

### Payable Methods
By default **all methods panic** if a user **attaches money** while calling them. To enable a
Expand Down Expand Up @@ -269,7 +269,7 @@ method to receive money use the payable decorator.
</TabItem>
</Tabs>

<hr class="subsection" />
<hr className="subsection" />


### Input & Return Types
Expand Down
6 changes: 3 additions & 3 deletions docs/2.develop/contracts/serialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This process of translating **complex objects into simpler single-value** repres
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 class="subsection" />
<hr className="subsection" />

### [JSON](https://www.json.org/json-en.html): Objects to Strings

Expand All @@ -43,7 +43,7 @@ Example{
"{\"number\": 2, \"arr\": [0, 1]}"
```

<hr class="subsection" />
<hr className="subsection" />

### [Borsh](https://borsh.io/): Objects to Bytes

Expand Down Expand Up @@ -232,7 +232,7 @@ 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 class="subsection" />
<hr className="subsection" />

<!-- We should see where to move/replicate this -->

Expand Down
8 changes: 4 additions & 4 deletions docs/2.develop/contracts/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ in the [serialized state](./serialization.md#borsh-state-serialization)
</CodeTabs>
:::

<hr class="subsection" />
<hr className="subsection" />

### Vector

Expand All @@ -74,7 +74,7 @@ Implements a [vector/array](https://en.wikipedia.org/wiki/Array_data_structure)
</Language>
</CodeTabs>

<hr class="subsection" />
<hr className="subsection" />

### Map

Expand Down Expand Up @@ -134,7 +134,7 @@ class StatusMessage {
}
```
</details>
<hr class="subsection" />
<hr className="subsection" />

### Set

Expand All @@ -154,7 +154,7 @@ Implements a [set](https://en.wikipedia.org/wiki/Set_(abstract_data_type)) which
</Language>
</CodeTabs>

<hr class="subsection" />
<hr className="subsection" />

### Tree

Expand Down
4 changes: 2 additions & 2 deletions docs/2.develop/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ You can initialize your contract [during deployment](#deploying-the-contract) us
## Calling the Contract
Once your contract is deployed you can interact with it right away using [NEAR CLI](../4.tools/cli.md).

<hr class="subsection" />
<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:
Expand All @@ -154,7 +154,7 @@ View methods are those that perform **read-only** operations. Calling these meth
View methods have by default 200 TGAS for execution
:::

<hr class="subsection" />
<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,
Expand Down
4 changes: 2 additions & 2 deletions docs/2.develop/integrate/frontend.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ Signing in is as simple as requesting the `wallet` object to `signIn`, the same

When the user clicks in the button, it will be asked to select a wallet and use it to login.

<hr class="subsection" />
<hr className="subsection" />

### Function Call Key

Expand Down Expand Up @@ -220,7 +220,7 @@ Remember that you can use the `wallet` to call methods in **any** contract. If y

:::

<hr class="subsection" />
<hr className="subsection" />


### Wallet Redirection
Expand Down
10 changes: 4 additions & 6 deletions docs/2.develop/integrate/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Once the app starts you will see the landing page, rendering a navigation bar th

Go ahead and sign in with your NEAR account. If you don't have one, you can create one on the fly.

<hr class="subsection" />
<hr className="subsection" />

### Under the Hood

Expand All @@ -82,7 +82,7 @@ The wallet selector is a component that allows users to select their preferred N

</details>

<hr class="subsection" />
<hr className="subsection" />

### Navigation Bar & Login
The navigation bar implements buttons to `login` and `logout` users with their Near wallet.
Expand All @@ -102,7 +102,7 @@ Now that you understand how the landing page works, we can move to the `Near Int

Login if you haven't done it yet and you will see a simple form that allows you to store a greeting in the smart contract.

<hr class="subsection" />
<hr className="subsection" />

### Under the Hood
Interactions with NEAR are done using the `useWallet` hook to retrieve both the `viewMethod` and `callMethod` methods and the `signedAccountId` property from the `wallet selector`.
Expand Down Expand Up @@ -134,7 +134,7 @@ To interact with the Ethereum components (a Lido) you will need to have Metamask
While the component's code is stored in the **Near testnet**, the Lido component is connected to the **Ethereum mainnet**.
:::

<hr class="subsection" />
<hr className="subsection" />

### Under the Hood

Expand All @@ -157,8 +157,6 @@ Particularly, the `Component` in the main page are wrappers around the `Widget`

That's it for our quickstart tutorial. You have now seen a fully functional frontend that can talk with NEAR contracts and render Web3 components.

<!-- In the following sections we dive deeper into what are [BOS components](../../bos/overview.md), how to [make your own gateway](../../bos/tutorial/gateway.md), and what are some of the [built-in components](../../bos/components.md). -->

If you have any questions, do not hesitate in joining us on [Discord](https://near.chat). We regularly host Office Hours, in which you can join our voice channel and ask questions.

Happy coding!
Loading

0 comments on commit b3b1b6d

Please sign in to comment.