Skip to content

feat(platform)!: addresses on the Platform chain - #2884

Merged
QuantumExplorer merged 31 commits into
v3.0-devfrom
feat/platformAddresses
Dec 21, 2025
Merged

QuantumExplorer merged 31 commits into
v3.0-devfrom
feat/platformAddresses

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Dec 9, 2025 •

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

Introduces Platform Addresses - a new account-based system for holding and transferring credits directly on the Dash Platform chain, independent of identities. This enables simpler fund management, reduces transaction complexity, and opens new use cases for Platform-native payments.

Why Platform Addresses?

Previously, all credits on Platform were tied to identities. This created friction:

  • Creating an identity required an asset lock transaction on Core chain
  • Transferring funds required both parties to have identities
  • Simple payment use cases required heavyweight identity infrastructure

Platform Addresses solve this by allowing credits to exist in lightweight address accounts that can:

  • Receive funds from Core via asset locks
  • Transfer to other addresses or identities
  • Fund identity creation and top-ups
  • Receive withdrawals back to Core

Why Nonce-based (Account Model) vs UTXO?

We chose a nonce-based account model over UTXO for several reasons:

  1. Simplicity: Account model tracks a single balance and nonce per address, versus managing sets of unspent outputs. This simplifies state management, fee calculation, and proof verification.
  2. Predictable fees: With account model, fee estimation is straightforward - we know the exact state size. UTXO fees depend on input/output counts and can vary significantly.
  3. Efficient proofs: Proving an address balance requires a single proof path. UTXO would require proving all unspent outputs, growing with transaction history.
  4. Platform alignment: Platform already uses account model for identities (balance + revision). Using the same model for addresses maintains consistency and allows code reuse.
  5. Batching friendly: Multiple operations from/to the same address in one block simply update the same account state, rather than creating complex UTXO chains.

The nonce ensures replay protection - each transaction from an address must use the next sequential nonce, preventing double-spends without UTXO's complexity.

What was done?

New State Transitions

  1. AddressFundingFromAssetLock - Bridge funds from Core chain asset locks to Platform addresses
  2. AddressFundsTransfer - Transfer credits between Platform addresses
  3. AddressCreditWithdrawal - Withdraw credits from addresses back to Core chain
  4. IdentityCreateFromAddresses - Create new identities funded by address balances (not asset locks)
  5. IdentityTopUpFromAddresses - Top up existing identities from address balances
  6. IdentityCreditTransferToAddresses - Transfer credits from identities to addresses

Core Infrastructure

  • Address balance storage in GroveDB with nonce tracking
  • Witness system for P2PKH and P2SH address authentication
  • Fee strategies allowing flexible fee payment from inputs or outputs
  • Proof verification for address balances and nonces
  • Strategy tests for all new operation types

Fee Validation Refactoring

  • Created StateTransitionEstimatedFeeValidation trait hierarchy in dpp
  • Centralized fee calculation logic for reuse across contexts
  • Reduced code duplication in drive-abci validation

How Has This Been Tested?

Unit tests for all address state transitions

cargo test -p drive-abci address_credit_withdrawal
cargo test -p drive-abci address_funding_from_asset_lock
cargo test -p drive-abci address_funds_transfer
cargo test -p drive-abci identity_create_from_addresses
cargo test -p drive-abci identity_topup_from_addresses

Strategy tests for multi-block scenarios

cargo test -p drive-abci --test strategy_tests run_chain_address_transitions
cargo test -p drive-abci --test strategy_tests run_chain_identity_to_addresses_transitions
cargo test -p drive-abci --test strategy_tests run_chain_identity_create_from_addresses_transitions

Breaking Changes

There are breaking changes that will require a fork to protocol version 11.

@coderabbitai

coderabbitai Bot commented Dec 9, 2025 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

More than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review.

86 files out of 298 files are above the max files limit of 100. Please upgrade to Pro plan to get higher limits.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/platformAddresses

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Dec 9, 2025 •

Copy link
Copy Markdown
Contributor

❌ gRPC Query Coverage Report

================================================================================
gRPC Query Coverage Report - NEW QUERIES ONLY
================================================================================

Total queries in proto: 51
Previously known queries: 47
New queries found: 4

================================================================================

New Query Implementation Status:
--------------------------------------------------------------------------------
✓ getAddressInfo                                /home/runner/work/platform/platform/packages/rs-sdk/src/platform/query.rs
✗ getAddressesBranchState                       NOT FOUND
✓ getAddressesInfos                             /home/runner/work/platform/platform/packages/rs-sdk/src/platform/fetch_many.rs
✗ getAddressesTrunkState                        NOT FOUND

================================================================================
Summary:
--------------------------------------------------------------------------------
New queries implemented: 2 (50.0%)
New queries missing: 2 (50.0%)

Total known queries: 51
  - Implemented: 46
  - Not implemented: 4
  - Excluded: 1

Not implemented queries:
  - getAddressesBranchState
  - getAddressesTrunkState
  - getConsensusParams
  - getTokenPreProgrammedDistributions

Missing NEW queries:
  - getAddressesBranchState
  - getAddressesTrunkState

@shumkov shumkov left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Major

  1. Missing withdrawal-specific validation in AddressCreditWithdrawalTransition (pooling, core_fee_per_byte etc)

Minor

  1. Potential overflow in the validate_structure method of identity credit transfer to address transition.
  2. Potential oveflow in the validate_fees_of_event method
  3. New prove state transition implementation use only recepient balance for proof. Shall we add sender as well?

@lklimek lklimek mentioned this pull request Dec 10, 2025
3 of 6 tasks
@github-actions

github-actions Bot commented Dec 10, 2025 •

Copy link
Copy Markdown
Contributor

✅ DashSDKFFI.xcframework built for this PR.

SwiftPM (host the zip at a stable URL, then use):

.binaryTarget(
  name: "DashSDKFFI",
  url: "https://your.cdn.example/DashSDKFFI.xcframework.zip",
  checksum: "90fabd9155d689daca17388e9da1bfee23f8c812a9fdfbadcdd34129859d2429"
)

Xcode manual integration:

  • Download 'DashSDKFFI.xcframework' artifact from the run link above.
  • Drag it into your app target (Frameworks, Libraries & Embedded Content) and set Embed & Sign.
  • If using the Swift wrapper package, point its binaryTarget to the xcframework location or add the package and place the xcframework at the expected path.

@QuantumExplorer
QuantumExplorer changed the base branch from v2.2-dev to v3.0-dev December 16, 2025 21:54
@QuantumExplorer
QuantumExplorer marked this pull request as ready for review December 16, 2025 21:56
@QuantumExplorer QuantumExplorer changed the title feat: addresses on the Platform chain (#2866) feat: addresses on the Platform chain Dec 16, 2025
@QuantumExplorer

Copy link
Copy Markdown
Member Author

Decided to merge this into 3.0-dev. Fixing swift sdk, and rs-sdk will come shortly

@QuantumExplorer QuantumExplorer changed the title feat: addresses on the Platform chain feat(platform)!: addresses on the Platform chain Dec 21, 2025
@QuantumExplorer
QuantumExplorer merged commit 5905702 into v3.0-dev Dec 21, 2025
@QuantumExplorer
QuantumExplorer deleted the feat/platformAddresses branch December 21, 2025 17:02
@thephez thephez added this to the v3.0 milestone Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants