How to calculate the "secret" field of an activation operation?

Tezos Asked on January 1, 2022

For particular reasons (let’s say I am creating a Tezos faucet) I want to send an activation operation to Tezos blockchain. This kind of operation (activate_account) requires three fields: kind, pkh and secret.

I would like to know what is the algorithm to create the "secret" field of the activate_account operation. I imagine it might use an account private and public keys to derive it from. So, my question is:

How to calculate the "secret" field of an activation operation?

2 Answers

Just to clarify the issue: the main reason for the question was that I was trying to add to my Java library, TezosJ, a feature to automatically create new Tezos addresses, because a client I am working with needs this functionallity.

By "create new Tezos addresses" I mean creating them, activating them and revealing them, in a single operation, so it becomes trivial to the end-user.

Occures that "activation" is an operation intended for those addresses from fundraiser participants (or faucets) and needs a "secret". So I had two options: Get the algorithm to create the secret (thanks Arthur, for kindly answering) or to activate an address by sending some tez to it (thanks, Klassare for the help).

What I finally did was to create a method on TezosJ called "activate", that has two different behaviours: with or without the "secret" parameter. If the parameter is present, then the method try to activate the address as it was from fundraiser or generated by a faucet, like this:

     transaction.put("kind", "activate_account");
     transaction.put("pkh", addressToActivate);
     transaction.put("secret", secret);

Otherwise, in the lack of the "secret" parameter, it assumes the proceedings are different from fundraiser/faucet and then activates the account by sending some tez to it:

sendTransaction(from, addressToActivate, amount, fee, gasLimit, storageLimit...);

Of course, by this methodology, an already known account should call the method to activate the new created account and will be charged for the operation.

Important to remember that, the main goal of TezosJ library is to always make easier for developers to build for Tezos blockchain, so whatever I can do to make things simpler, the better.

The end result for this was that, now the client I am working with can seamlessly send a JSON wrapped command ("createNewAddress") to a middleware I wrote (called Quarterback) and it interacts with Tezos blockchain by using TezosJ library. Quarterback acts like a new layer on top of TezosJ and free the client from even knowing how to code in Java. With this higher level layer it's possible to send commands to an FA1.2 smart contract without any programming. And it is working great!

Quarterback works integrated to AWS SQS (Amazon Queues). Amazon SQS is very popular between developers worldwide and now they can seamlessly integrate existing systems with Tezos smart contracts by sending JSON wrapped commands.

Answered by Luiz Milfont on January 1, 2022

Answered by Arthur B on January 1, 2022

Add your own answers!

Related Questions

About delegating XTZ

3  Asked on December 27, 2021 by nguyen-minh-dung


Why won’t tezos-client find my Ledger Nano S?

2  Asked on December 18, 2021 by tzduzit


How to calculate the total locked XTZ?

0  Asked on December 5, 2021 by innovativerp


How to send XTZ from fundraiser wallet

2  Asked on December 5, 2021 by nick-doulas


Question on receiving first staked reward

1  Asked on November 15, 2021 by clann


Why can’t I move my XTZ?

1  Asked on November 7, 2021 by user5185


Calling view of Fa1.2 contract

1  Asked on August 20, 2021


experience with AWS cloudHSM and remote-signer

0  Asked on August 20, 2021 by romain-braud


HTTP status codes for failing requests

0  Asked on August 20, 2021 by ivan-gromakovskii


Tezos GigaNode snapshots – Quick “latest” URL?

0  Asked on August 20, 2021 by babell


FA2 Permission Policies & Hook permission Behaviour

1  Asked on August 20, 2021 by vinnyson


Tezos.get_entrypoint_opt in Ligo issue

3  Asked on August 20, 2021 by anastasia-kondaurova


Trouble activating account on carthagenet

1  Asked on August 20, 2021 by lucasms


Ask a Question

Get help from others!

© 2023 All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir