TransWikia.com

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!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP