Generate a second key pair for an address in ARK.

Create a new set of keys

Use GenerateAsymmetricKeyPair to create an ARK key pair to be used for sending and receiving ark:

  • The workflow uses the devnet blockchain for these examples. To use the mainnet blockchain, specify BlockchainBase → "ARK".

Save the private key

Use Export to save the private keys to a .wl file for later use:

  • After this transaction is accepted, both keys must be used when signing.

Create the transaction object

Use BlockchainData to view the estimated transaction fee:

Using the preceding statistics, use Quantity to set an appropriate fee for the transaction:

  • The FeeStatistics property of BlockchainData for ARK can be used to decide the Fee.
  • Use BlockchainTransaction to build the transaction object with the chosen fee and the new public key:

    • The transaction exists locally until it is submitted to the ARK blockchain.
    • The sender is not part of the transaction until the transaction is signed.

    Determine the address to use

    Use BlockchainAddressData to determine if your address both has enough balance to add a second private key and does not already have a second one:

    Since the SecondPublicKey field is empty, this address can be used.

    Sign the transaction

    Use BlockchainTransactionSign to sign the transaction with the private key:

    • The transaction is now signed but not yet submitted to the blockchain. It only exists locally.
    • Signing the transaction with the private key associated with the given address will also add the corresponding public key to the transaction.

    Submit the transaction

    Use BlockchainTransactionSubmit to send the transaction to the blockchain:

    • After the transaction is submitted, you must wait for it to be included in a block.

    View the updated information

    Use BlockchainAddressData again to view the updated information for the address:

    The SecondPublicKey is no longer empty and contains a PublicKey object.

    • After the transaction is submitted, you must wait for it to be included in a block. The block can then be forged and added to the blockchain.

    Consider future transactions

    From now on, all of the transactions signed by this address should use a list of the main and second private keys in that order: