0

I'm working on a Substrate-based blockchain network. I need to verify if a user with a specific address (e.g., 5XDDFFDF...) has added a node to the network. Depending on the verification, I want to either allow or reject certain actions.

How can I programmatically check if an address has added a node to the network in Substrate?

1 Answer 1

1

The account and node are not bound.

To achieve this, you need to develop a pallet that can store this relationship.

When verification is needed, simply read the storage and check if the account exists in it.

By the way, I think you can use the existing pallet at https://github.com/paritytech/polkadot-sdk/blob/cc39edd5a84ce14f5a5bfbf3cb949086d18e2c87/substrate/frame/node-authorization/src/lib.rs#L100-L103. However, it provides more features. If you want something simple, it would be better to implement one yourself.

4
  • i dont have the peerID , i just have the AccountId
    – Mr Coder
    Sep 14, 2023 at 8:04
  • You don't have to. User need to do the "bind" action first. Otherwise, you can't know the relationship between an account and a node. And one more thing, you might need to check if there is really a node there.
    – AurevoirXavier
    Sep 14, 2023 at 10:20
  • I don't need these nodes to be part of the consensus algorithm. I simply want them to join the network, and their primary role is to validate or check the quality of item ( special senario ) . i think using the node-authorization pallet is good for me . im not sure the nodes that added, bcome part of the consensus or not and for add node thay have to pay like POS .
    – Mr Coder
    Sep 14, 2023 at 11:08
  • No, it definitely does not produce any proof and does not incorporate the proof into the consensus. It is just a storage of records.
    – AurevoirXavier
    Sep 14, 2023 at 12:31

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.