Can't connect successfully to Polkadot node
See original GitHub issuePlease let me know if this is rather an issue with Polkadot as opposed to polkadot.js and if I should report this somewhere else.
I’ve installed polkadot from its git repository and spinned up a node via
$ polkadot --dev
Next I wanted to try to connect to it via polkadot.js, so I took the “Simple Connect” example and ran it against my local node:
const { ApiPromise, WsProvider } = require('@polkadot/api');
async function main() {
const provider = new WsProvider('ws://127.0.0.1:9944');
const api = await ApiPromise.create(provider);
const [chain, nodeName, nodeVersion] = await Promise.all([
api.rpc.system.chain(),
api.rpc.system.name(),
api.rpc.system.version()
]);
console.log(`Connected to: ${chain} using ${nodeName} v${nodeVersion}`);
}
main().catch(console.error).finally(() => process.exit());
^ This is polkadot/api v^0.8.1 and polkadot version latest HEAD from master
which at the time of creating this issue was 12cb9cb5
.
Running this script gives me the following error:
2019-07-16 15:23:34 RPC-CORE: getMetadata (block: Hash): Metadata:: U8a: failed on 'MagicNumber':: U8a: failed on 'MetadataEnum':: Unable to create Enum via index 6, in
MetadataV0, MetadataV1, MetadataV2, MetadataV3, MetadataV4, MetadataV5
2019-07-16 15:23:34 API/DECORATOR: Error: FATAL: Unable to initialize the API: getMetadata (block: Hash): Metadata:: U8a: failed on 'MagicNumber':: U8a: failed on 'MetadataEnum':: Unable to create Enum via index 6, in MetadataV0, MetadataV1, MetadataV2, MetadataV3, MetadataV4, MetadataV5
at EventEmitter._rpcBase._provider.on (/Users/pascalprecht/projects/embark/polkadot-playground/node_modules/@polkadot/api/Base.js:433:23)
at process._tickCallback (internal/process/next_tick.js:68:7)
Any idea what I need to do?
Also, I’ve noticed that simply installing @polkadot/api
won’t do it as it needs bs58
to run as well. I needed to install it explicitly, maybe it should come as a (peer)dependency of polkadot/api.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to fix connection issues on polkadot.js
This usually fixes things, in case one node has connection issues. Simply select the other node and then click the "Switch" button on...
Read more >Setting Up a Polkadot Node (the easy way) | by Alberto Cevallos
This command sets up your node but won't sync with the rest of the network. Meaning, it'll appear in Telemetry but won't sync...
Read more >Create an Account on Polkadot.js Apps - Moonbeam Docs
First, you need to connect it to the Moonbase Alpha TestNet by clicking the logo in the top left corner, then scroll down...
Read more >Authorize specific nodes | Substrate_ Docs
Open the Polkadot/Substrate Portal in a browser. Click Developer and select Extrinsics. Select nodeAuthorization and select addConnections(node, connections).
Read more >How to Stake DOT (Polkadot) - Blockdaemon
It's easy to participate in the Polkadot network with Blockdaemon. ... Any less than this, and you won't be able to stake. ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This has worked well, thank you!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.