Import participation keys

I understand how to create participation keys for accounts that are local to my node. I also understand that I can create participation keys and output them to a file, using the -o flag. So now i have a [key].x.x.partkey binary file.

My understanding is that I can take care of the above steps on an offline node, and then import the participation key to an online node, and then use this key to stake, but I do not understand how to import this participation key onto a node.

Any advise, or pointer to a document that I missed?

One way to do this:

  1. Generate the participation key and the transaction to register it on an online node.
  2. Transfer the unsigned transaction to offline device with private key to sign.
  3. Transfer the signed transaction back to online device and submit. Make sure participation key is in the ledger directory on a participating node prior to submitting to ensure it is registered.

Another way to do this:

  1. On the offline node with your private key, generate the participation key and a signed transaction to register that participation key.
  2. Transfer participation key to participation node and place in the ledger directory of that node.
  3. Transfer signed transaction back to online device and submit (can be from the participation node too if you prefer).

The primary difference is that the first method does not necessarily require you to move your participation key if you’re already on your participating node. But the other option is available depending on your setup.

“Importing” a participation key is just transferring the .partkey file to the ledger directory of the node that is participating. Let me know if this helps.

This all makes sense, thanks. I’ve run through it, and all looks successful, but the account still shows offline. Did I miss a step, or make a mistake here? I’m doing this all one one node, but I understand which I should do offline “for real”.

Here’s what I did:
./goal account addpartkey -a EIH5NK5WCTWTWBPFBMIRMMWJUNQNE2BCVOUC7NZQD55ZIGNA64MIOL7BNY --roundFirstValid 1264194 --roundLastValid 2000000 -d data -o ./partkeys

This generated partkeys/EIH5NK5WCTWTWBPFBMIRMMWJUNQNE2BCVOUC7NZQD55ZIGNA64MA.1264194.2000000.partkey

Then:

mv partkeys/EIH5NK5WCTWTWBPFBMIRMMWJUNQNE2BCVOUC7NZQD55ZIGNA64MA.1264194.2000000.partkey data/testnet-v31.0/
./goal account changeonlinestatus -a IJQCM3KYGWVDBTRN4DPRCIZOXTVSYWPWTQYNKYDVDWKJOXH2CK2NFQVRUU --online -d data -t ./rawtx
./goal clerk sign -i rawtx -o signedtx -d data
./goal clerk rawsend -f signedtx -d data

And I have confirmation:

Raw transaction ID VDMDBJZIHMTUHM765MREFUUVO3ZF56GJS56SVPV3WSEIFWLWTDEQ issued
Transaction VDMDBJZIHMTUHM765MREFUUVO3ZF56GJS56SVPV3WSEIFWLWTDEQ still pending as of round 1265593
Transaction VDMDBJZIHMTUHM765MREFUUVO3ZF56GJS56SVPV3WSEIFWLWTDEQ committed in round 1265595

After you submit your registration, it takes 320 blocks for the new participation key to be registered. So you technically have time after submitting the transaction to move the partkey to the ledger directory. However, to reduce complexity we recommend just making sure that the partkey is in place before submitting.

This 320-rounds is likely why your account initially did not show as online (because it was still offline). Can you check now?

On a separate but related note, if you are rotating participation keys make sure the old and new keys overlap in block ranges. That way there will be no gaps in participation. For example, if your first partkey expires at block 1 million, you could create the new participation key with a first valid round at 900000 let’s say (or whatever amount of time you need). Place the new key in the ledger directory with the old one that is currently participating. When you register the new one it will switch over to the new key after 320 blocks with no gaps in participation from that account.