aelf
Published in

aelf

Tutorial: How to Manage Contracts with aelf Explorer v1.2.0

aelf explorer v1.2.0 supports one-stop contract deployment, update, and naming.

aelf explorer has just been upgraded to v1.2.0 and we are receiving loads of questions regarding the new contract management functions. The brand new design makes it possible that developers can complete the whole process of contract deployment, update, and naming within just one platform, the explorer. In this tutorial, we will guide you through everything you need to know about how to use these tools.

This tutorial uses Tesnet explorer as an example and Mainnet explorer follows the same procedure. You can switch the networks when using it.

Before you start contract management, please make sure you have:

  1. Installed the NightELF wallet extension and logged in to your account;
  2. Enough ELF tokens in your wallet to pay fees. Tip: Testnet ELF tokens can be received through this faucet;
  3. The contract file for deployment or upgrade.

Contract Deployment

Developers can complete contract deployment in aelf explorer v1.2.0 without using any other tools like aelf command. The whole deployment procedure is incorporated into the explorer and is split into 3 steps: Propose New Contract; Release Approved Contract; Release Code Checked Contract.

Developers need to connect their wallets to log in beforehand on the [Governance] — [Proposal] subpage and follow [Apply] — [Deploy/Update Contract] — [Deploy Contract]

Propose New Contract

To deploy a contract, a developer should click [Propose New Contract] in the Contract Method dropdown menu. After entering a contract name and uploading the contract file, click [Apply] to submit.

  • Requirements for names:
  1. 150-character limit: excessive characters will not be accepted;
  2. Characters supported: uppercase and lowercase letters, numbers, period “.” and comma “,”
  3. The same name cannot be used repeatedly.

After clicking [Apply] and paying the transaction fee, the developer can view the Transaction ID and Proposal ID on the pop-up window.

The proposal for this step will be submitted to the BPs and developers can check its status on the [Parliament] page. Paste the Proposal ID and search, an approved proposal will have a [Approved] label to its right while a proposal yet to be approved will display [Pending].

  • Note: If the Proposal ID cannot be found on that page, developers should search for the Transaction ID in the search box to check whether the proposal has been submitted to the BPs. If it is successfully submitted, the status of the transaction should display [MINED]. Transaction failure may be due to insufficient balance. If the balance is sufficient, developers can restart this step.

Release Approved Contract

After the proposal is approved, click [Release Approved Contract] in the Contract Method. The Proposal ID to be used will be automatically loaded. Choose this ID in the dropdown menu and click [Apply] to get a new Proposal ID for this step. (Note: the whole [Release Approved Contract] step must be completed within 24 hours after the BPs approve the proposal, otherwise it will expire.)

Release Code Checked Contract

Click [Release Code Checked Contract] in the Contract Method. The new Proposal ID to be used will be automatically loaded (it may take around 3 mins). Choose this ID in the dropdown menu and click [Apply] to deploy the contract. (Note: the whole [Release Code Checked Contract] step must be completed within 10 minutes after the previous step is completed. As the previous step is done automatically, developers can directly start this step after that.)

The Contract Address will be shown on the pop-up window after the submission is completed.

To view the deployed contract, please go to [Blockchain] — [Address] — [Contracts] and search for the contract address.

Contract Update

aelf Explorer v1.2.0 supports developers to change the content of a contract after it’s been deployed. The whole deployment procedure is also split into 3 steps: Propose Updated Contract; Release Approved Contract; Release Code Checked Contract.

Developers need to connect their wallets to log in beforehand on the [Governance] — [Proposal] subpage and follow [Apply] — [Deploy/Update Contract] — [Update Contract]

Propose Updated Contract

To update a contract, a developer should select [Update Contract File] and click [Propose Updated Contract] in the Contract Method dropdown menu. After that, find the address of the contract to be updated and upload a new contract file. Then click [Apply] to submit and view the transaction ID and Proposal ID on the pop-up window.

Here, the procedure of proposal approval is the same as [Contract Deployment]. Please scroll up to read the instructions in the [Propose New Contract] section.

Release Approved Contract

After the proposal is approved, click [Release Approved Contract] in the Contract Method. The Proposal ID to be used will be automatically loaded. Choose this ID in the dropdown menu and click [Apply] to get a new Proposal ID for this step. (Note: the whole [Release Approved Contract] step must be completed within 24 hours after the BPs approve the proposal, otherwise it will expire.)

Release Code Checked Contract

Click [Release Code Checked Contract] in the Contract Method. The new Proposal ID to be used will be automatically loaded (it may take around 3 mins). Choose this ID in the dropdown menu and click [Apply] to deploy the contract. (Note: the whole [Release Code Checked Contract] step must be completed within 10 minutes after the previous step is completed. As the previous step is done automatically, developers can directly start this step after that.)

The Contract Address will be shown on the pop-up window after the submission is completed.

To view the updated contract, please go to [Blockchain] — [Address] — [Contracts] and search for the contract address.

Contract Naming

Compared with [Update Contract File] which enables the real contract file update, [Update The Contract Name Only] allows developers to change only the contract name or set a name for unnamed contracts.

Developers need to connect their wallets to log in beforehand on the [Governance] — [Proposal] subpage and follow [Apply] — [Deploy/Update Contract] — [Update Contract]

Click [Update The Contract Name Only] and enter the address of the contract to be updated. Note: only the contract owner can change the contract’s name. Then, enter a new contract name and click [Apply]. The pop-up notification of “Contract Name has been updated!” will appear and the name is successfully changed.

  • Requirements for names:
  1. 150-character limit: excessive characters will not be accepted;
  2. Characters supported: uppercase and lowercase letters, numbers, period “.” and comma “,”
  3. The same name cannot be used repeatedly.

As a vital part of aelf network and the foundation for aelf ecosystem, aelf explorer enables users to keep track of all the on-chain activities, including real-time blockchain data, transaction history, and proposals. With it, developers can deploy contracts onto aelf and ELF holders can participate in the governance of the ecosystem through node election and voting.

Join us on TG or Discord to stay tuned and interact with aelf communities:

Telegram: https://t.me/aelfblockchain

Discord: https://discord.gg/bgysa9xjvD

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store