1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! # Neo Protocol
//!
//! Core protocol types and interfaces for the Neo N3 blockchain.
//!
//! ## Overview
//!
//! The neo_protocol module provides the core types and interfaces for interacting with
//! the Neo N3 blockchain protocol. It includes:
//!
//! - Account management and address handling
//! - NEP-2 password-protected key format support
//! - Protocol error definitions and handling
//! - Response types for Neo N3 RPC calls
//! - Role-based access control definitions
//!
//! This module forms the foundation for blockchain interactions, defining the data structures
//! and interfaces that represent the Neo N3 protocol.
//!
//! ## Examples
//!
//! ### Working with Neo N3 accounts
//!
//! ```ignore
//! use neo3::neo_protocol::{Account, AccountTrait};
//!
//! // Create a new account
//! let account = Account::create().unwrap();
//! println!("Address: {}", account.address());
//! println!("Script Hash: {}", account.script_hash());
//!
//! // Create an account from a WIF (Wallet Import Format) string
//! let wif = "KwYgW8gcxj1JWJXhPSu4Fqwzfhp5Yfi42mdYmMa4XqK7NJxXUSK7";
//! let account = Account::from_wif(wif).unwrap();
//!
//! // Sign a message
//! let message = b"Hello, Neo!";
//! let signature = account.sign(message).unwrap();
//!
//! // Verify the signature
//! let is_valid = account.verify(message, &signature).unwrap();
//! assert!(is_valid);
//! ```
//!
//! ### Using NEP-2 password-protected keys
//!
//! ```ignore
//! use neo3::neo_crypto::PrivateKey;
//! use neo3::neo_protocol::nep2::{encrypt_to_nep2, decrypt_from_nep2};
//!
//! // Encrypt a private key with a password (NEP-2 format)
//! let private_key = PrivateKey::from_slice(&[/* 32 bytes */]).unwrap();
//! let password = "your_secure_password_here";
//! let nep2_string = encrypt_to_nep2(&private_key, password).unwrap();
//!
//! // Decrypt a NEP-2 string back to a private key
//! let nep2_string = "6PYVPVe1fQznphjbUxXP9KZJqPMVnVwCx5s5pr5axRJ8uHkMtZg97eT5kL";
//! let password = "your_secure_password_here";
//! let private_key = decrypt_from_nep2(nep2_string, password).unwrap();
//! ```
pub use *;
pub use *;
pub use *;
pub use *;