I'm trying to fetch datas from an ended crowdloan. The crowdloan is on kusama, for parachain id 2113.

I first connect:

async function connect() {
    let endpoint = config.endpoint;
        global.endpoint = endpoint;
        const provider = new WsProvider(endpoint);
        const api = await ApiPromise.create({
        return api;

then fetch the addresses of the users that contributed:

async function fetchCrowdloan() {
    try {
        const api = await connect();

        console.log(await api.derive.crowdloan.contributions(2113))
        // other stuff
    } catch (error) {

Yesterday, when i ran my script, an array of the 478 users i expected to be here, was logged in the terminal. I closed my PC, went to sleep, and this morning, it doesn't work anymore, I get this error:

2022-06-23 12:27:51        RPC-CORE: getKeysPaged(childKey: PrefixedStorageKey, prefix: StorageKey, count: u32, startKey?: StorageKey, at?: Hash): Vec<StorageKey>:: creat
eType(StorageKey):: Expected hex value to convert, found '0x'
2022-06-23 12:27:51             DRR: createType(StorageKey):: Expected hex value to convert, found '0x'
Error: createType(StorageKey):: Expected hex value to convert, found '0x'
    at createTypeUnsafe (/home/erudyx/work/rusty-crewmates/polkadot/kusama-crowdloan-snapshot/node_modules/@polkadot/types-create/cjs/create/type.js:73:18)
    at TypeRegistry.createTypeUnsafe (/home/erudyx/work/rusty-crewmates/polkadot/kusama-crowdloan-snapshot/node_modules/@polkadot/types/cjs/create/registry.js:333:46)
    at /home/erudyx/work/rusty-crewmates/polkadot/kusama-crowdloan-snapshot/node_modules/@polkadot/rpc-core/cjs/bundle.js:395:50
    at Array.map (<anonymous>)
    at RpcCore._formatInputs (/home/erudyx/work/rusty-crewmates/polkadot/kusama-crowdloan-snapshot/node_modules/@polkadot/rpc-core/cjs/bundle.js:395:19)
    at callWithRegistry (/home/erudyx/work/rusty-crewmates/polkadot/kusama-crowdloan-snapshot/node_modules/@polkadot/rpc-core/cjs/bundle.js:252:27)
    at Observable._subscribe (/home/erudyx/work/rusty-crewmates/polkadot/kusama-crowdloan-snapshot/node_modules/@polkadot/rpc-core/cjs/bundle.js:266:9)
    at Observable._trySubscribe (/home/erudyx/work/rusty-crewmates/polkadot/kusama-crowdloan-snapshot/node_modules/rxjs/dist/cjs/internal/Observable.js:41:25)
    at /home/erudyx/work/rusty-crewmates/polkadot/kusama-crowdloan-snapshot/node_modules/rxjs/dist/cjs/internal/Observable.js:35:31
    at Object.errorContext (/home/erudyx/work/rusty-crewmates/polkadot/kusama-crowdloan-snapshot/node_modules/rxjs/dist/cjs/internal/util/errorContext.js:22:9)

Was there an update in the api of kusama in the night ? How can i solve it ?

Update: all of the other calls are working fine, it's really just the contribution()function

2 Answers 2


It was identified as a bug.


There is nothing wrong on your side. Wait for the fix to land and upgrade your @polkadot/api to a newer version.

  • Yep, i ended up asking on github, i'm glad they solved it so fast !
    – Nathan
    Commented Jun 27, 2022 at 9:06

Works fine for me ("@polkadot/api": "^8.8.3-9"):

import { ApiPromise, WsProvider } from '@polkadot/api';

export const fetchCrowdloan = async () => {
    const wsProvider = new WsProvider('wss://kusama-rpc.polkadot.io');
    const api = await ApiPromise.create({ provider: wsProvider });
    console.log(await api.derive.crowdloan.contributions(2113))
    console.log((await api.derive.crowdloan.contributions(2113)).contributorsHex.length)


  blockHash: '-',
  contributorsHex: [
  • I still have the same error using your code, your version and your endpoint... What env are you using ? How do you install/start the script ?
    – Nathan
    Commented Jun 24, 2022 at 8:58
  • install the packages and run the script*
    – Nathan
    Commented Jun 24, 2022 at 13:16
  • or maybe its a yarn version thing Commented Jun 24, 2022 at 14:52
  • Bruno what versions are you using? I am getting same problem as erudyx, maybe because i am adding fetchCrowdloan() to call the function, perhaps i need to await or i am calling it incorrectly? Commented Jun 24, 2022 at 15:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.