-
Embedded risk control provides basic, predefined rules that cannot be customized. You configure risk control rules in the
configs/cobo-tss-node-config.yamlfile. -
For TSS Node callback, you implement custom risk control logic in your callback server to check callback requests against your specific rules. Key fields to check in the callback request:
request_detail: Contains critical information about key generation, key resharing, and transaction signing.extra_info: Provides additional context; should be cross-referenced withrequest_detailfor validation.
Key generation
We recommend using embedded risk control for key generation requests. Callback server logic is usually not needed for this operation. Configure embedded risk control for key generation like this:- Allows key generation with specified threshold and TSS Node IDs
- Rejects all other requests
Key resharing
We recommend using embedded risk control for key resharing requests. Callback server logic is usually not needed for this operation. Configure embedded risk control for key resharing like this:- Allows key resharing requests from a specified key share holder group, threshold, and TSS Node IDs.
- Rejects all other requests
Transaction signing
We recommend using both embedded risk control and callback server logic for transaction signing requests.Embedded risk control
Configure your embedded risk control rules for transaction signing:Callback risk control
Implement these security checks in your TSS Node callback server:-
Verify the transaction hash to prevent transaction tampering:
- Extract the raw transaction data from
extra_info.Transaction.RawTxInfo.UnsignedRawTx - Calculate the hash of this raw transaction data according to the rules of the specific chain
- Compare the calculated hash with the value in
request_detail.msg_hash_list - Reject the transaction if the hashes don’t match
- Extract the raw transaction data from
-
Validate critical transaction parameters to prevent unauthorized or malicious transactions
- Parse
extra_info.Transaction.RawTxInfo.UnsignedRawTxaccording to the chain format, and extract key transaction parameters such as:- Gas fee: Ensure it is within acceptable ranges
- Destination address: Verify against allowed addresses
- Transaction amount: Check against configured limits
- Chain ID: Confirm it matches your expected network
- Call data
- Other specific parameters as needed
- Compare the parsed parameters with those in
extra_info.Transaction - Compare the parsed parameters or
extra_info.Transactionwith the original transaction created using the WaaS 2.0 API
- Parse
-
Validate the signing key share:
tweak_list: The list of tweaks to apply.bip32_path_list: BIP32 derivation paths.root_pub_key: Root extended public key of the key share holder group.
-
Check
signature_typecompatibility with the target blockchain, as signature types vary across chains.
Auto-sweeping implementation
For MPC Wallets with auto-sweeping enabled, implement a whitelist-based approval system that:- Verifies the transaction hash to ensure transaction integrity.
- Checks if the destination address is on the pre-approved whitelist.
- Automatically approves transactions that meet both criteria.
- Configure the whitelist of destination addresses in callback-server-config.yaml.
-
Refer to sign.go for examples of:
- Parsing transaction content
- Verifying hash against the signed message
- Approving transactions based on the whitelist
Future updates will expand the sample project to support additional blockchain networks. You can also extend support to more tokens using the token_adapter module in the repository.
Feel free to share your feedback to improve our documentation!
