Skip to content
Merged
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
2 changes: 2 additions & 0 deletions docs/explanations/fees.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ In an attempt to minimize Dash Platform's storage requirements, users are incent

Distribution is front-loaded rather than spread evenly across those 50 years, so the refundable remainder falls fastest in the early years. Removals below a small minimum byte threshold are not refunded at all. See the [protocol constants reference](../protocol-ref/protocol-constants.md) for the storage era counts and the refund threshold.

Documents of a type that declares a [time to live](./platform-protocol-document.md#document-delete) (`ttl`) are the exception. They do not pay the permanent storage rate. Instead, each byte is priced by how long the document lives, and the document also prepays the cost of its automatic deletion. Because nothing is stored permanently, deleting such a document refunds nothing. See [Document TTL](../protocol-ref/protocol-constants.md#document-ttl) for the rates.

## Minimum and Fixed Fees

In addition to the usage-based costs above, most identity- and address-funded transitions require a protocol-defined minimum balance before processing. This is a balance floor rather than a flat charge; the fee actually deducted is still the storage and processing total.
Expand Down
2 changes: 1 addition & 1 deletion docs/explanations/platform-protocol-state-transition.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ The following table contains a list of currently defined payload types:
| [Identity Top Up From Shielded Pool](../protocol-ref/shielded-pool.md#identity-top-up-from-shielded-pool) (`22`) | Add credits to an existing identity from the shielded pool |
| Identity Key Limits Update (`23`) | Raise the credit budget or extend the expiry of one of an [identity's keys](../explanations/identity.md#keys) |
| Contract User Moderation (`24`) | A moderator action on a moderated data contract, such as banning, suspending, or warning an identity, or removing or restoring a document |
| Contract Fee Claim (`25`) | Pay out the credit action fees a data contract's document types have collected to its owner or, in equal shares, to its moderation team |
| Contract Fee Claim (`25`) | Pay out the credit action fees a data contract's document types have collected to its owner or its moderation team (an elected team is paid according to its charter's reward split) |
| Token Shielded Transfer With Shielded Fee (`26`) | Transfer tokens privately within a [token shielded pool](../explanations/shielded-pool.md#token-shielded-pools), paying the fee from the credit shielded pool |
| Token Unshield With Shielded Fee (`27`) | Move tokens from a token shielded pool to an identity's token balance, paying the fee from the credit shielded pool |
| Token Purchase From Shielded Pool (`28`) | Buy tokens at their direct purchase price into a token shielded pool, paying the price and fee from the credit shielded pool |
Expand Down
6 changes: 4 additions & 2 deletions docs/explanations/tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@ The initial token implementation includes all actions required to create, use, a

#### Claim

- Claim tokens that have been allocated to an identity by a [distribution rule](#distribution-rules) but not yet credited to its balance. Claim covers both:
- Claim tokens that have been allocated to an identity by a [distribution rule](#distribution-rules) but not yet credited to its balance. Claim covers:
- **Perpetual distributions** - tokens continuously emitted on a block, time, or epoch schedule that recipients must pull in order to take ownership.
- **Pre-programmed distributions** - tokens scheduled for specific recipients at specific times that recipients must claim to receive.
- **Once-per-identity distributions** - a fixed amount that any identity may claim exactly once, for example for an airdrop.
- Each claim collects a bounded number of unclaimed perpetual distribution intervals (128 for variable-rate distribution functions), so recipients with a long backlog may need to claim more than once to collect everything owed.

#### Emergency Action
Expand Down Expand Up @@ -253,14 +254,15 @@ following table summarizes the configurable rules and their default authorized p

##### Distribution Rules

Tokens have distribution rules to define how new tokens are introduced over time. The three
Tokens have distribution rules to define how new tokens are introduced over time. The
distribution options are summarized below:

| Method | Description | Example | Notes |
| ------ | ----------- | -------- | ------ |
| Manual Minting | Authorized users/groups can create new tokens until `maxSupply` is reached | On-demand minting | - Requires proper configuration to enable<br>- Minting actions may be logged or controlled via permissions |
| Programmed Distribution | A fixed number of tokens are allocated to designated identities at explicit timestamps, and the recipients must [claim](#claim) them to receive the tokens | *On Jan 1, 2047, allocate `X` tokens to the provided identity* | - Schedules token release at known times<br>- Each entry is a one-time allocation at a fixed timestamp; there is no recurrence option<br>- The schedule is set when the contract is registered and cannot be changed later |
| [Perpetual Distribution](../protocol-ref/data-contract-token.md#perpetual-distribution-options) | Scheduled release of tokens based on block, time, or epoch intervals | *Emit 100 tokens every 20 blocks*, or *Halve the emission every year* | - Offers ongoing, dynamic token emission patterns.<br>- Supports variable rates (e.g., linear, steps).<br>- Emissions accrue on schedule and are always collected by the recipient via a [claim](#claim). |
| [Once-per-identity Distribution](../protocol-ref/data-contract-token.md#once-per-identity-distribution) | Every identity may [claim](#claim) a fixed amount of the token once | *Airdrop 10 tokens to any identity that claims them* | - Set when the token is created and cannot be changed later<br>- Total payout is bounded only by `maxSupply`, so set a maximum supply<br>- Enabling it adds a [registration fee](../protocol-ref/data-contract-token.md#token-creation-fees) |

Dash Platform also supports three options to control the destination for newly minted tokens:

Expand Down
2 changes: 1 addition & 1 deletion docs/reference/query-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ The query modifiers described here determine how query results will be sorted an

| Modifier | Effect | Example |
| - | - | - |
| `limit` | Restricts the number of documents returned. An omitted value or `0` uses the configured default (100 by default). Positive values cannot exceed the configured maximum (also 100 by default). See [Aggregate query limits](#aggregate-query-limits) for aggregate result modes. | `limit: 10` |
| `limit` | Restricts the number of documents returned. An omitted value uses the configured default (100 by default); SDK query objects and the v0 `getDocuments` wire also treat `0` as omitted, but the v1 wire rejects it. Positive values cannot exceed the configured maximum (also 100 by default). See [Aggregate query limits](#aggregate-query-limits) for aggregate result modes. | `limit: 10` |
| `orderBy` | Returns records sorted by the field(s) provided. The `orderBy` fields must match a consecutive run of the index's properties, read from the end of the index (for a compound index, sort by one or more of its trailing fields). Required for `>`, `<`, `>=`, `<=`, `in`, `Between`, `BetweenExcludeBounds`, `BetweenExcludeLeft`, `BetweenExcludeRight`, and `startsWith` queries. Can also be used with equality-only queries to sort by a trailing field of the matched index. | `orderBy: [['normalizedLabel', 'asc']]` |
| `startAt` | Returns records beginning with the document ID provided | `startAt: '<document ID>'` |
| `startAfter` | Returns records beginning after the document ID provided | `startAfter: '<document ID>'` |
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk-rs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ newer.
```toml
[dependencies]

dash-sdk = { git="https://github.com/dashpay/platform", tag="v5.0.1" }
dash-sdk = { git="https://github.com/dashpay/platform", tag="v5.0.3" }
```

### Examples
Expand Down
62 changes: 31 additions & 31 deletions docs/sdk-rs/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ version is installed, update it by running `rustup update`.
### Install Dash Core

The Rust SDK is the best fit when you want proof-aware Platform access and tighter integration with
the current Rust codebase. Many workflows still assume access to a Dash Core full node for proof
verification and wallet-related operations. Follow the instructions below to install Dash Core and
run it on testnet. **Note:** it is possible, although not recommended, to retrieve data from Dash
Platform without proof verification.
the current Rust codebase. It requests and verifies proofs by default, which requires a source of
quorum public keys. The example below gets them from a local Dash Core node, so follow the
instructions below to install Dash Core and run it on testnet. To verify proofs without running
Dash Core, see [Using Dash Platform without Dash Core](#using-dash-platform-without-dash-core).
**Note:** it is possible, although not recommended, to retrieve data from Dash Platform without
proof verification.

- [Dash Core installation instructions](inv:user:std#dashcore-installation)
- [Running Dash Core on Testnet](inv:user:std#dashcore-testnet)
Expand All @@ -68,16 +70,17 @@ rpcpassword=<password>

Restart Dash Core to apply the changes.

:::{admonition} **Using Dash Platform without Dash Core**
:class: attention
The Rust SDK requests proofs for all data retrieved from Platform. This makes it the recommended
(most secure) option, but also is why a Dash Core full node is currently required.
### Using Dash Platform without Dash Core

The [JavaScript SDK](../tutorials/introduction.md) provides access to Dash Platform without
requiring a full node; however, it **_does not support Dash Platform's proofs_**. The Rust DAPI
client can also perform read operations without a full node if proofs are not requested. See the
[DAPI client example](#dapi-client-example) below for details.
:::
`SdkBuilder::with_core()` is intended for development. Instead of a Dash Core node, the SDK can
get quorum public keys from Dash's quorum service by passing a `TrustedHttpContextProvider` (from
the `rs-sdk-trusted-context-provider` crate) to `SdkBuilder::with_context_provider()`. Proofs are
still verified, but the quorum keys come from that service rather than from your own node. See the
[SDK examples](https://github.com/dashpay/platform/tree/v5.0.3/packages/rs-sdk/examples) for usage.
The [JavaScript SDK](../tutorials/introduction.md) uses the same approach and also verifies proofs.

The Rust DAPI client can also perform read operations without a full node if proofs are not
requested. See the [DAPI client example](#dapi-client-example) below for details.

## Create a new project

Expand All @@ -99,9 +102,9 @@ Add the following dependencies to `Cargo.toml`:

``` toml
[dependencies]
dash-sdk = { git = "https://github.com/dashpay/platform", tag = "v5.0.1" }
dpp = { git = "https://github.com/dashpay/platform", tag = "v5.0.1", features = ["client",] }
rs-dapi-client = { git = "https://github.com/dashpay/platform", tag = "v5.0.1" }
dash-sdk = { git = "https://github.com/dashpay/platform", tag = "v5.0.3" }
dpp = { git = "https://github.com/dashpay/platform", tag = "v5.0.3", features = ["client",] }
rs-dapi-client = { git = "https://github.com/dashpay/platform", tag = "v5.0.3" }
tokio = { version = "1", features = ["full"] }
```

Expand Down Expand Up @@ -189,11 +192,10 @@ Add the following dependencies to `Cargo.toml`:

``` toml
[dependencies]
dash-sdk = { git = "https://github.com/dashpay/platform", tag = "v5.0.1" }
tokio = { version = "1", features = ["full"] }
dapi-grpc = { git = "https://github.com/dashpay/platform", tag = "v5.0.1", features = ["client",] }
rs-dapi-client = { git = "https://github.com/dashpay/platform", tag = "v5.0.1" }
dpp = { git = "https://github.com/dashpay/platform", tag = "v5.0.1", features = ["client",] }
dapi-grpc = { git = "https://github.com/dashpay/platform", tag = "v5.0.3", features = ["client",] }
rs-dapi-client = { git = "https://github.com/dashpay/platform", tag = "v5.0.3" }
dpp = { git = "https://github.com/dashpay/platform", tag = "v5.0.3", features = ["client",] }
```

Open `src/main.rs` and replace the contents with this code:
Expand All @@ -204,27 +206,25 @@ use dapi_grpc::platform::v0::{
get_identity_response::Version as GetIdentityResponseVersion, GetIdentityRequest,
GetIdentityResponse, ResponseMetadata,
};
use dash_sdk::platform::Identifier;
use dash_sdk::{Sdk, SdkBuilder};
use dpp::identifier::Identifier;
use dpp::platform_value::string_encoding::Encoding;
use rs_dapi_client::{Address, DapiRequest, IntoInner};
use rs_dapi_client::{Address, AddressList, DapiClient, DapiRequest, IntoInner, RequestSettings};
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
let sdk = SdkBuilder::new(rs_dapi_client::AddressList::from_iter([
"https://52.42.202.128:1443".parse::<Address>()?,
]))
.build()
.expect("Failed to build SDK");
let client = DapiClient::new(
AddressList::from_iter(["https://52.42.202.128:1443".parse::<Address>()?]),
RequestSettings::default(),
);

let identity_id = Identifier::from_string(
// Replace with the ID of a previously created identity
"HiCs4fEtVPQgGETMR5Fy8TnXmidPCV7YqhiH19Q6z8Kf",
Encoding::Base58,
)?;

let result = fetch_identity(identity_id, &sdk).await;
let result = fetch_identity(identity_id, &client).await;
match result {
Ok(_) => println!("Identity fetched successfully."),
Err(e) => eprintln!("Error fetching identity: {:?}", e),
Expand All @@ -233,7 +233,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
Ok(())
}

async fn fetch_identity(identity_id: Identifier, sdk: &Sdk) -> Result<(), Box<dyn Error>> {
async fn fetch_identity(identity_id: Identifier, client: &DapiClient) -> Result<(), Box<dyn Error>> {
let request = GetIdentityRequest {
version: Some(dapi_grpc::platform::v0::get_identity_request::Version::V0(
GetIdentityRequestV0 {
Expand All @@ -244,7 +244,7 @@ async fn fetch_identity(identity_id: Identifier, sdk: &Sdk) -> Result<(), Box<dy
};

let identity_response = request
.execute(sdk, rs_dapi_client::RequestSettings::default())
.execute(client, RequestSettings::default())
.await
.into_inner();
println!("Identity fetch result: {:?}", identity_response);
Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"build:sdk": "esbuild scripts/evo-sdk-entry.js --bundle --format=esm --platform=browser --target=es2022 --minify --outfile=_static/vendor/evo-sdk.js"
},
"dependencies": {
"@dashevo/evo-sdk": "5.0.1"
"@dashevo/evo-sdk": "5.0.3"
},
"devDependencies": {
"esbuild": "0.25.9"
Expand Down
Loading