Parsing validator key
Hi! I know this forum is more about Cosmos, but I cannot find any specific forum for Tendermint, so I’m trying here. I’m writing a Java application connected to Tendermint via ABCI. Inside the initChain callback, I want to create objects of class java.security.PublicKey corresponding to the public keys of the initial validators of the chain. Since the keys are in ED25519 format, I use the bouncycastle library for dealing with them. I wrote the following code: ``` @Override public void initChain(RequestInitChain req, StreamObserver<ResponseInitChain> responseObserver) { try { KeyFactory keyFactory = KeyFactory.getInstance("Ed25519", "BC"); for (ValidatorUpdate validator: req.getValidatorsList()) { System.out.println("key type: " + validator.getPubKey().getType()); ByteString data = validator.getPubKey().getData(); byte[] bytes = data.toByteArray(); String address = new String(Hex.encode(sha256.hash(bytes))).substring(0, 40); System.out.println("address: " + address); String publicKeyBase64 = new String(Base64.getEncoder().encode(bytes)); System.out.println("pubKey in Base64: " + publicKeyBase64);…
Excerpt (1178 of 1929 characters). Read the whole post on the forum ↗