For standard transactions, we can use
WalletRpcClient.send_transaction_multi(...), which returns a
TransactionRecord. We can track that transaction with the transaction name.
To spend non-standard coins, I guest I have to generate a solution for the coin manually, and compose a
SpendBundle, and call
- How should I check if that transaction is confirmed?
- If the SpendBundle doesn’t get confirmed for a long time, how can I cancel it so that I replace it with higher fee?
For the first question
cdv rpc coinrecords --by puzhash yourpuzzlehash -nd
Thanks. But I found a better way (not perfect):
Periodically check the spending state of any of the coins being spent.
However a counter-case is that the transaction may fail because some of the coins might be spent in another competing transaction, that causes a false positive.
I think I can answer my 2nd question now.
Can transaction be cancelled?
No, at least not guaranteed. A transaction has no owner. Once a transaction is pushed to the full node, it become public. Anyone (farmer) that wins the block can choose to add this transaction to the blockchain (to earn the fee) as long as it’s still valid. And there’s no way that the creator of the transaction can stop a farmer from doing so.
My transaction is stalled. How can I replace it with a higher-feed version?
Push another competing transaction (that spends the same coins), with a higher fee. Once the new transaction got accepted by the network, the old one will become invalid and therefore forgotten by the network.