基于区块链的毕业设计CLI Tool for EthVigil APIs – 用于EthVigil API的CLI工具

本文提供基于区块链的毕业设计国外最新区块链项目源码下载,包括solidity,eth,fabric等blockchain区块链,基于区块链的毕业设计CLI Tool for EthVigil APIs – 用于EthVigil API的CLI工具 是一篇很好的国外资料

CLI Tool for EthVigil APIs CLI Tool for EthVigil APIs - 用于EthVigil API的CLI工具

The guide will introduce you to the EthVigil API endpoints with the help of a CLI tool that abstracts away the underlying HTTP requests. By the end of this guide, you shall be able to perform the following:

  • sign up using your exclusive EthVigil invite code
  • access your account information on EthVigil
  • deploy a Solidity smart contract through the CLI tool

Binary Installation

Download the Linux or Mac OSX binary. You can unzip from a terminal with the following command. unzip /path/to/ev-cli-<platform>.zip

Most people would keep ev-cli in their primary user folder or set an alias for easy command-line access.

sudo cp /path/to/ev-cli /usr/local/bin/

Installation (via pip)

# clone the git repo git clone https://github.com/BlockVigil/ethvigil-cli.git cd ethvigil-cli pip install -e .

Setting up your account

There are a few handy paths you can take to setup or initialize your account on the EthVigil CLI. Choose one of them from the following as it fits your scenario.

Generate a new EthVigil invite code and complete signup on CLI

Head to EthVigil Beta to generate an invite code. Next you will need to run an init on the CLI tool.

ev-cli init

If you do not have ev-cli in your path and/or calling it directly, you will need to prefix ./

./ev-cli init

On the next prompt you will be asked for your invite code. The invite code should have been sent to the email address you used to register.

Enter your invite code: <invite-code-goes-here>

You should see something like the following

http://beta.ethvigil.com/api/signup {"success":true,"data":{"status":"active","email":"swaroop@ethvigil.com"}} Sign up succeeded... Logging in with your credentials... You have signed up and logged in successfully to EthVigil Beta ---YOU MIGHT WANT TO COPY THESE DETAILS TO A SEPARATE FILE--- ===Private key (that signs messages to interact with EthVigil APIs=== 0xprivatekeyhexstring ===ETHEREUM hexadecimal address corresponding to above private key=== 0xdFaFF6081f4544fEb76d213DEB2f9DC3C8453b6 

On EthVigil APIs, you are primarily idenitified by the above 160 bit address that we have generated locally for you. 0xdFaFF6081f4544fEb76d213DEB2f9DC3C8453b6 in this case.

You can import the corresponding private key to a wallet solution like MetaMask.

The keys are locally stored and EthVigil does not have access to them. You can check the ~/.ethvigil/settings.json file once init is complete.

Feel free to skip to the section Get your EthVigil account information if you have completed your account setup following the above instructions.

Reuse your in-browser local wallet settings (No Metamask involved)

If you are already signed up on the Web UI with a local wallet, you can export a settings.json file that can be used to initialize the CLI.

Use the Export Key option from the Settings dropdown to download the settings.json

CLI Tool for EthVigil APIs - 用于EthVigil API的CLI工具

Next run the following command on your terminal to import these settings

ev-cli importsettings path/to/settings.json

If you do not have ev-cli in your path and/or calling it directly, you will need to prefix ./

./ev-cli importsettings path/to/settings.json

And that’s it! Your CLI tool is now ready for further use. The GIF below demonstrates these instructions in action.

CLI Tool for EthVigil APIs - 用于EthVigil API的CLI工具

Get your EthVigil account information

Once initialized, you can find information related to your EthVigil account through the CLI tool.

ev-cli accountinfo  Contracts events fired to registered hooks: 	 {'usage': 0, 'limit': 1000} =============  Registered integrations/hooks: 	 {'usage': 1, 'limit': 10} =============  EthVigil API key: 	 80340b2a-633b-4a33-898c-06055ee10a34 =============  REST API prefix: 	 http://localhost:9000/api/v0.1 =============  Contracts deployed/verified: ============= Name: SignerControlBase Address: 0x746254cb1888a0f073fca2cf397457fb3e54396f -------------------- Name: ERC20Mintable Address: 0xaec35285e21045bd4f159165015cc1f9df14c13e -------------------- 

Deploy a Solidity smart contract

We have included a couple of smart contracts written in Solidity in the Github repo to help you test out their deployment right away. You can find them under contracts/ as ERC20Mintable.sol and SignerControlBase.sol

The syntax to deploy a contract through the CLI tool is:

ev-cli deploy <path-to-solidity-contract>   --contractName=<contract-name>   --constructorInputs='JSON representation of the constructor arguments'

Currently EthVigil API accepts Solidity files that import other Solidity files containing smart contracts and library code, within the same directory. For example, your imports must be of the form import './SafeMath.sol' denoting that SafeMath.sol is to be found in the same directory.

We will soon add support for parsing relative import paths as well. Feel free to create a pull request against our Github repo or chat with us on the public discord channel if you wish to contribute to solving this.

ERC20 token contract example – ERC20Mintable.sol

ev-cli deploy contracts/ERC20Mintable.sol --contractName=ERC20Mintable --constructorInputs='["TestTokenName", "SYMB", 18]'  Contract ERC20Mintable deployed successfully Contract Address: 0xaec35285e21045bd4f159165015cc1f9df14c13e Deploying tx: 0x17a8009565731f45a1621905a7e85e84a6330b485ac3e7e450d90f126b6c3006

Observe that we are setting --constructorInputs. It is optional for contracts that have no constructor inputs programmed.

If you do not pass the --constructorInputs argument for a contract that expects constructor arguments, you shall be prompted for the same.

ev-cli deploy contracts/ERC20Mintable.sol --contractName='ERC20Mintable'  Enter constructor inputs... name(string): TestToken symbol(string): TTK decimals(uint8): 18 Contract ERC20Mintable deployed successfully Contract Address: 0x9290b03870b0c4c99cc3c1e1dfcfa1ff789af6c0 Deploying tx: 0x699af417f4349f9e29d63dbc894874b5ae865fefe8e7a6bb2365339fab774211 

SignerControlBase.sol

This contract forms the base of EthVigil’s Proxy+Signer Control contract. Without going into the logic of the contract, let us take a look at the constructor as written in the contract.

constructor (address[] memory _primaryOwners, address[] memory _secondaryOwners, uint _required_confirmations)     public 

⚠️Passing JSON serialized constructor inputs to the CLI tool

This section deals with passing constructor inputs via the CLI tool. It is always easier to do the same with code. There can be compounding confusion since

  • individual constructor parameters that are arrays are expected by the EthVigil API to be encoded as strings
  • the CLI tool itself accepts all the inputs as an array string.

An equivalent representation of the constructor inputs in JSON would look like

[   "["0x774246187E1E2205C5920898eEde0945016080Df", "0x902Abade63A5CB1b503Fe389aEA5906D18DAAF2b"]",   "["0x0228c246170f010C386f49e2dbc7aA999384B399", "0x5747Ca27b1031D8054cB9Cbc79F70CD2d9D2E204"]",   2 ]

Example to generate the JSON serialized string with Python follows

>>> import json >>> _primary = ["0x774246187E1E2205C5920898eEde0945016080Df", "0x902Abade63A5CB1b503Fe389aEA5906D18DAAF2b"],  # primary owners >>> _secondary = ["0x0228c246170f010C386f49e2dbc7aA999384B399", "0x5747Ca27b1031D8054cB9Cbc79F70CD2d9D2E204"] # secondary owners >>> inputs = [   json.dumps(_primary), json.dumps(_secondary), 2  # _required_confirmations ] # write the entire list of arguments as a JSON serialized string into a file >>> with open('c_inputs', 'w') as f:         json.dump(inputs, f)

We dumped the JSON representation of the entire array of constructor inputs into a file, c_inputs. We shall pass this next to the command line option of --constructorInputs in our call to deploy.

ev-cli deploy SignerControlBase.sol --contractName SignerControlBase --constructorInputs="$(< c_inputs )" --verbose=1  Got constructor inputs: ["["0x774246187E1E2205C5920898eEde0945016080Df", "0x902Abade63A5CB1b503Fe389aEA5906D18DAAF2b"]", "["0x0228c246170f010C386f49e2dbc7aA999384B399", "0x5747Ca27b1031D8054cB9Cbc79F70CD2d9D2E204"]", 2] EthVigil deploy response: {"success":true,"data":{"contract":"0x746254cb1888a0f073fca2cf397457fb3e54396f","gas":"infinite","hash":"0xcb2cb6f036e01eb22707084f4780d731ee959a50fe6b6a562643cfa40f3d5e2f"}} Contract SignerControlBase deployed successfully Contract Address: 0x746254cb1888a0f073fca2cf397457fb3e54396f Deploying tx: 0xcb2cb6f036e01eb22707084f4780d731ee959a50fe6b6a562643cfa40f3d5e2f

Verifying a previously deployed contract

Ethereum is decentralized, and you may have deployed contracts through a different interface, for eg, remix.ethereum.org and would like to operate on them through your current EthVigil account.

For this purpose, you will have to verify and add the contract to your account by specifying a few details, including the contract source code.

To use the feature of verifying and adding contracts to EthVigil, we assume that you have the source code and the address at which the contract has been deployed.

Here we have deployed the Microblog.sol contract found in the CLI example contracts directory, contracts/Microblog.sol through remix.ethereum.org , compiled with the Solidity compiler v0.5.17+commit.d19bba13 and optimization flag off.

CLI Tool for EthVigil APIs - 用于EthVigil API的CLI工具

Interactive mode

Run the verify command in interactive mode

ev-cli verifycontract -i

or

ev-cli verifycontract --interactive

Let us go over the input prompts for the interactive mode.

  • Contract address to be verified: 0x797ae7841281b6b3a72496b0193c91d150c7105d

  • Contract name: Microblog

  • Location of Solidity file: contracts/Microblog.sol

Next you will have a paged list of compilers from which you have to choose the integer value against the compiler version which was used to compile the contract on https://remix.ethereum.org.

CLI Tool for EthVigil APIs - 用于EthVigil API的CLI工具

In our case, the Solidity compiler v0.5.17+commit.d19bba13 is at 27. Press q to exit the list and go back to the input prompt where you can enter this value

The last input is regarding the optimization flag set originally at the time of compiling the deployed contract. Which is off in this case.

If you entered all the values at the prompts correctly, you should see a success message.

CLI Tool for EthVigil APIs - 用于EthVigil API的CLI工具

Non-interactive mode (pass CLI arguments)

The same process as described above can be achieved from the command line by passing the right arguments against the parameters.

You can run ev-cli verifycontract --help to learn about all the parameters

ev-cli verifycontract --contractAddress 0x9d885fac1e993529b37fc50415a9c152a3ed5fd4  --contractName Microblog  --compilerVersion 'v0.5.17+commit.d19bba13'  --optimization false  --contractFile contracts/Microblog.sol

CLI Tool for EthVigil APIs - 用于EthVigil API的CLI工具

Adding integrations

You can add integrations like webhooks/email notifications/slack notifications on a contract deployed via EthVigil APIs.

  • You can monitor
    • specific/all events being emitted on a contract
    • all transactions taking place on a contract
  • You receive the relevant payloads like event topics or transaction input data

Webhooks

To test webhooks, it is suggested to set up a webhook listener on a service like https://webhook.site

EthVigil supports only HTTPS enabled webhook endpoints

Register the webhook endpoint to get an ID by which the endpoint willl be identified

ev-cli registerhook 0xbbd8cda5503e1df2983f738ad131a2304528e3dd https://webhook.site/9facc063-beb1-483f-b24a-408375e5d1b6  {"success":true,"data":{"id":10}} Succeeded in registering webhook with Ethvigil API... EthVigil Hook ID: 10 

Subscribe to the Transfer and Approval events on the contract

ev-cli addhooktoevent 0xbbd8cda5503e1df2983f738ad131a2304528e3dd 10 Transfer,Approval  Registering | hook ID: 10 | events: ['Transfer', 'Approval'] | contract: 0xbbd8cda5503e1df2983f738ad131a2304528e3dd {"success":true} Succeeded in adding hook 

Subscribe to all events, with a wildcard, *

ev-cli addhooktoevent 0xbbd8cda5503e1df2983f738ad131a2304528e3dd 10 '*'  Registering | hook ID: 10 | events: ['*'] | contract: 0xbbd8cda5503e1df2983f738ad131a2304528e3dd {"success":true} Succeeded in adding hook 

Subscribe to all transactions sent to the contract

ev-cli enabletxmonitor 0xbbd8cda5503e1df2983f738ad131a2304528e3dd 10  {"success":true} Succeded in adding hook to monitor all contract txs 

More CLI features

Dump local settings

ev-cli dumpsettings  {'PRIVATEKEY': '0xprivatekeyhexstring', 'INTERNAL_API_ENDPOINT': 'https://beta.ethvigil.com/api', 'REST_API_ENDPOINT': 'http://localhost:9000/api/v0.1', 'ETHVIGIL_USER_ADDRESS': '0x40b93b89f89c674fB97db61d4b2D9CE2C2Cf6EB6', 'ETHVIGIL_API_KEY': '80340b2a-633b-4a33-898c-06055ee10a34'} 

Reset

If you wish to begin with a fresh slate, run the tool with the reset argument.

You will lose all saved state, including the private key used to identify your account on EthVigil. You should either backup the information or request a new invite code

ev-cli reset  Do you want to reset the current EthVigil CLI configuration and state? [y/N]:

Backup settings and recover later

ev-cli dumpsettings > settings-backup.json  ev-cli reset  ev-cli importsettings setting-backup.json

CLI工具,用于EthVigil api<CLI Tool for EthVigil APIs>

本指南将向您介绍ethVigilAPI端点,该工具将抽象出底层HTTP请求。在本指南结束时,您将能够执行以下操作:

  • 使用专用EthVigil invite代码注册
  • 访问EthVigil上的帐户信息
  • 通过CLI工具部署Solidity智能合约

二进制安装

下载Linux或Mac OSX二进制文件。您可以使用以下命令从终端解压缩。解压缩/path/to/ev cli-&lt;platform&gt;.zip

大多数人都会将ev cli保存在主用户文件夹中,或设置别名以方便命令行访问。

sudo cp/path/to/ev cli/usr/local/bin/

安装(通过pip)

# clone the git repo git clone https://github.com/BlockVigil/ethvigil-cli.git cd ethvigil-cli pip install -e .

设置帐户

在EthVigil cli上可以使用一些方便的路径来设置或初始化帐户。从以下选项中选择一个适合您的场景。

✅ 生成新的EthVigil invite代码并在CLI上完成注册

前往EthVigil Beta生成邀请代码。接下来需要在CLI工具上运行init。

ev-cli init

如果路径中没有ev cli和/或直接调用ev cli,则需要添加前缀。/

./ev-cli init

下一次提示时,将要求您输入邀请代码。邀请代码应该已发送到您用于注册的电子邮件地址。

输入您的邀请代码:&lt;invite code goes here&gt;

您应该会看到如下内容

http://beta.ethvigil.com/api/signup {"success":true,"data":{"status":"active","email":"swaroop@ethvigil.com"}} Sign up succeeded... Logging in with your credentials... You have signed up and logged in successfully to EthVigil Beta ---YOU MIGHT WANT TO COPY THESE DETAILS TO A SEPARATE FILE--- ===Private key (that signs messages to interact with EthVigil APIs=== 0xprivatekeyhexstring ===ETHEREUM hexadecimal address corresponding to above private key=== 0xdFaFF6081f4544fEb76d213DEB2f9DC3C8453b6 

在EthVigil API上,您主要是通过我们在本地为您生成的上述160位地址来识别的。本例中为0xdFaFF6081f4544fEb76d213DEB2f9DC3C8453b6。

您可以将相应的私钥导入MetaMask等钱包解决方案。

密钥在本地存储,EthVigil无权访问它们。你可以查看~/.ethvigil/设置.json初始化完成后的文件。

如果您按照上述说明完成了帐户设置,请跳到获取EthVigil帐户信息部分。

✅ 重新使用浏览器内本地钱包设置(不涉及元掩码)

如果您已经使用本地钱包在Web UI上注册,则可以导出设置.json可用于初始化CLI的文件。

使用“设置”下拉列表中的“导出密钥”选项下载设置.json

CLI Tool for EthVigil APIs - 用于EthVigil API的CLI工具

CLI Tool for EthVigil APIs - 用于EthVigil API的CLI工具

ev-cli importsettings path/to/settings.json

下一步在您的终端上运行以下命令以导入这些设置

./ev-cli importsettings path/to/settings.json

如果您的路径中没有ev cli和/或直接调用ev cli,则需要使用前缀。/

,仅此而已!您的CLI工具现在可以进一步使用了。下面的GIF演示了这些操作说明。

获取您的EthVigil帐户信息

Once initialized, you can find information related to your EthVigil account through the CLI tool.

ev-cli accountinfo  Contracts events fired to registered hooks: 	 {'usage': 0, 'limit': 1000} =============  Registered integrations/hooks: 	 {'usage': 1, 'limit': 10} =============  EthVigil API key: 	 80340b2a-633b-4a33-898c-06055ee10a34 =============  REST API prefix: 	 http://localhost:9000/api/v0.1 =============  Contracts deployed/verified: ============= Name: SignerControlBase Address: 0x746254cb1888a0f073fca2cf397457fb3e54396f -------------------- Name: ERC20Mintable Address: 0xaec35285e21045bd4f159165015cc1f9df14c13e -------------------- 

部署Solidity智能合约

<CLI Tool for EthVigil APIs>

初始化后,您可以通过CLI工具找到与您的EthVigil帐户相关的信息。

ev-cli deploy <path-to-solidity-contract>   --contractName=<contract-name>   --constructorInputs='JSON representation of the constructor arguments'

我们在Github repo中包含了一些用Solidity编写的智能合约,以帮助您立即测试它们的部署。您可以在合同/as ERC20下找到它们Mintable.sol公司以及签名控制库.sol

通过CLI工具部署协定的语法是:

ERC20代币合约示例-ERC20Mintable.sol公司

ev-cli deploy contracts/ERC20Mintable.sol --contractName=ERC20Mintable --constructorInputs='["TestTokenName", "SYMB", 18]'  Contract ERC20Mintable deployed successfully Contract Address: 0xaec35285e21045bd4f159165015cc1f9df14c13e Deploying tx: 0x17a8009565731f45a1621905a7e85e84a6330b485ac3e7e450d90f126b6c3006

当前EthVigil API接受在同一目录中导入其他包含智能合约和库代码的Solidity文件的Solidity文件。例如,您的导入必须采用import’格式/安全数学.sol“表示安全数学.sol将在同一目录中找到。

我们将很快添加对解析相对导入路径的支持。如果您希望帮助解决此问题,请随时针对我们的Github repo创建一个pull请求,或者在公共discord频道上与我们聊天。

ev-cli deploy contracts/ERC20Mintable.sol --contractName='ERC20Mintable'  Enter constructor inputs... name(string): TestToken symbol(string): TTK decimals(uint8): 18 Contract ERC20Mintable deployed successfully Contract Address: 0x9290b03870b0c4c99cc3c1e1dfcfa1ff789af6c0 Deploying tx: 0x699af417f4349f9e29d63dbc894874b5ae865fefe8e7a6bb2365339fab774211 

签名控制库.sol

注意我们正在设置–constructorInputs。对于没有已编程的构造函数输入的契约,它是可选的。

constructor (address[] memory _primaryOwners, address[] memory _secondaryOwners, uint _required_confirmations)     public 

⚠️将JSON序列化的构造函数输入传递给CLI工具所有事件,使用通配符,*

如果没有为需要构造函数参数的协定传递–constructorInputs参数,则会提示您输入相同的参数。

  • EthVigil API期望将单个构造函数参数编码为字符串
  • CLI工具本身接受所有输入作为数组字符串。

本合同构成了EthVigil代理+签署人控制合同的基础。在不讨论契约逻辑的情况下,让我们看看契约中所写的构造器。

[   "["0x774246187E1E2205C5920898eEde0945016080Df", "0x902Abade63A5CB1b503Fe389aEA5906D18DAAF2b"]",   "["0x0228c246170f010C386f49e2dbc7aA999384B399", "0x5747Ca27b1031D8054cB9Cbc79F70CD2d9D2E204"]",   2 ]

本节介绍通过CLI工具传递构造函数输入。用代码做同样的事情总是比较容易。由于在JSON中构造函数输入的等效表示类似于使用Python生成JSON序列化字符串的示例,

>>> import json >>> _primary = ["0x774246187E1E2205C5920898eEde0945016080Df", "0x902Abade63A5CB1b503Fe389aEA5906D18DAAF2b"],  # primary owners >>> _secondary = ["0x0228c246170f010C386f49e2dbc7aA999384B399", "0x5747Ca27b1031D8054cB9Cbc79F70CD2d9D2E204"] # secondary owners >>> inputs = [   json.dumps(_primary), json.dumps(_secondary), 2  # _required_confirmations ] # write the entire list of arguments as a JSON serialized string into a file >>> with open('c_inputs', 'w') as f:         json.dump(inputs, f)

我们将构造函数输入的整个数组的JSON表示转储到一个文件cu inputs中,这可能会造成更复杂的混淆。我们将在调用deploy的命令行选项–constructorInputs旁边传递这个参数。

ev-cli deploy SignerControlBase.sol --contractName SignerControlBase --constructorInputs="$(< c_inputs )" --verbose=1  Got constructor inputs: ["["0x774246187E1E2205C5920898eEde0945016080Df", "0x902Abade63A5CB1b503Fe389aEA5906D18DAAF2b"]", "["0x0228c246170f010C386f49e2dbc7aA999384B399", "0x5747Ca27b1031D8054cB9Cbc79F70CD2d9D2E204"]", 2] EthVigil deploy response: {"success":true,"data":{"contract":"0x746254cb1888a0f073fca2cf397457fb3e54396f","gas":"infinite","hash":"0xcb2cb6f036e01eb22707084f4780d731ee959a50fe6b6a562643cfa40f3d5e2f"}} Contract SignerControlBase deployed successfully Contract Address: 0x746254cb1888a0f073fca2cf397457fb3e54396f Deploying tx: 0xcb2cb6f036e01eb22707084f4780d731ee959a50fe6b6a562643cfa40f3d5e2f

订阅发送到合同的所有事务

以太坊eth是分散的,您可能已经通过不同的接口部署了合同,例如,remix.ethereum.org网站并希望通过您目前的EthVigil账户对其进行操作。

为此,您必须通过指定一些详细信息(包括合同源代码)来验证合同并将其添加到您的帐户中。

要使用验证合同并将其添加到EthVigil的功能,我们假定您拥有部署契约的源代码和地址。

我们在这里部署了微博.sol在CLI example contracts目录中找到contract/微博.sol通过remix.ethereum.org网站,使用Solidity编译器v0.5.17+commit.d19bba13编译,并关闭优化标志。在交互模式下验证输入。合同地址:合同号/微博.sol

接下来,您将看到一个分页的编译器列表,您必须根据用于编译合同日期https://remix.ethereum.org。在我们的例子中,Solidity编译器v0.5.17+commit.d19bba13位于27。按q退出列表并返回到输入提示,您可以在其中输入此值

更多CLI功能

最后一个输入与编译部署的契约时最初设置的优化标志有关。在这种情况下是关闭的。

ev-cli verifycontract -i

如果您在提示下正确输入了所有值,则会看到一条成功消息。

ev-cli verifycontract --interactive

Let us go over the input prompts for the interactive mode.

  • 待核实合同地址:0x797ae7841281b6b3a72496b0193c91d150c7105d合同名称:微博/微博.sol
  • 合同上发生的所有交易
  • 您将收到相关的有效负载,如事件主题或事务输入数据

<CLI Tool for EthVigil APIs>

您可以在通过EthVigil API部署的合约上添加Webhook/email notifications/slack notifications等集成。

要测试webhook,建议在以下服务上设置webhook侦听器https://webhook.site

EthVigil只支持支持HTTPS的webhook端点

注册webhook端点以获取标识端点的ID

如果您希望从新的开始,使用reset参数运行工具。

转储本地设置

您将丢失所有已保存状态,包括用于在EthVigil上标识您帐户的私钥。您应该备份信息或请求新的invite代码

You can run ev-cli verifycontract --help to learn about all the parameters

ev-cli verifycontract --contractAddress 0x9d885fac1e993529b37fc50415a9c152a3ed5fd4  --contractName Microblog  --compilerVersion 'v0.5.17+commit.d19bba13'  --optimization false  --contractFile contracts/Microblog.sol

CLI Tool for EthVigil APIs - 用于EthVigil API的CLI工具

重置

You can add integrations like webhooks/email notifications/slack notifications on a contract deployed via EthVigil APIs.

  • You can monitor
    • specific/all events being emitted on a contract
    • all transactions taking place on a contract
  • You receive the relevant payloads like event topics or transaction input data

备份设置并稍后恢复

To test webhooks, it is suggested to set up a webhook listener on a service like https://webhook.site

EthVigil supports only HTTPS enabled webhook endpoints

Register the webhook endpoint to get an ID by which the endpoint willl be identified

ev-cli registerhook 0xbbd8cda5503e1df2983f738ad131a2304528e3dd https://webhook.site/9facc063-beb1-483f-b24a-408375e5d1b6  {"success":true,"data":{"id":10}} Succeeded in registering webhook with Ethvigil API... EthVigil Hook ID: 10 

Subscribe to the Transfer and Approval events on the contract

ev-cli addhooktoevent 0xbbd8cda5503e1df2983f738ad131a2304528e3dd 10 Transfer,Approval  Registering | hook ID: 10 | events: ['Transfer', 'Approval'] | contract: 0xbbd8cda5503e1df2983f738ad131a2304528e3dd {"success":true} Succeeded in adding hook 

Subscribe to all events, with a wildcard, *

ev-cli addhooktoevent 0xbbd8cda5503e1df2983f738ad131a2304528e3dd 10 '*'  Registering | hook ID: 10 | events: ['*'] | contract: 0xbbd8cda5503e1df2983f738ad131a2304528e3dd {"success":true} Succeeded in adding hook 

Subscribe to all transactions sent to the contract

ev-cli enabletxmonitor 0xbbd8cda5503e1df2983f738ad131a2304528e3dd 10  {"success":true} Succeded in adding hook to monitor all contract txs 

More CLI features

Dump local settings

ev-cli dumpsettings  {'PRIVATEKEY': '0xprivatekeyhexstring', 'INTERNAL_API_ENDPOINT': 'https://beta.ethvigil.com/api', 'REST_API_ENDPOINT': 'http://localhost:9000/api/v0.1', 'ETHVIGIL_USER_ADDRESS': '0x40b93b89f89c674fB97db61d4b2D9CE2C2Cf6EB6', 'ETHVIGIL_API_KEY': '80340b2a-633b-4a33-898c-06055ee10a34'} 

Reset

If you wish to begin with a fresh slate, run the tool with the reset argument.

You will lose all saved state, including the private key used to identify your account on EthVigil. You should either backup the information or request a new invite code

ev-cli reset  Do you want to reset the current EthVigil CLI configuration and state? [y/N]:

Backup settings and recover later

ev-cli dumpsettings > settings-backup.json  ev-cli reset  ev-cli importsettings setting-backup.json

部分转自网络,侵权联系删除区块链源码网

www.interchains.cc

https://www.interchains.cc/16385.html

区块链毕设网(www.interchains.cc)全网最靠谱的原创区块链毕设代做网站 部分资料来自网络,侵权联系删除! 最全最大的区块链源码站 !
区块链知识分享网, 以太坊dapp资源网, 区块链教程, fabric教程下载, 区块链书籍下载, 区块链资料下载, 区块链视频教程下载, 区块链基础教程, 区块链入门教程, 区块链资源 » 基于区块链的毕业设计CLI Tool for EthVigil APIs – 用于EthVigil API的CLI工具

提供最优质的资源集合

立即查看 了解详情