远程激活Alphanet水龙头钱包(无tezos-client)
2 个回答
- 投票数
-
- 2019-03-03
是的,使用sotez可以做到.最初存在一个带有激活功能的错误,该错误已在 0.2.11 <中修复./a>.您可以执行以下操作来激活帐户并生成密钥:
import { rpc, crypto } from 'sotez'; // tz1eQV2GqDTY7dTucnjzNgvB5nP4H5c7Xr5m.json const accountJSON = { "mnemonic": [ "raw", "peace", "visual", "boil", "prefer", "rebel", "anchor", "right", "elegant", "side", "gossip", "enroll", "force", "salmon", "between" ], "secret": "0c5fa9a3d707acc816d23940efdef01aa071bdc6", "amount": "12358548903", "pkh": "tz1eQV2GqDTY7dTucnjzNgvB5nP4H5c7Xr5m", "password": "wc0W7jn3Vf", "email": "[email protected]" }; const activateAccount = async (accountJSON) => { let keys; try { const activatedOperation = await rpc.activate(accountJSON.pkh, accountJSON.secret); await rpc.awaitOperation(activatedOperation.hash); keys = await crypto.generateKeys(accountJSON.mnemonic.join(' '), `${accountJSON.email}${accountJSON.password}`); console.log(keys); } catch (e) { console.log(e); } }; activateAccount(accountJSON);
从示例中可以看到的一些事情是,助记符是作为字符串输入的,密码短语是JSON文件中串联的电子邮件和密码值.
Yes this is possible with sotez. There initially was a bug with the activate function which was just fixed in 0.2.11. You can do something like the following to activate an account as well as generate the keys:
import { rpc, crypto } from 'sotez'; // tz1eQV2GqDTY7dTucnjzNgvB5nP4H5c7Xr5m.json const accountJSON = { "mnemonic": [ "raw", "peace", "visual", "boil", "prefer", "rebel", "anchor", "right", "elegant", "side", "gossip", "enroll", "force", "salmon", "between" ], "secret": "0c5fa9a3d707acc816d23940efdef01aa071bdc6", "amount": "12358548903", "pkh": "tz1eQV2GqDTY7dTucnjzNgvB5nP4H5c7Xr5m", "password": "wc0W7jn3Vf", "email": "[email protected]" }; const activateAccount = async (accountJSON) => { let keys; try { const activatedOperation = await rpc.activate(accountJSON.pkh, accountJSON.secret); await rpc.awaitOperation(activatedOperation.hash); keys = await crypto.generateKeys(accountJSON.mnemonic.join(' '), `${accountJSON.email}${accountJSON.password}`); console.log(keys); } catch (e) { console.log(e); } }; activateAccount(accountJSON);
Some things you can see from the example is that the mnemonic is entered as a string and the passphrase is the concatenated email and password values from the JSON file.
-
- 2019-03-03
您可以使用eztz库执行此操作.这是您要查看的相关命令:
//Point to alphanet node eztz.node.setProvider("https://alphanet.tezrpc.me"); //From https://faucet.tzalpha.net/ var faucet = { "mnemonic": [ "viable", "decline", "spend", "excess", "hour", "panel", "decade", "sniff", "blame", "crane", "enact", "clever", "rival", "bundle", "silk" ], "secret": "b318178ddad24f1f9f789aecdbe62a4f4723f47f", "amount": "19080702922", "pkh": "tz1XfgzFAdNijPdANxxJ69wYUdHfYrWr4bqS", "password": "Omxz6rDlHz", "email": "[email protected]" }; //Generate keys var keys = eztz.crypto.generateKeys(faucet.mnemonic.join(" "), faucet.email + faucet.password); if (keys.pkh != faucet.pkh) throw "Invalid"; //Activate eztz.rpc.activate(faucet.pkh, faucet.secret).then(function(d){ console.log(d); });
这将查询远程tezrpc Alphanet节点,在本地构造密钥和进行伪造操作,并将激活操作注入该节点.
You can do this using the eztz library. Here are the relevant commands you want to look at:
//Point to alphanet node eztz.node.setProvider("https://alphanet.tezrpc.me"); //From https://faucet.tzalpha.net/ var faucet = { "mnemonic": [ "viable", "decline", "spend", "excess", "hour", "panel", "decade", "sniff", "blame", "crane", "enact", "clever", "rival", "bundle", "silk" ], "secret": "b318178ddad24f1f9f789aecdbe62a4f4723f47f", "amount": "19080702922", "pkh": "tz1XfgzFAdNijPdANxxJ69wYUdHfYrWr4bqS", "password": "Omxz6rDlHz", "email": "[email protected]" }; //Generate keys var keys = eztz.crypto.generateKeys(faucet.mnemonic.join(" "), faucet.email + faucet.password); if (keys.pkh != faucet.pkh) throw "Invalid"; //Activate eztz.rpc.activate(faucet.pkh, faucet.secret).then(function(d){ console.log(d); });
This queries the remote tezrpc Alphanet node, constructs keys and forges operations locally and injects the activation operation into the node.
昨天我了解到必须首先使用
activate account
激活Alphanet钱包提供的JSON../tezos-client activate account myRandomAlias with tzWhAtEvEr.json
(感谢Fredcy!),这也促使我在开发人员文档 https://tezos.gitlab.io/master/introduction/howtouse.html#get-free-tez .是否可以在没有tezos-client的情况下执行此操作,而是通过将eztz或sotez之类的库与远程提供程序一起使用来执行此操作?我看到sotez确实具有"激活"方法,但是我尝试了几种从水龙头JSON提取的值的组合,但无济于事. https://github.com/AndrewKishino/sotez/wiki/Documentation#activate
当ZuluRepublic最初与Tezos合作将Tezos实施到我们的产品套件中时,我们被告知无需托管我们自己的节点就可以实现这一目标,但是现在我想知道这是否不正确?
编辑: 详细地说,我的意图是处理密钥生成,存储,事务构建和本地签名(脱机方法),并仅使用远程提供程序来获取诸如块,事务,余额和广播已签名事务之类的公共数据.
我习惯于要求将令牌发送到的地址的水龙头,然后将地址输入到我控制的钱包中,然后就可以开始在我的代码库中尝试发送和接收Tezzies了.但是有了这个水龙头,似乎我需要有一个自己的节点,以便可以使用tezos-client来激活它.