Clawback
Intro
This page includes a comprehensive list of Chia's Command Line Interface commands for using the clawback primitive.
These commands are only relevant for the clawback primitive, which is located in the chia-clawback-primitive repository.
In order to view the commands that are built into the CLI for Chia's reference wallet, see the following wallet
commands:
For more info, see the following:
Reference
clawback
Functionality: Get info about the clawback
command
Usage: clawback [OPTIONS] COMMAND [ARGS]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
--version | None | False | Show the version and exit | |
-h | --help | None | False | Show a help message and exit |
Commands:
Name | Description |
---|---|
claim | Claim a clawback coin after the timelock has passed |
claw | Clawback an unclaimed coin |
create | Send xch to a clawback coin |
show | Show details of all clawback coins |
claim
Functionality: Claim a clawback coin after the timelock has passed
Usage: clawback claim [OPTIONS]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-c | --coin-id | TEXT | True | The coin ID you want to claim |
-m | --fee | FLOAT | False | The fee in XCH for this transaction |
-w | --wallet-id | INTEGER | False | The wallet id for fees. If no target address given the clawback will go to this wallet id |
-t | --target-address | TEXT | False | The address you want to send the coin to |
-np | --node-rpc-port | INTEGER | False | Set the port where the Node is hosting the RPC interface |
-f | --fingerprint | INTEGER | False | Set the fingerprint to specify which wallet to use |
-wp | --wallet-rpc-port | INTEGER | False | Set the port where the Wallet is hosting the RPC interface. See the rpc_port under wallet in config.yaml |
-db | --db-path | TEXT | False | Set the path for the database |
-h | --help | None | False | Show a help message and exit |
In most cases, if the output of the clawback show
command contains Time left: 0 seconds
, this indicates that the Recipient can proceed with the claim
call.
However, there is a small window of time where the timer has expired, but a block still hasn't been farmed with a timestamp after the expiry. If the Recipient attempts to make the claim
call during this window, they will receive the following error:
You are trying to claim the coin too early
In this case, the Recipient needs to wait for one more block to be farmed before proceeding with the claim
call. As a reminder, a new block is farmed every 18.75 seconds, on average.
Example
First, the Sender creates a new clawback coin with a 60-second timelock:
clawback create -t txch1czxl4c42kwem8jllm4xp78jt7t0j0pu9uh9xw5jddegcu703xnpsqaaxxx -a 0.1 -l 60 -m 0.000275
Result:
Created Coin with ID: ef4b69e65e99261d6e30c8d2d331a8ed84995f3452b95aaa944f76a0f9af74c5
Coin { parent_coin_info: f5e408a15299df27a00d0403ea50ed29a06f87a31b638cff1b63ef3e6060b45a, puzzle_hash: 2e91566d9549cb909109d147c79b457d15ced2d8a24dea5a125b1e5c05cdd1ec, amount: 100000000000 }
The Sender can run the clawback show
command to show the details of each of their clawback coins:
clawback show
Result:
Updating coin records...
Coin ID: ef4b69e65e99261d6e30c8d2d331a8ed84995f3452b95aaa944f76a0f9af74c5
Amount: 0.1 XCH (100000000000 mojos)
Timelock: 60 seconds
Time left: 23 seconds
The timelock expires when the Time left:
value reaches 0 seconds
:
clawback show
Result:
Updating coin records...
Coin ID: ef4b69e65e99261d6e30c8d2d331a8ed84995f3452b95aaa944f76a0f9af74c5
Amount: 0.1 XCH (100000000000 mojos)
Timelock: 60 seconds
Time left: 0 seconds
For your reference, the Recipient wallet currently has a balance of 0 XCH:
chia wallet show -f 1231588123
Result:
Wallet height: 2405060
Sync status: Synced
Balances, fingerprint: 1231588123
Chia Wallet:
-Total Balance: 0.0 txch (0 mojo)
-Pending Total Balance: 0.0 txch (0 mojo)
-Spendable: 0.0 txch (0 mojo)
-Type: STANDARD_WALLET
-Wallet ID: 1