• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tari-project / tari / 15853103462

24 Jun 2025 02:21PM UTC coverage: 71.683% (-0.7%) from 72.398%
15853103462

push

github

web-flow
feat: offline signing (#7122)

Description
---

Adds the following features.

### CLI `--skip-recovery` option.

Cold wallets need to run in environments without Internet connection.
Console wallet created from seed words will require full initial
recovery to proceed with other functionality.
This switch allows to skip the recovery step.

### "prepare-one-sided-transaction-for-signing" CLI command

```sh
minotari_console_wallet prepare-one-sided-transaction-for-signing --output-file <unsigned_tx_file> <amount> <recipient_address>
```

Supposed to be run on _hot side_. This will create an unsigned
transaction request, which needs to be signed on cold side.

### "sign-one-sided-transaction" CLI command

```sh
minotari_console_wallet sign-one-sided-transaction --input-file <unsigned_tx_file> --output-file <signed_tx_file>
```

Supposed to be run on _cold side_. Signs the transaction using **private
spend key**.

### "broadcast-signed-one-sided-transaction" CLI command

```sh
minotari_console_wallet broadcast-signed-one-sided-transaction --input-file <signed_tx_file>
```

Supposed to be run on _hot side_. Broadcasts the signed transaction to
Tari network (mempool)

### GRPC methods to be run on _hot side_

* PrepareOneSidedTransactionForSigning
* BroadcastSignedOneSidedTransaction

Motivation and Context
---

Exchanges are requesting a way to have offline signing.
Basically, they want two wallets:
- a hot wallet, which uses view key and public spend key
- cold wallet with private spend key, not connected to internet

The signing process would look like follows.
1. Hot wallet is requested to create an unsigned transaction (from
recipient address and amount). There will be an option to use CLI to
create a file, which contains unsigned transaction
2. Unisigned transaction will be airgap transferred to cold wallet,
where it is signed via CLI. The output will be another file containing a
signed transaction
3. Signed transaction file is transferred to hot walle... (continued)

0 of 851 new or added lines in 9 files covered. (0.0%)

301 existing lines in 23 files now uncovered.

82846 of 115572 relevant lines covered (71.68%)

239176.69 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

16.67
/base_layer/core/src/base_node/sync/ban.rs
1
//  Copyright 2023, The Tari Project
2
//
3
//  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
4
//  following conditions are met:
5
//
6
//  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
7
//  disclaimer.
8
//
9
//  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
10
//  following disclaimer in the documentation and/or other materials provided with the distribution.
11
//
12
//  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
13
//  products derived from this software without specific prior written permission.
14
//
15
//  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
16
//  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
//  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18
//  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19
//  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
20
//  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
21
//  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22

23
use std::time::Duration;
24

25
use log::*;
26
use tari_comms::{connectivity::ConnectivityRequester, peer_manager::NodeId};
27

28
use crate::base_node::BlockchainSyncConfig;
29

30
const LOG_TARGET: &str = "c::bn::sync";
31

32
// Sync peers are banned if there exists a ban reason for the error and the peer is not on the allow list for sync.
33

34
pub struct PeerBanManager {
35
    config: BlockchainSyncConfig,
36
    connectivity: ConnectivityRequester,
37
}
38

39
impl PeerBanManager {
40
    pub fn new(config: BlockchainSyncConfig, connectivity: ConnectivityRequester) -> Self {
12✔
41
        Self { config, connectivity }
12✔
42
    }
12✔
43

UNCOV
44
    pub async fn ban_peer_if_required(&mut self, node_id: &NodeId, ban_reason: String, ban_duration: Duration) {
×
UNCOV
45
        if self.config.forced_sync_peers.contains(node_id) {
×
46
            debug!(
×
47
                target: LOG_TARGET,
×
48
                "Not banning peer that is on the allow list for sync. Ban reason = {}", ban_reason
×
49
            );
50
            return;
×
UNCOV
51
        }
×
UNCOV
52
        debug!(target: LOG_TARGET, "Sync peer {} removed from the sync peer list because {}", node_id, ban_reason);
×
53

UNCOV
54
        match self
×
UNCOV
55
            .connectivity
×
UNCOV
56
            .ban_peer_until(node_id.clone(), ban_duration, ban_reason.clone())
×
UNCOV
57
            .await
×
58
        {
59
            Ok(_) => {
UNCOV
60
                warn!(target: LOG_TARGET, "Banned sync peer {} for {:?} because {}", node_id, ban_duration, ban_reason)
×
61
            },
62
            Err(err) => error!(target: LOG_TARGET, "Failed to ban sync peer {}: {}", node_id, err),
×
63
        }
UNCOV
64
    }
×
65
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc