Skip to main content

Deprecating CB58 in AvalancheGo API

Overview

We are working to deprecate cb58 encoding in favor of hex in the return of AvalancheGo API calls. This only changes the supported encoding formats for variable length representations (such as UTXOs, transactions, blocks, etc). Other data represented using cb58 such as addresses and IDs (txIDs, chainIDs, subnetIDs, and utxoIDs) are unchanged.

To prepare for this change, you can now specify hex (or json if supported) for the encoding parameter in places where cb58 is used by default or explicitly. For example, for API call avm.getUTXOs in which

  • encoding sets the format for the returned UTXOs.

you can specify "encoding": "hex" when issuing the API call.

curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"avm.getUTXOs",
"params" :{
"addresses":["X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5", "X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],
"limit":5,
"encoding": "hex"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/X

This gives response where utxos will be in hex format:

{
"jsonrpc": "2.0",
"result": {
"numFetched": "5",
"utxos": [
"0x0000a195046108a85e60f7a864bb567745a37f50c6af282103e47cc62f036cee404700000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216c1f01765",
"0x0000ae8b1b94444eed8de9a81b1222f00f1b4133330add23d8ac288bffa98b85271100000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216473d042a",
"0x0000731ce04b1feefa9f4291d869adc30a33463f315491e164d89be7d6d2d7890cfc00000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f21600dd3047",
"0x0000b462030cc4734f24c0bc224cf0d16ee452ea6b67615517caffead123ab4fbf1500000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216c71b387e",
"0x000054f6826c39bc957c0c6d44b70f961a994898999179cc32d21eb09c1908d7167b00000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f2166290e79d"
],
"endIndex": {
"address": "X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",
"utxo": "kbUThAUfmBXUmRgTpgD6r3nLj7rJUGho6xyht5nouNNypH45j"
},
"encoding": "hex"
},
"id": 1
}

You can also use json if the api supports it.

Affected APIs

Following APIs are affected with this change.

tip

When going through this API list, please make sure to check the omitted/default encoding parameter. Before the new release of cb58 deprecation is out, by default, cb58 is used for the encoding parameter if not specified in these APIs. You will need to add "encoding": "hex" (or "encoding": "json" if supported) explicitly and update your code to handle the response accordingly.

X-Chain API

P-Chain API

C-Chain API

Index API

Keystore API