Skip to content
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
215 changes: 215 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
# Dash Evo Tool

**Dash Evo Tool** is a graphical user interface for easily interacting with Dash Evolution. The current version enables the following actions:

- Registering a DPNS username
- Viewing active DPNS username contests
- Voting on active DPNS username contests
- Decoding and viewing state transitions

The tool supports both Mainnet and Testnet networks.

## Table of Contents

- [Prerequisites](#prerequisites)
- [Rust Installation](#rust-installation)
- [Dash Core Wallet Setup](#dash-core-wallet-setup)
- [Installation](#installation)
- [Getting Started](#getting-started)
- [Start the App](#start-the-app)
- [Connect to a Network](#connect-to-a-network)
- [Usage](#usage)
- [Register a DPNS Username](#register-a-dpns-username)
- [Vote on an Active DPNS Contest](#vote-on-an-active-dpns-contest)
- [View Decoded State Transition](#view-decoded-state-transition)
- [Switching Networks](#switching-networks)
- [Contributing](#contributing)
- [License](#license)
- [Support](#support)
- [Security Note](#security-note)

## Prerequisites

Before you begin, ensure you have met the following requirements:

### Rust Installation

- **Rust**: Install Rust using [rustup](https://rustup.rs/):

```
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

- Update Rust to the latest version:

```
rustup update
```

### Dash Core Wallet Setup

- **Dash Core Wallet**: Download and install from [dash.org/wallets](https://www.dash.org/wallets/).

- **Synchronize Wallet**: Ensure the wallet is fully synced with the network you intend to use (Mainnet or Testnet).

## Installation

To install Dash Evo Tool:

1. **Clone the repository**:

```
git clone https://github.com/dashpay/dash-evo-tool.git
```

2. **Navigate to the project directory**:

```
cd dash-evo-tool
```

3. **Build the project**:

```
cargo build --release
```

## Getting Started

### Create `.env` File

Create a new file in the root of the dash-evo-tool directory named `.env` and copy the contents of `.env.example` into it. No changes to the file are necessary in this version.

### Start the App

Run the application using:

```
cargo run
```

### Connect to a Network

1. **Open Network Chooser**: In the app, navigate to the **Network Chooser** screen.

2. **Select Network**: Choose **Mainnet** or **Testnet**.

3. **Start Connection**: Click **Start** next to the selected network.

- If Dash Core Wallet is running and synced, the status will show **Online**.
- If not, the app attempts to start Dash Core Wallet automatically.

## Usage

### Register a DPNS Username

1. **Load User Identity**:

- Go to the **Identity** screen.
- Click **Load Identity** at the top right.
- Fill in your user identity details:
- **Identity ID** (Hex or Base58)
- **Identity Type** should be "User"
- **Alias** (optional alias for use within Dash Evo Tool)
- **Private Keys** (only the authentication key that will be used to register the name is required for registering a username. Other keys can be added later.)
- Click **Submit**.

2. **Register Username**:

- Navigate to the **DPNS** screen.
- Click **Register Username** at the top right.
- Select the Identity you'd like to register the username for.
- Enter your desired username.
- Click **Register Name**

### Vote on an Active DPNS Contest

1. **Load HPMN Identity**:

- Go to the **Identity** screen.
- Fill in your Masternode or HPMN (High Performance Masternode) identity details:
- For **Testnet**, you can click "Fill Random HPMN" or "Fill Random Masternode".
- For **Mainnet**, ensure you have valid Masternode or HPMN credentials.
- Click **Submit**.

2. **Vote on Contest**:

- Navigate to the **DPNS** screen.
- If no contests appear, click **Refresh**. If still no contests appear, there are probably no active contests.
- Locate the active contest you wish to vote on.
- Click the button for the option you'd like to vote for within the contest's row (Lock, Abstain, or an Identity ID).
- Choose the Masternode or HPMN identity to vote with or select **All** to vote with all loaded Masternodes and HPMNs.
- Confirm your vote.

### View Decoded State Transition

1. **Open State Transition Viewer**:

- Navigate to the **State Transition Viewer** screen.

2. **Decode State Transition**:

- Paste a hex or base58 encoded state transition into the input box at the top.
- View the decoded details displayed below.

## Switching Networks

1. **Open Network Chooser**:

- Go to the **Network Chooser** screen.

2. **Select Network**:

- Choose the network you'd like to interact with (**Mainnet** or **Testnet**).

3. **Check Wallet Status**:

- If Dash Core Wallet is already running on that network, the status column will show **Online**.
- If not, click **Start** to launch Dash Core Wallet on the selected network.

4. **Wait for Sync**:

- Ensure Dash Core Wallet is fully synchronized before proceeding.

## Contributing

Contributions are welcome!

- **Fork the Repository**: Click the **Fork** button on the GitHub repository page.

- **Create a Branch**:

```
git checkout -b feature/YourFeatureName
```

- **Commit Changes**: Make your changes and commit them with descriptive messages.

```
git commit -m "Add feature: YourFeatureName"
```

- **Push to Branch**:

```
git push origin feature/YourFeatureName
```

- **Submit Pull Request**: Open a pull request on GitHub and describe your changes.

- **Follow Guidelines**: Please ensure your code adheres to the project's coding standards and passes all tests.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

## Support

For assistance:

- **Issues**: Open an issue on [GitHub Issues](https://github.com/dashpay/dash-evo-tool/issues).
- **Community**: Join the Dash community forums or Discord server for discussions.

## Security Note

Keep your private keys and identity information secure. Do not share them with untrusted parties or applications.
2 changes: 1 addition & 1 deletion src/database/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::model::wallet::{AddressInfo, DerivationPathReference, DerivationPathT
use dash_sdk::dashcore_rpc::dashcore::Address;
use dash_sdk::dpp::dashcore::bip32::DerivationPath;
use dash_sdk::dpp::dashcore::hashes::Hash;
use dash_sdk::dpp::dashcore::{consensus, Network, OutPoint, Script, ScriptBuf, TxOut, Txid};
use dash_sdk::dpp::dashcore::{Network, OutPoint, ScriptBuf, TxOut, Txid};
use rusqlite::params;
use std::collections::BTreeMap;
use std::str::FromStr;
Expand Down
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

mod app;
mod config;
mod database;
Expand Down
2 changes: 1 addition & 1 deletion src/model/qualified_identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ impl QualifiedIdentity {
let mut keys = vec![];

// Check the main identity's public keys
for ((public_key, _)) in self.encrypted_private_keys.values() {
for (public_key, _) in self.encrypted_private_keys.values() {
if public_key.purpose() == Purpose::TRANSFER {
keys.push(public_key);
}
Expand Down
3 changes: 1 addition & 2 deletions src/model/wallet/utxos.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::model::wallet::Wallet;
use dash_sdk::dashcore_rpc::{Client, RpcApi};
use dash_sdk::dpp::dashcore::{Address, OutPoint, PublicKey, TxOut};
use dash_sdk::dpp::dashcore::{Address, OutPoint, TxOut};
use std::collections::{BTreeMap, HashMap};
use tracing::info;

impl Wallet {
pub fn take_unspent_utxos_for(
Expand Down
2 changes: 1 addition & 1 deletion src/platform/contested_names/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl AppContext {
.await
.map(|_| BackendTaskSuccessResult::None),
ContestedResourceTask::QueryDPNSVoteContenders(name) => self
.query_dpns_vote_contenders(name, sdk, sender)
.query_dpns_vote_contenders(name, sdk)
.await
.map(|_| BackendTaskSuccessResult::None),
Comment on lines +36 to 38

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix method signature inconsistency.

The run_contested_resource_task method still accepts a sender parameter, but it's not being used in the QueryDPNSVoteContenders branch. This creates an inconsistency between the interface and implementation.

Consider one of these approaches:

  1. If sender is no longer needed:
- pub async fn run_contested_resource_task(
-     self: &Arc<Self>,
-     task: ContestedResourceTask,
-     sdk: &Sdk,
-     sender: mpsc::Sender<TaskResult>,
- ) -> Result<BackendTaskSuccessResult, String> {
+ pub async fn run_contested_resource_task(
+     self: &Arc<Self>,
+     task: ContestedResourceTask,
+     sdk: &Sdk,
+ ) -> Result<BackendTaskSuccessResult, String> {
  1. If sender is still needed:
- .query_dpns_vote_contenders(name, sdk)
+ .query_dpns_vote_contenders(name, sdk, sender)

Committable suggestion was skipped due to low confidence.

ContestedResourceTask::VoteOnDPNSName(name, vote_choice, voters) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl AppContext {
// Acquire a permit from the semaphore
let _permit: OwnedSemaphorePermit = semaphore.acquire_owned().await.unwrap();

match self_ref.query_dpns_ending_times(sdk, sender.clone()).await {
match self_ref.query_dpns_ending_times(sdk).await {
Ok(_) => {
// Send a refresh message if the query succeeded
sender
Expand Down Expand Up @@ -112,10 +112,7 @@ impl AppContext {
let _permit: OwnedSemaphorePermit = semaphore.acquire_owned().await.unwrap();

// Perform the query
match self_ref
.query_dpns_vote_contenders(&name, sdk, sender.clone())
.await
{
match self_ref.query_dpns_vote_contenders(&name, sdk).await {
Ok(_) => {
// Send a refresh message if the query succeeded
sender
Expand Down
3 changes: 0 additions & 3 deletions src/platform/contested_names/query_dpns_vote_contenders.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::app::TaskResult;
use crate::context::AppContext;
use dash_sdk::dpp::data_contract::accessors::v0::DataContractV0Getters;
use dash_sdk::dpp::data_contract::document_type::accessors::DocumentTypeV0Getters;
Expand All @@ -10,14 +9,12 @@ use dash_sdk::drive::query::vote_poll_vote_state_query::{
};
use dash_sdk::platform::FetchMany;
use dash_sdk::Sdk;
use tokio::sync::mpsc;

impl AppContext {
pub(super) async fn query_dpns_vote_contenders(
&self,
name: &String,
sdk: Sdk,
sender: mpsc::Sender<TaskResult>,
) -> Result<(), String> {
let data_contract = self.dpns_contract.as_ref();
let document_type = data_contract
Expand Down
8 changes: 1 addition & 7 deletions src/platform/contested_names/query_ending_times.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,10 @@ use dash_sdk::platform::FetchMany;
use std::collections::BTreeMap;
use std::sync::Arc;

use crate::app::TaskResult;
use dash_sdk::Sdk;
use tokio::sync::mpsc;

impl AppContext {
pub(super) async fn query_dpns_ending_times(
self: &Arc<Self>,
sdk: Sdk,
sender: mpsc::Sender<TaskResult>,
) -> Result<(), String> {
pub(super) async fn query_dpns_ending_times(self: &Arc<Self>, sdk: Sdk) -> Result<(), String> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Inconsistent sender parameter removal across contested_names module

The verification reveals that mpsc::Sender is still being used in other files within the same module:

  • query_dpns_contested_resources.rs: Uses sender: mpsc::Sender<TaskResult>
  • mod.rs: Uses sender: mpsc::Sender<TaskResult>
  • vote_on_dpns_name.rs: Uses _sender: mpsc::Sender<TaskResult>

This indicates an inconsistent pattern where the sender parameter was removed only from query_ending_times.rs while being retained in related files, potentially breaking the module's cohesive design.

🔗 Analysis chain

LGTM: Method signature simplification aligns with PR objectives.

The removal of the sender parameter streamlines the interface while maintaining the same functionality through the Result return type. This change is consistent with similar modifications in related files and helps reduce unused code as per the PR objectives.

Let's verify this is part of a consistent pattern across the codebase:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining mpsc::Sender usage in related files
# to ensure consistency of the interface changes

# Search for any remaining Sender usage in contested_names
rg -A 3 "mpsc::Sender" "src/platform/contested_names/"

Length of output: 1185

let now: DateTime<Utc> = Utc::now();
let start_time_dt = now - Duration::weeks(2);
let end_time_dt = now + Duration::weeks(2);
Expand Down
2 changes: 1 addition & 1 deletion src/platform/identity/add_key_to_identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use dash_sdk::dpp::state_transition::proof_result::StateTransitionProofResult;
use dash_sdk::platform::transition::broadcast::BroadcastStateTransition;
use dash_sdk::platform::{Fetch, Identity, IdentityPublicKey};
use dash_sdk::Sdk;
use futures::TryFutureExt;

impl AppContext {
pub(super) async fn add_key_to_identity(
&self,
Expand Down
9 changes: 2 additions & 7 deletions src/platform/identity/register_identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,13 @@ use dash_sdk::dapi_grpc::core::v0::{
BroadcastTransactionRequest, GetBlockchainStatusRequest, GetTransactionRequest,
GetTransactionResponse,
};
use dash_sdk::dashcore_rpc::dashcore::PrivateKey;
use dash_sdk::dashcore_rpc::RpcApi;
use dash_sdk::dpp::dashcore::psbt::serialize::Serialize;
use dash_sdk::dpp::dashcore::{Address, Transaction};
use dash_sdk::dpp::prelude::AssetLockProof;
use dash_sdk::platform::transition::put_identity::PutIdentity;
use dash_sdk::platform::Identity;
use dash_sdk::{RequestSettings, Sdk};
use rand::prelude::StdRng;
use std::collections::BTreeMap;
use dash_sdk::RequestSettings;
use std::time::Duration;
use tokio::sync::MutexGuard;

impl AppContext {
pub(crate) async fn broadcast_and_retrieve_asset_lock(
Expand Down Expand Up @@ -108,7 +103,7 @@ impl AppContext {
input: IdentityRegistrationInfo,
) -> Result<(), String> {
let IdentityRegistrationInfo {
alias_input,
alias_input: _,
amount,
keys,
identity_index,
Expand Down
2 changes: 1 addition & 1 deletion src/ui/components/contract_chooser_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub fn add_contract_chooser_panel(
current_search_term: &mut String,
app_context: &Arc<AppContext>,
) -> AppAction {
let mut action = AppAction::None;
let action = AppAction::None;

// Fetch contracts from the app context
let contracts = app_context.get_contracts(None, None).unwrap_or_else(|e| {
Expand Down
8 changes: 1 addition & 7 deletions src/ui/components/left_panel.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
use crate::app::AppAction;
use crate::context::AppContext;
use crate::ui::RootScreenType;
use eframe::epaint::{Color32, Margin};
use egui::{Context, Frame, ImageButton, SidePanel, TextureHandle};
use rust_embed::RustEmbed;
use std::sync::Arc;

#[derive(RustEmbed)]
#[folder = "icons/"] // Adjust the folder path if necessary
Expand Down Expand Up @@ -35,11 +33,7 @@ fn load_icon(ctx: &Context, path: &str) -> Option<TextureHandle> {
}
}

pub fn add_left_panel(
ctx: &Context,
app_context: &Arc<AppContext>,
selected_screen: RootScreenType,
) -> AppAction {
pub fn add_left_panel(ctx: &Context, selected_screen: RootScreenType) -> AppAction {
let mut action = AppAction::None;

// Define the button details directly in this function
Expand Down
Loading