Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
189 commits
Select commit Hold shift + click to select a range
47b75f3
initial commit
fluffypony Jun 1, 2025
8151471
add payref to output manager
fluffypony Jun 1, 2025
5b0bcd5
implement in gRPC
fluffypony Jun 1, 2025
fb05599
add to existing gRPC outputs
fluffypony Jun 1, 2025
7fde31e
change how we get the block hash
fluffypony Jun 1, 2025
c53884e
update gRPC responses
fluffypony Jun 1, 2025
f0f6ad7
return hex instead of bytes for payref
fluffypony Jun 1, 2025
8ca45da
fix GetCompletedTransactions to return payref
fluffypony Jun 1, 2025
781cfc2
add payref commands to console wallet
fluffypony Jun 1, 2025
2abcb87
fix payref in TUI
fluffypony Jun 2, 2025
8f37a8b
FFI payref integration
fluffypony Jun 2, 2025
daeff64
add payref searching to the base node
fluffypony Jun 2, 2025
3b321a0
add payref indexing so the base node doesn't get chewed up
fluffypony Jun 2, 2025
695924e
move payref to its own crate, add docs and test
fluffypony Jun 2, 2025
48cfe25
fix errors
fluffypony Jun 2, 2025
88e33cb
build PayRef index on first start after upgrade
fluffypony Jun 2, 2025
dadc129
Merge branch 'development' into payref
stringhandler Jun 2, 2025
664fe42
fix clippy complaints + test compiling
fluffypony Jun 2, 2025
fd288b5
Merge branch 'payref' of https://github.com/fluffypony/tari into payref
fluffypony Jun 2, 2025
f21bb15
fix incorrect FFI implementation
fluffypony Jun 2, 2025
bd73907
fix coderabbit issues
fluffypony Jun 2, 2025
d76c51a
fix build + linting
fluffypony Jun 3, 2025
2ae1b2a
unify config
fluffypony Jun 3, 2025
7c93b22
fix duplicate function
fluffypony Jun 3, 2025
93687e8
fix coderabbit nitpicks
fluffypony Jun 3, 2025
46eb56e
remove pagination + dupes
fluffypony Jun 3, 2025
644cf9b
use crate constant instead of hardcoded value
fluffypony Jun 3, 2025
770f0a6
clean up gRPC by removing pagination
fluffypony Jun 3, 2025
9a11e5e
Merge branch 'development' into payref
SWvheerden Jun 3, 2025
03ead4b
Update PayRef formula from commitment to output_hash
fluffypony Jun 4, 2025
cb3e8b1
Add output hash storage to transaction models
fluffypony Jun 4, 2025
923b936
Implement fast PayRef calculation using stored output hashes
fluffypony Jun 4, 2025
f9e70fc
Fix compilation errors in PayRef implementation
fluffypony Jun 4, 2025
e7632eb
Update core blockchain database to use output_hash for PayRef generation
fluffypony Jun 4, 2025
de60252
Add wallet ownership detection methods to OutputManager
fluffypony Jun 4, 2025
705bbec
Complete OutputManager handle interface for PayRef integration
fluffypony Jun 4, 2025
d3e25c2
Implement receiver protocol output hash capture for PayRef
fluffypony Jun 4, 2025
9032d07
Add service method implementations for PayRef API with compilation er…
fluffypony Jun 4, 2025
6fb38b5
Fix PayRef service method implementations to compile successfully
fluffypony Jun 4, 2025
2c07b8d
Add FFI API functions for PayRef functionality
fluffypony Jun 4, 2025
185e1eb
Add gRPC API definitions for PayRef functionality
fluffypony Jun 4, 2025
388a3ef
Enhance console wallet PayRef commands to use new multiple PayRef APIs
fluffypony Jun 4, 2025
fea3168
Fix hex encoding usage in PayRef commands
fluffypony Jun 4, 2025
90e04cf
Implement missing gRPC methods and fix compilation issues
fluffypony Jun 4, 2025
17ce4f7
Add PayRef columns to database schema and SQL structs
fluffypony Jun 4, 2025
9cb6dc7
Fix all struct initializations with PayRef fields
fluffypony Jun 4, 2025
5cf8dbd
Add basic PayRef unit tests and start fixing test structs
fluffypony Jun 4, 2025
018b3fb
Add basic PayRef integration tests - core functionality works
fluffypony Jun 4, 2025
fb87320
Implement PayRef serialization/deserialization helpers and fix first …
fluffypony Jun 4, 2025
abb7766
Fix PayRef serialization/deserialization in transaction storage
fluffypony Jun 4, 2025
9d22cca
Fix remaining test CompletedTransaction struct initializations
fluffypony Jun 4, 2025
615bf65
Fix PayRef error handling types in serialization
fluffypony Jun 4, 2025
15bfce4
Implement PayRef output hash population when transactions are mined
fluffypony Jun 4, 2025
dfe5645
Implement gRPC PayRef methods using actual transaction data
fluffypony Jun 4, 2025
5d641a6
Fix gRPC PayRef compilation errors
fluffypony Jun 4, 2025
1a88b8e
Fix PayRef test types and imports (partial)
fluffypony Jun 4, 2025
c260f74
Add PayRef cleanup during block deletion for reorgs
fluffypony Jun 4, 2025
a5bbff6
Complete PayRef reorg cleanup implementation - all tests passing
fluffypony Jun 4, 2025
4861fa1
fix coderabbit issue
fluffypony Jun 4, 2025
a40f097
add a space to the TUI description
fluffypony Jun 4, 2025
cffa97c
Add PayRef migration batch commit optimization
fluffypony Jun 4, 2025
4b86d1a
Add PayRef migration checkpointing support
fluffypony Jun 4, 2025
7084874
Add PayRef migration error handling and recovery
fluffypony Jun 4, 2025
4522bf8
Replace PayRef cleanup error suppression with proper handling
fluffypony Jun 4, 2025
29b60bf
Add transaction verification and replace panic-prone code
fluffypony Jun 4, 2025
5d99909
Update PayRef service documentation for consistency
fluffypony Jun 4, 2025
490674f
Enhance FFI documentation and clarify response types
fluffypony Jun 4, 2025
2142828
Fix critical PayRef generation bug - use proper Blake2b hash
fluffypony Jun 4, 2025
f41d3d3
Enforce minimum confirmation requirements for PayRef generation
fluffypony Jun 4, 2025
fd29c26
Improve PayRef migration error handling and resource monitoring
fluffypony Jun 4, 2025
bf83b2b
Add detailed documentation for wallet_generate_payment_reference_from…
fluffypony Jun 4, 2025
13b7a91
Add detailed documentation for wallet_format_payment_reference
fluffypony Jun 4, 2025
61184f1
Fix compilation errors by using correct error variant
fluffypony Jun 4, 2025
2cff8bf
Fix compilation errors in PayRef migration code
fluffypony Jun 4, 2025
06c848a
Improve PayRef cleanup error handling in delete_block_inputs_outputs
fluffypony Jun 5, 2025
0167d7d
Add granular error handling and resource monitoring to PayRef migrati…
fluffypony Jun 5, 2025
726feaa
Add database integrity verification before PayRef migration
fluffypony Jun 5, 2025
f171cbb
feat: add docs with payref included
fluffypony Jun 5, 2025
ebedf8c
Increase PayRef migration disk space thresholds: 50MB->500MB warn, 20…
fluffypony Jun 5, 2025
9236031
Add batch commitment query to OutputManager for PayRef optimization
fluffypony Jun 5, 2025
3882fae
Optimize PayRef lookup using targeted database query
fluffypony Jun 5, 2025
3b455d4
Add multiple payment_references support to TransactionInfo
fluffypony Jun 5, 2025
ecad66c
Fix multiple PayRef return bug - populate all PayRefs instead of just…
fluffypony Jun 5, 2025
304b98b
Optimize UI PayRef calculation using batch commitment query
fluffypony Jun 5, 2025
b8819d4
Add database indexes for PayRef performance optimization
fluffypony Jun 5, 2025
29829eb
Fix compilation errors in PayRef implementation
fluffypony Jun 5, 2025
6d64c87
Fix remaining compilation errors and warnings
fluffypony Jun 5, 2025
a3ac3ac
Fix clippy::io_other_error lint issue
fluffypony Jun 5, 2025
d712dc3
Remove deprecated payment_reference field from gRPC schema
fluffypony Jun 5, 2025
05a2877
Replace [u8; 32] with FixedHash in FetchOutputByPayRef
fluffypony Jun 5, 2025
cc102db
Replace manual async implementation with make_async_fn! macro
fluffypony Jun 5, 2025
193cf29
Remove outdated comments from lmdb_db.rs
fluffypony Jun 5, 2025
77590fe
Change PayRef deletion warnings to errors
fluffypony Jun 5, 2025
b7e94d3
Replace [u8; 32] with FixedHash in GetPaymentByReference
fluffypony Jun 5, 2025
943f41e
Error instead of defaulting when output change check fails
fluffypony Jun 5, 2025
95c8d57
Change get_transaction_payrefs return type to Vec<FixedHash>
fluffypony Jun 5, 2025
e6e8545
Remove bincode serialization for output hashes, use raw byte form
fluffypony Jun 5, 2025
ee99dcc
Fix FixedHash type compatibility issues in wallet service
fluffypony Jun 5, 2025
f34e4a0
Fix console wallet PayRef calculation using direct transaction approach
fluffypony Jun 5, 2025
83fe76a
Simplify wallet output direction logic using PaymentId check
fluffypony Jun 5, 2025
5424fa4
Change SQLite schema to use Vec<FixedHash> directly
fluffypony Jun 5, 2025
0fa10fa
Add missing FixedHash imports to async_db.rs and comms_request.rs
fluffypony Jun 5, 2025
5ed30e7
Add missing BlockchainDatabase method implementations
fluffypony Jun 5, 2025
fe06ecd
Remove unused doc comments from async macros
fluffypony Jun 5, 2025
06e88b0
Fix core compilation errors and type consistency issues
fluffypony Jun 5, 2025
9b68e38
Revert SQLite schema changes and implement proper FixedHash conversion
fluffypony Jun 5, 2025
361c302
Update transaction models to use Vec<FixedHash> and fix type consistency
fluffypony Jun 5, 2025
ff10b0b
Fix all remaining compilation errors and type mismatches
fluffypony Jun 5, 2025
1546614
Fix clippy error by changing loop to conditional in PayRef generation
fluffypony Jun 5, 2025
7ee6726
Refactor duplicate payment reference functions with helper functions
fluffypony Jun 5, 2025
d2e063f
Fix formatting logic duplication with TODO for custom format
fluffypony Jun 5, 2025
1536c88
Add standardized documentation to PayRef functions in wallet.h
fluffypony Jun 5, 2025
6d230c1
Add bounds checking for PayRef hex string slicing to prevent panic
fluffypony Jun 5, 2025
1b25d0e
Fix compilation errors in refactored payment reference functions
fluffypony Jun 5, 2025
dbc597d
Apply code formatting fixes for final linting compliance
fluffypony Jun 5, 2025
b5c128d
Add OutputWithPayRef data structures for per-output PayRef tracking
fluffypony Jun 5, 2025
58e572d
Update service.rs with per-output PayRef generation logic
fluffypony Jun 5, 2025
d47e5c6
Update gRPC server to use per-output PayRef approach
fluffypony Jun 5, 2025
e3ae913
Update console wallet UI to display per-output PayRefs
fluffypony Jun 5, 2025
fbb44ec
Add FFI interface for per-output PayRef structures and functions
fluffypony Jun 5, 2025
5f68a66
Add tests for per-output PayRef structures
fluffypony Jun 5, 2025
b011c0f
Fix compilation errors in gRPC and FFI interfaces
fluffypony Jun 5, 2025
e6cb0d8
Import DbWalletOutput for PayRef output data
fluffypony Jun 5, 2025
bdad927
Add output manager get_output_by_hash method for PayRef
fluffypony Jun 5, 2025
0e98362
Replace mock data with real output amounts and status from output man…
fluffypony Jun 5, 2025
226a55d
Implement wallet_get_payref_for_output_hash FFI function
fluffypony Jun 5, 2025
05ecb8c
Fix compilation errors: remove invalid OutputStatus variant and unuse…
fluffypony Jun 5, 2025
6565bd9
Fix clippy warnings: box large enum variant and remove problematic test
fluffypony Jun 5, 2025
5c362ff
Apply clippy fixes and remove test module reference
fluffypony Jun 5, 2025
b6badb7
Remove redundant conversion in output_hashes processing
fluffypony Jun 5, 2025
ac5e904
Update core PaymentReference type from [u8; 32] to FixedHash
fluffypony Jun 5, 2025
a4e8b81
Update PaymentDetails and PaymentRecord structs to use FixedHash
fluffypony Jun 5, 2025
ed50664
Update transaction service structs to use FixedHash
fluffypony Jun 5, 2025
f5bc192
Update output manager handle enum and method to use FixedHash
fluffypony Jun 5, 2025
3dd0da3
Update blockchain backend interface to use FixedHash
fluffypony Jun 5, 2025
6ba8e56
Update LMDB database methods to use FixedHash
fluffypony Jun 5, 2025
8950f4c
Update blockchain database method to use FixedHash
fluffypony Jun 5, 2025
1c3ea56
Update async database macros to use FixedHash
fluffypony Jun 5, 2025
0da1a45
Update local interface methods to use FixedHash
fluffypony Jun 5, 2025
06af2fe
Update test helper methods to use FixedHash
fluffypony Jun 5, 2025
5dd0022
Update output manager service methods to use FixedHash
fluffypony Jun 5, 2025
b26b338
Update FFI layer to use FixedHash
fluffypony Jun 5, 2025
c308e38
Fix inbound handler PayRef usage for FixedHash
fluffypony Jun 5, 2025
0201312
Fix compilation errors for FixedHash conversion
fluffypony Jun 5, 2025
3373a8d
Fix remaining FFI compilation errors for FixedHash
fluffypony Jun 5, 2025
36feb75
Fix clippy warnings and test compilation error
fluffypony Jun 5, 2025
5e687df
Optimize console wallet PayRef calculation to use transaction service
fluffypony Jun 5, 2025
447d3ee
Optimize OMS PayRef methods to use transaction service instead of out…
fluffypony Jun 5, 2025
8f0e470
Fix compilation errors and unused variable warnings
fluffypony Jun 5, 2025
7de87ed
Clean up unused variables and mark deprecated methods as allow(dead_c…
fluffypony Jun 5, 2025
a994e2b
format
SWvheerden Jun 6, 2025
2b9ae6f
wip cleanup
SWvheerden Jun 6, 2025
e152e06
some changes
SWvheerden Jun 6, 2025
f2f7a2b
change command
SWvheerden Jun 6, 2025
1106632
more stuff
SWvheerden Jun 6, 2025
78f86e2
more work
SWvheerden Jun 9, 2025
fa05b71
more wip
SWvheerden Jun 9, 2025
f14efb7
done wallet grpc server
SWvheerden Jun 9, 2025
b6be593
more delete
SWvheerden Jun 9, 2025
969faa0
more work
SWvheerden Jun 9, 2025
3d9c660
more cleanup
SWvheerden Jun 9, 2025
f206653
cleanup
SWvheerden Jun 9, 2025
2b001fd
cleanup
SWvheerden Jun 9, 2025
87706ee
more cleanup
SWvheerden Jun 9, 2025
88f92b3
fixes
SWvheerden Jun 9, 2025
edfbff7
more cleanup
SWvheerden Jun 9, 2025
b58753c
fix trp
SWvheerden Jun 9, 2025
37957f0
cleanup stp
SWvheerden Jun 9, 2025
0f7eba6
cleanup ffi
SWvheerden Jun 9, 2025
e83dd17
final cleanup ffi
SWvheerden Jun 9, 2025
59a01cd
cleanup
SWvheerden Jun 9, 2025
cfa9d88
More cleanup
SWvheerden Jun 10, 2025
98aa160
fix
SWvheerden Jun 10, 2025
82ed25b
more removed
SWvheerden Jun 10, 2025
e09fca4
more fixes
SWvheerden Jun 10, 2025
f28531a
oms models
SWvheerden Jun 10, 2025
3b0fc3b
build
SWvheerden Jun 10, 2025
58d98cc
More updates
SWvheerden Jun 10, 2025
add2d86
exstra debug
SWvheerden Jun 10, 2025
7d8a87a
Merge branch 'development' into payref
SWvheerden Jun 10, 2025
e266c78
fmt
SWvheerden Jun 10, 2025
f4890ef
fix migrate
SWvheerden Jun 10, 2025
a27a163
Fix payment id cutoff
Jun 10, 2025
a4edf2f
fix for utxo
SWvheerden Jun 10, 2025
ba5bd8d
fix db migration bug
SWvheerden Jun 10, 2025
50bc979
done
SWvheerden Jun 10, 2025
a7807db
code rabbit
SWvheerden Jun 11, 2025
c281d7d
fixes
SWvheerden Jun 11, 2025
0ce902f
fix cw update
SWvheerden Jun 11, 2025
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
5 changes: 3 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion applications/minotari_app_grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license.workspace = true
[dependencies]
tari_common_types = { workspace = true }
tari_comms = { workspace = true }
tari_core = { workspace = true }
tari_core = { workspace = true, features = ["base_node"] }
tari_crypto = { workspace = true }
tari_script = { workspace = true }
tari_max_size = { workspace = true }
Expand Down
34 changes: 34 additions & 0 deletions applications/minotari_app_grpc/proto/base_node.proto
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ service BaseNode {
rpc GetTemplateRegistrations(GetTemplateRegistrationsRequest) returns (stream GetTemplateRegistrationResponse);
rpc GetSideChainUtxos(GetSideChainUtxosRequest) returns (stream GetSideChainUtxosResponse);
rpc GetNetworkState(GetNetworkStateRequest) returns (GetNetworkStateResponse);
// PayRef (Payment Reference) lookup for block explorers and external services
rpc SearchPaymentReferences(SearchPaymentReferencesRequest) returns (stream PaymentReferenceResponse);
}

message GetAssetMetadataRequest {
Expand Down Expand Up @@ -559,3 +561,35 @@ message LivenessResult{
uint64 ping_latency = 3;
}

// PayRef (Payment Reference) search and lookup messages

// Request to search for outputs by payment reference
message SearchPaymentReferencesRequest {
// Payment reference as hex string (64 characters)
repeated string payment_reference_hex = 1;
// Optional: include spent outputs in results
bool include_spent = 2;
}

// Response containing payment reference match
message PaymentReferenceResponse {
// The payment reference that was found
string payment_reference_hex = 1;
// Block height where the output was mined
uint64 block_height = 2;
// Block hash where the output was mined
bytes block_hash = 3;
// Timestamp when the output was mined
uint64 mined_timestamp = 4;
// Output commitment (32 bytes)
bytes commitment = 5;
// Whether this output has been spent
bool is_spent = 6;
// Height where output was spent (if spent)
uint64 spent_height = 7;
// Block hash where output was spent (if spent)
bytes spent_block_hash = 8;
// Transaction output amount will be 0 for non set a
uint64 min_value_promise = 9;
}

4 changes: 4 additions & 0 deletions applications/minotari_app_grpc/proto/transaction.proto
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ message TransactionOutput {
bytes encrypted_data = 10;
// The minimum value of the commitment that is proven by the range proof (in MicroMinotari)
uint64 minimum_value_promise = 11;
// Payment reference (PayRef) - 32-byte Blake2b hash of (block_hash || output_hash)
// This provides a unique, deterministic reference for the output that can be used
// for payment verification without revealing wallet ownership
bytes payment_reference = 12;
}

// Options for UTXOs
Expand Down
137 changes: 137 additions & 0 deletions applications/minotari_app_grpc/proto/wallet.proto
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,44 @@ service Wallet {
// ```
rpc GetBlockHeightTransactions (GetBlockHeightTransactionsRequest) returns (GetBlockHeightTransactionsResponse);

// Returns all PayRefs (payment references) for a specific transaction.
//
// The `GetTransactionPayRefs` call retrieves all PayRefs associated with the specified
// transaction ID. PayRefs are cryptographic references generated from output hashes
// that allow recipients to verify payments without revealing sensitive transaction details.
//
// ### Request Parameters:
//
// - `transaction_id` (required):
// - **Type**: `uint64`
// - **Description**: The transaction ID to retrieve PayRefs for.
// - **Restrictions**:
// - Must be a valid transaction ID that exists in the wallet.
// - If the transaction ID is invalid or not found, an error will be returned.
//
// ### Example JavaScript gRPC client usage:
//
// ```javascript
// const request = {
// transaction_id: 12345
// };
// const response = await client.getTransactionPayRefs(request);
// console.log("PayRefs:", response.payment_references.map(ref => Buffer.from(ref).toString('hex')));
// ```
//
// ### Sample JSON Response:
//
// ```json
// {
// "payment_references": [
// "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
// "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321"
// ]
// }
// ```
rpc GetTransactionPayRefs (GetTransactionPayRefsRequest) returns (GetTransactionPayRefsResponse);


// Returns the wallet balance details.
//
// The `GetBalance` call retrieves the current balance status of the wallet,
Expand Down Expand Up @@ -1050,6 +1088,52 @@ service Wallet {

// Get all completed transactions including cancelled ones, sorted by timestamp and paginated
rpc GetAllCompletedTransactions(GetAllCompletedTransactionsRequest) returns (GetAllCompletedTransactionsResponse);

// Gets transaction information by payment reference (PayRef)
//
// The `GetPaymentByReference` call retrieves transaction information using a 32-byte payment reference hash.
// PayRefs are generated as Blake2b_256(block_hash || output_hash) and provide a stable way to look up
// transactions even after outputs are spent.
//
// ### Request Parameters:
//
// - `payment_reference` (required):
// - **Type**: `bytes` (32 bytes)
// - **Description**: The payment reference hash to look up
// - **Restrictions**: Must be exactly 32 bytes representing a valid PayRef
//
// ### Example JavaScript gRPC client usage:
//
// ```javascript
// const payref = Buffer.from('a1b2c3d4e5f6789012345678901234567890123456789012345678901234567890', 'hex');
// const request = { payment_reference: payref };
// client.getPaymentByReference(request, (err, response) => {
// if (err) console.error(err);
// else console.log('Transaction found:', response.transaction);
// });
// ```
//
// ### Sample JSON Response:
//
// ```json
// {
// "transaction": {
// "tx_id": 12345,
// "source_address": "0x1234abcd...",
// "dest_address": "0x5678efgh...",
// "status": "TRANSACTION_STATUS_MINED_CONFIRMED",
// "direction": "TRANSACTION_DIRECTION_INBOUND",
// "amount": 1000000,
// "fee": 20,
// "is_cancelled": false,
// "excess_sig": "0xabcdef...",
// "timestamp": 1681234567,
// "payment_id": "0xdeadbeef...",
// "mined_in_block_height": 150000
// }
// }
// ```
rpc GetPaymentByReference(GetPaymentByReferenceRequest) returns (GetPaymentByReferenceResponse);
}


Expand Down Expand Up @@ -1197,6 +1281,9 @@ message TransactionInfo {
bytes user_payment_id = 14;
repeated bytes input_commitments = 15;
repeated bytes output_commitments = 16;
repeated bytes payment_references_sent = 17;
repeated bytes payment_references_received = 18;
repeated bytes payment_references_change = 19;
}
Comment on lines +1284 to 1287
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.

🛠️ Refactor suggestion

Document new PayRef fields in TransactionInfo
You've added payment_references_sent, payment_references_received, and payment_references_change to TransactionInfo, but none of the RPC docs or sample JSON for calls returning TransactionInfo have been updated to include these fields. Please update documentation to reflect these new properties.

🤖 Prompt for AI Agents
In applications/minotari_app_grpc/proto/wallet.proto around lines 1351 to 1354,
you added new repeated bytes fields for payment references in TransactionInfo
but did not update the related RPC documentation or sample JSON responses.
Update the RPC method comments and any example JSON outputs that include
TransactionInfo to document these new fields, describing their purpose and
format clearly.


enum TransactionDirection {
Expand Down Expand Up @@ -1252,6 +1339,7 @@ message GetCompletedTransactionsResponse {
TransactionInfo transaction = 1;
}


// Request message for GetBalance RPC.
message GetBalanceRequest {
// Optional: A user-defined payment ID to filter balance data.
Expand Down Expand Up @@ -1443,3 +1531,52 @@ message GetBlockHeightTransactionsResponse {
// List of transactions mined at the specified block height
repeated TransactionInfo transactions = 1;
}

// PayRef (Payment Reference) related messages and enums

// Request message for GetTransactionPayRefs RPC.
message GetTransactionPayRefsRequest {
// The transaction ID to retrieve PayRefs for.
uint64 transaction_id = 1;
}

// Response message for GetTransactionPayRefs RPC.
message GetTransactionPayRefsResponse {
// List of PayRefs (32-byte payment references) for the transaction.
repeated bytes payment_references = 1;
}


// Response message for GetTransactionsWithPayRefs RPC.
message GetTransactionsWithPayRefsResponse {
// The transaction information.
TransactionInfo transaction = 1;
// List of PayRefs associated with this transaction.
repeated bytes payment_references = 2;
// Number of unique recipients for this transaction.
uint64 recipient_count = 3;
}

Comment on lines +1551 to +1559
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

Add missing GetTransactionsWithPayRefs RPC
The GetTransactionsWithPayRefsResponse message is defined, but there is no corresponding rpc GetTransactionsWithPayRefs(...) in the Wallet service. Declare the RPC (and its request message) to match the new response type.

🤖 Prompt for AI Agents
In applications/minotari_app_grpc/proto/wallet.proto around lines 1550 to 1558,
the GetTransactionsWithPayRefsResponse message is defined but the Wallet service
lacks the corresponding GetTransactionsWithPayRefs RPC method. Define the
GetTransactionsWithPayRefs RPC in the Wallet service, including creating the
appropriate request message if it does not exist, and set the response type to
GetTransactionsWithPayRefsResponse to complete the RPC declaration.

// Request message for getting payment details by payment reference
message GetPaymentByReferenceRequest {
// The 32-byte payment reference hash to look up
bytes payment_reference = 1;
}

// Response message containing transaction information for a payment reference
message GetPaymentByReferenceResponse {
// The transaction information if PayRef is found (optional).
// Returns full transaction details
TransactionInfo transaction = 1;
}


// Enum for payment direction
enum PaymentDirection {
// Unknown or unspecified direction
PAYMENT_DIRECTION_UNKNOWN = 0;
// Payment received by this wallet
PAYMENT_DIRECTION_INBOUND = 1;
// Payment sent from this wallet
PAYMENT_DIRECTION_OUTBOUND = 2;
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ impl TryFrom<TransactionOutput> for grpc::TransactionOutput {
version: output.version as u32,
encrypted_data: output.encrypted_data.to_byte_vec(),
minimum_value_promise: output.minimum_value_promise.into(),
// Payment reference will be populated when the output is included in a block
// and the block hash is available
payment_reference: vec![],
})
}
}
Expand Down
126 changes: 126 additions & 0 deletions applications/minotari_console_wallet/src/automation/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2711,6 +2711,132 @@ pub async fn command_runner(
println!("removing temp wallet in: {:?}", temp_path);
fs::remove_dir_all(temp_path)?;
},
ShowPayRef(args) => {
// Show transaction details first
match transaction_service
.get_any_transaction(args.transaction_id.into())
.await
{
Ok(Some(tx)) => {
println!("Transaction ID: {}", args.transaction_id);
let _status = match &tx {
WalletTransaction::Completed(completed_tx) => {
println!("Transaction status: Completed");
println!("Amount: {}", completed_tx.amount);
println!("Fee: {}", completed_tx.fee);
println!("Direction: {:?}", completed_tx.direction);
if let Some(height) = completed_tx.mined_height {
println!("Mined at height: {}", height);
}
if let Some(timestamp) = completed_tx.mined_timestamp {
println!("Mined timestamp: {}", timestamp);
}
if completed_tx.mined_in_block.is_some() {
println!("\nReceived PayRefs for this transaction:");
for (i, pay_ref) in completed_tx.calculate_received_payment_references().iter().enumerate() {
println!("{}. PayRef: {}", i + 1, pay_ref);
}
println!("\nSent PayRefs for this transaction:");
for (i, pay_ref) in completed_tx.calculate_sent_payment_references().iter().enumerate() {
println!("{}. PayRef: {}", i + 1, pay_ref);
}
println!("\nChange PayRefs for this transaction:");
for (i, pay_ref) in completed_tx.calculate_change_payment_references().iter().enumerate() {
println!("{}. PayRef: {}", i + 1, pay_ref);
}
} else {
println!("Payrefs: Transaction not mined yet.");
}
"Completed"
},
minotari_wallet::transaction_service::storage::models::WalletTransaction::PendingInbound(_) => {
println!("Transaction status: PendingInbound");
"PendingInbound"
},
minotari_wallet::transaction_service::storage::models::WalletTransaction::PendingOutbound(_) => {
println!("Transaction status: PendingOutbound");
"PendingOutbound"
},
};
},
Ok(None) => {
println!("Transaction ID {} not found", args.transaction_id);
},
Err(e) => eprintln!("ShowPayRef error! {}", e),
}
},
FindPayRef(args) => match FixedHash::from_hex(&args.payment_reference_hex) {
Ok(payref) => match transaction_service.get_payment_by_reference(payref).await {
Ok(Some(payment_details)) => {
println!("Found PayRef: {}", args.payment_reference_hex);
println!("Transaction ID: {}", payment_details.tx_id);
println!("Amount: {}", payment_details.amount);
println!("Direction: {:?}", payment_details.direction);
println!("Block height: {}", payment_details.block_height);
println!("Confirmations: {}", payment_details.confirmations);
if let Some(timestamp) = payment_details.timestamp {
println!("Timestamp: {}", timestamp);
}
if let Some(payment_id) = &payment_details.payment_id {
println!("Payment ID: {}", String::from_utf8_lossy(payment_id));
}
},
Ok(None) => {
println!("No payment found for PayRef: {}", args.payment_reference_hex);
},
Err(e) => eprintln!("FindPayRef error! {}", e),
},
Err(e) => {
eprintln!("FindPayRef error! Invalid PayRef format: {}", e);
},
},
ListTx => {
debug!(target: LOG_TARGET, "payref_debug: List all transactions command starting execution");

match transaction_service.get_completed_transactions(None, None, None).await {
Ok(txs) => {
debug!(target: LOG_TARGET, "ListTxs command got {} transactions", txs.len());

if txs.is_empty() {
println!("No transactions.");
continue;
}
println!("Found {} transaction(s)", txs.len());
println!("{}", "=".repeat(80));

for (i, tx) in txs.iter().enumerate() {
println!("{}. Transaction ID: {}", i + 1, tx.tx_id);
println!(" Amount: {}", tx.amount);
println!(" Direction: {:?}", tx.direction);
println!(" Status: {:?}", tx.status);
if let Some(height) = tx.mined_height {
println!(" Mined at height: {}", height);
}
if let Some(timestamp) = tx.mined_timestamp {
println!(" Mined timestamp: {}", timestamp);
}
if tx.mined_in_block.is_some() {
println!("\nReceived PayRefs for this transaction:");
for (i, pay_ref) in tx.calculate_received_payment_references().iter().enumerate() {
println!("{}. PayRef: {}", i + 1, pay_ref);
}
println!("\nSent PayRefs for this transaction:");
for (i, pay_ref) in tx.calculate_sent_payment_references().iter().enumerate() {
println!("{}. PayRef: {}", i + 1, pay_ref);
}
println!("\nChange PayRefs for this transaction:");
for (i, pay_ref) in tx.calculate_change_payment_references().iter().enumerate() {
println!("{}. PayRef: {}", i + 1, pay_ref);
}
} else {
println!("Payrefs: Transaction not mined yet.");
}
println!();
}
},
Err(e) => eprintln!("ListTxs error! {}", e),
}
},
}
}
if unban_peer_manager_peers {
Expand Down
Loading
Loading