Skip to main content

General Commands

WalletConnect is a communications protocol that allows decentralized applications (dApps) and wallets to securely interact with each other. Chia supports WalletConnect and exposes various RPCs for requesting wallet actions from a web application.

For more information, see our WalletConnect Developer Guide.

Getting Started​

You can install our example WalletConnect dApp and run it in your browser to test out WalletConnect. The code can be adapted for use in your own React applications.

Commands​

chia_logIn​

Logs in to a wallet key (account), as identified by its fingerprint.

ParameterTypeDescription
fingerprintnumberWallet fingerprint.

Output Data​

ParameterTypeDescription
fingerprintnumberWallet fingerprint.
successbooleanBackend success status.

chia_getPublicKey​

Gets the wallet's master public key.

ParameterTypeDescription
fingerprintnumberWallet fingerprint.

Output Data​

ParameterTypeDescription
pubkeystringHex encoded master public key.

chia_getWallets​

Gets a list of wallet ids associated with the current account.

ParameterTypeDescription
includeDatabooleanWhether to include metadata.

Output Data​

The output is a value of type WalletInfo.

chia_getTransaction​

Gets a transaction record by its id.

ParameterTypeDescription
transactionIdstringTransaction id.

Output Data​

The output is a value of type TransactionRecord.

chia_getWalletBalance​

Gets the various wallet balances for a given wallet id, as shown in the GUI.

ParameterTypeDescription
walletId? (optional)numberWallet id to get the balance of.

Output Data​

The output is a value of type WalletBalance.

chia_getCurrentAddress​

Gets the address of the current derivation index.

ParameterTypeDescription
walletId? (optional)numberWallet id to get the address of.

Output Data​

The output is a bech32m encoded address of type string.

chia_getNextAddress​

Gets the address of the next derivation index.

ParameterTypeDescription
walletId? (optional)numberWallet id to get the address of.
newAddress? (optional)booleanWhether to increase derivation index.

Output Data​

The output is a bech32m encoded address of type string.

chia_sendTransaction​

Sends an amount of mojos in a given wallet to a recipient address.

ParameterTypeDescription
amountnumberAmount in mojos.
feenumberTransaction fee in mojos.
addressstringBech32m encoded recipient address.
walletId? (optional)numberWallet id to use coins from.
waitForConfirmation? (optional)booleanWhether to wait for inclusion in a block.
memos? (optional)string[]A list of coin memos (such as hint).

Output Data​

ParameterTypeDescription
transactionTransactionRecordTransaction record.
transactionIdstringTransaction id.
successbooleanBackend success status.

chia_signMessageById​

Signs a message with the private key of a given DID.

note

In order to ensure the message being signed isn't a transaction, the message is the tree hash of "Chia Signed Message" and the raw message. You can learn more about this in CHIP-0002, the dApp protocol.


ParameterTypeDescription
messagestringMessage to sign.
idstringDID to sign the message with the key of.

Output Data​

ParameterTypeDescription
latestCoinIdstringLatest DID singleton coin id.
pubkeystringHex encoded DID public key.
signaturestringHex encoded BLS12-381 signature.
signingModestringSigning mode used.
successbooleanBackend success status.

chia_signMessageByAddress​

Signs a message with the private key of a given address.

note

In order to ensure the message being signed isn't a transaction, the message is the tree hash of "Chia Signed Message" and the raw message. You can learn more about this in CHIP-0002, the dApp protocol.


ParameterTypeDescription
messagestringMessage to sign.
addressstringAddress to sign the message with the key of.

Output Data​

ParameterTypeDescription
pubkeystringHex encoded address public key.
signaturestringHex encoded BLS12-381 signature.
signingModestringSigning mode used.
successbooleanBackend success status.

chia_verifySignature​

Verifies a signature over a message from a given public key.

ParameterTypeDescription
messagestringMessage to verify.
pubkeystringHex encoded public key.
signaturestringHex encoded BLS12-381 signature.
address? (optional)stringAddress used for signing.
signingMode? (optional)stringSigning mode used.

Output Data​

ParameterTypeDescription
isValidbooleanWhether the signature is valid.
successbooleanBackend success status.

chia_getSyncStatus​

Gets the current sync status of the wallet.

Output Data​

ParameterTypeDescription
genesisInitializedbooleanWhether the genesis is initialized.
syncedbooleanWhether the wallet is fully synced.
syncingbooleanWhether the wallet is currently syncing.
successbooleanBackend success status.

Types​

WalletInfo​

ParameterTypeDescription
idnumberThe wallet id.
namestringThe name of the wallet.
typeWalletTypeThe type of the wallet.
dataanyExtra info (unused for standard wallet).
metaanyMetadata specific to each wallet type.

CAT Metadata​

ParameterTypeDescription
assetIdstringAsset id.
namestringDisplay name.

NFT Metadata​

ParameterTypeDescription
didstringOwner DID.

WalletType​

NameValue
STANDARD_WALLET0
RATE_LIMITED1
ATOMIC_SWAP2
AUTHORIZED_PAYEE3
MULTI_SIG4
CUSTODY5
CAT6
RECOVERABLE7
DECENTRALIZED_ID8
POOLING_WALLET9
NFT10
DATA_LAYER11

TransactionRecord​

ParameterTypeDescription
confirmedAtHeightnumberBlock height the tx was confirmed.
createdAtTimenumberThe timestamp when the tx was created.
toPuzzleHashstringThe destination puzzle hash.
amountnumberThe amount sent in mojos.
feeAmountnumberThe transaction fee in mojos.
confirmedbooleanWhether the tx was confirmed.
sentnumberNumber of peers the tx was sent to.
sentToPeer[]The peers the tx has been sent to.
spendBundleSpendBundle | nullThe associated spend bundle.
additionsCoin[]Created coins in the block.
removalsCoin[]Spent coins in the block.
walletIdnumberThe wallet id.
toAddressstringThe bech32m encoded to_puzzle_hash.
trade_idstring | null
typeTransactionTypeThe type of transaction.
namestringThe transaction's id.
memosMemo[]The memos associated with the tx.

TransactionType​

NameValue
Incoming0
Outgoing1
CoinbaseReward2
FeeReward3
IncomingTrade4
OutgoingTrade5

Peer​

note

This is a tuple with the following parameters.


ParameterTypeDescription
peerId (item 1)stringPeer id.
inclusionStatus (item 2)InclusionStatusInclusion status.
errorMessage (item 3)string | nullError message, if present.

InclusionStatus​

NameValue
SUCCESS1
PENDING2
FAILED3

SpendBundle​

ParameterTypeDescription
coinSpendsCoinSpend[]The coin spends.
aggregatedSignaturestringThe G2Element of the aggregated signature.

CoinSpend​

ParameterTypeDescription
coinCoinThe coin that is being spent.
puzzleRevealstringThe puzzle reveal in serialized CLVM hex format.
solutionstringThe solution in serialized CLVM hex format.

Coin​

ParameterTypeDescription
parentCoinIdstringThe parent coin id.
puzzleHashstringThe puzzle hash.
amountnumberThe amount in mojos.

WalletBalance​

ParameterTypeDescription
confirmedWalletBalancenumberThe confirmed balance.
unconfirmedWalletBalancenumberThe unconfirmed balance.
spendableBalancenumberThe spendable balance.
pendingChangenumberThe pending change.
maxSendAmountnumberThe max amount that can be sent.
unspentCoinCountnumberThe number of unspent coins.
pendingCoinRemovalCountnumberThe number of coins that are being spent.
walletIdnumberThe wallet id.
walletTypenumberThe type of wallet.