Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(de): Draft PR for the German translation #464

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,79 @@ export default defineUserConfig<DefaultThemeOptions>({
],
},
},
"/de/": {
selectLanguageName: "Deutsch",
navbar: [
{
text: "Beitragen",
link: "https://github.com/solana-developers/solana-cookbook",
},
{
text: "Integrationen",
link: "/de/integrations",
},
],
sidebar: {
"/": [
{
text: "Installation",
children: ["/de/", "/de/getting-started/installation.md"],
},
{
text: "Kernkonzepte",
children: [
"/de/core-concepts/accounts.md",
"/de/core-concepts/programs.md",
"/de/core-concepts/transactions.md",
"/de/core-concepts/pdas.md",
],
},
{
text: "Leitfäden",
children: [
"/de/guides/get-program-accounts.md",
"/de/guides/serialization.md",
"/de/guides/data-migration.md",
"/de/guides/account-maps.md",
"/de/guides/retrying-transactions.md",
"/de/guides/debugging-solana-programs.md",
"/de/guides/feature-parity-testing.md",
],
},
{
text: "Referenzen",
children: [
"/de/references/local-development.md",
"/de/references/keypairs-and-wallets.md",
"/de/references/basic-transactions.md",
"/de/references/accounts.md",
"/de/references/programs.md",
"/de/references/token.md",
"/de/references/staking.md",
"/de/references/nfts.md",
"/de/references/offline-transactions.md",
"/de/references/name-service.md",
],
},
],
"/id/integrations": [
{
text: "Integrationen",
children: [
"/de/integrations",
"/de/integrations/serum.md",
"/de/integrations/pyth.md",
"/de/integrations/switchboard.md",
"/de/integrations/mango.md",
"/de/integrations/strata.md",
"/de/integrations/web3auth.md",
"/de/integrations/react-native.md",
"/de/integrations/jupiter.md",
],
},
],
},
},
},
},
locales: {
Expand Down Expand Up @@ -535,6 +608,10 @@ export default defineUserConfig<DefaultThemeOptions>({
lang: "id-ID",
title: "Buku Panduan Solana",
},
"/de/": {
lang: "de-DE",
title: "Solana Kochbuch",
},
},
markdown: {
importCode: {
Expand Down Expand Up @@ -571,6 +648,9 @@ export default defineUserConfig<DefaultThemeOptions>({
"/id/": {
placeholder: "Cari",
},
"/de/": {
placeholder: "Suchen",
},
},
maxSuggestions: 10,
},
Expand Down Expand Up @@ -639,6 +719,14 @@ export default defineUserConfig<DefaultThemeOptions>({
},
},
},
"/de/": {
placeholder: "Suchen",
translations: {
button: {
buttonText: "Suchen",
},
},
},
},
},
],
Expand Down
67 changes: 67 additions & 0 deletions docs/de/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
title: Kochen mit Solana
head:
- - meta
- name: title
content: Solana Kochbuch| Solana-Referenzen
- - meta
- name: og:title
content: Solana Kochbuch| Solana-Referenzen
- - meta
- name: description
content: Das Solana Kochbuch ist eine Ansammlung an nützlichen Beispielen und Referenzen für die Softwareentwicklung mit Solana
- - meta
- name: og:description
content: Das Solana Kochbuch ist eine Ansammlung an nützlichen Beispielen und Referenzen für die Softwareentwicklung mit Solana
- - meta
- name: og:image
content: https://solanacookbook.com/cookbook-sharing-card.png
- - meta
- name: og:image:alt
content: Solana splash card
- - meta
- name: twitter:card
content: summary
- - meta
- name: twitter:site
content: "@solanacookbook"
- - meta
- name: twitter:image
content: "https://solanacookbook.com/cookbook-sharing-card.png"
- - meta
- name: robots
content: index,follow,noodp
- - meta
- name: googlebot
content: index,follow
footer: MIT Licensed
---

# Kochen mit Solana

Das *Solana Kochbuch* ist eine Ressource für
Entickler und beschreibt die wesentlichen Konzepte
und Referenzen für das Entwickeln von Anwendungen
auf Solana. Jedes Konzept und Beispiel konzentriert sich
auf bestimmte Aspekte von Solana, während zusätzliche
Details und Verwendungsbeispiele bereitgestellt werden.

## Beitragen

Das Kochbuch ist so strukturiert, dass es von
neuen Solanaentwicklern einfach mitgestalted
werden kann. Auch wenn man noch nicht weiß wie
etwas in Solana funktioniert, dem Kochbuch beizutragen
ist ein großartiger Weg neues zu lernen.

Offenen Issues findest du [hier](https://github.com/solana-developers/solana-cookbook/issues). Die Richtlinien zum Beitragen findest du [hier](https://github.com/solana-developers/solana-cookbook#contributing). Wenn du denkst, dass im Kochbuch etwas fehlt, dann füge bitte eine neue Issue hinzu.

## Wie du das Kochbuch lesen solltest

Das Solana Kochbuch ist in verschiedene Abschnitte eingeteilt. Jeder dieser Abschnitte verfolgt ein eigenes Lernziel.

| Abschnitt | Beschreibung |
|---------------|-----------------------------------------------------------------------------|
| Kernkonzepte | Die Bausteine von Solana die du kennen solltest |
| Leitfäden | Leitfäden in Snackgröße zu verschiedenen Tools für die Entwicklung mit Solana |
| Referenzen | Referenzen für gängige Code Snippets |
Binary file added docs/de/core-concepts/account-matrix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/de/core-concepts/account_example.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
130 changes: 130 additions & 0 deletions docs/de/core-concepts/accounts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
---
title: Accounts
head:
- - meta
- name: title
content: Solana Cookbook | Accounts
- - meta
- name: og:title
content: Solana Cookbook | Accounts
- - meta
- name: description
content: Accounts are an essential building block for developing on Solana. Learn about Accounts and more Core Concepts at The Solana cookbook.
- - meta
- name: og:description
content: Accounts are an essential building block for developing on Solana. Learn about Accounts and more Core Concepts at The Solana cookbook.
- - meta
- name: og:image
content: https://solanacookbook.com/cookbook-sharing-card.png
- - meta
- name: og:image:alt
content: Solana splash card
- - meta
- name: twitter:card
content: summary
- - meta
- name: twitter:site
content: "@solanacookbook"
- - meta
- name: twitter:image
content: "https://solanacookbook.com/cookbook-sharing-card.png"
- - meta
- name: robots
content: index,follow,noodp
- - meta
- name: googlebot
content: index,follow
footer: MIT Licensed
---

# Accounts

Accounts within Solana are used to store state. They are an essential
building block for developing on Solana.

## Facts

::: tip Fact Sheet

- Accounts are used to store data
- Each account has a unique address
- Accounts have a max size of 10MB (10 Mega Bytes)
- PDA accounts have a max size of 10KB (10 Kilo Bytes)
- PDA accounts can be used to sign on behalf of a program
- Accounts size are fixed at creation time, but can be adjusted using [realloc](https://solanacookbook.com/references/programs.html#how-to-change-account-size)
- Account data storage is paid with rent
- Default account owner is the System Program
:::

## Deep Dive

### Account Model

There are 3 kinds of accounts on Solana:

- Data accounts store data
- Program accounts store executable programs
- Native accounts that indicate native programs on Solana such as System, Stake, and Vote

Within data accounts, there are 2 types:

- System owned accounts
- PDA (Program Derived Address) accounts

Each account has an address (usually a public key) and an owner
(address of a program account). The full field list an account stores
is found below.

| Field | Description |
| ---------- | ---------------------------------------------- |
| lamports | The number of lamports owned by this account |
| owner | The program owner of this account |
| executable | Whether this account can process instructions |
| data | The raw data byte array stored by this account |
| rent_epoch | The next epoch that this account will owe rent |

There are a few important ownership rules:

- Only a data account's owner can modify its data and debit lamports
- Anyone is allowed to credit lamports to a data account
- The owner of an account may assign a new owner if the account's data is zeroed out

Program accounts do not store state.

For example, if you have a counter program that lets you increment a counter, you
must create two accounts, one account to store the program's code, and one to store
the counter.

![](./account_example.jpeg)

To prevent an account from being deleted, you must pay rent.

### Rent

Storing data on accounts costs SOL to maintain, and it is funded by what is called
rent. If you maintain a minimum balance equivalent to 2 years of rent payments in an
account, your account will be exempt from paying rent. You can retrieve rent by closing
the account and sending the lamports back to your wallet.

Rent is paid during two different timings:

1. When referenced by a transaction
2. Once an epoch

A percentage of rent collected by accounts is destroyed, while the rest is distributed
to vote accounts at the end of every slot.

If the account does not have enough to pay rent, the account will be deallocated and the data
removed.

It is also important to note that new accounts must be rent exempt.

## Other Resources

- [Solana Account Model](https://solana.wiki/zh-cn/docs/account-model/#account-storage)
- [Official Documentation](https://docs.solana.com/developing/programming-model/accounts)
- [pencilflip account thread](https://twitter.com/pencilflip/status/1452402100470644739)

### Credit

This core concept is credited to Pencilflip. [Follow him on Twitter](https://twitter.com/intent/user?screen_name=pencilflip).
Binary file added docs/de/core-concepts/pda-curve.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions docs/de/core-concepts/pdas.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
title: Program Derived Addresses (PDAs)
head:
- - meta
- name: title
content: Solana Cookbook | PDAs
- - meta
- name: og:title
content: Solana Cookbook | PDAs
- - meta
- name: description
content: PDAs are home to accounts that are designed to be controlled by a specific program. Learn about PDAs and more Core Concepts at The Solana cookbook.
- - meta
- name: og:description
content: PDAs are home to accounts that are designed to be controlled by a specific program. Learn about PDAs and more Core Concepts at The Solana cookbook.
- - meta
- name: og:image
content: https://solanacookbook.com/cookbook-sharing-card.png
- - meta
- name: og:image:alt
content: Solana splash card
- - meta
- name: twitter:card
content: summary
- - meta
- name: twitter:site
content: "@solanacookbook"
- - meta
- name: twitter:image
content: "https://solanacookbook.com/cookbook-sharing-card.png"
- - meta
- name: robots
content: index,follow,noodp
- - meta
- name: googlebot
content: index,follow
footer: MIT Licensed
---

# Program Derived Addresses (PDAs)

Program Derived Addresses (PDAs) are home to accounts that are designed to be controlled by a specific program. With PDAs, programs can programmatically sign for certain addresses without needing a private key. PDAs serve as the foundation for [Cross-Program Invocation](https://docs.solana.com/developing/programming-model/calling-between-programs#cross-program-invocations), which allows Solana apps to be composable with one another.

## Facts

::: tip Fact Sheet
- PDAs are 32 byte strings that look like public keys, but don’t have corresponding private keys
- `findProgramAddress` will deterministically derive a PDA from a programId and seeds (collection of bytes)
- A bump (one byte) is used to push a potential PDA off the ed25519 elliptic curve
- Programs can sign for their PDAs by providing the seeds and bump to [invoke_signed](https://docs.solana.com/developing/programming-model/calling-between-programs#program-signed-accounts)
- A PDA can only be signed by the program from which it was derived
- In addition to allowing for programs to sign for different instructions, PDAs also provide a hashmap-like interface for [indexing accounts](../guides/account-maps.md)
:::

## Deep Dive

PDAs are an essential building block for developing programs on Solana. With PDAs, programs can sign for accounts while guaranteeing that no external user could also generate a valid signature for the same account. In addition to signing for accounts, certain programs can also modify accounts held at their PDAs.

![Accounts matrix](./account-matrix.png)

<small style="text-align:center;display:block;">Image courtesy of <a href="https://twitter.com/pencilflip">Pencilflip</a></small>

### Generating PDAs

To understand the concept behind PDAs, it may be helpful to consider that PDAs are not technically created, but rather found. PDAs are generated from a combination of seeds (such as the string `“vote_account”`) and a program id. This combination of seeds and program id is then run through a sha256 hash function to see whether or not they generate a public key that lies on the ed25519 elliptic curve.

In running our program id and seeds through a hash function, there is a ~50% chance that we actually end up with a valid public key that does lie on the elliptic curve. In this case, we simply add something to fudge our input a little bit and try again. The technical term for this fudge factor is a bump. In Solana, we start with bump = 255 and simply iterate down through bump = 254, bump = 253, etc. until we get an address that is not on the elliptic curve. This may seem rudimentary, but once found it gives us a deterministic way of deriving the same PDA over and over again.

![PDA on the ellipitic curve](./pda-curve.png)

### Interacting with PDAs

When a PDA is generated, `findProgramAddress` will return both the address and the bump used to kick the address off of the elliptic curve. Armed with this bump, a program can then [sign](../references/accounts.md#sign-with-a-pda) for any instruction that requires its PDA. In order to sign, programs should pass the instruction, the list of accounts, and the seeds and bump used to derive the PDA to `invoke_signed`. In addition to signing for instructions, PDAs must also sign for their own creation via `invoke_signed`.

When building with PDAs, it is common to [store the bump seed](https://github.com/solana-labs/solana-program-library/blob/78e29e9238e555967b9125799d7d420d7d12b959/token-swap/program/src/state.rs#L100) in the account data itself. This allows developers to easily validate a PDA without having to pass in the bump as an instruction argument.

## Other Resources
- [Official Documentation](https://docs.solana.com/developing/programming-model/calling-between-programs#program-derived-addresses)
- [Understanding Program Derived Addresses](https://www.brianfriel.xyz/understanding-program-derived-addresses/)
Loading