Confused with address->private->public with a delegated address

Hello Cardano Community! I’m new here. Working on a Cardano-rosetta integration since two weeks but I have some stopstopper issues right now.

First of all. I really don’t understand how can I get a private key for an address. For example I have a key generation script (see below):

cat root.prv | ./cardano-address key child 1852H/1815H/0H/0/10 > addr10.prv
cat root.prv | ./cardano-address key child 1852H/1815H/0H/2/0 > stake0.prv
cat addr10.prv | ./cardano-address key public --with-chain-code | ./cardano-address address payment --network-tag mainnet | ./cardano-address address delegation $(cat stake0.prv | ./cardano-address key public --with-chain-code)
echo "public key:"
cat addr10.prv | ./cardano-address key public --with-chain-code | ./cardano-address key inspect
echo "secret key:"
cat addr10.prv | ./cardano-address key inspect

Result:

addr1q8k9c9n8awpa6r7djjc286vxjyfte476cqj829usq9a8ym79wa8uqh7parm0d7rqvuzexj9wg5nnn95pv3fkg5p2rt0sapfy23
public key:
{
“chain_code”: “938f452fc81519a3d616149103d16c936a57299be4551ad3d8b5990e47cec9e6”,
“key_type”: “public”,
“extended_key”: “d2ac5ffcc75838e035d656d343dd6cd0d413fe5f35559ed7ff9f331a9c520b5c”
}
secret key:
{
“chain_code”: “938f452fc81519a3d616149103d16c936a57299be4551ad3d8b5990e47cec9e6”,
“key_type”: “private”,
“extended_key”: “0864c423edab1f7f943e8106d11bc498a565b2ebe4d1c254c5167a7627e2f6593fd8750d60141e9af9e1f1ea955e47655d715de2dc6bb3d9dac75c51c142ac0f”
}

My first problem is with the private key. As I learned it recently, the “extended_key” is a 64 byte long key concatenated the private key and the public key. (first 32 bytes is private, second 32 bytes is the public)

If this information is correct, then the public key result and the second half of privatekey should be identical. But these are different!


Second question: In my example the generated address is a delegated address (addr1q8k9c9n…), but the public and private key only generated from the child’s private info. Is this private key is enough to spend/transfer ADA from the delegated address?

Hi!

Still need help?

Hi. Every helps could be great. But right now, I’m waiting for an update in cardano-addresses project.

This probably solves my original issue.