Satya
Mar 24, 2022

--

Hi,

Can you please tell about your use case ? Are you trying to sign a transaction using pvt key?

If you have a private key for an address, you can sign the transaction directly using SecretKey.

In the following example, I am using a pvt key generated through cardano-cli.

SecretKey secretKey = new SecretKey("58202033e8015e8003e6592ae211cda7c6692e730576ed299d10e7bf3a72d5axxxxx");

Transaction signedTxn = TransactionSigner.INSTANCE.sign(transaction, secretKey);

But to get Account object from a pvt key, you need the pvt key at account level (m/1852'/1815'/x ) . Then you can use the following constructor to create an Account.

public Account(Network network, byte[] accountKey)

--

--

Satya
Satya

Written by Satya

A developer’s journey in blockchain world

Responses (1)