This library provides a clean wrapper around all the methods exposed by a Polkadot/Subtrate network client and defines all the types exposed by a node.
Questions tagged [polkadot-js]
88 questions
6
votes
3 answers
How to decode block extrinsics using Polkadot js api
I am writing typescript code to get block information. I am connected to wss://kusama-rpc.polkadot.io . I am followig official polkadot js api documentation .
I am calling api.rpc.chain.getBlock method get block information, and it returns block…

Bopsi
- 2,090
- 5
- 36
- 58
5
votes
1 answer
How do I update my token's name in Substrate?
I have set up a custom Substrate chain, and I want to modify the display name of my token.
What do I need to modify such that Polkadot JS and other APIs can discover my token name?
By default it is "Unit".

Shawn Tabrizi
- 12,206
- 1
- 38
- 69
5
votes
1 answer
How to encode the hex string representation of an account id in Substrate using Rust?
Given a hex representation: 0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d, we can get the AccountId it represents using keyring.encodeAddress() using JavaScript. However, what is the corresponding function in Rust?
AccountId is…

Aviral Srivastava
- 4,058
- 8
- 29
- 81
4
votes
0 answers
How can I subscribe to a single event using Polkadot.js API?
I want to subscribe to a single event (or a list of events) using the Polkadot.js API. However, I have only found information on how to traverse events and then filter the results. In addition, the documentation about events lists all the events…

Daniel Bastos
- 59
- 4
4
votes
0 answers
Public key / Private key encryption using polkadot lib?
I'm building a substrate blockchain backed by polkadot js. While working on a task I have a requirement of public/private key encryption and decryption. for ex: Bob wants to send Alice an encrypted email. To do this, Bob takes Alice's public key and…

sachin murali
- 469
- 2
- 7
- 22
4
votes
2 answers
Use custom types (Substrate FRAME pallet + Polkadot/Substrate frontend)
Scenario: You are developing a FRAME pallet for a custom Substrate node that uses custom types within Storage or Events. To interact with your custom Substrate node, you use the Polkadot/Substrate frontend
Problem:
When you query the storage that…

sea212
- 299
- 2
- 12
4
votes
1 answer
How do you format balances with the Polkadot JS API?
I would like to get the balance of a user formatted using the base unit of the Substrate chain.
When I use toHuman(), I get an opinionated formatting which includes a prefix like so:
let account = await…

Shawn Tabrizi
- 12,206
- 1
- 38
- 69
4
votes
1 answer
Connect via WSS to Polkadot Full Noder running on local network failed
I have setup a Full Node running at a local server at 192.168.2.254. I'm just trying to make a simple script which is basically subscribe to new heads on the blockchain.
const { ApiPromise, WsProvider } = require('@polkadot/api');
async function…

Minh Tran Duc
- 227
- 3
- 13
3
votes
1 answer
Using api.rpc.payment.queryFeeDetails to get extrinsic fee
I want to use api.rpc.payment.queryFeeDetails api call ( https://polkadot.js.org/docs/substrate/rpc#queryfeedetailsextrinsic-bytes-at-blockhash-feedetails) to get information about fees of a specific extrinsic in a Substrate blockchain.
I'm using…

Mario Pino Uceda
- 61
- 6
3
votes
2 answers
What are the Proof-of-Stake[PoS] algorithms available
What are the Proof-of-Stake[PoS] algorithms available which can be configured on substrate-node-template

Kiran Kumar HM
- 41
- 3
3
votes
2 answers
Use custom Substrate node name (Substrate FRAME pallet + Polkadot/Substrate frontend)
Scenario: You want to submit an extrinsic to your custom Substrate node based on the substrate-node-template by using the Polkadot/Substrate frontend. You have renamed the Substrate node either manually by carefully searching and replacing all…

sea212
- 299
- 2
- 12
3
votes
1 answer
Error Connecting to Substrate: Unable to initialize the API: createType(StorageKey):: Derived
I've got a Substrate node running locally on my PC, following this tutorial. https://substrate.dev/docs/en/tutorials/create-your-first-substrate-chain/interact. It can be viewed on two ports:
Local: …

Sarah Kay
- 81
- 5
3
votes
3 answers
How to access the `Alice` account on a Parity Substrate developer chain?
The Substrate Collectables Workshop suggests at some point that the developer chain comes with a prefunded account for Alice.
Let's go into the Transfer app, and make a transaction. The default account named "Alice" is pre-funded with a ton of…

q9f
- 11,293
- 8
- 57
- 96
2
votes
1 answer
An Reference Error is occured at "@polkadot/extension-dapp/bundle.js"
I tried to implement a simple UI for smart contracts using polkadot.js in the next.js framework.
The content of the WEB UI is a simple one that calls the Flipper contract, which is famous for the sample contract of the substrate.
When compiling,…

s.Takahashi
- 469
- 4
- 15
2
votes
1 answer
How can I decode events help on substrate using polkadot-js?
I have a base smart contract in Rust with package manager Cargo. In that smart contract, I have some events which I'm emitting while function calling. For listing those events, I have a service in JavaScript, but I'm not sure how to decode that…

Puneet Jindal
- 99
- 1
- 9