Skip to main content

CKB Address

Q: Is there any demos available for encoding and decoding full addresses?

A: Here is a demo in Python where you to see the cases for testing. Compared with the bitcoin address format bech32, CKB’s solution only differs in payload. They have the same programming scheme. For example, RFCs in Python demo have added Bitcoin's latest bech32m address format.

Here is a JavaScript demo on Codebox, which shows how to transform addresses in different formats.


Q: Which wallets currently support the full address for funds transfer, including transfer in and transfer out?

A: Nervos’ desktop wallets Neuron, versatile command-line tool ckb-cli, and mobile/hardware wallets, like imToken and Safepal, support transfer funds out to full addresses. ckb-cli, web wallet ckb.pw, and DAS in-app wallet can generate full address and receive funds with it.

You can test a full address that supports transfer to a full address on testnet with a minimum amount.

A full address example, ckt1qr6k6tltndf5kh09zl4p63wju9cejya9mangkkns3aaugkm6mm8tgq2vctn9ycsy4e4zar70ztm663e0gxskqm2mjcjta67jzhtcpqyldff9d38e4h6hpw6rvzjvtg29mtjjr69dzwpedzjdayled8ufjr2ln5reqgqqqqqqqqgpreg7.

After transferring, you can check the transaction status on explorer.


Q: The length of the address in ckb.pw and Godwoken is both 95 bits. Is the length of the full address/long address variable? How to determine the code hash, hash type, the location of args, etc. during parsing?

A: Because the length of args is variable, the length of long address is not fixed. Shorter args have relatively shorter full/long address. For these three parameters: code hash, hash type and args, their positions are fixed during parsing. The length of code hash and hash type is fixed, and they need to be placed at the beginning of the payload, while args at the end. Payload is generated by three parameters: code hash, hash type, and args. For the details of generation method, see: https://github.com/nervosnetwork/rfcs/blob/5e90ace4d26f2b2891d8a83ec838968d655b6b41/rfcs/0021-ckb-address-format/0021-ckb-address-format.md.


Q: How to transform CKB address format, for example, to transform a short address to a full address?

A: In the latest version of GO SDK, you can use ConvertToBech32mFullAddress to convert any address formats into our recommended address format —— the new full address format. You can also use ConvertToShortAddress to convert secp, ACP and multi-sig script addresses of any format into short addresses, and ConvertToBech32FullAddress to convert any address format to an old full address. For details about GO SDK, you may refer to: https://github.com/nervosnetwork/ckb-sdk-go.

In the latest version of Java SDK, you can use AddressTools.ConvertToBech32mFullAddress to convert any address formats into our recommended address format -- the new full address format. You can also use AddressTools.ConvertToShortAddress to convert secp, ACP and multi-sig script address of any format into short address, and ConvertToBech32FullAddress to convert any address format to the old full address. For details about Java SDK, you may refer to: https://github.com/nervosnetwork/ckb-sdk-java.

In the latest version (0.18.0-rc3) of Lumos, we provide a brand new encodeToAddress API to generate the new full address format, while retaining the old generateAddress API to generate an address. However, the generateAddress is going to be marked as deprecated, and we recommend that you can migrate to the new encodeToAddress API. If users find out some platforms (e.g. Nervos Aggron Faucet) do not yet support the new address format, the old API can still be used. You can use yarn add @ckb-lumos/[email protected] to install if using the latest version of Lumos.