钱包 RPC
本文档提供了Chia钱包RPC API 的全面参考(不包含DID及NFT,这两者有专门的章节介绍)。
Note about Windows command escaping
This document will use Linux/MacOS RPC syntax. When running rpc commands on Windows, you'll need to escape all quotes with backslashes.
For example, here is a typical RPC command on Linux and MacOS:
chia rpc wallet create_new_wallet '{"wallet_type": "nft_wallet"}'
To run the same command on Windows, you need to escape the quotes with backslashes. In other words, add a \ before each double quote, such that:
"fee"
becomes \"fee\"
"1000"
becomes \"1000\"
etc
密钥管理
add_key
功能:从给定的助记词创建一个新的密钥 (钱包/指纹)
用法: chia rpc wallet [OPTIONS] add_key [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
mnemonic | TEXT ARRAY | True | 一个24字助记词,表示为数组 |
Example
chia rpc wallet add_key '{"mnemonic": ["hint", "dice", "session", "fun", "budget", "strong", "album", "lava", "tackle", "sudden", "garage", "people", "bundle", "federal", "chest", "process", "vicious", "behave", "nephew", "zero", "vital", "ocean", "artist", "lawsuit"]}'
Response:
{
"fingerprint": 874731676,
"success": true
}
check_delete_key
功能:显示指纹是否有余额,以及指纹是否用于耕种或联合耕种奖励。 这有助于确定是否可以安全地删除一个密钥而不需要先备份它
用法: chia rpc wallet [OPTIONS] check_delete_key [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
fingerprint | NUMBER | True | The wallet's fingerprint, obtainable by running chia wallet show |
max_ph_to_search | NUMBER | False | 要搜索的拼图哈希的最大数量[默认:100] |
Example
chia rpc wallet check_delete_key '{"fingerprint": 874731676, "max_ph_to_search": 200}'
Response:
{
"fingerprint": 874731676,
"success": true,
"used_for_farmer_rewards": false,
"used_for_pool_rewards": false,
"wallet_balance": false
}
delete_all_keys
功能:从钱包中删除所有密钥
用法:chia rpc wallet [OPTIONS] delete_all_keys [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters: None
这将删除所有密钥,无需任何进一步提示。 Prior to running this command, be sure to either verify that each key can be safely deleted by running check_delete_key, or back up each seed phrase for later recovery
Example
chia rpc wallet delete_all_keys
Response:
{
"success": true
}
delete_key
功能:基于钱包指纹删除一个密钥
用法:chia rpc wallet [OPTIONS] delete_key [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
fingerprint | NUMBER | True | The wallet's fingerprint, obtainable by running chia wallet show |
Example
chia rpc wallet delete_key '{"fingerprint": 874731676}'
Response:
{
"success": true
}
generate_mnemonic
功能:生成一组随机的24字助记词
用法: chia rpc wallet [OPTIONS] generate_mnemonic [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters: None
Example
chia rpc wallet generate_mnemonic
Response:
{
"mnemonic": [
"hint",
"dice",
"session",
"fun",
"budget",
"strong",
"album",
"lava",
"tackle",
"sudden",
"garage",
"people",
"bundle",
"federal",
"chest",
"process",
"vicious",
"behave",
"nephew",
"zero",
"vital",
"ocean",
"artist",
"lawsuit"
],
"success": true
}
get_logged_in_fingerprint
功能:获取当前登录的钱包的指纹。
用法: chia rpc wallet [OPTIONS] get_logged_in_fingerprint [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters: None
Example
chia rpc wallet get_logged_in_fingerprint
Response:
{
"fingerprint": 2818719465,
"success": true
}
get_private_key
功能:显示关于密钥的公共和私有信息
用法: chia rpc wallet [OPTIONS] get_private_key [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
fingerprint | NUMBER | True | The wallet's fingerprint, obtainable by running chia wallet show |
This RPC will show the private key and seed phrase for the given fingerprint. Use with caution. Use with caution.
Example
chia rpc wallet get_private_key '{"fingerprint": 2473794447}'
Response:
{
"private_key": {
"farmer_pk": "8c65856685323f149a651e6cbe068ece36f87a84efa16246b0eef65ac586a30fb678878bd4364d52c432fbb77838cbf6",
"fingerprint": 2473794447,
"pk": "b73cf2471b10a7ba839616aff0ab1cb319d9d3a77ee26ff88ec1c8e645468eb0b7653518b85e5dd0df7cf50d8612b978",
"pool_pk": "845ff087376ffecf83950485d63ffed1cc73f36daf018deb4fbd2f05e7198b07521486274d82ecc4f5a2eaae63dfd0a7",
"seed": "arrest legend bounce attend rebel blade palace bean dry shell nice bubble coil cook token nerve visa december hero garment grid attend nerve certain",
"sk": "0665913196501420c0fe2de6b5ce7b25f749d52dcbf997b069bb2ea8438c6c3c"
},
"success": true
}
get_public_keys
功能: Show all public key fingerprints stored in the OS keyring. Note that the keyring must be unlocked in order to run this RPC 请注意,必须解锁密钥环才能运行此RPC。
用法: chia rpc wallet [OPTIONS] get_public_keys [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters: None
Example
chia rpc wallet get_public_keys
Response:
{
"public_key_fingerprints": [2104826454, 3792481086, 2818719465, 2121994410],
"success": true
}
log_in
功能:使用指定的密钥登录钱包。
用法: chia rpc wallet [OPTIONS] log_in [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
fingerprint | NUMBER | True | The wallet's fingerprint, obtainable by running chia wallet show |
Example
chia rpc wallet log_in '{"fingerprint": 2818719465}'
Response:
{
"fingerprint": 2818719465,
"success": true
}
钱包节点
get_auto_claim
Functionality: Show the auto claim settings for all types of claims, including clawback
Usage: chia rpc wallet [OPTIONS] get_auto_claim [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters: None
Note that the auto claim settings are configurable in ~/.chia/mainnet/config/config.yaml
in the auto_claim:
section.
Example
chia rpc wallet get_auto_claim
Response:
{
"batch_size": 50,
"enabled": false,
"min_amount": 0,
"success": true,
"tx_fee": 0
}
get_height_info
功能:显示当前钱包同步的区块高度。
用法: chia rpc wallet [OPTIONS] get_height_info [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters: None
Example
chia rpc wallet get_height_info
Response:
{
"height": 2863319,
"success": true
}
get_network_info
功能:显示当前网络(例如 mainnet
) 和网络前缀 (例如 XCH
)
用法: chia rpc wallet [OPTIONS] get_network_info [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters: None
Example
chia rpc wallet get_network_info
Response:
{
"network_name": "mainnet",
"network_prefix": "xch",
"success": true
}
get_sync_status
功能:显示当前钱包是否正在同步或已经完成同步
用法: chia rpc wallet [OPTIONS] get_sync_status [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters: None
Example
chia rpc wallet get_sync_status
Response:
{
"genesis_initialized": true,
"success": true,
"synced": true,
"syncing": false
}
get_timestamp_for_height
功能:显示给定区块高度的时间戳
用法: chia rpc wallet [OPTIONS] get_timestamp_for_height [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
height | NUMBER | True | The block height for which to retrieve the timestamp |
Example
This example is from testnet10, so the timestamp won't match the equivalent call on mainnet:
chia rpc wallet get_timestamp_for_height '{"height": 2000000}'
Response:
{
"success": true,
"timestamp": 1672215722
}
push_transactions
功能:将多笔交易推送到区块链中
用法: chia rpc wallet [OPTIONS] push_transactions [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
transactions | TEXT ARRAY | True | A list of transactions to push |
push_tx
功能:将一个花费捆包(交易) 推送到区块链中
用法: chia rpc wallet [OPTIONS] push_tx [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
spend_bundle | TEXT | True | The spend bundle (transaction) to push |
set_auto_claim
Functionality: Set the auto claim settings for all types of claims, including clawback
Usage: chia rpc wallet [OPTIONS] set_auto_claim [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
enabled | BOOLEAN | TRUE | Set to true to enable auto claim, or false to disable it |
tx_fee | NUMBER | TRUE | The default transaction fee to be used for claims, in mojos |
min_amount | NUMBER | TRUE | The minimum value, in mojos, of a claim to be included in the auto claim |
batch_size | NUMBER | TRUE | The maximum number of claims to process in one spend bundle |
If one or more flags is missing, this RPC will succeed and set the missing flag back to the default value.
Example
Start by obtaining a baseline:
chia rpc wallet get_auto_claim
Response:
{
"batch_size": 50,
"enabled": false,
"min_amount": 0,
"success": true,
"tx_fee": 0
}
Next, change all of these settings:
chia rpc wallet set_auto_claim '{"enabled": true, "tx_fee": 1, "min_amount": 1, "batch_size": 1}'
Response:
{
"batch_size": 1,
"enabled": true,
"min_amount": 1,
"success": true,
"tx_fee": 1
}
set_wallet_resync_on_startup
功能:重新同步当前已登录的钱包。 交易和报价记录将被保留。
用法: chia rpc wallet [OPTIONS] set_wallet_resync_on_startup [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
enable | BOOLEAN | False | Set to true to enable resync [Default: true ] |
Example
chia rpc wallet set_wallet_resync_on_startup
Response:
{
"success": true
}
钱包管理
create_new_wallet
功能:为CAT、DID、NFT或联合耕种创建一个新钱包
Usage: chia rpc wallet [OPTIONS] create_new_wallet [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters (all wallet types):
Flag | Type | Required | Description |
---|---|---|---|
wallet_type | STRING | True | The type of wallet to create. Must be one of cat_wallet , did_wallet , dao_wallet , nft_wallet , or pool_wallet |
fee | NUMBER | False | An optional blockchain fee, in mojos |
cat_wallet
Parameters:
Flag | Type | Required | Description |
---|---|---|---|
mode | STRING | True | Must be either new of existing |
name | STRING | False | The name of the wallet to create or modify [Default: CAT followed by the beginning of the CAT ID] |
amount | NUMBER | True* | *Required if mode is new . Specify the value, in mojos, of this wallet |
asset_id | STRING | True* | *Required if mode is existing . *Required if mode is existing . Specify the asset_id of the wallet to update |
Example 1 (CAT wallet with name)
Create a new CAT wallet called test
and send it 100 mojos:
chia rpc wallet create_new_wallet '{"wallet_type": "cat_wallet", "mode": "new", "name": "test", "amount": 100, "fee": 1}'
Response:
{
"asset_id": "1f9fd0d4a1221241df986f042e014c056571062c82a5ba9b88c866c92808e1a9",
"success": true,
"type": 6,
"wallet_id": 2
}
Show the new wallet:
chia wallet show
Response:
Wallet height: 2863496
Sync status: Synced
Balances, fingerprint: 874731676
Chia Wallet:
-Total Balance: 0.0009999999 xch (999999900 mojo)
-Pending Total Balance: 0.0009999999 xch (999999900 mojo)
-Spendable: 0.0009999999 xch (999999900 mojo)
-Type: STANDARD_WALLET
-Wallet ID: 1
test:
-Total Balance: 0.1 (100 mojo)
-Pending Total Balance: 0.1 (100 mojo)
-Spendable: 0.1 (100 mojo)
-Type: CAT
-Asset ID: 1f9fd0d4a1221241df986f042e014c056571062c82a5ba9b88c866c92808e1a9
-Wallet ID: 2
Example 2 (CAT wallet without name)
Create a new CAT wallet without specifying a name:
chia rpc wallet create_new_wallet '{"wallet_type": "cat_wallet", "mode": "new", "amount": 100, "fee": 1}'
Response:
{
"asset_id": "348dfae821c76f0a0f45fe84d757d5050d07fda83c68a9425c24de666479786f",
"success": true,
"type": 6,
"wallet_id": 3
}
Show the new wallet:
chia wallet show
Response:
Chia Wallet:
-Total Balance: 0.0009999998 xch (999999800 mojo)
-Pending Total Balance: 0.0009999998 xch (999999800 mojo)
-Spendable: 0.0009999998 xch (999999800 mojo)
-Type: STANDARD_WALLET
-Wallet ID: 1
test:
-Total Balance: 0.1 (100 mojo)
-Pending Total Balance: 0.1 (100 mojo)
-Spendable: 0.1 (100 mojo)
-Type: CAT
-Asset ID: 1f9fd0d4a1221241df986f042e014c056571062c82a5ba9b88c866c92808e1a9
-Wallet ID: 2
CAT 348dfae821c76f0a...:
-Total Balance: 0.1 (100 mojo)
-Pending Total Balance: 0.1 (100 mojo)
-Spendable: 0.1 (100 mojo)
-Type: CAT
-Asset ID: 348dfae821c76f0a0f45fe84d757d5050d07fda83c68a9425c24de666479786f
-Wallet ID: 3
did_wallet
Parameters:
Flag | Type | Required | Description |
---|---|---|---|
did_type | STRING | True | Must be either new or recovery . Must be either new or recovery . If recovery , then each of the following parameters will be ignored |
backup_dids | STRING ARRAY | True* | *Required if did_type is new . An array of backup DID IDs to be used for recovery. Must match actual DIDs |
num_of_backup_ids_needed | NUMBER | True* | *Required if did_type is new . The number of backup DIDs required for recovery. Minimum value is 1 , maximum value is the number of DIDs in backup_dids |
metadata | DICT | False | The metadata of the DID |
wallet_name | STRING | False | The name of the DID wallet [Default: None] |
amount | NUMBER | True* | *Required if did_type is new . Specify the initial value of this wallet, in mojos. Minimum value is 1 |
Note: Because backup_dids
is required, you must already have access to a DID in order to run this RPC for a did_wallet. If you do not already have a DID, then run the CLI command to create a DID wallet instead. If you do not already have a DID, then run the CLI command to create a DID wallet instead.
Example 3 (DID wallet)
Create a new DID wallet with one backup DID:
chia rpc wallet create_new_wallet '{"wallet_type": "did_wallet", "did_type": "new", "amount": 1, "backup_dids": ["did:chia:13p5fdxgm8e2pngdwp8m088t0etp7rgzx9ye2ju8v5ackcyg7t9nqx2um83"], "num_of_backup_ids_needed": 1, "fee": 10000000}'
Response:
{
"my_did": "did:chia:1pzrm9dyhvu8hmqyzqmy0v3wyp7cn98jlxk49jv7mgkhvk229erhqmh6c2m",
"success": true,
"type": 8,
"wallet_id": 2
}
Show the newly created DID wallet:
chia wallet show
Response:
Wallet height: 1144662
Sync status: Synced
Balances, fingerprint: 455254876
Chia Wallet:
-Total Balance: 0.999999999999 txch (999999999999 mojo)
-Pending Total Balance: 0.999999999999 txch (999999999999 mojo)
-Spendable: 0.999999999999 txch (999999999999 mojo)
-Type: STANDARD_WALLET
-Wallet ID: 1
Profile 1:
-Total Balance: 1.0
-Pending Total Balance: 1.0
-Spendable: 1.0
-Type: DECENTRALIZED_ID
-DID ID: did:chia:1pzrm9dyhvu8hmqyzqmy0v3wyp7cn98jlxk49jv7mgkhvk229erhqmh6c2m
-Wallet ID: 2
dao_wallet
Parameters:
Flag | Type | Required | Description |
---|---|---|---|
mode | STRING | True | Must be either new of existing |
name | STRING | False | A name to give to the DAO new/existing wallet [Default: None] |
dao_rules | JSON DICT | True* | *Required if mode is new ; this is a json dictionary of the new DAO's rules |
amount_of_cats | NUMBER | False* | *Only used if mode is new ; this is the number of DAO CATs (in mojos) to create when initializing the DAO [Default: 0] |
filter-amount | NUMBER | False | The minimum number of votes a proposal needs before the wallet will recognise it [default: 1] |
fee | NUMBER | False* | *Required if mode is new . This is the puzzle hash to which payouts will go |
fee_for_cat | NUMBER | False* | *Only used if mode is new ; this is a blockchain fee to add to the transaction to create the DAO CATs [Default: 0] |
treasury_id | STRING | True* | *Required if mode is existing . *Required if mode is existing . Specify the asset_id of the wallet to update |
Notes:
- When
mode
isnew
, this RPC has a similar functionality to the create DAO CLI command. - When
mode
isexisting
, this RPC has a similar functionality to the add DAO CLI command.
Example 4 (New DAO wallet)
Create a new wallet with some basic DAO rules; also mint CATs and include transaction fees:
chia rpc wallet create_new_wallet '{"wallet_type": "dao_wallet", "mode": "new", "name": "My Dao Wallet", "dao_rules": {"attendance_required": 3000, "oracle_spend_delay": 2, "pass_percentage": 5000, "proposal_minimum_amount": 1000001, "proposal_timelock": 3, "self_destruct_length": 1, "soft_close_length": 2}, "amount_of_cats": 1000, "filter-amount": 1, "fee": 500000000, "fee_for_cat": 100000000}'
As a result, a new treasury will be created, along with a CAT wallet containing 1000 CATs, and a DAO CAT wallet:
{
"cat_wallet_id": 4,
"dao_cat_wallet_id": 5,
"success": true,
"treasury_id": "0x89fdd510ce617c0b78d7f997d6fe52737a8c57100cca73c9dc4957eaf7fe55dc",
"type": 14,
"wallet_id": 3
}
Example 5 (Join existing DAO)
To join a DAO, set mode
to existing
:
chia rpc wallet create_new_wallet '{"wallet_type": "dao_wallet", "mode": "existing", "name": "My Dao Wallet", "filter-amount": 1, "treasury_id": "0x89fdd510ce617c0b78d7f997d6fe52737a8c57100cca73c9dc4957eaf7fe55dc"}'
Your wallet will join the treasury and automatically create the required DAO, CAT, and DAO_CAT wallets without any balance:
{
"cat_wallet_id": 3,
"dao_cat_wallet_id": 4,
"success": true,
"treasury_id": "0x89fdd510ce617c0b78d7f997d6fe52737a8c57100cca73c9dc4957eaf7fe55dc",
"type": 14,
"wallet_id": 2
}
nft_wallet
Parameters:
Flag | Type | Required | Description |
---|---|---|---|
did_id | STRING | False | Associate a DID with the new NFT wallet |
name | STRING | False | The name of the wallet to create or modify [Default: NFT Wallet ] |
Example 6 (NFT wallet without DID)
Create a new NFT wallet that is not associated with a DID:
chia rpc wallet create_new_wallet '{"wallet_type": "nft_wallet", "fee": 1}'
Response:
{
"success": true,
"type": 10,
"wallet_id": 4
}
Example 7 (NFT wallet with DID)
Create an NFT wallet that is associated with a DID. First, create the DID: First, create the DID:
chia wallet did create -n My_DID
Response:
Successfully created a DID wallet with name My_DID and id 5 on key 874731676
Successfully created a DID did:chia:1ypvxg7t327m4hsmgzrlhnuk4448nqc20crnnmzzd52lk7dvdza9s8qp8q6 in the newly created DID wallet
Next, create the NFT wallet, passing in the new DID ID:
chia rpc wallet create_new_wallet '{"wallet_type": "nft_wallet", "did_id": "did:chia:1ypvxg7t327m4hsmgzrlhnuk4448nqc20crnnmzzd52lk7dvdza9s8qp8q6", "name": "My NFT WAllet", "fee": 1}'
Response:
{
"success": true,
"type": 10,
"wallet_id": 6
}
pool_wallet
Parameters:
Flag | Type | Required | Description |
---|---|---|---|
mode | STRING | True | Must be either new of recovery . Must be either new of recovery . However, recovery has not been implemented, so currently (version 1.6) it will automatically fail |
initial_target_state | STRING | True | This info should be sent from the daemon. This info should be sent from the daemon. PoolState is a type that is serialized to the blockchain to track the state of the user's pool singleton target_puzzle_hash is either the pool address, or the self-pooling address that pool rewards will be paid to. target_puzzle_hash is NOT the p2_singleton puzzle that block rewards are sent to. The p2_singleton address is the initial address, and the target_puzzle_hash is the final destination. relative_lock_height is zero when in SELF_POOLING state target_puzzle_hash is NOT the p2_singleton puzzle that block rewards are sent to. The p2_singleton address is the initial address, and the target_puzzle_hash is the final destination. relative_lock_height is zero when in SELF_POOLING state |
p2_singleton_delayed_ph | STRING | True* | *Required if mode is new . This is the puzzle hash to which payouts will go |
p2_singleton_delay_time | INTEGER | False | The time (in seconds) to delay payments [Default: None ] |
get_wallets
功能:显示与当前指纹相关联的所有钱包,包含(默认) 硬币信息
用法: chia rpc wallet [OPTIONS] get_wallets [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
include_data | BOOLEAN | False | Set to true to include all coin info for this wallet [Default: true ] |
type | INTEGER | False | The type of wallet to retrieve. See below for valid types |
Valid wallet types (the type
parameter) include the following integers:
Name | type |
---|---|
STANDARD_WALLET | 0 |
ATOMIC_SWAP | 2 |
AUTHORIZED_PAYEE | 3 |
MULTI_SIG | 4 |
CUSTODY | 5 |
CAT | 6 |
RECOVERABLE | 7 |
DECENTRALIZED_ID | 8 |
POOLING_WALLET | 9 |
NFT | 10 |
DATA_LAYER | 11 |
DATA_LAYER_OFFER | 12 |
VC | 13 |
More types may be added in the future. More types may be added in the future. See wallet_types.py for an up-to-date list of valid types.
Example 1
Get all info for all wallets:
chia rpc wallet get_wallets '{"include_data": false}'
Response:
{
"fingerprint": 874731676,
"success": true,
"wallets": [
{
"data": "",
"id": 1,
"name": "Chia Wallet",
"type": 0
}
]
}
Example 2
Get NFT wallet info (NFT type = 10):
chia rpc wallet get_wallets '{"type": 10}'
Response:
{
"fingerprint": 2104826454,
"success": true,
"wallets": [
{
"data": "{"did_id": "0xb08c01ace955ce180ce2e0b332b4c8d98d46469078e5191351f025d9cf9117f3"}",
"id": 3,
"name": "NFT Wallet",
"type": 10
},
{
"data": "{"did_id": null}",
"id": 4,
"name": "NFT Wallet",
"type": 10
}
]
}
Wallet
create_signed_transaction
功能:从给定的钱包创建一个签名的交易
用法: chia rpc wallet [OPTIONS] create_signed_transaction [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
wallet_id | TEXT | True | The wallet ID for the origin of the transaction |
additions | TEXT ARRAY | True | A list of puzzle hashes and amounts to be included |
min_coin_amount | NUMBER | False | The minimum coin amount to send [Default: 0] |
max_coin_amount | NUMBER | False | The maximum coin amount to send [Default: 0] |
exclude_coin_amounts | NUMBER ARRAY | False | A list of coin amounts to exclude |
coins | TEXT ARRAY | True | A list of coins to include |
exclude_coins | TEXT ARRAY | True | A list of coins to exclude |
coin_announcements | TEXT ARRAY | False | A list of coin announcements, which includes coin_id , message , and morph_bytes |
puzzle_announcements | TEXT ARRAY | False | A list of puzzle announcements, which includes puzzle_hash , message , and morph_bytes |
fee | NUMBER | False | An optional blockchain fee, in mojos |
delete_notifications
功能:删除通知,可以选择指定要删除的通知的ID。
用法: chia rpc wallet [OPTIONS] delete_notifications [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | TEXT | False | Instead of REQUEST, provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Parameter | Required | Description |
---|---|---|
ids | False | Set to delete notifications only from the specified IDs. [Default: delete from all IDs] [Default: delete from all IDs] |
Example
chia rpc wallet delete_notifications
Response:
{
"success": true
}
delete_unconfirmed_transactions
功能:从给定的钱 包中删除所有尚未确认的交易
用法: chia rpc wallet [OPTIONS] delete_unconfirmed_transactions [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
wallet_id | NUMBER | True | The ID of the wallet from which to delete transactions |
Example
chia rpc wallet delete_unconfirmed_transactions '{"wallet_id": 2}'
Response:
{
"success": true
}
extend_derivation_index
功能:增加派生索引(derivation index)
用法: chia rpc wallet [OPTIONS] extend_derivation_index [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
index | NUMBER | True | The new derivation index. The new derivation index. Must be larger than the previous index |
Note: The derivation index is the minimum number of addresses the wallet will examine. It's not possible to decrease this number. It's not possible to decrease this number.
Example
chia rpc wallet extend_derivation_index '{"index": 436}'
Response:
{
"index": 436,
"success": true
}
get_coin_records
Functionality: Obtain all coin records for the current wallet
Usage: chia rpc wallet [OPTIONS] get_coin_records [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
None
Example
chia rpc wallet get_coin_records
Response:
{
"coin_records": [
{
"amount": 100,
"coinbase": false,
"confirmed_height": 3879053,
"id": "0x8c8518c23670a37287063951761e6f23348918b887762d9a8fc7f2217bd44c04",
"metadata": null,
"parent_coin_info": "0x6b17387014afbdc661bec74438cc49e44889861b5ddd13ae2113807e82f9df08",
"puzzle_hash": "0x59714c1cebe4a747bb90b607bce5cc589df6b612ee7f742c79f6d070a50e9083",
"spent_height": 0,
"type": 0,
"wallet_identifier": {
"id": 1,
"type": 0
}
}
],
"success": true,
"total_count": null
}
get_coin_records_by_names
功能:从硬币名称列表中获取硬币记录
用法: chia rpc wallet [OPTIONS] get_coin_records_by_names [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
names | TEXT ARRAY | True | A list of coin names from which to retrieve records |
start_height | NUMBER | False | The block height at which to start the query |
end_height | NUMBER | False | The block height at which to end the query |
include_spent_coins | BOOLEAN | False | Include spent coins in the result [Default: false] |
Example
chia rpc wallet get_coin_records_by_names '{"names": ["0xeb17e80fcb72f15bfb28924f0bcd684df626646dca282bc88098cb0d59ffe1bb"]}'
Response:
{
"coin_records": [
{
"coin": {
"amount": 999996796,
"parent_coin_info": "0xfecaf9d1cffe1b71f00aee7816ea90562b18307d4461757e23f097703340beb7",
"puzzle_hash": "0x138373343443d3cdf6bd033244f32d904dd93e1ad2772f120955c0d8d761b722"
},
"coinbase": false,
"confirmed_block_index": 2867783,
"spent_block_index": 0,
"timestamp": 1669261898
}
],
"success": true
}
get_current_derivation_index
功能:获取当前钱包的当前派生索引(derivation index)
用法: chia rpc wallet [OPTIONS] get_current_derivation_index [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters: None
Example
chia rpc wallet get_current_derivation_index
Response:
{
"index": 435,
"success": true
}
get_farmed_amount
功能:显示已经收获(farmed)的总额。
用法: chia rpc wallet [OPTIONS] get_farmed_amount [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters: None
Example
chia rpc wallet get_farmed_amount
Response:
{
"farmed_amount": 0,
"farmer_reward_amount": 0,
"fee_amount": 0,
"last_height_farmed": 0,
"pool_reward_amount": 0,
"success": true
}
get_next_address
功能: 获取HD树中的下一个地址,并可选择显示最新的地址。
用法: chia rpc wallet [OPTIONS] get_next_address [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
wallet_id | TEXT | True | The ID of the wallet from which to obtain the next address |
new_address | BOOLEAN | True | If true , then create a new address, else display the latest existing address |
Example
chia rpc wallet get_next_address '{"wallet_id": 2, "new_address": false}'
Response:
{
"address": "xch1jxe8yfq8xem0e8ty5dq9hp86ududys96n6ugy2q4fextr0pplw9qwpfru9",
"success": true,
"wallet_id": 2
}
get_notifications
功能:获取当前通知
用法: chia rpc wallet [OPTIONS] get_notifications [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | TEXT | False | Instead of REQUEST, provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Parameter | Required | Description |
---|---|---|
ids | False | Set to receive notifications only from the specified IDs. [Default: receive from all IDs] [Default: receive from all IDs] |
start | False | The number corresponding to the first notification to list. [Default: the first notification] [Default: the first notification] |
end | False | The number corresponding to the last notification to list. [Default: the last notification] [Default: the last notification] |
Example
If no parameters are set, then all notifications will be listed from all IDs:
chia rpc wallet get_notifications
Response:
{
"notifications": [
{
"amount": 10000000,
"id": "f74fb363fbdeef3f6bcf7a0664a8ef76ea3e5f22bb4ffc9a1f9ef23b9329ae28",
"message": "fadedcab"
}
],
"success": true
}
get_spendable_coins
功能:获取所有可用的硬币,可以使用不同的过滤器(filters)进行筛选。
用法: chia rpc wallet [OPTIONS] get_spendable_coins [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
wallet_id | NUMBER | True | The ID of the wallet from which to display coins |
min_coin_amount | NUMBER | False | The smallest coin to be selected in this query [Default: No minimum] |
max_coin_amount | NUMBER | False | The largest coin to be selected in this query [Default: No maximum] |
excluded_coin_amounts | NUMBER ARRAY | False | A list of coin amounts to exclude |
excluded_coins | TEXT ARRAY | False | A list of coins to exclude |
excluded_coin_ids | TEXT ARRAY | False | A list of coin IDs to exclude |
Example
List all unspent coins from wallet 1:
chia rpc wallet get_spendable_coins '{"wallet_id": 1}'
Response:
{
"confirmed_records": [
{
"coin": {
"amount": 999996796,
"parent_coin_info": "0xfecaf9d1cffe1b71f00aee7816ea90562b18307d4461757e23f097703340beb7",
"puzzle_hash": "0x138373343443d3cdf6bd033244f32d904dd93e1ad2772f120955c0d8d761b722"
},
"coinbase": false,
"confirmed_block_index": 2867783,
"spent_block_index": 0,
"timestamp": 1669261898
}
],
"success": true,
"unconfirmed_additions": [],
"unconfirmed_removals": []
}
get_transaction
功能:通过交易ID获取交易的详细信息。
用法: chia rpc wallet [OPTIONS] get_transaction [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
transaction_id | TEXT | True | The ID of the transaction to obtain. The ID of the transaction to obtain. This is listed as name in the output of the get_transactions RPC |
Details
Notes about transactions
The transaction history is not deterministic due to heuristics we use to counter privacy features of the blockchain. This means, a couple of details cannot be fetched fully:- The transaction IDs can and will change if you resync the wallet
- Transactions of assets other than xch (cat, nft, ...) which include a fee will cause a second fee-transaction in the xch currency wallet (wallet 1)
- Offers are split into multiple transactions on the corresponding wallets
- Transactions of one Offer do not share the same id`s. To match them up, it is best to keep the offer files
- The transaction time is a rough estimate. When an offer is accepted, the individual transactions of one offer can/will have slightly differing transaction times
- For your offers which were accepted by a 3rd Party , the incoming coins are beeing marked as incoming transaction, not as incoming trade
- When cancelling offers, the cancellation Transactions are beeing shown as transaction, not as trade For accurate records, you should keep a local record of transactions (TXs) and the Offer files made.
Example
chia rpc wallet get_transaction '{"transaction_id": "0x43f6811a4daf18622fc7f132f5166a1246056b4a983b7befccb7e4b2e2c57f3b"}'
Response:
{
"success": true,
"transaction": {
"additions": [
{
"amount": 100,
"parent_coin_info": "0xabbb6c6859db74e8e627f21263c078893383131bcf22faec68b2de914d03e59f",
"puzzle_hash": "0xb4a41bbce457745b006181ab99e34a0cbd8c83c196bc74fc98eb3aec882ed784"
}
],
"amount": 100,
"confirmed": true,
"confirmed_at_height": 2863494,
"created_at_time": 1669182237,
"fee_amount": 0,
"memos": {},
"name": "0x43f6811a4daf18622fc7f132f5166a1246056b4a983b7befccb7e4b2e2c57f3b",
"removals": [
{
"amount": 100,
"parent_coin_info": "0x9c0083d8da8733c899787e4dcf18a56bc944f49ed668808e20890f01cbc35f37",
"puzzle_hash": "0xb4a41bbce457745b006181ab99e34a0cbd8c83c196bc74fc98eb3aec882ed784"
}
],
"sent": 10,
"sent_to": [],
"spend_bundle": null,
"to_address": "xch1kmk3jx30sqv57j07x05mjf2xgt9fgthzslaweg4yta9edfwqsadqagh96h",
"to_puzzle_hash": "0xb6ed191a2f80194f49fe33e9b9254642ca942ee287faeca2a45f4b96a5c0875a",
"trade_id": null,
"type": 0,
"wallet_id": 2
},
"transaction_id": "0x43f6811a4daf18622fc7f132f5166a1246056b4a983b7befccb7e4b2e2c57f3b"
}
get_transactions
功能:获取给定钱包的所有交易
用法: chia rpc wallet [OPTIONS] get_transactions [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
wallet_id | NUMBER | True | The Wallet ID of the wallet from which to obtain transactions |
start | NUMBER | False | The sequence number of the first transaction to show [Default: 0] |
end | NUMBER | False | The sequence number of the last transaction to show [Default: 50] |
sort_key | NUMBER | False | Specify the key for sorting, sort_keys members [Default: confirmed_at_height ] |
reverse | BOOLEAN | False | Set to true to sort the results in reverse order [Default: false] |
to_address | STRING | False | Only include transactions with this to_address [Default: None] |
Details
Notes about transactions
By default, the function lists the oldest transactions first. This is recommended for building a transaction history due to pagination. If reverse is set to true, it lists the newest transactions first. This is most useful for fetching recent transactions.The transaction history is not deterministic due to heuristics we use to counter privacy features of the blockchain. This means, a couple of details cannot be fetched fully:
- The transaction IDs can and will change if you resync the wallet
- Transactions of assets other than xch (cat, nft, ...) which include a fee will cause a second fee-transaction in the xch currency wallet (wallet 1)
- Offers are split into multiple transactions on the corresponding wallets
- Transactions of one Offer do not share the same id`s. To match them up, it is best to keep the offer files
- The transaction time is a rough estimate. When an offer is accepted, the individual transactions of one offer can/will have slightly differing transaction times
- For your offers which were accepted by a 3rd Party , the incoming coins are beeing marked as incoming transaction, not as incoming trade
- When cancelling offers, the cancellation Transactions are beeing shown as transaction, not as trade For accurate records, you should keep a local record of transactions (TXs) and the Offer files made.
Example 1: List a single XCH transaction
Start by listing all wallets associated with the currently synced fingerprint:
chia rpc wallet get_wallets
Response:
{
"fingerprint": 2104826454,
"success": true,
"wallets": [
{
"data": "",
"id": 1,
"name": "Chia Wallet",
"type": 0
},
{
"data": "{\"did_id\": null}",
"id": 2,
"name": "NFT Wallet",
"type": 10
},
{
"data": "{\"did_id\": \"0xb08c01ace955ce180ce2e0b332b4c8d98d46469078e5191351f025d9cf9117f3\"}",
"id": 4,
"name": "NFT Wallet",
"type": 10
},
{
"data": "",
"id": 5,
"name": "DataLayer Wallet",
"type": 11
},
{
"data": "f17f88130c63522821f1a75466849354eee69c414c774bd9f3873ab643e9574d00",
"id": 6,
"name": "CAT f17f88130c635228...",
"type": 6
},
{
"data": "aaee6b63bcbc4aef0a005d31119ad65e5228b0ddff18c5c563fd7a4db54fb08400",
"id": 7,
"name": "CAT aaee6b63bcbc4aef...",
"type": 6
},
{
"data": "",
"id": 11,
"name": "Pool wallet",
"type": 9
}
]
}
In this case, we are interested in the Chia Wallet
, of type 0
. This has an id
of 1
. This has an id
of 1
.
Next, list only the transaction from that wallet with an index of 3
:
chia rpc wallet get_transactions '{"wallet_id": 1, "start": 3, "end": 4}'
{
"success": true,
"transactions": [
{
"additions": [
{
"amount": 999999999,
"parent_coin_info": "0x4346c6f866ce790ef0c48c5afe472751a9f09ee926a1bb60cb4cb6ab7c845377",
"puzzle_hash": "0xe4c9f6dd30498ae0e19d9bdba2eeaa54296d91a5b8ccbb4b9b748034f9525253"
},
{
"amount": 1,
"parent_coin_info": "0x4346c6f866ce790ef0c48c5afe472751a9f09ee926a1bb60cb4cb6ab7c845377",
"puzzle_hash": "0xeff07522495060c066f66f32acc2a77e3a3e737aca8baea4d1a64ea4cdc13da9"
}
],
"amount": 1,
"confirmed": true,
"confirmed_at_height": 1688205,
"created_at_time": 1666232735,
"fee_amount": 0,
"memos": {},
"name": "0x8d1a6db10aa69a8aceff700596bfd736b87a133d73e394c15c13152633e729d0",
"removals": [
{
"amount": 1000000000,
"parent_coin_info": "0x73336c365fdcae474f672b0f35950369fb12b1dac0289aa2f5b702e731098447",
"puzzle_hash": "0x3377e81d20ad9a3028ffe7e77360c03df48c412f2525aac58035738888adb83d"
}
],
"sent": 0,
"sent_to": [],
"spend_bundle": null,
"to_address": "txch1alc82gjf2psvqehkdue2es480caruum6e296afx35e82fnwp8k5shty4cp",
"to_puzzle_hash": "0xeff07522495060c066f66f32acc2a77e3a3e737aca8baea4d1a64ea4cdc13da9",
"trade_id": null,
"type": 1,
"wallet_id": 1
}
],
"wallet_id": 1
}
Example 2: List all transactions for a CAT
Start by listing all wallets associated with the currently synced fingerprint:
chia rpc wallet get_wallets
Response:
{
"fingerprint": 2104826454,
"success": true,
"wallets": [
{
"data": "",
"id": 1,
"name": "Chia Wallet",
"type": 0
},
{
"data": "{\"did_id\": null}",
"id": 2,
"name": "NFT Wallet",
"type": 10
},
{
"data": "{\"did_id\": \"0xb08c01ace955ce180ce2e0b332b4c8d98d46469078e5191351f025d9cf9117f3\"}",
"id": 4,
"name": "NFT Wallet",
"type": 10
},
{
"data": "",
"id": 5,
"name": "DataLayer Wallet",
"type": 11
},
{
"data": "f17f88130c63522821f1a75466849354eee69c414c774bd9f3873ab643e9574d00",
"id": 6,
"name": "CAT f17f88130c635228...",
"type": 6
},
{
"data": "aaee6b63bcbc4aef0a005d31119ad65e5228b0ddff18c5c563fd7a4db54fb08400",
"id": 7,
"name": "CAT aaee6b63bcbc4aef...",
"type": 6
},
{
"data": "",
"id": 11,
"name": "Pool wallet",
"type": 9
}
]
}
For this example, we'll use the wallet with ID 7
. This wallet is type 6
(CAT):
chia rpc wallet get_transactions '{"wallet_id": 7}'
Response:
{
"success": true,
"transactions": [
{
"additions": [
{
"amount": 10000,
"parent_coin_info": "0x5104073950bccd17a7ea57ca9f13c5546f88a048e3165069d0e255d3018faeed",
"puzzle_hash": "0x5e5073dab71209426358624462fac281431f87571ad40009d7ec731784154a1c"
}
],
"amount": 10000,
"confirmed": true,
"confirmed_at_height": 1932515,
"created_at_time": 1670949639,
"fee_amount": 0,
"memos": {},
"name": "0x38306b461975741641d397330bb34c01681bb242119bd4aa457c06e2080cf257",
"removals": [],
"sent": 0,
"sent_to": [],
"spend_bundle": null,
"to_address": "txch1stn20rhgmh5wvmyyfj2etdpdp73fla0ga4ymtsejz600dszf392s58kx2s",
"to_puzzle_hash": "0x82e6a78ee8dde8e66c844c9595b42d0fa29ff5e8ed49b5c332169ef6c0498955",
"trade_id": null,
"type": 0,
"wallet_id": 7
}
],
"wallet_id": 7
}
get_transaction_count
功能:获取钱包交易次数
用法: chia rpc wallet [OPTIONS] get_transaction_count [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
wallet_id | TEXT | True | The wallet ID from which to obtain the transaction count |
Example
chia rpc wallet get_transaction_count '{"wallet_id": 2}'
Response:
{
"count": 2,
"success": true,
"wallet_id": 2
}
get_transaction_memo
功能:获取指定交易的备注
用法: chia rpc wallet [OPTIONS] get_transaction_memo [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | TEXT | False | Instead of REQUEST, provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Parameter | TYPE | Required | Description |
---|---|---|---|
transaction_id | STRING | True | The ID of the transaction for which to retrieve the memo |
Example
chia rpc wallet get_transaction_memo '{"transaction_id": "0x21899b89bf36154e44c2277e9bfb6cff0574d7e9df4e100b782b03ab2476e171"}'
Response:
{
"21899b89bf36154e44c2277e9bfb6cff0574d7e9df4e100b782b03ab2476e171": {
"21899b89bf36154e44c2277e9bfb6cff0574d7e9df4e100b782b03ab2476e171": [
"f8858363837eaccf1249844dfd200999ebd480b393dd0f7f2022880868ce3bf3"
]
},
"success": true
}
get_wallet_balance
功能:从钱包中获取余额 (及相关信息)
用法: chia rpc wallet [OPTIONS] get_wallet_balance [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
wallet_id | NUMBER | True | The Wallet ID of the wallet from which to obtain the balance |
Example
chia rpc wallet get_wallet_balance '{"wallet_id": 1}'
Response:
{
"success": true,
"wallet_balance": {
"confirmed_wallet_balance": 999999799,
"fingerprint": 874731676,
"max_send_amount": 999999799,
"pending_change": 0,
"pending_coin_removal_count": 0,
"spendable_balance": 999999799,
"unconfirmed_wallet_balance": 999999799,
"unspent_coin_count": 1,
"wallet_id": 1,
"wallet_type": 0
}
}
get_wallet_balances
Functionality: Obtain the balance (and related info) from one or more wallets
用法: chia rpc wallet [OPTIONS] get_wallet_balance [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
wallet_ids | LIST | False | A list of Wallet IDs from which to obtain the balance [Default: list info for all wallets] |
Example
Get the balance and other info for wallets 1 and 2:
chia rpc wallet get_wallet_balances '{"wallet_ids": [1,2]}'
Response:
{
"success": true,
"wallet_balances": {
"1": {
"confirmed_wallet_balance": 249908082013,
"fingerprint": 3792481086,
"max_send_amount": 249908082013,
"pending_change": 0,
"pending_coin_removal_count": 0,
"spendable_balance": 249908082013,
"unconfirmed_wallet_balance": 249908082013,
"unspent_coin_count": 19,
"wallet_id": 1,
"wallet_type": 0
},
"2": {
"confirmed_wallet_balance": 0,
"fingerprint": 3792481086,
"max_send_amount": 0,
"pending_change": 0,
"pending_coin_removal_count": 0,
"spendable_balance": 0,
"unconfirmed_wallet_balance": 0,
"unspent_coin_count": 6,
"wallet_id": 2,
"wallet_type": 10
}
}
}
select_coins
功能: 从指定的钱包中选择加起来至少达到指定金额的硬币。
用法: chia rpc wallet [OPTIONS] select_coins [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
wallet_id | NUMBER | True | The ID of the wallet from which to select coins |
amount | NUMBER | True | The number of mojos to select |
min_coin_amount | NUMBER | False | The smallest coin to be selected in this query [Default: No minimum] |
max_coin_amount | NUMBER | False | The largest coin to be selected in this query [Default: No maximum] |
excluded_coin_amounts | NUMBER ARRAY | False | A list of coin amounts to exclude |
excluded_coins | TEXT ARRAY | False | A list of coins to exclude |
Example 1
Select 1000 mojos. Select 1000 mojos. Note that in this wallet, the smallest coin is worth 999 996 796
mojos, so that coin is selected:
chia rpc wallet select_coins '{"wallet_id": 1, "amount": 1000}'
Response:
{
"coins": [
{
"amount": 999996796,
"parent_coin_info": "0xfecaf9d1cffe1b71f00aee7816ea90562b18307d4461757e23f097703340beb7",
"puzzle_hash": "0x138373343443d3cdf6bd033244f32d904dd93e1ad2772f120955c0d8d761b722"
}
],
"success": true
}
Example 2
Attempt to select 1000 mojos with max_coin_amount
set to 10 000
. As in the previous example, the smallest coin in the wallet is worth 999 996 796
mojos, so the coin selection will fail: As in the previous example, the smallest coin in the wallet is worth 999 996 796
mojos, so the coin selection will fail:
chia rpc wallet select_coins '{"wallet_id": 1, "amount": 1000, "min_coin_amount": 10, "max_coin_amount": 10000}'
Response:
Request failed: {'error': 'Transaction for 1000 is greater than spendable balance of 0. There may be other transactions pending or our minimum coin amount is too high.', 'success': False} There may be other transactions pending or our minimum coin amount is too high.', 'success': False}
send_notification
功能:向指定的拼图哈希发送通知
用法: chia rpc wallet [OPTIONS] send_notification [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | TEXT | False | Instead of REQUEST, provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Parameter | TYPE | Required | Description |
---|---|---|---|
target | HEX STRING | True | The puzzle hash you would like to send a message to |
message | HEX STRING | True | The hex-encoded message you would like to send |
amount | NUMBER | True | The number of mojos to include with this message |
fee | NUMBER | False | An optional blockchain fee, in mojos |
Example 1: Send a generic message
chia rpc wallet send_notification '{"target": "8c436f983d5bcbdb92d6d029a4113da580f2fc43b943e92ddf06a9f54e5f5003", "message": "fadedcab", "amount": 10000000, "fee": 10000000}'
Response:
{
"success": true,
"tx": {
"additions": [
{
"amount": 10000000,
"parent_coin_info": "0x7159b046aa0f1af65f561efe6ed1de0beb3341cc28a883892c9bc14d89115ed0",
"puzzle_hash": "0x201ef13f780295649cd7e2c8713c575b8dd2568463add6f8d3cfc6b3687d27bd"
},
{
"amount": 249979799998,
"parent_coin_info": "0x7159b046aa0f1af65f561efe6ed1de0beb3341cc28a883892c9bc14d89115ed0",
"puzzle_hash": "0x970afdde67983d39b55475fa1a6bb24eb23e9ba47681fb693e80dee8c9346a83"
}
],
"amount": 10000000,
"confirmed": false,
"confirmed_at_height": 0,
"created_at_time": 1667386486,
"fee_amount": 10000000,
"memos": {
"f74fb363fbdeef3f6bcf7a0664a8ef76ea3e5f22bb4ffc9a1f9ef23b9329ae28": "fadedcab"
},
"name": "0x749898b3efcd50882283fb879e80e42cd59340c41943832b4daf896b5e6e80e4",
"removals": [
{
"amount": 249999799998,
"parent_coin_info": "0xf634ab1fc513d90d63c7eed840eb49a034f804b2d910418614776333590aab8c",
"puzzle_hash": "0x8c436f983d5bcbdb92d6d029a4113da580f2fc43b943e92ddf06a9f54e5f5003"
}
],
"sent": 0,
"sent_to": [],
"spend_bundle": {
"aggregated_signature": "0xb9db8ff2e29f00ec98b17019e13f11daea890a8ef82d1019b7655308c14623a0c15d37504b1e742d0f29132e6225c7f505a2c75f93ea0940f50615c3b83c2b851c5a76f5f027c8d823c85df7bea57e3dd702f03e2d8997173c1bb4ca64b97b87",
"coin_spends": [
{
"coin": {
"amount": 249999799998,
"parent_coin_info": "0xf634ab1fc513d90d63c7eed840eb49a034f804b2d910418614776333590aab8c",
"puzzle_hash": "0x8c436f983d5bcbdb92d6d029a4113da580f2fc43b943e92ddf06a9f54e5f5003"
},
"puzzle_reveal": "0xff02ffff01ff02ffff01ff02ffff03ff0bffff01ff02ffff03ffff09ff05ffff1dff0bffff1effff0bff0bffff02ff06ffff04ff02ffff04ff17ff8080808080808080ffff01ff02ff17ff2f80ffff01ff088080ff0180ffff01ff04ffff04ff04ffff04ff05ffff04ffff02ff06ffff04ff02ffff04ff17ff80808080ff80808080ffff02ff17ff2f808080ff0180ffff04ffff01ff32ff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff06ffff04ff02ffff04ff09ff80808080ffff02ff06ffff04ff02ffff04ff0dff8080808080ffff01ff0bffff0101ff058080ff0180ff018080ffff04ffff01b0acc98d7c361cb95a6d16a2ee6a5dccb55d3beab9e7dbb52ebd7e4a94a8290166cf8e745d67a6eb36de6687141da09dccff018080",
"solution": "0xff80ffff01ffff33ffa0201ef13f780295649cd7e2c8713c575b8dd2568463add6f8d3cfc6b3687d27bdff8400989680ffffa08c436f983d5bcbdb92d6d029a4113da580f2fc43b943e92ddf06a9f54e5f5003ff84fadedcab8080ffff33ffa0970afdde67983d39b55475fa1a6bb24eb23e9ba47681fb693e80dee8c9346a83ff853a33f509be80ffff34ff840098968080ffff3cffa0ef1272dc555d2fa0b17eb8a2d50dc507ce1f873de3443f3b7e36a3c802b0863b80ffff3dffa0a2d1d50e1bf8bd6f08e02885631ea6cbe7aa91d9de9809b5c37a7858fc0ad94b8080ff8080"
},
{
"coin": {
"amount": 10000000,
"parent_coin_info": "0x7159b046aa0f1af65f561efe6ed1de0beb3341cc28a883892c9bc14d89115ed0",
"puzzle_hash": "0x201ef13f780295649cd7e2c8713c575b8dd2568463add6f8d3cfc6b3687d27bd"
},
"puzzle_reveal": "0xff02ffff01ff02ffff01ff04ffff04ff04ffff04ff05ffff04ff0bff80808080ffff04ffff04ff06ffff01ff808080ff808080ffff04ffff01ff333cff018080ffff04ffff01a08c436f983d5bcbdb92d6d029a4113da580f2fc43b943e92ddf06a9f54e5f5003ffff04ffff018400989680ff01808080",
"solution": "0x80"
}
]
},
"to_address": "xch1yq00z0mcq22kf8xhuty8z0zhtwxay45yvwkad7xnelrtx6ray77sshkp7r",
"to_puzzle_hash": "0x201ef13f780295649cd7e2c8713c575b8dd2568463add6f8d3cfc6b3687d27bd",
"trade_id": null,
"type": 1,
"wallet_id": 1
}
}
Example 2: Send an NFT notification
In this example, we will attempt to buy the following NFT:
nft1dcw9gfx034mxv2xkv568aupaqlc6em5sn3d2y3kzkt5js2gydr0stfd4ek
We will create an offer for this NFT and use the command line to send an offer directly to its owner.
First, create an Offer file. First, create an Offer file. This can be accomplished with the create_offer_for_ids RPC. Offers can also be created from the reference wallet's GUI. Offers can also be created from the reference wallet's GUI.
Next, post the offer to a URI. Next, post the offer to a URI. In this example, we will use Dexie.
The human-readable offer is located here:
https://dexie.space/offers/4xtVpZWkTrpdsZhtJCKSpyRqJoT1qZXsJXy6Hqm8tYjr
However, the notification command requires a raw offer file. However, the notification command requires a raw offer file. In Dexie's case, the URI will start with raw.dexie.space
, as shown here:
https://raw.dexie.space/4xtVpZWkTrpdsZhtJCKSpyRqJoT1qZXsJXy6Hqm8tYjr
Note that the raw offer file can be posted to any URI; it does not need to be on an exchange.
We will also need to obtain the Current Owner address of the NFT. This can be obtained from the nft_get_info
RPC: This can be obtained from the nft_get_info
RPC:
chia rpc wallet nft_get_info '{"coin_id":"nft1dcw9gfx034mxv2xkv568aupaqlc6em5sn3d2y3kzkt5js2gydr0stfd4ek"}'
Result:
{
"nft_info": {
"chain_info": "((117 \"https://nftstorage.link/ipfs/bafybeic32cwe43voxoybnwbayy7bedv4ip5tqho4jfol3xmtd62vscfoqa/78.jpg\" \"ipfs://bafybeic32cwe43voxoybnwbayy7bedv4ip5tqho4jfol3xmtd62vscfoqa/78.jpg\") (104 . 0x1a9152787d8374ececa0bf070b7a10e91162ada15964404d52232152f25b8b7a) (28021 \"https://nftstorage.link/ipfs/bafybeic32cwe43voxoybnwbayy7bedv4ip5tqho4jfol3xmtd62vscfoqa/metadata.json\" \"ipfs://bafybeic32cwe43voxoybnwbayy7bedv4ip5tqho4jfol3xmtd62vscfoqa/metadata.json\") (27765) (29550 . 1) (29556 . 1) (28008 . 0xfdfe889a579916f8f75dcfff809eee44fc844df5fa92aecd2d562578e7e69a24))",
"data_hash": "0x1a9152787d8374ececa0bf070b7a10e91162ada15964404d52232152f25b8b7a",
"data_uris": [
"https://nftstorage.link/ipfs/bafybeic32cwe43voxoybnwbayy7bedv4ip5tqho4jfol3xmtd62vscfoqa/78.jpg",
"ipfs://bafybeic32cwe43voxoybnwbayy7bedv4ip5tqho4jfol3xmtd62vscfoqa/78.jpg"
],
"edition_number": 1,
"edition_total": 1,
"launcher_id": "0x6e1c5424cf8d766628d665347ef03d07f1acee909c5aa246c2b2e928290468df",
"launcher_puzhash": "0xeff07522495060c066f66f32acc2a77e3a3e737aca8baea4d1a64ea4cdc13da9",
"license_hash": "0x",
"license_uris": [],
"metadata_hash": "0xfdfe889a579916f8f75dcfff809eee44fc844df5fa92aecd2d562578e7e69a24",
"metadata_uris": [
"https://nftstorage.link/ipfs/bafybeic32cwe43voxoybnwbayy7bedv4ip5tqho4jfol3xmtd62vscfoqa/metadata.json",
"ipfs://bafybeic32cwe43voxoybnwbayy7bedv4ip5tqho4jfol3xmtd62vscfoqa/metadata.json"
],
"mint_height": 2459174,
"minter_did": "0x7af52cbf50837fd387b02c60351f8ab9842a8f18b99ced7ab9a16a155c35d400",
"nft_coin_id": "0x78a3012f0aa0c837ee1bed53f91c8d4e4897578e7757dee4965fdcd4cff0c94a",
"nft_id": "nft1dcw9gfx034mxv2xkv568aupaqlc6em5sn3d2y3kzkt5js2gydr0stfd4ek",
"off_chain_metadata": null,
"owner_did": null,
"p2_address": "0x47e26aa7ee46e7ed3a2f762fda7aa1d63db6be42e14fc3a18e54e13ee509f84b",
"pending_transaction": false,
"royalty_percentage": 300,
"royalty_puzzle_hash": "0x3ed2cab30efeddb0d58c660b380ef0671292e922e1a01cccdff51d390f0473eb",
"supports_did": true,
"updater_puzhash": "0xfe8a4b4e27a2e29a4d3fc7ce9d527adbcaccbab6ada3903ccf3ba9a769d2d78b"
},
"success": true
}
In this case, we need the p2_address
, which is 47e26aa7ee46e7ed3a2f762fda7aa1d63db6be42e14fc3a18e54e13ee509f84b
(the leading 0x
isn't needed).
Finally, we need to construct a valid message to send. Finally, we need to construct a valid message to send. The notification message payload is a JSON object with the following fields:
v
: <number> version of the notification message. Currently1
. Currently1
.t
: <number> type of the notification message. Currently1
for offer. Currently1
for offer.d
: <object> payload of the notification message. The type of the payload depends on the notification type. For offer, the payload is an object with the following fields: The type of the payload depends on the notification type. For offer, the payload is an object with the following fields:u
: <string> offer URLph
: <string, optional> puzzlehash of the notification sender, for sending a response (counter offer). If you want to disable counter offers for this offer, simply omit this flag If you want to disable counter offers for this offer, simply omit this flag
The ph
for the message payload can be any puzzlehash in your key derivation. One way to obtain an address is with the chia wallet get_address
command. For this example, we'll use: One way to obtain an address is with the chia wallet get_address
command. For this example, we'll use:
xch1ta7zjqqtaw9wyfnawl3z84a26vexr3qtmp7jq6gx4vpzl792sf9qddsacl
This address still needs to be converted into a puzzlehash. One way to accomplish this is with an online converter, such as the one available from spacescan.
Another option is to use the decode
command from the chia-dev-tools repository:
cdv decode xch1ta7zjqqtaw9wyfnawl3z84a26vexr3qtmp7jq6gx4vpzl792sf9qddsacl
Response:
5f7c29000beb8ae2267d77e223d7aad33261c40bd87d206906ab022ff8aa824a
The payload command we will use in this example is:
{
"v": 1,
"t": 1,
"d": {
"u": "https://raw.dexie.space/4xtVpZWkTrpdsZhtJCKSpyRqJoT1qZXsJXy6Hqm8tYjr",
"ph": "5f7c29000beb8ae2267d77e223d7aad33261c40bd87d206906ab022ff8aa824a"
}
}
However, we still need to convert it to hexadecimal format for the RPC command.
The hex equivalent of the payload command is:
7B2276223A312C2274223A312C2264223A7B2275223A2268747470733A2F2F7261772E64657869652E73706163652F34787456705A576B54727064735A68744A434B53707952714A6F5431715A58734A58793648716D3874596A72222C227068223A2235663763323930303062656238616532323637643737653232336437616164333332363163343062643837643230363930366162303232666638616138323461227D7D
Having obtained all of this information, we can run the command to send the message:
chia rpc wallet send_notification '{"target": "47e26aa7ee46e7ed3a2f762fda7aa1d63db6be42e14fc3a18e54e13ee509f84b", "message": "7B2276223A312C2274223A312C2264223A7B2275223A2268747470733A2F2F7261772E64657869652E73706163652F34787456705A576B54727064735A68744A434B53707952714A6F5431715A58734A58793648716D3874596A72222C227068223A2235663763323930303062656238616532323637643737653232336437616164333332363163343062643837643230363930366162303232666638616138323461227D7D", "amount": 100000000, "fee": 1}'
Response:
{
"success": true,
"tx": {
"additions": [
{
"amount": 100000000,
"parent_coin_info": "0xd5619c0b02a9279edf11ae85407fd8dc7472fe449fe6ab88d4cc480a5d4b24f5",
"puzzle_hash": "0xa52a2bcbff9ece1137bbc9199be03b0b32e6406bf377f6dc201be6ee5a4dfd9c"
},
{
"amount": 3106899989,
"parent_coin_info": "0xd5619c0b02a9279edf11ae85407fd8dc7472fe449fe6ab88d4cc480a5d4b24f5",
"puzzle_hash": "0x1732d207b04a03dd7d622cc9f491d43ca0561cf73a1efacdaa0e26e8902c8b73"
}
],
"amount": 100000000,
"confirmed": false,
"confirmed_at_height": 0,
"created_at_time": 1677570233,
"fee_amount": 1,
"memos": {
"121a439f242f4e59a871c464a9f324507aa4566d61ad8ec5d717468551e89c5a": "7b2276223a312c2274223a312c2264223a7b2275223a2268747470733a2f2f7261772e64657869652e73706163652f34787456705a576b54727064735a68744a434b53707952714a6f5431715a58734a58793648716d3874596a72222c227068223a2235663763323930303062656238616532323637643737653232336437616164333332363163343062643837643230363930366162303232666638616138323461227d7d"
},
"name": "0x61c5c10e604c7196a216ec7c39f1a448a222737ee854c85bb6e3dca174656348",
"removals": [
{
"amount": 3206899990,
"parent_coin_info": "0x162aea6e661610421def30f3c8b58c4154aef9dc4f847024f757a0b92117d704",
"puzzle_hash": "0x035f40ced4483a04d2f677586724af21c868960d94410ac9e595d0944a019842"
}
],
"sent": 0,
"sent_to": [],
"spend_bundle": {
"aggregated_signature": "0xa558eb279ebdf8bd9c58cddd992f38c7b2f48e86b2024917f85eb8beb4b24c7541e5ff8b1a81e3f73c35144f42ba4ce60ef55d36474e078292ddb6b99edb3f039a9f3f9282c1be2102ed811af5080cca37cb450a12039edce9ead563a6ab9740",
"coin_spends": [
{
"coin": {
"amount": 3206899990,
"parent_coin_info": "0x162aea6e661610421def30f3c8b58c4154aef9dc4f847024f757a0b92117d704",
"puzzle_hash": "0x035f40ced4483a04d2f677586724af21c868960d94410ac9e595d0944a019842"
},
"puzzle_reveal": "0xff02ffff01ff02ffff01ff02ffff03ff0bffff01ff02ffff03ffff09ff05ffff1dff0bffff1effff0bff0bffff02ff06ffff04ff02ffff04ff17ff8080808080808080ffff01ff02ff17ff2f80ffff01ff088080ff0180ffff01ff04ffff04ff04ffff04ff05ffff04ffff02ff06ffff04ff02ffff04ff17ff80808080ff80808080ffff02ff17ff2f808080ff0180ffff04ffff01ff32ff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff06ffff04ff02ffff04ff09ff80808080ffff02ff06ffff04ff02ffff04ff0dff8080808080ffff01ff0bffff0101ff058080ff0180ff018080ffff04ffff01b0b749d5d97e4e0acd2f5683215470994a04ccaaabdf11f6fa8df3d8e872ef28f86cb5fb98b29ec351d343dd5e447865b4ff018080",
"solution": "0xff80ffff01ffff33ffa0a52a2bcbff9ece1137bbc9199be03b0b32e6406bf377f6dc201be6ee5a4dfd9cff8405f5e100ffffa047e26aa7ee46e7ed3a2f762fda7aa1d63db6be42e14fc3a18e54e13ee509f84bffc0a67b2276223a312c2274223a312c2264223a7b2275223a2268747470733a2f2f7261772e64657869652e73706163652f34787456705a576b54727064735a68744a434b53707952714a6f5431715a58734a58793648716d3874596a72222c227068223a2235663763323930303062656238616532323637643737653232336437616164333332363163343062643837643230363930366162303232666638616138323461227d7d8080ffff33ffa01732d207b04a03dd7d622cc9f491d43ca0561cf73a1efacdaa0e26e8902c8b73ff8500b92f881580ffff34ff0180ffff3cffa087e5e080ce5b080e6e42deaf20d2170a553fdf0ace32cbbce0a88b0c46a4aa0580ffff3dffa0eae0770951a738b72415a06b0a92ba0bcd9c46e2f16e2c545e9eafb9020485768080ff8080"
},
{
"coin": {
"amount": 100000000,
"parent_coin_info": "0xd5619c0b02a9279edf11ae85407fd8dc7472fe449fe6ab88d4cc480a5d4b24f5",
"puzzle_hash": "0xa52a2bcbff9ece1137bbc9199be03b0b32e6406bf377f6dc201be6ee5a4dfd9c"
},
"puzzle_reveal": "0xff02ffff01ff02ffff01ff04ffff04ff04ffff04ff05ffff04ff0bff80808080ffff04ffff04ff06ffff01ff808080ff808080ffff04ffff01ff333cff018080ffff04ffff01a047e26aa7ee46e7ed3a2f762fda7aa1d63db6be42e14fc3a18e54e13ee509f84bffff04ffff018405f5e100ff01808080",
"solution": "0x80"
}
]
},
"to_address": "xch1554zhjllnm8pzdameyvehcpmpvewvsrt7dmldhpqr0nwukjdlkwqsngqcq",
"to_puzzle_hash": "0xa52a2bcbff9ece1137bbc9199be03b0b32e6406bf377f6dc201be6ee5a4dfd9c",
"trade_id": null,
"type": 1,
"wallet_id": 1
}
}
This command will create a Message Coin on the blockchain. This command will create a Message Coin on the blockchain. Once it has been confirmed, the current owner of the NFT will receive a notification of the offer in their wallet. The owner can choose to accept the offer, delete the notification, or send a counter offer to the ph
that was included in the payload. The owner can choose to accept the offer, delete the notification, or send a counter offer to the ph
that was included in the payload.
send_transaction
功能:发 送交易
用法: chia rpc wallet [OPTIONS] send_transaction [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
wallet_id | TEXT | True | The wallet ID for the origin of the transaction |
address | TEXT | True | The destination address |
amount | NUMBER | True | The number of mojos to send |
fee | NUMBER | False | An optional blockchain fee, in mojos |
memos | TEXT ARRAY | False | An optional array of memos to be sent with the transaction |
min_coin_amount | NUMBER | False | The minimum coin amount to send [Default: 0] |
max_coin_amount | NUMBER | False | The maximum coin amount to send [Default: 0] |
exclude_coin_amounts | NUMBER ARRAY | False | A list of coin amounts to exclude |
exclude_coin_ids | TEXT ARRAY | False | A list of coin IDs to exclude |
reuse_puzhash | BOOLEAN | False | If true , will not generate a new puzzle hash / address for this transaction only. Note that setting this parameter to true will override the global default setting from config.yaml |
Example
chia rpc wallet send_transaction '{"wallet_id": 1, "address": "xch1fev2qaclwpcue9kx4p39dzfxpzaavvcz5v3lhx77cxha7f0tjjlsngh5k0", "amount": 1000, "fee": 1, "memos":["memo1"]}'
Response:
{
"success": true,
"transaction": {
"additions": [
{
"amount": 1000,
"parent_coin_info": "0xfecaf9d1cffe1b71f00aee7816ea90562b18307d4461757e23f097703340beb7",
"puzzle_hash": "0x4e58a0771f7071cc96c6a86256892608bbd63302a323fb9bdec1afdf25eb94bf"
},
{
"amount": 999996796,
"parent_coin_info": "0xfecaf9d1cffe1b71f00aee7816ea90562b18307d4461757e23f097703340beb7",
"puzzle_hash": "0x138373343443d3cdf6bd033244f32d904dd93e1ad2772f120955c0d8d761b722"
}
],
"amount": 1000,
"confirmed": false,
"confirmed_at_height": 0,
"created_at_time": 1669261889,
"fee_amount": 1,
"memos": {
"029b8689abda7f4ff4871e1cd69eb32725a0cda8520b751bcf774fb681e19bc5": "6d656d6f31"
},
"name": "0x94a6b6a2353a8f49b6dc30d7141272df14bc82727fd0d82a18680605b2a90051",
"removals": [
{
"amount": 999997797,
"parent_coin_info": "0x81d6dac68bb566d696a62629e1e08edd5b684d35c3ee8c7164b1c3a457514203",
"puzzle_hash": "0xd84faa841550d718863fc1139ff880c8366a546ab7dc567a672a14c7ddf5b4b7"
}
],
"sent": 0,
"sent_to": [],
"spend_bundle": {
"aggregated_signature": "0xa95fba5e9e310d1c096bb44e27d98b070b7591be29d3f174ac42bcad39ec5e8a356747851c3df456973c96f55884dbb913247000368b0d1fa3518f11dae0ed45cb8f0961899aa7ee2102c58265d9460a31c33bd896ce9a2ef377bbc6419343b0",
"coin_spends": [
{
"coin": {
"amount": 999997797,
"parent_coin_info": "0x81d6dac68bb566d696a62629e1e08edd5b684d35c3ee8c7164b1c3a457514203",
"puzzle_hash": "0xd84faa841550d718863fc1139ff880c8366a546ab7dc567a672a14c7ddf5b4b7"
},
"puzzle_reveal": "0xff02ffff01ff02ffff01ff02ffff03ff0bffff01ff02ffff03ffff09ff05ffff1dff0bffff1effff0bff0bffff02ff06ffff04ff02ffff04ff17ff8080808080808080ffff01ff02ff17ff2f80ffff01ff088080ff0180ffff01ff04ffff04ff04ffff04ff05ffff04ffff02ff06ffff04ff02ffff04ff17ff80808080ff80808080ffff02ff17ff2f808080ff0180ffff04ffff01ff32ff02ffff03ffff07ff0580ffff01ff0bffff0102ffff02ff06ffff04ff02ffff04ff09ff80808080ffff02ff06ffff04ff02ffff04ff0dff8080808080ffff01ff0bffff0101ff058080ff0180ff018080ffff04ffff01b0a5abd588cc5a2c873ee37809ea33432b7a87aaf8370eba7f9806bc1eac517034b3850cc7a4f2550f108b8a124d3dbbc3ff018080",
"solution": "0xff80ffff01ffff33ffa04e58a0771f7071cc96c6a86256892608bbd63302a323fb9bdec1afdf25eb94bfff8203e8ffff856d656d6f318080ffff33ffa0138373343443d3cdf6bd033244f32d904dd93e1ad2772f120955c0d8d761b722ff843b9abd7c80ffff34ff0180ffff3cffa086ec6c5fe3716c6e0b39c0049a3d164f491c3347c4fd36196ecc561b5cf347da8080ff8080"
}
]
},
"to_address": "xch1fev2qaclwpcue9kx4p39dzfxpzaavvcz5v3lhx77cxha7f0tjjlsngh5k0",
"to_puzzle_hash": "0x4e58a0771f7071cc96c6a86256892608bbd63302a323fb9bdec1afdf25eb94bf",
"trade_id": null,
"type": 1,
"wallet_id": 1
},
"transaction_id": "0x94a6b6a2353a8f49b6dc30d7141272df14bc82727fd0d82a18680605b2a90051"
}
send_transaction_multi
功能:从指定的钱包发送多个交易。
用法: chia rpc wallet [OPTIONS] send_transaction_multi [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | FILENAME | False | Optionally instead of REQUEST you can provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Flag | Type | Required | Description |
---|---|---|---|
wallet_id | TEXT | True | The wallet ID for the origin of the transaction |
address | TEXT | True | The destination address |
amount | NUMBER | True | The number of mojos to send |
fee | NUMBER | False | An optional blockchain fee, in mojos |
memos | TEXT ARRAY | False | An optional array of memos to be sent with the transaction |
additions | TEXT ARRAY | True | A list of puzzle hashes and amounts to be included |
sign_message_by_address
功能:使用XCH 地址签名消息,不会产生链上交易
用法: chia rpc wallet [OPTIONS] sign_message_by_address [REQUEST]
Options:
Short Command | Long Command | Type | Required | Description |
---|---|---|---|---|
-j | --json-file | TEXT | False | Instead of REQUEST, provide a json file containing the request data |
-h | --help | None | False | Show a help message and exit |
Request Parameters:
Parameter | TYPE | Required | Description |
---|---|---|---|
address | STRING | True | The address to use for signing. The address to use for signing. Must possess the key for this address |
message | STRING | True | The message to include with the signature |
Example
chia rpc wallet sign_message_by_address '{"address":"xch1q94gd4hd62ecx08d0kuagmp5cr8umrwtcvatfupmd7uyzhuf4c4sy2zd46", "message":"test"}'
Response:
{
"pubkey": "814612ec24a4957cf38ee5f5d5bc544820575375d7997da12c07f3f09215a178cfa76f151edba4c0ae40b66a97a6275e",
"signature": "a10234b38cc962f9678882f18885fee23a288c389bc0145588f7000bca12b55fcfaffff0cdd4ef7f136f8aab571ddd2e089b281ae267347fb20225d86490e91fbedad59ba9d38f9308f251070ea1260909dd69133273a49650749cfe6ff96d40",
"success": true
}