From 1be2f32c57f59307315d5e880e45ad4e8b3fdd36 Mon Sep 17 00:00:00 2001 From: biganxin Date: Thu, 16 Jan 2025 09:15:48 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20PlatONne?= =?UTF-8?q?twork/docs@87b357cd529b637a0472fbf0ca20d22450a0f235=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 404.html | 4 ++-- ATON-user-manual/index.html | 4 ++-- About_PlatON/index.html | 4 ++-- Become_PlatON_Dev_Verification/index.html | 4 ++-- Become_PlatON_Main_Verification/index.html | 6 +++--- Build_Private_Chain/index.html | 4 ++-- CTool_Manual/index.html | 4 ++-- Command_Line_Tools/index.html | 4 ++-- DApp_integration_with_WalletConnect_for_ATON/index.html | 4 ++-- DApp_migrate/index.html | 4 ++-- EVM_Smart_Contract/index.html | 4 ++-- Economic_Model/index.html | 4 ++-- Explorer_API/index.html | 4 ++-- Go_SDK/index.html | 4 ++-- GraphQL_Server/index.html | 4 ++-- Install_PlatON/index.html | 4 ++-- JS_SDK/index.html | 4 ++-- Java_SDK/index.html | 4 ++-- Join_Dev_Network/index.html | 4 ++-- Json_Rpc/index.html | 4 ++-- Ledger-hardware-wallet/index.html | 4 ++-- MetaMask/index.html | 4 ++-- NET_SDK/index.html | 4 ++-- Network_Description/index.html | 4 ++-- OffLine_MTool_Manual/index.html | 4 ++-- OnLine_MTool_Manual/index.html | 4 ++-- PRC20_contract/index.html | 4 ++-- PRC721_contract/index.html | 4 ++-- Particle_Network_Integration_for_PlatON/index.html | 4 ++-- PlaTrust-wallet-js-sdk-api/index.html | 4 ++-- PlaTrust-wallet-js-sdk/index.html | 4 ++-- PlaTrust_Wallet/index.html | 4 ++-- PlatEye/index.html | 4 ++-- PlatON_BlockChain_Browser/index.html | 4 ++-- PlatON_Dev_Faucet/index.html | 4 ++-- PlatON_Governance_Solution/index.html | 4 ++-- PlatON_Overall_Solution/index.html | 4 ++-- PlatON_Overview_DevGuide/index.html | 4 ++-- PlatON_Solution/index.html | 4 ++-- PlatON_Validation_Introduce/index.html | 4 ++-- PlatON_system_contract/index.html | 4 ++-- PlatON_system_contract_api/index.html | 4 ++-- PlatON_wallet_plugin/index.html | 4 ++-- PlatON_wallet_plugin_sdk/index.html | 4 ++-- Python_SDK/index.html | 4 ++-- Samurai_API/index.html | 4 ++-- Samurai_user_manual/index.html | 4 ++-- Secure_Multi_Party_Computation/index.html | 4 ++-- Solidity_Contract_Best_Practice/index.html | 4 ++-- Solidity_Contract_Dev_Costs/index.html | 4 ++-- Solidity_Contract_Migrate/index.html | 4 ++-- Solidity_Contract_Security_Dev_Guide/index.html | 4 ++-- Solidity_Dev_Manual/index.html | 4 ++-- Solidity_Inner_Contract/index.html | 4 ++-- Third_Party_Walle/index.html | 4 ++-- Verifiable_Computation/index.html | 4 ++-- WASM_Contract_1/index.html | 4 ++-- WASM_Contract_2/index.html | 4 ++-- WASM_Contract_3/index.html | 4 ++-- WASM_Contract_4/index.html | 4 ++-- WASM_Contract_5/index.html | 4 ++-- WASM_Contract_6/index.html | 4 ++-- WASM_Contract_7/index.html | 4 ++-- WASM_Contract_8/index.html | 4 ++-- WASM_Contract_9/index.html | 4 ++-- WASM_Smart_Contract/index.html | 4 ++-- Wasm_Contract_API/index.html | 4 ++-- Wasm_Contract_Best_Practice/index.html | 4 ++-- Wasm_Contract_Dev_Costs/index.html | 4 ++-- Wasm_Dev_Manual/index.html | 4 ++-- Wasm_Operation_Principle/index.html | 4 ++-- adapting_to_new_chainid/index.html | 4 ++-- assets/js/{ebf40b11.2715c803.js => ebf40b11.287f2a0d.js} | 2 +- .../{runtime~main.869f808a.js => runtime~main.44ec277b.js} | 2 +- community/index.html | 4 ++-- contributing/index.html | 4 ++-- eip55-bech32-compatible/index.html | 4 ++-- en/404.html | 4 ++-- en/ATON-user-manual/index.html | 4 ++-- en/About_PlatON/index.html | 4 ++-- en/Become_PlatON_Dev_Verification/index.html | 4 ++-- en/Become_PlatON_Main_Verification/index.html | 6 +++--- en/Build_Private_Chain/index.html | 4 ++-- en/CTool_Manual/index.html | 4 ++-- en/Command_Line_Tools/index.html | 4 ++-- en/DApp_integration_with_WalletConnect_for_ATON/index.html | 4 ++-- en/DApp_migrate/index.html | 4 ++-- en/EVM_Smart_Contract/index.html | 4 ++-- en/Economic_Model/index.html | 4 ++-- en/Explorer_API/index.html | 4 ++-- en/Go_SDK/index.html | 4 ++-- en/GraphQL_Server/index.html | 4 ++-- en/Install_PlatON/index.html | 4 ++-- en/JS_SDK/index.html | 4 ++-- en/Java_SDK/index.html | 4 ++-- en/Join_Dev_Network/index.html | 4 ++-- en/Json_Rpc/index.html | 4 ++-- en/Ledger-hardware-wallet/index.html | 4 ++-- en/MetaMask/index.html | 4 ++-- en/NET_SDK/index.html | 4 ++-- en/Network_Description/index.html | 4 ++-- en/OffLine_MTool_Manual/index.html | 4 ++-- en/OnLine_MTool_Manual/index.html | 4 ++-- en/PRC20_contract/index.html | 4 ++-- en/PRC721_contract/index.html | 4 ++-- en/Particle_Network_Integration_for_PlatON/index.html | 4 ++-- en/PlaTrust-wallet-js-sdk-api/index.html | 4 ++-- en/PlaTrust-wallet-js-sdk/index.html | 4 ++-- en/PlaTrust_Wallet/index.html | 4 ++-- en/PlatEye/index.html | 4 ++-- en/PlatON_BlockChain_Browser/index.html | 4 ++-- en/PlatON_Dev_Faucet/index.html | 4 ++-- en/PlatON_Governance_Solution/index.html | 4 ++-- en/PlatON_Overall_Solution/index.html | 4 ++-- en/PlatON_Overview_DevGuide/index.html | 4 ++-- en/PlatON_Solution/index.html | 4 ++-- en/PlatON_Validation_Introduce/index.html | 4 ++-- en/PlatON_system_contract/index.html | 4 ++-- en/PlatON_system_contract_api/index.html | 4 ++-- en/PlatON_wallet_plugin/index.html | 4 ++-- en/PlatON_wallet_plugin_sdk/index.html | 4 ++-- en/Python_SDK/index.html | 4 ++-- en/Samurai_API/index.html | 4 ++-- en/Samurai_user_manual/index.html | 4 ++-- en/Secure_Multi_Party_Computation/index.html | 4 ++-- en/Solidity_Contract_Best_Practice/index.html | 4 ++-- en/Solidity_Contract_Dev_Costs/index.html | 4 ++-- en/Solidity_Contract_Migrate/index.html | 4 ++-- en/Solidity_Contract_Security_Dev_Guide/index.html | 4 ++-- en/Solidity_Dev_Manual/index.html | 4 ++-- en/Solidity_Inner_Contract/index.html | 4 ++-- en/Third_Party_Walle/index.html | 4 ++-- en/Verifiable_Computation/index.html | 4 ++-- en/WASM_Contract_1/index.html | 4 ++-- en/WASM_Contract_2/index.html | 4 ++-- en/WASM_Contract_3/index.html | 4 ++-- en/WASM_Contract_4/index.html | 4 ++-- en/WASM_Contract_5/index.html | 4 ++-- en/WASM_Contract_6/index.html | 4 ++-- en/WASM_Contract_7/index.html | 4 ++-- en/WASM_Contract_8/index.html | 4 ++-- en/WASM_Contract_9/index.html | 4 ++-- en/WASM_Smart_Contract/index.html | 4 ++-- en/Wasm_Contract_API/index.html | 4 ++-- en/Wasm_Contract_Best_Practice/index.html | 4 ++-- en/Wasm_Contract_Dev_Costs/index.html | 4 ++-- en/Wasm_Dev_Manual/index.html | 4 ++-- en/Wasm_Operation_Principle/index.html | 4 ++-- en/adapting_to_new_chainid/index.html | 4 ++-- en/assets/js/{ebf40b11.121f6cc8.js => ebf40b11.8ca1e803.js} | 2 +- .../{runtime~main.10d91a1e.js => runtime~main.4917b9c8.js} | 2 +- en/community/index.html | 4 ++-- en/contributing/index.html | 4 ++-- en/eip55-bech32-compatible/index.html | 4 ++-- en/get_vrf_random_number/index.html | 4 ++-- en/index.html | 4 ++-- en/lat_introduced/index.html | 4 ++-- en/qianqian_prc721_tutorial/index.html | 4 ++-- en/search/index.html | 4 ++-- en/staking_and_delegation/index.html | 4 ++-- en/walletconnect_tutorial/index.html | 4 ++-- get_vrf_random_number/index.html | 4 ++-- index.html | 4 ++-- lat_introduced/index.html | 4 ++-- qianqian_prc721_tutorial/index.html | 4 ++-- search/index.html | 4 ++-- staking_and_delegation/index.html | 4 ++-- walletconnect_tutorial/index.html | 4 ++-- 168 files changed, 334 insertions(+), 334 deletions(-) rename assets/js/{ebf40b11.2715c803.js => ebf40b11.287f2a0d.js} (99%) rename assets/js/{runtime~main.869f808a.js => runtime~main.44ec277b.js} (99%) rename en/assets/js/{ebf40b11.121f6cc8.js => ebf40b11.8ca1e803.js} (99%) rename en/assets/js/{runtime~main.10d91a1e.js => runtime~main.4917b9c8.js} (99%) diff --git a/404.html b/404.html index 04b5d4eb5..1e9bbf89c 100644 --- a/404.html +++ b/404.html @@ -8,13 +8,13 @@ Page Not Found | PlatON - +
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

- + \ No newline at end of file diff --git a/ATON-user-manual/index.html b/ATON-user-manual/index.html index a3970e248..fcb57bb9e 100644 --- a/ATON-user-manual/index.html +++ b/ATON-user-manual/index.html @@ -8,13 +8,13 @@ ATON Wallet User Manual | PlatON - +
Skip to main content

ATON Wallet

ATON is a secure and user-friendly mobile wallet for PlatON Network and Alaya Network. The ATON Mobile Wallet allows you to easily transfer LAT/ATP tokens to others, view your transaction history and account balance. At the same time, it provides convenient delegation service for you.

All images in this manual are sample images on PlatON Network.

Start#

Create Wallet#


1. Click [Create Wallet].
2. Select "Normal" or "HD". Set the wallet name, and password.
3. Click the [Create] button to create a wallet.
4. After the wallet is successfully created, you can click [Start to Backup] to start the backup, or click [Skip] to do it later.

Note
1. Password is your credentials to use and manage the wallet. Servers of ATON does not store your password,Please make sure you keep it in mind.
2. We strongly recommend you to back up your wallet after it is created.
3. Click on the network name in the upper left corner of the page to switch networks.
4. Amount of wallets cannot be larger than 200(including all normal wallets and all sub-wallets generated from HD).

Wallet Backup#


1. After creating the wallet, click [Backup] button for wallet backup. Or you can find it in [My]-[Wallet Management].
2. Wallet password is reeuqired for backup. After the password verification is passed, the system will display 12 English words as the mnemonic words.
3. Copy the mnemonic and keep them in a safe place. Click [Next] to verify the mnemonic. If the verification succeeds, the wallet backup is completed.

Note
1. You can restore and manage your wallet with mnemonics words, keep them in a safe place.

Import Wallet#

Import Using Keystore#


1. Click the [...] button at the top right coner of the main interface, and select [Import Wallet]. Then move to [Keystore].
2. Paster Input the keystore content, or scan the QR code to get the keystore file.
3. Set the wallet name and password for this wallet.
4. Click the [Start to Import] button. After the password verification is passed, the wallet is successfully imported.

Note
1. Password is required when import ing wallet Keystore.
2. Your wallet password is not stored in the server. If you forget the password, please use mnemonic and private key to import it.
3. You can also click the "[...]" button on the top right corner to import wallet.

Import Using Mnemonics#


1. Click the [...] button at the top right coner of the main interface, and select [Import Wallet]. Then move to [Mnemonic].
2. Fill in the mnemonics in the correct order.
3. Select type "Normal" or "HD". Set the wallet name and password.
4. Click the [Start to Import] button. After the mnemonic verification is passed, the wallet is successfully imported.

Note
1. Password is your credentials to use and manage the wallet.Servers of ATON does not store your password, make sure you keep it in mind.
2. Store your mnemonics in a safe place.
3. You can also click the "[...]" button on the top right corner to import wallet.

Import Using Private Key#


1.Click the [...] button at the top right coner of the main interface, and select [Import Wallet]. Then move to [Private Key].
2. Input your private key, or scan the QR code to get the private key.
3. Set the wallet name and password.
4. Click the [Start to Import] button. After the verification is passed, the wallet is successfully imported.

Note
1. Password is your credentials to use and manage the wallet. Servers of ATON does not store your password, make sure you keep it in mind.
2. Store your private key in a safe place.
3. You can also click the "[...]" button on the top right corner to import wallet.

Import observed wallet#

For details about importing observed wallets, please refer to the instructions of “Set observed wallet and cold wallet”.

Address Book#


1. Select [My-Settings],and you can see the list of wallet addresses stored in the address book.
2. Click any of the address information to copy the selected address.
3. Slide any of the address information to delete and edit it.
4. Click the [+] button on the right side of the top navigation bar to manually add address information to the address book.
5. At the same time, you can also check the [Deposit Address] button above the [Start Import] button on the [Create Wallet] and [Import Wallet] pages to enable the wallet to be stored in the address book automatically, and this option is checked by default.

Select Wallet#


1. Click the [...] button at the top right coner of the main interface, then click [Select Wallet].
2. All your wallets can be classified and filtered as "All", "HD", "Normal", and you can also use fuzzy search with your wallet name or precise search with your wallet address.
3. Select the wallet you need.
4. Then you will be guide to the wallet page you selected.

Wallet Assets#


1. When you successfully created a wallet, you can find the valid wallet and asset info at the Wallet Asset page.
2. ①The upper part shows the brief information of the current wallet.
3. ②The brief wallet information includes the wallet name and wallet address,and [Switch Wallet] button.
4. ③Click the [Copy] button to copy the wallet address.
5. ④Click the [Wallet Management] button to manage the wallet.
6. ⑤Click the [QR Code] button to enter the receiving page to receive the transfer.
7. ⑥The network information of the current wallet is displayed at the top left corner, click to switch networks.
8. ⑦By Click [...],you can create, import and select wallets, and click "Scan" to scan the QR code.
9. The lower part of the page is [assets List].
10. ⑧The first item is the LAT/ATP data, you can see the unit and balance, click it to enter the LAT/ATP assets details page.
11. ⑨The PRC20/ARC20 assets, you can see the unit and balance, click it to enter the PRC20/ARC20 assets details page.
12. ⑩The "Collectibles" tab is for PRC721/ARC721 assets, click on it to go to the PRC721/ARC721 assets list page.
13. Click the [eye] button, it will show/hide the number of assets.

LAT/ATP Assets Detail#


1. The upper part is the current wallet information.
2. The wallet information includes the balance, unit and locked-up balance, as well as the [Send] button and [Receive] button.
3. Click the [Send] button to jump to the sending page for transfer.
4. Click the [Receive] button to enter the receiving page to receive the transfer.
5. The lower part of the page is [Transactions].
6. The lower part of the page is the transaction records, click on a transaction record, you can get more transaction details.

Collectibles(PRC721)#

Collectible Set List#


Click a Collectible Set to the page of Collectible Set Detail.

Collectible Set Detail#


1. At the top is the introduction about current shown Collectible Set.
2. The rest part are Collectibles belong to current wallet. Click a picture of Collectible to the page of Collectible Detail.

Collectible Detail#


1. Top of this page is current collectible's name and ID.
2. Middle part contains the detail and tradings of this collectible.
3. At the bottom is the button for sending this collectible. To send this collectible to another address on sending page by clicking this button.

Collectible Tradings' Record#


1. After clicking Recent Trading tag, you can see the list of tradings of current collectible.
2. Click one of these records to see trading detail.

Receive#


1. Select the asset at the Assets parts on the main interface for more details, and click the [Receive] button to check the wallet address and QR code.
2. You can copy your wallet address with the copy button.
3. Click [Save image and Share] to save the picture to the local album.
4. Your friends can transfer LAT/ATP to you through your wallet address or scanning the QR code.

Note
1. This LAT/ATP address and QR code only accept LAT/ATP and assets on PlatON/Alaya, do not transfer assets on other networks to this wallet.
2. Please make sure that you transfer assets to correct network.

Sending#

Send LAT/ATP#


1. Click the [Send] button at the asset details page you selected.
2. Enter a valid wallet address, or scan the QR code by clicking the scan button at the upper right corner of the interface, or select one wallet you stored.
3. Enter the LAT/ATP amount you want to send.
4. Set Select the transaction fee rate, you can move the slide bar to set the service fee.
5. Click [Next] to confirm the transaction information,click [Send] to proceed the transaction.

Send Collectible#


1. On the page of Collectible Detail, click the [Send] button.
2. Type in valid wallet address, or scan the QR code of the wallet to automatically fill in the address, or select a locally saved wallet address through the address book.
3. Choose the transaction fee, and you can click to adjust it to be lower or higher.
4. Click the [Next] button to confirm the transaction information, and click the [Send] button and enter the correct wallet password to send the transaction to the blockchain network.

Choose Transaction Fee#


1. The functions of sending, entrusting, redeeming and receiving rewards all incur transaction fees.
2. Take the sending function as an example, click [Transaction Fee] to enter the transaction fee setting page.
3. There are 5 choices for transaction fees (Fastest, Fast, Recommended, Cheap, Customize).
4. [Recommended] configuration item is selected by default.
5. The user can select the corresponding option according to actual needs.
6. In the [Customize] column, users can enter Gas Price and Gas Limit independently to achieve flexible cost configuration.

Validators#

Validators List#


1. Move to the [Delegate] tab at the main interface, and then opt for [Validators], you can view all validators.
2. Usually, the nodes are sorted by rank. They can also be sorted by Delegated amount/Delegators/Expected delegation annualized yield.
3. Active node: validators participating in the consensus election in the current settlement interval.
4. Candidate node: validators do not participate in consensus election in the current settlement interval.

Validator Details#


1. Select a validator, you can check the related profit informaiton, like expected delegation annualized yield, reward ratio and total reward.
2. Also you can check the basic information of validators, such as delegators, blocks info, etc.
3. If you want to delegate your LAT/ATP to this validator, you can click the [Delegate] button to start it.

Note:
1. The validators funded by Foundation do not accept delegations.
2. The "locked validators" not accept delegation.

Delegate#

Participate in Delegation#


1. Select a validator to delegate. If you’ve delegated, then you can check your delegation details via: [Delegate] - [My Delegations]-[Delegation Rec], and then select one validator to continue delegation.
2. Select the wallet you want to delegrate.
3. You can select locked-up balance to delegate if there is, or select delegated freeze balance to delegate if there is.
4. Enter the amount, and it must not be less than 10LAT/1ATP.
5. Enter the correct password.
6. You can delegate to the nodes you’ve delegated, no limit to the delegation times.

Note
1. Delegators delegates LAT/ATP to validtaors, when the delegated validators get profit, delegators will win the profits according to the delegation ratio set by validators.
2. The wallet address connected to profit validators can’t be used to delegate.
3. The delegated LAT/ATP will be valid at the next settlement interval.

My Delegations#


1. Click [My Delegation] to check your uncalmied reward, total reward and delegated amount.
2. Select a specific wallet to check the details including total delegated amount, total rewards and unclaimed rewards. You can also delegate and withdraw your delegation.
3. Click the [Claim] button to get all unclaimed rewards, and input your wallet. After that, you can see your rewards.

Undelegation#


1. Click You can withdraw your delegation via: [My Delegations]-[Delegation Rec]-[Withdraw].
2. Enter the number,it should be greater than or equal to 10 LAT/1 ATP. Enter your password to proceed the process.

Note
1.When undelegate the delegation, the delegation will return to the original way during the hesitation period, and the delegation within the validity period will be returned to the delegation frozen account, which will be frozen for a certain period.
2.When withdrawing all delegations, the delegation rewards will be claimed automatically.

Freeze Details#


There is a certain settlement period as a freezing period after Undelegate, and each settlement cycle is 10750 blocks.Delegation within the freeze period can be viewed on the Freeze Details.
[Delegate node Details] Click [Delegated Freeze] to enter the Freeze details.

Withdraw#


After the freeze period ends, the user needs to manually perform the extraction operation,all delegations to be withdrawn will be withdrawn and returned to the user's wallet balance or locked account according to the source of the asset.
1. [Freeze Details] Click the [Withdraw] button to enter the withdrawal;
2. Click the [Withdraw] button to withdraw all the withdrawable delegations.

Observed Wallet and Cold Wallet#

Set the Observed Wallet and Cold Wallet#

Preparation:

  1. Prepare two mobile phones and install the latest ATON.
  2. Make sure that one phone is never connected to the Internet. It is recommended to turn on the airplane mode and turn off WiFi to set it as a cold wallet device. The other one is connected to the network as an observed wallet device.

1. Create a wallet as a cold wallet in offline environment, click [ Receive] to find the QR code.
2. Click [...] at the upper right corner of the main interface, and then select [Import Wallet] -[Observe Wallet] with the mobile phone connected to the network, scan the wallet QR code or enter the wallet address on the mobile phone not connected to the Internet, and click [Finish]. Then the wallet is set successfully.

Note
1. Oberseved wallet: a wallet connected to network, and is used for observation only. If you need to conduct transactions,the observed wallet need to work with the cold wallet.
2. Cold wallet:a wallet that is not connected to the Internet but has a private key, which needs to be kept in a safe place.

Transaction with Cold Wallet#

If you have set up observed wallets and cold wallets, you can initiate transfers, delegations, delegation withdrawals, etc. with the observed wallets, and have it worked with the cold wallets cooperate for sign. The following Below is an example.

1. Observed wallet


(1) Select an observed wallet, then move to the send page, enter the required trasfer details, and then click Finish.
(2) Click the [Next] button, then you will find the QR code that would be scanned by the cold wallet.

2. Cold wallet


(1) Click the scan button at the upper right corner, or click the [Offline Signature] button of the specified wallet to scan the QR code displayed on the wallet page.
(2) The page displays the detailed transaction information. If there is no problems with the transaction, you can click [OK, Sign] and enter the password.
(3) After you can see the QR code of the signed transactions for the observed wallet to scan.

3. Observed wallet


(1) The offline signature is requied when you use observed wallet to send, delegate and withdraw.
(2) Click [Already Scaned, Next], then you will arrive at the reading signature data page.
(3) Click [Send] to send the transaction to the blockchain network.

Note
1. Jointly use observed wallet and cold wallet to do transactions.
2. Please do not deposit assets to the observed wallet address that you cannot control.

Others#

Settings / Help and Feedback#


1. Move to [Me] - [Settings], you can make
- Network Settings: Select the network to be connected.
- Reminder Threshold:Send notification when the amount of transfer exceeds the transaction threshold you set.
- Resend Reminder:Send notification when repeated transaction occurred within 2 housrs.
- Fingerprint / Face Unlocking: If you enable it, fingerprint or face unlock is required every time you launch the app.
- Language: Chinese and English are available.
2. Move to [Me] - [Support and feedback], You can find the user guide and Q &A. If you can’t find what you want, you can submit it and we will respond as soon as possible.

Change Password#


1. Move to [Me] - [Wallet Management] - [Change Password].
2. Input the original password and click Confirm.
3. Set new password and click Confirm.
4. Click the [Confirm] button,then the wallet's password is successfully changed.

Note
1. Password is your credentials to use and manage the wallet. Servers of ATON does not store your password, make sure you keep it in mind.

Reset Password#

When you forget the password of a wallet, you could reimport the wallet using mnemonic/private key/keyStore and set the password again.

Path for HD wallet: [Me] - [Wallet Management] - [HD Wallet Detail] - [HD Settings] - [Reimport Wallet]

Path for Normal wallet: [Wallet] - [Wallet Icon] - [Reimport Wallet], or [Me] - [Wallet Management] - [Wallet Detail] - [Reimport Wallet]

After successfully reimport a wallet, the old information of this wallet would be deleted.

If you reimport a wallet by PrivateKey or KeyStore, the Mnemonic of this wallet would not be saved in ATON.

Cold wallet signature chain ID#


1. Observing the wallet and cold wallet signatures need to keep the chain ID consistent;
2. ATON 1.1.5 and above are compatible with PlatON Mainnet's new chain ID:210425; the cold wallet has not been upgraded to ATON 1.1.5 and above, and the signature defaults to chain ID:100; if the hot wallet is changed to the latest chain ID:210425, Please upgrade the cold wallet and set a new chain ID at the same time to sign successfully;

ATON 1.1.0 supports WalletConnect!#


Support WalletConnect, you can easily complete the connection with the desktop DApp.

WalletConnect is a service that supports connecting with desktop DApps through code scanning authorization. It is like an inter-city express train that narrows the distance between desktop applications and mobile wallets.

ATON officially supports the WalletConnect standard [observation of wallets and cold wallets are not currently supported]. Not only can you realize the interaction between mobile DApps and ATON, you can also use ATON scan codes to authorize any desktop DApps that support this standard, and you don’t need to worry about asset security. The connection method is also very simple:
1. The desktop DApp chooses to use WalletConnect to connect;
2. Click [Scan] in the upper right corner of the ATON homepage, and select the wallet to complete the authorization;
3. To confirm the operation, perform [Confirm] in ATON;

Demo video:
https://www.youtube.com/watch?v=hnHRR7D0Rak

ATON’s WalletConnect Dapp demo on GitHub.
https://github.com/PlatONnetwork/WalletConnect-Example

HashKey DID#


HashKey DID is a multi-chain decentralized identity data aggregator, powered by smart contract, NFT and privacy protection decentralised protocol, to provide identity services to Web3 users.
HashKey Website: www.hashkey.id

1.Use ATON to quickly register HashKey DID: Click the [HashKey DID Register] button below the wallet address on the ATON home page to register.


2.Support input DID as the receiving address for transfer, for example, input the registered DID Name: abc123.key.

- + \ No newline at end of file diff --git a/About_PlatON/index.html b/About_PlatON/index.html index ef14bd2f5..4352a6642 100644 --- a/About_PlatON/index.html +++ b/About_PlatON/index.html @@ -8,13 +8,13 @@ About PlatON | PlatON - +
Skip to main content
- + \ No newline at end of file diff --git a/Become_PlatON_Dev_Verification/index.html b/Become_PlatON_Dev_Verification/index.html index c27961510..4459c8186 100644 --- a/Become_PlatON_Dev_Verification/index.html +++ b/Become_PlatON_Dev_Verification/index.html @@ -8,7 +8,7 @@ Run a dev node | PlatON - + @@ -40,7 +40,7 @@ } } }

...]

If the printed information is empty, it means that the connection node failed. If there is any problem, you can contact the official customer service personnel.

View the current block height#

View the block height of the current node by executing the following command in the Platon console.

platon.blockNumber

Exit console#

Type Exit to exit the console.

Upgrade to Validator Node#

PlatON is a blockchain project that implements democratic governance. Verification nodes are jointly selected by all LAT holders to maintain and develop the PlatON network. The 201 nodes with the most votes will become candidate nodes, from which 43 verification nodes will be randomly selected using VRF to participate in the management of the entire PlatON network.

This section describes how to operate as a validator node.

Install PlatON MTool#

Proceed as follows:

Step1. Download PlatON MTool toolkit

cd ~ && wget https://download.platon.network/platon/devnet/mtool/linux/1.1.1/platon_mtool.zip

Step2. Extract the PlatON MTool toolkit

(if ! command -v unzip;then sudo apt install unzip; fi;) && unzip platon_mtool.zip && cd platon_mtool

Step3. Download script

The script is downloaded to the platon_mtool directory, otherwise the script cannot find the path of the new version of mtool.

wget https://download.platon.network/platon/scripts/mtool_install.sh

Step4. Execute command

chmod +x mtool_install.sh && ./mtool_install.sh

Step5. Restart the session window

After installation is complete, you need to restart the session window (do not restart the server, close the session window or SSH tool to reopen the window) for the newly added environment variables to take effect.

Configure PlatON MTool#

Generate wallet#

To participate in the verification node to produce blocks, two wallets must be created. If you want to create a node using an existing wallet, rename the wallet file for the mortgaging account to staking.json, rename the wallet file for the income account to reward.json, and copy the wallet file to the $PLATON_MTOOLDIR/keystore directory to skip this step.

platon_mtool account new staking

Enter the password once and confirm the password again to create a wallet file. After the creation is successful, a staking wallet file staking.json will be generated in the directory $PLATON_MTOOLDIR/keystore.

platon_mtool account new reward

Enter the password once and confirm the password again to create the wallet file. After the creation is successful, the staking wallet file reward.json will be generated in the directory $PLATON_MTOOLDIR/keystore.

Update config.properties#

If you want to run mtool on the development network 2, change the chain ID in the config.properties file to 2206132;

Configure verification node information#

Download the script#
cd $PLATON_MTOOLDIR && wget https://download.platon.network/platon/scripts/validator_conf.sh
Run the script configuration#
chmod +x validator_conf.sh && ./validator_conf.sh

Note:

Validator node information configuration file description#

After the configuration of the validator node information is completed, the validator node information file validator_config.json will be generated in the validator subdirectory of the PlatON MTool installation directory. The file content is as follows:

{    "nodePublicKey": "0abaf3219f454f3d07b6cbcf3c10b6b4ccf605202868e2043b6f5db12b745df0604ef01ef4cb523adc6d9e14b83a76dd09f862e3fe77205d8ac83df707969b47",    "blsPubKey": "82d740cbc0314ec558c5426f88fdad6f07a07f9846c6be4e40cd628b74b9f641ddad01e4c281a2c3693f8ff2a73a410297aff379ee0575127d51de99b97acc9a1b7bc8ca132ef6f0379a3ec9d76a603d623176e49e1c53e87fead36317895099",    "nodeAddress": "http://192.168.120.146",    "nodePort": "16789",    "nodeRpcPort": "6789"}

Parameter description:

Custom PlatScan avatar#

If users do not need to display their specified avatar on PlatScan, they can skip this step. Otherwise, the following operations are required:

Note: After the user completes the staking operation, the avatar customized by the user can be displayed on PlatScan.

Initiate a staking operation#

If the consensus node deployment is complete and is catching up the blocknumber of Platscan, you can use PlatON MTool for staking operations. Please ensure that the balance of the staking account is sufficient before staking. The minimum threshold for staking is one hundred thousand LAT. If you want to access the development network, please send an email to support@latticex.foundation according to the format requirements. The email requirements are:

Title: Platon Development Network Token ApplicationName:Contact Information:WeChat ID (or other instant messaging software) :Application amount:USES:Receipt account:Remark:

Note:

Excuting command

platon_mtool staking --config $PLATON_MTOOLDIR/validator/validator_config.json --keystore $PLATON_MTOOLDIR/keystore/staking.json --autoamount 100000 --benefit_address xxx196278ns22j23awdfj9f2d4vz0pedld8a2fzwwj --delegated_reward_rate 5000 --node_name myNode --website www.mywebsite.com --details myNodeDescription --external_id 121412312

Enter the password of the staking wallet and press Enter. If the following information is displayed, the staking is successful:

operation finishedtransaction hash:0x89b964d27d0caf1d8bf268f721eb123c4af57aed36187bea90b262f4769eeb9bSUCCESS

Parameter description:

- + \ No newline at end of file diff --git a/Become_PlatON_Main_Verification/index.html b/Become_PlatON_Main_Verification/index.html index 6928d461b..086e3bb91 100644 --- a/Become_PlatON_Main_Verification/index.html +++ b/Become_PlatON_Main_Verification/index.html @@ -8,12 +8,12 @@ Run a validator node | PlatON - +
-
Skip to main content

Run a validator node

This guide demonstrates how to install the PlatON Node software on Linux.

System Requirements#

  • Server: Server and backup server running PlatON software (both have a firewall)
  • Memory: 16GB RAM
  • Local storage: 100GB system disk, 200GB data disk (can be expanded online)
  • Processor: 64-bit 4 cores (each core above 2.4 GHz)
  • Bandwidth: 5 MB/sec (can be expanded online)

Installation Overview#

It takes three or four steps to install a new node, which depends on the operating system used. The detailed procedures are list below.

  • Installing on Ubuntu (18.04)

Note: Use the normal user to execute the following command.

Installing on Ubuntu#

Install and run NTP service#

Open a terminal and run the following commands#
sudo apt-get update &&sudo apt-get install -y gnupg2 curl software-properties-common ntp &&sudo systemctl enable ntp && sudo systemctl start ntp

Notes:

NTP service is used for time synchronization, incorrect system time will affect the normal operation of PlatON

Validate the NTP time synchronization#
ntpq -4c rv | grep leap_none

Notes:

Display associd=0 status=0615 leap_none, sync_ntp, 1 event, clock_sync, where leap_none is red, indicating that the NTP time synchronization is normal.

Install PlatON#

Ubuntu 18.04:

sudo wget https://download.platon.network/platon/platon/1.4.4/platon -O /usr/bin/platonsudo wget https://download.platon.network/platon/platon/1.4.2/platonkey -O /usr/bin/platonkey

Ubuntu 20.04:

sudo wget https://download.platon.network/platon/platon/ubuntu20.04/1.4.4/platon -O /usr/bin/platonsudo wget https://download.platon.network/platon/platon/ubuntu20.04/1.4.2/platonkey -O /usr/bin/platonkey

Ubuntu 22.04:

sudo wget https://download.platon.network/platon/platon/ubuntu22.04/1.4.4/platon -O /usr/bin/platonsudo wget https://download.platon.network/platon/platon/ubuntu22.04/1.4.2/platonkey -O /usr/bin/platonkey
sudo chmod +x /usr/bin/platon  /usr/bin/platonkeyplaton version

After executing the commands above, platon and platonkey binary should be successfully installed in the /usr/bin directory on your system. You can execute corresponding commands in any directory.

After you execute the platon version, please double check whether your Git Commit value is consistent with the following, if it is consistent, it means that it has been installed correctly:

PlatON
+

Run a validator node

This guide demonstrates how to install the PlatON Node software on Linux.

System Requirements#

  • Server: Server and backup server running PlatON software (both have a firewall)
  • Memory: 16GB RAM
  • Local storage: 100GB system disk, 200GB data disk (can be expanded online)
  • Processor: 64-bit 4 cores (each core above 2.4 GHz)
  • Bandwidth: 5 MB/sec (can be expanded online)

Installation Overview#

It takes three or four steps to install a new node, which depends on the operating system used. The detailed procedures are list below.

  • Installing on Ubuntu (18.04)

Note: Use the normal user to execute the following command.

Installing on Ubuntu#

Install and run NTP service#

Open a terminal and run the following commands#
sudo apt-get update &&sudo apt-get install -y gnupg2 curl software-properties-common ntp &&sudo systemctl enable ntp && sudo systemctl start ntp

Notes:

NTP service is used for time synchronization, incorrect system time will affect the normal operation of PlatON

Validate the NTP time synchronization#
ntpq -4c rv | grep leap_none

Notes:

Display associd=0 status=0615 leap_none, sync_ntp, 1 event, clock_sync, where leap_none is red, indicating that the NTP time synchronization is normal.

Install PlatON#

Ubuntu 18.04:

sudo wget https://download.platon.network/platon/platon/1.4.4/platon -O /usr/bin/platonsudo wget https://download.platon.network/platon/platon/1.4.2/platonkey -O /usr/bin/platonkey

Ubuntu 20.04:

sudo wget https://download.platon.network/platon/platon/ubuntu20.04/1.4.4/platon -O /usr/bin/platonsudo wget https://download.platon.network/platon/platon/ubuntu20.04/1.4.2/platonkey -O /usr/bin/platonkey

Ubuntu 22.04:

sudo wget https://download.platon.network/platon/platon/ubuntu22.04/1.4.4/platon -O /usr/bin/platonsudo wget https://download.platon.network/platon/platon/ubuntu22.04/1.4.4/platonkey -O /usr/bin/platonkey
sudo chmod +x /usr/bin/platon  /usr/bin/platonkeyplaton version

After executing the commands above, platon and platonkey binary should be successfully installed in the /usr/bin directory on your system. You can execute corresponding commands in any directory.

After you execute the platon version, please double check whether your Git Commit value is consistent with the following, if it is consistent, it means that it has been installed correctly:

PlatON
Version: 1.4.4-unstable
Git Commit: af1168d0b62febf53913cb1ceebaa6413d3ba9b3
Git Commit Date: 20230719
@@ -47,7 +47,7 @@ } } }

...]

If the printed information is empty, it means that the connection node failed. If there is any problem, you can contact the official customer service personnel.

View the current block height#

View the block height of the current node by executing the following command in the Platon console.

platon.blockNumber
  • Execute this command several times, if the block height value increases continuously, then the connection is successful;

  • If it is a new node and the block height is always 0, it means that the node is in the synchronous block and there may be delay. You can use the command:

    platon.syncing
    • If false is printed, the node is not in a synchronous block state.

    • If the following message is printed, the node is in a synchronous block state;

      {  currentBlock: 1412416,  highestBlock: 1416699,  knownStates: 522,  pulledStates: 522,  startingBlock: 1408247}

Exit console#

Type Exit to exit the console.

Upgrade to Validator Node#

PlatON is a blockchain project that implements democratic governance. Verification nodes are jointly selected by all LAT holders to maintain and develop the PlatON network. The 201 nodes with the most votes will become candidate nodes, from which 43 verification nodes will be randomly selected using VRF to participate in the management of the entire PlatON network.

This section describes how to operate as a validator node.

Install PlatON MTool#

Proceed as follows:

Step1. Download PlatON MTool toolkit

cd ~ && wget https://download.platon.network/platon/mtool/linux/1.1.1/platon_mtool.zip

Step2. Extract the PlatON MTool toolkit

(if ! command -v unzip;then sudo apt install unzip; fi;) && unzip platon_mtool.zip && cd platon_mtool

Step3. Download script

The script is downloaded to the platon_mtool directory, otherwise the script cannot find the path of the new version of mtool.

wget https://download.platon.network/platon/scripts/mtool_install.sh

Step4. Execute command

chmod +x mtool_install.sh && ./mtool_install.sh
  • When the message Install platon mtool succeed. is displayed, PlatON MTool is successfully installed. If it is not successfully installed, please contact our official customer service to provide feedback on specific issues.

Step5. Restart the session window

After installation is complete, you need to restart the session window (do not restart the server, close the session window or SSH tool to reopen the window) for the newly added environment variables to take effect.

Configure PlatON MTool#

Generate wallet#

To participate in the verification node to produce blocks, two wallets must be created. If you want to create a node using an existing wallet, rename the wallet file for the mortgaging account to staking.json, rename the wallet file for the income account to reward.json, and copy the wallet file to the $PLATON_MTOOLDIR/keystore directory to skip this step.

  • Staking wallet: The staking wallet is used to stake tokens. To become a candidate node, you must stake successfully. Run the following command to create a staking wallet:
platon_mtool account new staking

Enter the password once and confirm the password again to create a wallet file. After the creation is successful, a staking wallet file staking.json will be generated in the directory $PLATON_MTOOLDIR/keystore.

  • Reward wallet: It is used to collect block rewards and staking rewards. Staking rewards are uniformly distributed to verification nodes, which are distributed by the verification nodes themselves. Run the following command to create a reward wallet
platon_mtool account new reward

Enter the password once and confirm the password again to create the wallet file. After the creation is successful, the staking wallet file reward.json will be generated in the directory $PLATON_MTOOLDIR/keystore.

Configure verification node information#

Download the script#
cd $PLATON_MTOOLDIR && wget https://download.platon.network/platon/scripts/validator_conf.sh
Run the script configuration#
chmod +x validator_conf.sh && ./validator_conf.sh

Note:

  • When the prompt shows "Please enter the platon node IP address:", please enter the PlatON node server ip address.
  • When the prompt shows "validator conf success", and when the validator_config.json content printed at the end is normal, it means that the script is executed successfully. If the script is not executed successfully, please contact our official customer service to feedback specific questions.
Validator node information configuration file description#

After the configuration of the validator node information is completed, the validator node information file validator_config.json will be generated in the validator subdirectory of the PlatON MTool installation directory. The file content is as follows:

{    "nodePublicKey": "0abaf3219f454f3d07b6cbcf3c10b6b4ccf605202868e2043b6f5db12b745df0604ef01ef4cb523adc6d9e14b83a76dd09f862e3fe77205d8ac83df707969b47",    "blsPubKey": "82d740cbc0314ec558c5426f88fdad6f07a07f9846c6be4e40cd628b74b9f641ddad01e4c281a2c3693f8ff2a73a410297aff379ee0575127d51de99b97acc9a1b7bc8ca132ef6f0379a3ec9d76a603d623176e49e1c53e87fead36317895099",    "nodeAddress": "http://192.168.120.146",    "nodePort": "16789",    "nodeRpcPort": "6789"}

Parameter description:

  • nodePublicKey: Node ID, which can be viewed in the nodeid file under the node data directory data
  • blsPubKey: BLS public key, which can be viewed in the blspub file under the node data directory data.
  • nodeAddress: If PlatON MTool and the node are on the same machine or in the same local area network, you can use the intranet IP, otherwise use the public IP whose format is: http://18.238.183.12.
  • nodePort: Node P2P port, default is 16789.
  • nodeRpcPort: rpc port, the default port is 6789.
Custom PlatScan avatar#

If users do not need to display their specified avatar on PlatScan, they can skip this step. Otherwise, the following operations are required:

  • Register a keybase account

    Users first need to register on the official website of keybase.io . If they have already registered, they can log on the official website of keybase.

  • Upload specified avatar

    Click the user avatar to upload the avatar.

  • Generate PGP key

    If the user has a PGP key, after a successful login, a series of 16-bit public keys will be displayed next to the user's avatar, such as: EB621920A48D0699; if the user does not already have a PGP key, click add a PGP key next to the user's avatar to generate.

  • Specify the externalId value

    When issuing the staking operation, specify the --external_id parameter to be the PGP key generated in the previous step.

Note: After the user completes the staking operation, the avatar customized by the user can be displayed on PlatScan.

Initiate a staking operation#

If the consensus node deployment is complete and is catching up the blocknumber of Platscan, you can use PlatON MTool for staking operations. Please ensure that the balance of the staking account is sufficient before staking. The minimum threshold for staking is one hundred thousand LAT.

Note:

  • Please keep at least 1 LAT in the staking account, so that the transactions initiated by the subsequent node management have sufficient transaction fees, such as voting for upgrade proposals, and unsecured transactions.

Excuting command

platon_mtool staking --config $PLATON_MTOOLDIR/validator/validator_config.json --keystore $PLATON_MTOOLDIR/keystore/staking.json --autoamount 100000 --benefit_address xxx196278ns22j23awdfj9f2d4vz0pedld8a2fzwwj --delegated_reward_rate 5000 --node_name myNode --website www.mywebsite.com --details myNodeDescription --external_id 121412312

Enter the password of the staking wallet and press Enter. If the following information is displayed, the staking is successful:

operation finishedtransaction hash:0x89b964d27d0caf1d8bf268f721eb123c4af57aed36187bea90b262f4769eeb9bSUCCESS

Parameter description:

  • config:node configuration file
  • keystore: staking wallet file
  • amount: staking amount, not less than 100000LAT-staking threshold, no more than 8 decimal places
  • restrictedamount: not less than 100000LAT - staking threshold, no more than 8 decimal points (staking using locked balance)
  • autoamount: Not less than 10000LAT-Priority to use the lock-up balance staking, if the lock-up balance is not enough for the staking deposit, then use free amount staking
  • benefit_address: benefit account to receive block-packing reward and staking reward
  • delegated_reward_rate:Delegated bonus ratio, type is integer range is [0,10000], unit: ten thousand percent, e.g. enter 5000, it means the bonus ratio is 50%
  • nodename:node name,30 bytes(beginning with a letter, including alphabet, number, space, , -, #)
  • website:node website, 30 bytes
  • details:node description, 280 bytes
  • external_id:node Icon ID of keybase.io, or identity authentication ID
- + \ No newline at end of file diff --git a/Build_Private_Chain/index.html b/Build_Private_Chain/index.html index b2463a512..bf1a866a0 100644 --- a/Build_Private_Chain/index.html +++ b/Build_Private_Chain/index.html @@ -8,7 +8,7 @@ Private Network | PlatON - + @@ -16,7 +16,7 @@

Private Network

This document describes how to quickly deploy a private blockchain.

  • Before building the private chain, you need to compile the binary. You can refer to the Install PlatON document.

  • Take the private chain deployment under Ubuntu as an example, including single node and cluster deployment. The deployment procedures under Windows is similar to Ubuntu.

If you can't easily connect to an external network, you can choose to build your own private network.PlatON supports single node mode and cluster mode to run private networks.Take the Ubuntu environment as an example and suppose the node data directory is ~/platon-node/data , which the users should modify accordingly:

Standalone or Single Node Mode#

  • Generate nodekey and blskey files
mkdir -p ~/platon-node/data && platonkey genkeypair | tee >(grep "PrivateKey" | awk '{print $2}' > ~/platon-node/data/nodekey) >(grep "PublicKey" | awk '{print $3}' > ~/platon-node/data/nodeid) && platonkey genblskeypair | tee >(grep "PrivateKey" | awk '{print $2}' > ~/platon-node/data/blskey) >(grep "PublicKey" | awk '{print $3}' > ~/platon-node/data/blspub)

Note:

  • nodeid: node public key (ID) file, which stores the public key of the node and is used to identify the node
  • nodekey: node private key file which stores the node's private key and can not be public and need to do a backup.
  • blspub: node BLS public key file which stores the BLS public key of the node, and is used for fast verification of signatures in the consensus protocol.
  • blskey: node BLS private key file which stores the node's BLS private key, cannot be published and need to make a backup.
  • Generate wallet file
mkdir -p ~/platon-node/data && platon --datadir ~/platon-node/data account new

Your new account is locked with a password. Please give a password. Do not forget this password.

Passphrase:

Repeat passphrase:

Address: {lat1q25u0zphmre6tz8nt3cuen0ekmas7qfzaalgh4}

Note:

The wallet file and password are very important for the generated account address. Losing the wallet file or forgetting the password will cause the token in the account to be lost. Please make a backup of the wallet file and remember the password.

  • Editing the genesis block configuration file platon.json

Create the genesis block configuration file platon.json in the ~/platon-node directory, then copy the following genesis block configuration file template content to platon.json file, modify your-node-pubkey as the previously generated node public key (nodeid), your-node-blspubkey as node BLS public key (blspub), your-account-address as the wallet address:

……    "cbft": {    "initialNodes": [{        "node": "enode://your-node-pubkey@127.0.0.1:16789",        "blsPubKey": "your-node-blspubkey"    }],    ……    "alloc": {      "your-account-address": {            "balance": "999000000000000000000"      }    },……
  • Genesis block configuration file template
{    "config": {        "chainId": 1021,        "eip155Block": 3,        "cbft": {            "initialNodes": [              {                    "node":"enode://4fcc251cf6bf3ea53a748971a223f5676225ee4380b65c7889a2b491e1551d45fe9fcc19c6af54dcf0d5323b5aa8ee1d919791695082bae1f86dd282dba4150f@127.0.0.1:16790",                    "blsPubKey":"d341a0c485c9ec00cecf7ea16323c547900f6a1bacb9daacb00c2b8bacee631f75d5d31b75814b7f1ae3a4e18b71c617bc2f230daa0c893746ed87b08b2df93ca4ddde2816b3ac410b9980bcc048521562a3b2d00e900fd777d3cf88ce678719"              }            ],            "amount": 10,            "period": 10000,            "validatorMode": "ppos"        },        "genesisVersion": 3328    },    "economicModel":{        "common":{            "maxEpochMinutes":4,            "maxConsensusVals":4,            "additionalCycleTime":28        },        "staking":{            "stakeThreshold": 100000000000000000000000,            "operatingThreshold": 10000000000000000000,            "maxValidators": 30,            "unStakeFreezeDuration": 2,            "rewardPerMaxChangeRange": 500,            "rewardPerChangeInterval": 10        },        "slashing":{           "slashFractionDuplicateSign": 100,           "duplicateSignReportReward": 50,           "maxEvidenceAge":1,           "slashBlocksReward":20,           "zeroProduceCumulativeTime":3,           "zeroProduceNumberThreshold":2,           "zeroProduceFreezeDuration":1        },         "gov": {            "versionProposalVoteDurationSeconds": 160,            "versionProposalSupportRate": 6670,            "textProposalVoteDurationSeconds": 160,            "textProposalVoteRate": 5000,            "textProposalSupportRate": 6670,                      "cancelProposalVoteRate": 5000,            "cancelProposalSupportRate": 6670,            "paramProposalVoteDurationSeconds": 160,            "paramProposalVoteRate": 5000,            "paramProposalSupportRate": 6670              },        "reward":{            "newBlockRate": 50,            "platonFoundationYear": 10,            "increaseIssuanceRatio": 250        },        "innerAcc":{            "platonFundAccount": "lat1q25u0zphmre6tz8nt3cuen0ekmas7qfzaalgh4",            "platonFundBalance": 0,            "cdfAccount": "lat10kvcm60zhmlsfmsjjdqggnsu6nccl5q2v6kqw2",            "cdfBalance": 331811981000000000000000000        }    },    "nonce": "0x0376e56dffd12ab53bb149bda4e0cbce2b6aabe4cccc0df0b5a39e12977a2fcd23",    "timestamp": "0x5bc94a8a",    "extraData": "0xd782070186706c61746f6e86676f312e3131856c696e757800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",    "gasLimit": "4712388",    "alloc": {        "lat1zqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqrdyjj2v": {            "balance": "200000000000000000000000000"        },        "lat1jvm3ljpeyrc6k9c7d6x0sq4dq9m42skueugvxy": {            "balance": "9718188019000000000000000000"        }    },    "number": "0x0",    "gasUsed": "0x0",    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"}
  • Initialize the genesis block
cd ~/platon-node && platon --datadir ./data init platon.json

Note:

The Successfully genesis state prompt appears to indicate that the initialization of the genesis information is complete.

  • Start Node

    In general, the platon process is always in the foreground, so we cannot do anything else, and if we exit the terminal in the middle, the program will exit.Ubuntu can launch programs in nohup mode:

cd ~/platon-node && nohup platon --identity "platon" --datadir ./data --port 16789 --rpcaddr 127.0.0.1 --rpcport 6789 --rpcapi "db,platon,net,web3,admin,personal" --rpc --nodiscover --nodekey ./data/nodekey --cbft.blskey ./data/blskey & > ./data/platon.log 2>&1 &

When succeed in excuting the command of nohup, press enter again to ensure that the process does not exit because the terminal is closed by mistake.

  • Check the running status of the node
platon attach http://localhost:6789 --exec platon.blockNumber

Execute the above command several times. If the block height keeps growing, the single-node private chain deployment is successful.

Cluster Deployment#

PlatON cluster is a private chain with multiple nodes. Here we assume that you can already build a single node. And we will build a network of two nodes on one server.The deployment of more than two nodes is similar.U:

  • Each node instance has a separate data directory (--datadir)
  • Each instance runs on a different port, whether it is a p2p port or an rpc port (--port and --rpcport)
  • Nodes can be interconnected with each other
  • RPC server port is not occupied

1.Create directory

Create directories data0 and data1 under the platon-node directory as the data directories for the two nodes. Generate two coinbase accounts for each node.

mkdir -p ~/platon-node/data0 ~/platon-node/data1

2. Generate key pair

Save the nodekey and blskey of the two nodes to 'data0' and 'data1' respectively.

cd ~/platon-node/data0 && platonkey genkeypair | tee >(grep "PrivateKey" | awk '{print $2}' > ./nodekey) >(grep "PublicKey" | awk '{print $3}' > ./nodeid) && platonkey genblskeypair | tee >(grep "PrivateKey" | awk '{print $2}' > ./blskey) >(grep "PublicKey" | awk '{print $3}' > ./blspub)
 cd ~/platon-node/data1 && platonkey genkeypair | tee >(grep "PrivateKey" | awk '{print $2}' > ./nodekey) >(grep "PublicKey" | awk '{print $3}' > ./nodeid) && platonkey genblskeypair | tee >(grep "PrivateKey" | awk '{print $2}' > ./blskey) >(grep "PublicKey" | awk '{print $3}' > ./blspub)

3. Editing genesis files

Modify the genesis block configuration file platon.json.

Add the node information of the two nodes to the initialNodes array, which is 2 because we are generating a two-node cluster environment.The platon.json file needs to be modified: please replace the contents of the following files 'node0-nodekey ', 'node1-nodekey', 'node0-blspubkey' and 'node1-blspubkey' with the node public key and node BLS public key generated in the previous step.Replace 'your account-address' with the wallet address.

……  "cbft": {  "initialNodes": [{        "node": "enode://node0-pubkey@127.0.0.1:16789",        "blsPubKey": "node0-blspubkey"    },{        "node": "enode://node1-pubkey@127.0.0.1:16790",        "blsPubKey": "node1-blspubkey"    }],    ……  "alloc": {    "your-account-address": {        "balance": "999000000000000000000"    },    "1000000000000000000000000000000000000003": {        "balance": "200000000000000000000000000"    }  },……

4. Initialization and startup

Initialize genesis block information for node 0 and node 1, respectively:

platon --datadir ~/platon-node/data0 init platon.json && platon --datadir ~/platon-node/data1 init platon.json

After successful initialization, start node 0 and node 1 in nohup mode:

cd ~/platon-node && nohup platon --identity "platon0" --datadir ./data0 --port 16789 --rpcaddr 0.0.0.0 --rpcport 6789 --rpcapi "db,platon,net,web3,admin,personal" --rpc --nodiscover --nodekey ./data0/nodekey --cbft.blskey ./data0/blskey > ./data0/platon.log 2>&1 &
 cd ~/platon-node && nohup platon --identity "platon1" --datadir ./data1 --port 16790 --rpcaddr 0.0.0.0 --rpcport 6790 --rpcapi "db,platon,net,web3,admin,personal" --rpc --nodiscover --nodekey ./data1/nodekey --cbft.blskey ./data1/blskey  > ./data1/platon.log 2>&1 &

5. Check

Go to the platon console for any node as described above to see if the node is connected to its counterpart and to see if the cluster has started successfully by seeing if blockNumber continues to grow.

platon attach http://localhost:6789 --exec platon.blockNumberplaton attach http://localhost:6790 --exec platon.blockNumber

Do this multiple times and watch if the block height increases.

- + \ No newline at end of file diff --git a/CTool_Manual/index.html b/CTool_Manual/index.html index a96cd2240..eb080a95e 100644 --- a/CTool_Manual/index.html +++ b/CTool_Manual/index.html @@ -8,13 +8,13 @@ CTool tutorial | PlatON - +

CTool tutorial

CTool is an integrated tool kit for wallet/contract transactions on PlatON. It allows users to create wallets, transfer funds, and engage in contract transactions safely and conveniently on PlatON. This document introduces the operating environment of the contract tools and how they are used.

To keep the wallet and private key safe and secure, users need to set up two operating environments:

  • An offline operating environment specifically used to generate regular/HD wallets and to store wallets and private keys, as well as offline signatures of transaction files, including batch operations for staking, transfers, locking, trading contracts, etc.
  • An online operating environment for sending PlatON offline-signed transactions, including batch operations for staking, transfers, locking, trading contracts, etc.

More specifically, you will go through the process as below:

1. Install the Offline CTool#

1.1 Hardware Requirements#

A computer running Windows 10 without any Internet connection (e.g. WiFi and network cable).

A USB flash drive that contains CTool.exe (the CTool installation package).

A USB flash drive used to store and copy data (from/to the offline device/the online device).

1.2 Install CTool#

For security concerns, the offline CTool should be installed on an offline device without any Internet connection.

step1. Download the CTool installation package

Download path: https://download.platon.network/platon/CTool/CTool.exe.

step2. Copy CTool.exe to the offline device through a secure storage medium, such as a USB flash drive or hard drive.

step3. Install CTool on the offline device

Double-click CTool.exe to install CTool. The default installation directory is C:\CTool. We do not recommend changing this default setting. The popup window notice of “Completing the CTool Setup Wizard” indicates that CTool has been installed, and you can now click on Finish.

1.3 Config Modification#

To support the different chain-id of the two versions, we added new config files to adjust the chain-id, as well as the ip and rpc ports. Config file path: C:\CTool\bin\config\config.json. Config file template:

{    "wallet_file_base_dir": "C:\CTool\keystore\",    "prikey_file_base_dir": "C:\CTool\priatekey\",    "validator_file_base_dir": "C:\CTool\validator\",    "unsigned_transaction_file_dir": "C:\CTool\unsigned_transaction\",    "signed_transaction_file_dir": "C:\CTool\signed_transaction\",    "transaction_result_dir": "C:\CTool\transaction_result\",    "rpc_url":"http://127.0.0.1:6789",    "chain_id": 210425,    "hrp_type": "lat"}

Fields:

  • wallet_file_base_dir: the directory where regular/HD wallet files are generated;

  • prikey_file_base_dir: the directory where the private keys and QR codes of regular/HD wallets are generated;

  • validator_file_base_dir: the directory for staking node info and config files;

  • unsigned_transaction_file_dir: the directory where unsigned transactions are saved;

  • signed_transaction_file_dir: the directory where signed transaction files are saved;

  • transaction_result_dir: the directory where the results of sending and verifying transactions are saved;

  • rpc_url: the path for calling a node’s rpc interface;

  • chain_id: the ChainID of the current version used by the node (the ChainID of the PlatON mainnet: 210425);

  • hrp_type: the bech32 address format prefix;

    The above config file should be modified as appropriate.

1.4 File Templates#

After CTool is installed, you can find the config files relating to the generation of wallets and transactions under C:\CTool\template. Specifically:

  • wallet_file.xlsx, the wallet config file, includes the configuration for generating regular/HD wallets;

    Note:

    • As the wallet and private key files are stored under the Private Key Manager\Wallet Type\Account Usage path, the three fields cannot contain special characters, such as \;
  • transfer_file.xlsx is the transfer transaction config file;

  • restrict_file.xlsx is the locking transaction config file;

Please modify the config files according to the template format.

2. Install the Online CTool#

Refer to the installation of the offline CTool for the specific methods and steps.

3. Operating Steps#

  • Generate wallet

    For security concerns, we recommend generating wallets on the offline machine;

  • About transactions

    • Generating unsigned files and sending transactions are both operations that ought to be executed on the online device;
    • Transactions are signed on the offline device;

3.1 Generate Wallet#

Modify wallet_file.xlsx (the wallet config file) under C:\CTool\template in advance;

3.1.1 Generate Regular Wallet#

Execute the command:

batch_generate_wallet -f C:\CTool\template\wallet_file.xlsx --empty_keystore

-f: wallet config file path;

--empty_keystore: the command will empty the files in the wallet file directory and wallet private key directory, which correspond to the directories of wallet_file_base_dir and prikey_file_base_dir, specified in [1.3 Config Modification](#1.3 修改config配). Please use the command as appropriate. The files are not emptied by default.

After the command is executed, the regular wallet file and the regular wallet private key file will be generated under the configured directory; and the password file password_xxxx.txt corresponding to the wallet file is also generated. In particular, the password file format is $address:$password, in which $address represents the address, and $password corresponds to the plaintext. In addition, the plaintext is randomly generated, for instance:

lat1jhsv560t2cx7m90fwsu66uhegjtm2w7049s6d9:DWkRAJU8

3.1.2 Generate HD Wallet#

Execute the command:

batch_generate_wallet -f C:\CTool\template\wallet_file.xlsx -t hd

-f: wallet config file path;

-t: wallet type (HD indicates that a hierarchical deterministic wallet will be generated);

After the command is executed, the HD wallet file and the HD wallet private key file will be generated under the configured directory;

3.2 Batch Transfer#

Modify transfer_file.xlsx (the transfer transaction config file) under C:\CTool\template in advance;

  • Generate the unsigned transfer transaction file

Execute the command:

batch_unsigned_transfer_tx -f C:\CTool\template\transfer_file.xlsx

Note:

  • -f: the transfer transaction config file;

After the command is executed, unsigned_transfer_transactions.csv (the unsigned transfer transaction file) will be generated under unsigned_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

  • Generate signed transfer transaction files

Execute the command:

batch_signed_transfer_tx -f C:\CTool\unsigned_transaction\unsigned_transfer_transactions.csv -k C:\CTool\keystore

Note:

-f: the unsigned transfer transaction file;

-k: the path of the wallet file for transfer transactions; if the wallet is provided externally, you will need to name the wallet the address and then add the address and password of the wallet file to the current password file password.txt following the format $address:$password.

After the command is executed, signed_transfer_transaction.csv (the signed transfer transaction file) will be generated under signed_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

  • Send batch transfer transactions

Execute the command:

batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_transfer_transaction.csv -t transfer --no-wait

Note:

-f: the signed transfer transaction file;

-t: transaction type, including staking\transfer\restrict;

-s: sleep time after sending each transaction (measured in milliseconds; default: 100 ms);

--no-wait: the transaction hash will be directly returned, without waiting for the receipt; --wait: wait for the transaction receipt (it will take longer to send transactions by this means);

Print information such as the transaction hash and the balance of the from/to address accounts before the transfer (unit: ATP). After all the transactions are sent, transfer_transaction_result.csv (the transaction result file) will be generated under transaction_result_dir, specified in [1.3 Config Modification](#1.3 修改config配).

Verify transactions:

  • Use the generated result file transfer_transaction_result.csv to verify whether the transaction was successful:
verify_transaction_result -f C:\CTool\template\transfer_file.xlsx -r C:\CTool\transaction_result\transfer_transaction_result.csv -t transfer

After verification, check_transfer_result_XXXXXXXXXXX.csv (a test file) will be generated, which records information such as the balance of the from/to address accounts before and after the transfer (unit: ATP);

Where err_transfer_result_XXXXXXXXXXX.csv is generated, the transaction is abnormal, and you will need to resend the transfer transaction using transfer_file_XXXXXXXXXXX.xlsx.

3.3 Batch Staking Nodes#

Modify staking_file.xlsx (the batch staking config file) under C:\CTool\template in advance;

  • Generate the unsigned batch staking file

Execute the command:

batch_unsigned_staking_tx -f C:\CTool\template\staking_file.xlsx

Note:

  • -f: the node staking info file

After the command is executed, unsigned_staking_transactions.csv (the unsigned staking transaction file) will be generated under unsigned_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

  • Generate the signed staking transaction file

Execute the command:

batch_signed_staking_tx -f C:\CTool\unsigned_transaction\unsigned_staking_transactions.csv -k C:\CTool\keystore

Note:

-f: the unsigned staking transaction file;

-k: the path of the wallet file for staking addresses; if the wallet is provided externally, you will need to name the wallet the address and then add the address and password of the wallet file to the current password file password.txt following the format $address:$password.

After the command is executed, signed_staking_transaction.csv (the signed staking transaction file) will be generated under signed_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

  • Send node staking transactions

Execute the command:

batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_staking_transaction.csv -t staking --no-wait

Note:

-f: Signed staking transaction file;

-t: transaction type, including staking\transfer\restrict;

-s: sleep time after sending each transaction (measured in milliseconds; default: 100 ms);

--no-wait: the transaction hash will be directly returned, without waiting for the receipt; --wait: wait for the transaction receipt (it will take longer to send transactions by this means);

Print information such as the transaction hash and the transaction type. After all the transactions are sent, staking_transaction_result.csv (the transaction result file) will be generated under transaction_result_dir, specified in [1.3 Config Modification](#1.3 修改config配).

Check whether the transactions are on the chain:

  • To check whether all the transactions are on the chain, execute:
batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_staking_transaction.csv -t staking --check
  • If not all transactions are on the chain, please wait!!! pops up, then not all the transactions are on the chain. In this case, please wait, and do not verify transactions (repeat the above command after a while);
  • If all transactions are on the chain. pops up, then all the transactions are on the chain, and you can verify the transactions to see whether they are successful;

Verify transactions:

  • Use the generated result file staking_transaction_result.csv to verify whether the transaction was successful:
verify_transaction_result -f C:\CTool\template\staking_file.xlsx -r C:\CTool\transaction_result\staking_transaction_result.csv -t staking

After verification, check_staking_result_XXXXXXXXXXX.csv (a test file) will be generated, which records information such as the balance of the staking accounts (unit: LAT) and staking nodes before and after the transfer;

Where err_staking_result_XXXXXXXXXXX.csv is generated, the transaction is abnormal, and you will need to resend the staking transaction using staking_file_XXXXXXXXXXX.xlsx.

3.4 Batch Locking#

  • Generate the unsigned locking transaction file

Execute the command:

batch_unsigned_restrict_tx -f C:\CTool\template\restrict_file.xlsx

Note:

  • -f: the batch locking config file

After the command is executed, unsigned_restrict_transaction.csv (the unsigned locking transaction file) will be generated under unsigned_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

  • Generate the signed locking transaction file

Execute the command:

batch_signed_restrict_tx -f C:\CTool\unsigned_transaction\unsigned_restrict_transaction.csv -k C:\CTool\keystore

Note:

-f: the unsigned locking transaction file

-k: the path of the wallet file for locking transactions; if the wallet is provided externally, you will need to name the wallet the address and then add the address and password of the wallet file to the current password file password.txt following the format $address:$password.

After the command is executed, signed_restrict_transaction.csv (the signed locking transaction file) will be generated under signed_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

  • Send locking transactions

Execute the command:

batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_restrict_transaction.csv -t restrict --no-wait

Note:

-f: the signed locking transaction file;

-t: transaction type, including staking\transfer\restrict;

-s: sleep time after sending each transaction (measured in milliseconds; default: 100 ms);

--no-wait: the transaction hash will be directly returned, without waiting for the receipt; --wait: wait for the transaction receipt (it will take longer to send transactions by this means);

Print information such as the transaction hash and the transaction type. After all the transactions are sent, restrict_transaction_result.csv (the statistics file) will be generated.

Check whether the transactions are on the chain:

  • To check whether all the transactions are on the chain, execute:
batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_restrict_transaction.csv -t restrict --check
  • If not all transactions are on the chain, please wait!!! pops up, then not all the transactions are on the chain. In this case, please wait, and do not verify transactions (repeat the above command after a while);
  • If all transactions are on the chain. pops up, then all the transactions are on the chain, and you can verify the transactions to see whether they are successful;

Verify transactions:

  • Use the generated result file restrict_transaction_result.csv to verify whether the transaction was successful:
verify_transaction_result -f C:\CTool\template\restrict_file.xlsx -r C:\CTool\transaction_result\restrict_transaction_result.csv -t restrict

After verification, check_restrict_result_XXXXXXXXXXX.csv (a test file) will be generated, which records information such as the free balance of the from account (unit: LAT) before and after the locking;

Where err_restrict_result_XXXXXXXXXXX.csv is generated, the transaction is abnormal, and you will need to resend the locking transaction using restrict_file_XXXXXXXXXXX.xlsx.

3.5 General Contract Transaction (Batch)#

  • Acquire the abi and bin files of the contract

  • Copy the abi and bin files to the device where CTool is installed;

  • Generate the config file template for contract transactions

    generate_erc20_file -a $abi_path -c contractName -n func_name -s $save_dir

    Parameters:

    -a: the path of the contract abi file;

    -c: the contract name; if not specified, the default name ERC20 will be used;

    -n: the function name; if not specified, the default name constructor will be used, which indicates contract deployment;

    -s: the directory where the file is saved; if not specified, the file will be saved in the current directory;

    After the command is executed, the config file {$contractName}_{$func_name}_file.xlsx will be generated under $save_dir, specified in [1.3 Config Modification](#1.3 修改config配).

    In particular, “from” indicates the address that initiates the contract transaction, “contract_address” represents the contract address, and param_xxx refers to the parameters of the function;

  • Edit the config file of contract transactions

    Edit {$contractName}_{$func_name}_file.xlsx according to specific needs;

  • Generate the unsigned contract transaction file

    Copy the edited config file of contract transactions to the online device where CTool is installed, and execute:

batch_unsigned_erc20_tx -f {$contractName}_{$func_name}_file.xlsx -a $abi_path -b $bin_path -c $contractName -d $contract_address -n $func_name

Parameters:

-f: the path of the contract transaction file;

-a: the path of the contract abi file;

-b: the path of the contract bin file;

-c: the contract name;

-d: the erc2.0 contract address; if not specified, the address will be read from the contract_address field in the contract transaction file; when specifying the address, please change $contract_address to an authentic contract address; if contract deployment is required, then no address should be specified;

-n: the function name; if not specified, the default name transfer will be used, which indicates contract transfer transaction; if contract deployment is required, then the name should be specified as constructor;

After the command is executed, unsigned_{$contractName}_{$func_name}_transactions.csv (the unsigned contract transaction file) will be generated underunsigned_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

  • Sign contract transactions
batch_signed_erc20_tx -f C:\CTool\unsigned_transaction\unsigned_{$contractName}_{$func_name}_transactions.csv -k C:\CTool\keystore

Parameters:

-f: the unsigned erc2.0 contract transaction file;

-k: the path of the wallet file for transfer transactions; if the wallet is provided externally, you will need to name the wallet the address and then add the address and password of the wallet file to the current password file password.txt following the format $address:$password;

After the command is executed, signed_{$contractName}_{$func_name}_transactions.csv (the unsigned contract transaction file) will be generated under signed_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

  • Send the contract transaction
batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_{$contractName}_{$func_name}_transactions.csv -t erc20 --no-wait

Parameters:

-f: the signed contract transaction file;

-t: transaction type, including staking\transfer\restrict\erc20;

-s: sleep time after sending each transaction (measured in milliseconds; default: 100 ms);

--no-wait: the transaction hash will be directly returned, without waiting for the receipt; --wait: wait for the transaction receipt (it will take longer to send transactions by this means). If contract deployment is required, then the result files will need to save the contract address, and this parameter will be needed;

After the command is executed, {$contractName}_{$func_name}_transaction_result.csv (the signed contract transaction file) will be generated under transaction_result_dir, specified in [1.3 Config Modification](#1.3 修改config配).

Check whether the transactions are on the chain:

  • To check whether all the transactions are on the chain, execute:
batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_{$contractName}_{$func_name}_transactions.csv -t erc20 --check
  • If not all transactions are on the chain, please wait!!! pops up, then not all the transactions are on the chain. In this case, please wait, and do not verify transactions (repeat the above command after a while);
  • If all transactions are on the chain. pops up, then all the transactions are on the chain, and you can verify the transactions to see whether they are successful;

  • Verify contract transactions

Use the generated result file {contractName}_{func_name}_transaction_result.csv to verify whether the transaction was successful:

verify_transaction_result -f {$contractName}_{$func_name}_file.xlsx -r C:\CTool\transaction_result\{$contractName}_{$func_name}_transaction_result.csv -t erc20

After verification, check_{$contractName}_{$func_name}_result_XXXXXXXXXXX.csv (a test file) will be generated, which records information such as the verification result of contract transfer transactions;

Where err_{$contractName}_{$func_name}_result_XXXXXXXXXXX.csv is generated, the transaction is abnormal, and you will need to resend the contract transaction using {$contractName}_{$func_name}_file_XXXXXXXXXXX.xlsx.

3.6 Batch NFT Transaction#

3.6.1 Contract Deployment#

  • Generate the unsigned contract deployment file

    Copy the edited config file of contract deployment transactions C:\CTool\template\erc721_constructor_file.xlsx to the online device where CTool is installed, and execute:

batch_unsigned_erc20_tx -f C:\CTool\template\erc721_constructor_file.xlsx -a C:\CTool\bin\contract\erc721.abi -b C:\CTool\bin\contract\erc721.bin -c ERC721 -n constructor

Parameters:

-f: the path of the contract transaction file;

-a: the path of the NFT contract abi file;

-b: the path of the NFT contract bin file;

-c: the NFT contract name;

-n: the NFT contract interface name; constructor refers to the contract constructor name and is used for contract deployment;

After the command is executed, unsigned_ERC721_deploy_transactions.csv (the unsigned contract transaction file) will be generated under unsigned_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

  • Sign erc721 contract transactions
batch_signed_erc20_tx -f C:\CTool\unsigned_transaction\unsigned_ERC721_deploy_transactions.csv -k C:\CTool\keystore

Parameters:

-f: the unsigned contract transaction file;

-k: the path of the wallet file for transfer transactions; if the wallet is provided externally, you will need to name the wallet the address and then add the address and password of the wallet file to the current password file password.txt following the format $address:$password;

After the command is executed, signed_ERC721_deploy_transactions.csv (the signed contract transaction file) will be generated under signed_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

  • Send contract transactions
batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_ERC721_deploy_transactions.csv -t erc20 --no-wait

Parameters:

-f: the signed contract transaction file;

-t: transaction type, including staking\transfer\restrict\erc20;

s: sleep time after sending each transaction (measured in milliseconds; default: 100 ms); this parameter will become invalid when the specified -m is greater than 0;

--no-wait: the transaction hash will be directly returned, without waiting for the receipt; --wait: wait for the transaction receipt (it will take longer to send transactions by this means). If contract deployment is required, then the result files will need to save the contract address, and this parameter will be needed;

After the command is executed, ERC721_deploy_transaction_result.csv (the signed contract transaction file) will be generated under transaction_result_dir, specified in [1.3 Config Modification](#1.3 修改config配).

Check whether the transactions are on the chain:

  • To check whether all the transactions are on the chain, execute:
batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_ERC721_deploy_transactions.csv -t erc20 --check
  • If not all transactions are on the chain, please wait!!! pops up, then not all the transactions are on the chain. In this case, please wait, and do not verify transactions (repeat the above command after a while);
  • If all transactions are on the chain. pops up, then all the transactions are on the chain, and you can verify the transactions to see whether they are successful;
  • Verify contract transactions

Use the generated result file ERC721_deploy_transaction_result.csv to verify whether the transaction was successful:

verify_transaction_result -f C:\CTool\template\erc721_constructor_file.xlsx -r C:\CTool\transaction_result\ERC721_deploy_transaction_result.csv -t erc20

After verification, check_ERC721_deploy_result_XXXXXXXXXXX.csv (a test file) will be generated, which records the verification result of the erc721 contract transaction;

Where err_ERC721_deploy_result_XXXXXXXXXXX.csv is generated, the transaction is abnormal, and you will need to resend the erc721 contract transaction using ERC721_deploy_file_XXXXXXXXXXX.xlsx.

3.6.2 Batch Minting#

  • Generate the unsigned batch minting transaction file

    Copy the edited config file of contract transfer transactions C:\CTool\template\erc721_mint_file.xlsx to the online device where CTool is installed, and execute:

batch_unsigned_erc20_tx -f C:\CTool\template\erc721_mint_file.xlsx -a C:\CTool\bin\contract\erc721.abi -b C:\CTool\bin\contract\erc721.bin -c ERC721 -n mint -d $contract_address

Parameters:

-f: the path of the contract transaction file;

-a: the path of the NFT contract abi file;

-b: the path of the NFT contract bin file;

-c: the NFT contract name;

-n: the NFT contract interface name; constructor refers to the contract constructor name and is used for contract deployment;

-d: the contract address; if not specified, the address will be read from the contract_address field in the contract transaction file; when specifying the address, please change $contract_address to an authentic contract address, which can be acquired from contract deployment;

After the command is executed, unsigned_ERC721_mint_transactions.csv (the unsigned contract transaction file) will be generated under unsigned_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

  • Sign erc721 contract transactions
batch_signed_erc20_tx -f C:\CTool\unsigned_transaction\unsigned_ERC721_mint_transactions.csv -k C:\CTool\keystore

Parameters:

-f: the unsigned contract transaction file;

-k: the path of the wallet file for transfer transactions; if the wallet is provided externally, you will need to name the wallet the address and then add the address and password of the wallet file to the current password file password.txt following the format $address:$password;

After the command is executed, signed_ERC721_mint_transactions.csv (the signed contract transaction file) will be generated under signed_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

  • Send erc721 contract transactions
batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_ERC721_mint_transactions.csv -t erc20 --no-wait

Parameters:

-f: the signed contract transaction file;

-t: transaction type; including staking/transfer/restrict/erc20;

s: sleep time after sending each transaction (measured in milliseconds; default: 100 ms); this parameter will become invalid when the specified -m is greater than 0;

--no-wait: the transaction hash will be directly returned, without waiting for the receipt; --wait: wait for the transaction receipt (it will take longer to send transactions by this means);

After the command is executed, ERC721_mint_transaction_result.csv (the signed contract transaction file) will be generated under transaction_result_dir, specified in [1.3 Config Modification](#1.3 修改config配).

Check whether the transactions are on the chain:

  • To check whether all the transactions are on the chain, execute:
batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_ERC721_mint_transactions.csv -t erc20 --check
  • If not all transactions are on the chain, please wait!!! pops up, then not all the transactions are on the chain. In this case, please wait, and do not verify transactions (repeat the above command after a while);
  • If all transactions are on the chain. pops up, then all the transactions are on the chain, and you can verify the transactions to see whether they are successful;
  • Verify contract transactions

Use the generated result file ERC721_mint_transaction_result.csv to verify whether the transaction was successful:

verify_transaction_result -f C:\CTool\template\erc721_mint_file.xlsx -r C:\CTool\transaction_result\ERC721_mint_transaction_result.csv -t erc20

After verification, check_ERC721_mint_result_XXXXXXXXXXX.csv (a test file) will be generated, which records the verification result of the contract minting transaction;

Where err_ERC721_mint_result_XXXXXXXXXXX.csv is generated, the transaction is abnormal, and you will need to resend the erc721 contract transaction using ERC721_mint_file_XXXXXXXXXXX.xlsx.

3.6.3 Batch NFT Transactions#

  • Edit the config file of erc721 contract transactions

    Edit C:\CTool\template\erc721_safeTransferFrom_file.xlsx according to specific needs;

    fromcontract_addressparam_fromparam_toparam_tokenId

    Fields:

    • from: the address for sending contract transactions, i.e. the minting address $param_from;
    • contract_address: the erc721 contract address;
    • param_from: the minting address;
    • param_to: the voting/recipient NFT wallet;
    • param_tokenId: the token ID;
  • Generate the unsigned erc721 contract transfer transaction file

    Copy the edited config file of contract transfer transactions C:\CTool\template\erc721_safeTransferFrom_file.xlsx to the online device where CTool is installed, and execute:

batch_unsigned_erc20_tx -f C:\CTool\template\erc721_safeTransferFrom_file.xlsx -a  C:\CTool\bin\contract\erc721.abi -b C:\CTool\bin\contract\erc721.bin -c erc721 -d $contract_address -n safeTransferFrom 

Parameters:

-f: the path of the contract transaction file;

-a: the path of the erc721 contract abi file;

-b: the path of the erc721 contract bin file;

-c: the erc721 contract name;

-d: the erc721 contract address; if not specified, the address will be read from the contract_address field in the contract transaction file; when specifying the address, please change $contract_address to an authentic contract address;

-n: the function name; if not specified, the default name transfer will be used, i.e. erc721 contract transfer transaction;

After the command is executed, unsigned_erc721_safeTransferFrom_transactions.csv (the unsigned contract transaction file) will be generated under unsigned_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

  • Sign erc721 contract transactions
batch_signed_erc20_tx -f C:\CTool\unsigned_transaction\unsigned_erc721_safeTransferFrom_transactions.csv -k C:\CTool\keystore

Parameters:

-f: the unsigned erc2.0 contract transaction file;

-k: the path of the wallet file for transfer transactions; if the wallet is provided externally, you will need to name the wallet the address and then add the address and password of the wallet file to the current password file password.txt following the format $address:$password;

After the command is executed, signed_erc721_safeTransferFrom_transactions.csv (the signed contract transaction file) will be generated under signed_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

  • Send erc721 contract transactions
batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_erc721_safeTransferFrom_transactions.csv -t erc20 -n 1 -m 20 --no-wait

Parameters:

-f: the signed contract transaction file;

-t: transaction type, including staking\transfer\restrict\erc20;

-s: sleep time after sending each transaction (measured in milliseconds; default: 100 ms); this parameter will become invalid when the specified -m is greater than 0;

-n: the minimum sleep time after sending each transaction (measured in minutes; 0 by default);

-m: the maximum sleep time after sending each transaction (measured in minutes; 0 by default);

--no-wait: the transaction hash will be directly returned, without waiting for the receipt; --wait: wait for the transaction receipt (it will take longer to send transactions by this means);

After the command is executed, erc721_safeTransferFrom_transaction_result.csv (the signed contract transaction file) will be generated under transaction_result_dir, specified in [1.3 Config Modification](#1.3 修改config配).

Check whether the transactions are on the chain:

  • To check whether all the transactions are on the chain, execute:
batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_erc721_safeTransferFrom_transactions.csv -t erc20 --check
  • If not all transactions are on the chain, please wait!!! pops up, then not all the transactions are on the chain. In this case, please wait, and do not verify transactions (repeat the above command after a while);
  • If all transactions are on the chain. pops up, then all the transactions are on the chain, and you can verify the transactions to see whether they are successful;
  • Verify contract transactions

Use the generated result file erc721_safeTransferFrom_transaction_result.csv to verify whether the transaction was successful:

verify_transaction_result -f C:\CTool\template\erc721_safeTransferFrom_file.xlsx -r C:\CTool\transaction_result\erc721_safeTransferFrom_transaction_result.csv -t erc20

After verification, check_erc721_safeTransferFrom_result_XXXXXXXXXXX.csv (a test file) will be generated, which records the verification result of the erc721 contract transaction;

Where err_erc721_safeTransferFrom_result_XXXXXXXXXXX.csv is generated, the transaction is abnormal, and you will need to resend the erc721 contract transaction using erc721_safeTransferFrom_file_XXXXXXXXXXX.xlsx.

- + \ No newline at end of file diff --git a/Command_Line_Tools/index.html b/Command_Line_Tools/index.html index 6ed99ae16..6b8b79ee6 100644 --- a/Command_Line_Tools/index.html +++ b/Command_Line_Tools/index.html @@ -8,7 +8,7 @@ Command line tools | PlatON - + @@ -17,7 +17,7 @@ Copyright 2019 The PlatON-Go Authors USAGE: platon [options] command [command options] [arguments...] VERSION: 1.4.4-unstable COMMANDS: account Manage accounts attach Start an interactive JavaScript environment (connect to node) console Start an interactive JavaScript environment copydb Create a local chain from a target chaindata folder dump Dump a specific block from storage dumpconfig Show configuration values export-preimages Export the preimage database into an RLP stream import-preimages Import the preimage database from an RLP stream init Bootstrap and initialize a new genesis block inspect Inspect the storage size for each type of data in the database js Execute the specified JavaScript files license Display license information removedb Remove blockchain and state databases show-deprecated-flags Show flags that have been deprecated version Print version numbers help, h Shows a list of commands or help for one command PLATON OPTIONS: --config value TOML configuration file --datadir "/home/platon/.platon" Data directory for the databases and keystore --datadir.ancient Data directory for ancient chain segments (default = inside chaindata) --keystore Directory for the keystore (default = inside the datadir) --nousb Disables monitoring for and managing USB hardware wallets --networkid value Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten, 4=Rinkeby) (default: 1) --main Mainnet network: pre-configured main network (default network) --testnet Testnet network: pre-configured test network --syncmode "full" Blockchain sync mode ("fast", "full", or "light") --identity value Custom node name --lightkdf Reduce key-derivation RAM & CPU usage at some expense of KDF strength DEVELOPER CHAIN OPTIONS: --dev.period value Block period to use in developer mode (0 = mine only if transaction pending) (default: 0) TRANSACTION POOL OPTIONS: --txpool.locals value Comma separated accounts to treat as locals (no flush, priority inclusion) --txpool.nolocals Disables price exemptions for locally submitted transactions --txpool.journal value Disk journal for local transaction to survive node restarts (default: "transactions.rlp") --txpool.rejournal value Time interval to regenerate the local transaction journal (default: 1h0m0s) --txpool.pricebump value Price bump percentage to replace an already existing transaction (default: 10) --txpool.accountslots value Minimum number of executable transaction slots guaranteed per account (default: 16) --txpool.globalslots value Maximum number of executable transaction slots for all accounts (default: 16384) --txpool.accountqueue value Maximum number of non-executable transaction slots permitted per account (default: 64) --txpool.globalqueue value Maximum number of non-executable transaction slots for all accounts (default: 4096) --txpool.globaltxcount value Maximum number of transactions for package (default: 3000) --txpool.lifetime value Maximum amount of time non-executable transaction are queued (default: 3h0m0s) --txpool.cacheSize value After receiving the specified number of transactions from the remote, move the transactions in the queen to pending (default: 0) PERFORMANCE TUNING OPTIONS: --cache value Megabytes of memory allocated to internal caching (default: 1024) --cache.database value Percentage of cache memory allowance to use for database io (default: 75) --cache.gc value Percentage of cache memory allowance to use for trie pruning (default = 25% full mode, 0% archive mode) (default: 25) --cache.triedb value Megabytes of memory allocated to triedb internal caching (default: 512) ACCOUNT OPTIONS: --unlock value Comma separated list of accounts to unlock --password value Password file to use for non-interactive password input --allow-insecure-unlock Allow insecure account unlocking when account-related RPCs are exposed by http API AND CONSOLE OPTIONS: --ipcdisable Disable the IPC-RPC server --ipcpath Filename for IPC socket/pipe within the datadir (explicit paths escape it) --http Enable the HTTP-RPC server --http.addr value HTTP-RPC server listening interface (default: "localhost") --http.port value HTTP-RPC server listening port (default: 6789) --http.api value API's offered over the HTTP-RPC interface --http.corsdomain value Comma separated list of domains from which to accept cross origin requests (browser enforced) --http.vhosts value Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: "localhost") --ws Enable the WS-RPC server --ws.addr value WS-RPC server listening interface (default: "localhost") --ws.port value WS-RPC server listening port (default: 6790) --ws.api value API's offered over the WS-RPC interface --ws.origins value Origins from which to accept websockets requests --graphql Enable GraphQL on the HTTP-RPC server. Note that GraphQL can only be started if an HTTP server is started as well. --graphql.corsdomain value Comma separated list of domains from which to accept cross origin requests (browser enforced) --graphql.vhosts value Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: "localhost") --rpc.gascap value Sets a cap on gas that can be used in platon_call/estimateGas (default: 0) --jspath loadScript JavaScript root path for loadScript (default: ".") --exec value Execute JavaScript statement --preload value Comma separated list of JavaScript files to preload into the console NETWORKING OPTIONS: --bootnodes value Comma separated enode URLs for P2P discovery bootstrap (set v4+v5 instead for light servers) --bootnodesv4 value Comma separated enode URLs for P2P v4 discovery bootstrap (light server, full nodes) --port value Network listening port (default: 16789) --maxpeers value Maximum number of network peers (network disabled if set to 0) (default: 60) --maxconsensuspeers value Maximum number of network consensus peers (network disabled if set to 0) (default: 40) --maxpendpeers value Maximum number of pending connection attempts (defaults used if set to 0) (default: 0) --nat value NAT port mapping mechanism (any|none|upnp|pmp|extip:<IP>) (default: "any") --nodiscover Disables the peer discovery mechanism (manual peer addition) --netrestrict value Restricts network communication to the given IP networks (CIDR masks) --nodekey value P2P node key file --nodekeyhex value P2P node key as hex (for testing) MINER OPTIONS: --miner.gasprice "1000000000" Minimum gas price for mining a transaction GAS PRICE ORACLE OPTIONS: --gpo.blocks value Number of recent blocks to check for gas prices (default: 20) --gpo.percentile value Suggested gas price is the given percentile of a set of recent transaction gas prices (default: 60) LOGGING AND DEBUGGING OPTIONS: --nocompaction Disables db compaction after import --verbosity value Logging verbosity: 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=detail (default: 3) --vmodule value Per-module verbosity: comma-separated list of <pattern>=<level> (e.g. eth/*=5,p2p=4) --backtrace value Request a stack trace at a specific logging statement (e.g. "block.go:271") --debug Prepends log messages with call-site location (file and line number) --pprof Enable the pprof HTTP server --pprof.addr value pprof HTTP server listening interface (default: "127.0.0.1") --pprof.port value pprof HTTP server listening port (default: 6060) --pprof.memprofilerate value Turn on memory profiling with the given rate (default: 524288) --pprof.blockprofilerate value Turn on block profiling with the given rate (default: 0) --pprof.cpuprofile value Write CPU profile to the given file --trace value Write execution trace to the given file --wasmlog value output wasm contract log to file METRICS AND STATS OPTIONS: --metrics Enable metrics collection and reporting --metrics.expensive Enable expensive metrics collection and reporting --metrics.influxdb Enable metrics export/push to an external InfluxDB database --metrics.influxdb.endpoint value InfluxDB API endpoint to report metrics to (default: "http://localhost:8086") --metrics.influxdb.database value InfluxDB database name to push reported metrics to (default: "alaya") --metrics.influxdb.username value Username to authorize access to the database (default: "test") --metrics.influxdb.password value Password to authorize access to the database (default: "test") --metrics.influxdb.tags value Comma-separated InfluxDB tags (key/values) attached to all measurements (default: "host=localhost") CBFT OPTIONS: --cbft.msg_queue_size value Message queue size (default: 1024) --cbft.wal.disabled Disable the Wal server --cbft.max_ping_latency value Maximum latency of ping (default: 2000) --cbft.blskey value BLS key file --cbft.blacklist_deadline value Blacklist effective time. uint:minute (default: "60") DB OPTIONS: --db.nogc Disables database garbage collection --db.gc_interval value Block interval for garbage collection (default: 86400) --db.gc_timeout value Maximum time for database garbage collection (default: 1m0s) --db.gc_mpt Enables database garbage collection MPT --db.gc_block value Number of cache block states, default 10 (default: 10) --db.validators_history Store the list of validators for each consensus round VM OPTIONS: --vm.wasm_type value The actual implementation type of the wasm instance (default: "wagon") --vm.timeout_duration value The VM execution timeout duration (uint: ms) (default: 0) ALIASED (deprecated) OPTIONS: --rpc Enable the HTTP-RPC server (deprecated, use --http) --rpcaddr value HTTP-RPC server listening interface (deprecated, use --http.addr) (default: "localhost") --rpcport value HTTP-RPC server listening port (deprecated, use --http.port) (default: 6789) --rpccorsdomain value Comma separated list of domains from which to accept cross origin requests (browser enforced) (deprecated, use --http.corsdomain) --rpcvhosts value Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (deprecated, use --http.vhosts) (default: "localhost") --rpcapi value API's offered over the HTTP-RPC interface (deprecated, use --http.api) --wsaddr value WS-RPC server listening interface (deprecated, use --ws.addr) (default: "localhost") --wsport value WS-RPC server listening port (deprecated, use --ws.port) (default: 6790) --wsorigins value Origins from which to accept websockets requests (deprecated, use --ws.origins) --wsapi value API's offered over the WS-RPC interface (deprecated, use --ws.api) --gpoblocks value Number of recent blocks to check for gas prices (deprecated, use --gpo.blocks) (default: 20) --gpopercentile value Suggested gas price is the given percentile of a set of recent transaction gas prices (deprecated, use --gpo.percentile) (default: 60) --pprofport value pprof HTTP server listening port (deprecated, use --pprof.port) (default: 6060) --pprofaddr value pprof HTTP server listening interface (deprecated, use --pprof.addr) (default: "127.0.0.1") --memprofilerate value Turn on memory profiling with the given rate (deprecated, use --pprof.memprofilerate) (default: 524288) --blockprofilerate value Turn on block profiling with the given rate (deprecated, use --pprof.blockprofilerate) (default: 0) --cpuprofile value Write CPU profile to the given file (deprecated, use --pprof.cpuprofile) MISC OPTIONS: --help, -h show help COPYRIGHT: Copyright 2019 The PlatON-Go Authors

Common rpc commands#

  • Description
    • The rpc port is changed according to the actual startup command and the default is 6789

admin#

  • View the data directory of the current node

    platon attach http://localhost:6789 -exec admin.datadir
  • View the ChainID of the current node

    platon attach http://localhost:6789 -exec admin.nodeInfo.protocols.platon.config.chainId
  • View the id of the current node

    platon attach http://localhost:6789 -exec admin.nodeInfo.id
  • View the blsPubKey of the current node

    platon attach http://localhost:6789 -exec admin.nodeInfo.blsPubKey
  • View the p2p port number of the current node

    platon attach http://localhost:6789 -exec admin.nodeInfo.ports.listener
  • View the connection information of peers of the current node

    platon attach http://localhost:6789 -exec admin.peers
  • View the genesis block hash of the current node

    platon attach http://localhost:6789 -exec admin.nodeInfo.protocols.platon.genesis
  • View the maximum number of blocks ($amount) of a single node in each consensus round of cbft consensus

    platon attach http://localhost:6789 -exec admin.nodeInfo.protocols.platon.config.cbft.amount
  • View the time window of block generation by a single node in each consensus round of cbft consensus ($period, unit: ms)

    platon attach http://localhost:6789 -exec admin.nodeInfo.protocols.platon.config.cbft.period

    Blocking time interval = period / 1000 / amount

  • Get the binary version number and signature information

    platon attach http://localhost:6789 -exec 'admin.getProgramVersion()'
  • Obtain zero- knowledge proof information (use the node's private key to prove whether the certificate issued by the interface is correct and used for node pledge)

    platon attach http://localhost:6789 -exec 'admin.getSchnorrNIZKProve()'
  • View the type of virtual machine used at the bottom (EVM / WASM)

    platon attach http://localhost:6789 -exec admin.nodeInfo.protocols.platon.config.interpreter

platon#

  • View all wallet addresses under the current node

    platon attach http://localhost:6789 -exec platon.accounts
  • View the block height of the current node

    platon attach http://localhost:6789 -exec platon.blockNumber
  • Check the balance of the specified account ($account is the account address)

    platon attach http://localhost:6789 -exec 'platon.getBalance("$account")'
  • Query the number of transactions in the specified block ($blockNumber is the block height or block hash of the specified block)

    platon attach http://localhost:6789 -exec 'platon.getBlockTransactionCount($blockNumber)'
  • Query transaction information ($txHash is transaction hash)

    platon attach http://localhost:6789 -exec 'platon.getTransaction("$txHash")'
  • Query transaction receipt ($txHash is transaction hash)

    platon attach http://localhost:6789 -exec 'platon.getTransactionReceipt("$txHash")'
  • Query the number of transactions in the specified account (parameter $address is the account address, used to specify the nonce of the transaction when sending the transaction)

    platon attach http://localhost:6789 -exec 'platon.getTransactionCount("$address")'
  • Query the pending transaction of the current node

    platon attach http://localhost:6789 -exec platon.pendingTransactions
  • View the default gasPrice of the current node (unit: von)

    platon attach http://localhost:6789 -exec platon.gasPrice
  • Estimate the gas of the transaction (parameter $transaction is the transaction details, unit: von)

    platon attach http://localhost:6789 -exec 'platon.estimateGas($transaction)'

    For example:

    platon attach http://localhost:6789 -exec 'platon.estimateGas({from:"lax1fyeszufxwxk62p46djncj86rd553skpptsj8v6",to:"lax1zhllhqu72wz66cdwly8983xhla2sann75j2ec2",value:"0x10000000000000",data:"0x11",gas:"0x88888",gasprice:"0x333333",nonce:"11"})'
  • View the p2p protocol number of the underlying version of the current node

    platon attach http://localhost:6789 -exec 'web3.toDecimal(platon.protocolVersion)'
  • See if the current node is in sync

    platon attach http://localhost:6789 -exec platon.syncing
  • Get details of specified block

    platon attach http://localhost:6789 -exec 'platon.getBlock($blockNumber)'

personal#

  • Generate wallet (parameter is wallet password)

    platon attach http://localhost:6789 -exec 'personal.newAccount("88888888")'
  • Import private key to generate wallet

    platon attach http://localhost:6789 -exec 'personal.importRawKey($privateKey, $password)'

    Parameters:

    • privateKey: private key, remove the leading 0x
    • password: wallet password

    Back to:

    • Wallet address

    For example:

    platon attach http://localhost:6789 -exec 'personal.importRawKey ("842d943dbb50a8d3fe63af2f82fda3d8f0ca817fe8d47e61698142bac7c24212", "88888888")'
  • View account address

    platon attach http://localhost:6789 -exec 'personal.listAccounts'
  • View local wallet information, including wallet address, wallet file path and wallet status

    platon attach http://localhost:6789 -exec 'personal.listWallets'
  • Lock account

    platon attach http://localhost:6789 -exec 'personal.lockAccount(platon.accounts[0])'
  • Unlock account

    platon attach http://localhost:6789 -exec 'personal.unlockAccount(platon.accounts[0], "88888888", 24*3600)'

    Parameters:

    • Account address
    • Wallet password
    • Unlock time in seconds
  • Send unsigned transactions

    platon attach http://localhost:6789 -exec 'personal.sendTransaction({from: platon.accounts[2], to: platon.accounts[0], value:web3.toVon("0.1","lat"), nonce: platon.getTransactionCount(platon.accounts[2])}, "88888888") '

net#

  • View the networkid of the current node

    platon attach http://localhost:6789 -exec net.version
  • Check whether the p2p port of the current node is in the listening state

    platon attach http://localhost:6789 -exec net.listening
  • View the number of peer connections of the current node

    platon attach http://localhost:6789 -exec net.peerCount

debug#

  • Query the economic model configuration parameters of the current node

    platon attach http://localhost:6789 -exec 'debug.economicConfig()'
  • Set log level

    platon attach http://localhost:6789 -exec 'debug.verbosity(4)'

    Log level description:

    0: CRIT

    1: ERROR

    2: WARN

    3: INFO

    4: DEBUG

    5: TRACE

- + \ No newline at end of file diff --git a/DApp_integration_with_WalletConnect_for_ATON/index.html b/DApp_integration_with_WalletConnect_for_ATON/index.html index 68be32d99..2cec4483b 100644 --- a/DApp_integration_with_WalletConnect_for_ATON/index.html +++ b/DApp_integration_with_WalletConnect_for_ATON/index.html @@ -8,7 +8,7 @@ DApp integration with WalletConnect for ATON | PlatON - + @@ -35,7 +35,7 @@ // send transaction const result = await connector.sendTransaction(tx); console.log("connector.sendTransaction result txHash: ", result);};

Display of transaction results

Obtain txHash, which provides browser links and display of transaction details in the DApp

// format displayed resultconst formattedResult = {  method: "eth_sendTransaction",  txHash: result,  from: address,  to: address,  value: "0 ETH",};
 // display resultthis.setState({  connector,  result: formattedResult || null,});

Confirm Transaction

Transaction Success@3x

Conclusion#

After the three steps are completed, users of your DApp will be able to connect with ATON in the DApp and send signature requests through sendTransaction provided by WalletConnect.

Video Demo#

- + \ No newline at end of file diff --git a/DApp_migrate/index.html b/DApp_migrate/index.html index a0a8639aa..458766b25 100644 --- a/DApp_migrate/index.html +++ b/DApp_migrate/index.html @@ -8,13 +8,13 @@ DApp Quick Migration Tutorial | PlatON - +
Skip to main content
- + \ No newline at end of file diff --git a/EVM_Smart_Contract/index.html b/EVM_Smart_Contract/index.html index 5a482dad7..25e944ad3 100644 --- a/EVM_Smart_Contract/index.html +++ b/EVM_Smart_Contract/index.html @@ -8,7 +8,7 @@ EVM Smart Contract | PlatON - + @@ -29,7 +29,7 @@ function writeMap(uint _map, uint _key, uint _value) public { array[_map][_key] = _value; } function readMap(uint _map, uint _key) public view returns (uint) { return array[_map][_key]; } function eraseMaps() public { delete array; }}

Consider the example above and the following sequence of calls: allocate(10), writeMap(4, 128, 256). At this point, calling readMap(4, 128) returns 256. If we call eraseMaps, the length of state variable array is zeroed, but since its mapping elements cannot be zeroed, their information stays alive in the contract’s storage. After deleting array, calling allocate(5) allows us to access array[4] again, and calling readMap(4, 128) returns 256 even without another call to writeMap.

If your mapping information must be deleted, consider using a library similar to iterable mapping, which allows you to traverse the keys and delete their values in the appropriate mapping.

Permission Control Error#

In smart contracts, contract developers usually set some permission for the contract owner, but if the developer negligently writes wrong function permissions, it may lead to serious consequences such as transfer of the owner.

function initContract() public {    owner = msg.reader;}

The above code function needs to be set onlyOwner.

Reasonable permissions should be set for different functions in the contract.

Address Initialization Problem#

In EVM, all address-related initializations are given an initial value of 0.

If an address variable is equal to 0, the variable may not be initialized or an unknown error may occur.

If the developer initializes an address variable in the code but does not assign an initial value, or the user does not assign the address variable by mistake when initiating an operation, but this variable needs to be handled in the following code, it is possible Cause unnecessary security risks.

For functions that involve addresses, it is recommended to add require (_to! = Address (0)) verification to effectively avoid unnecessary losses caused by user misoperations or unknown errors.

Transaction Order Dependent#

Since transactions are first stored in mempool in a short period of time, it is possible to know what action will take place before miners package them into blocks. This is troublesome for a decentralized market, because the transaction information of the token can be viewed, and the transaction order can be changed before it is packaged into a block. Avoiding this is difficult because it comes down to the specific contract itself.

For example, in the market, it is best to implement batch auctions (this also prevents high frequency trading issues). Another method is using a pre-commit scheme.

Minor Details#

Types that do not occupy the full 32 bytes might contain “dirty higher order bits”. This is especially important if you access msg.data - it poses a malleability risk: You can craft transactions that call a function f(uint8 x) with a raw byte argument of 0xff000001 and with 0x00000001. Both are fed to the contract and both will look like the number 1 as far as x is concerned, but msg.data will be different, so if you use keccak256(msg.data) for anything, you will get different results.

Security Recommendations#

Take Warnings Seriously#

If the compiler warns you about something, you should better change it. Even if you do not think that this particular warning has security implications, there might be another issue buried beneath it. Any compiler warning we issue can be silenced by slight changes to the code.

Always use the latest version of the compiler to be notified about all recently introduced warnings.

Restrict the Amount of Ether#

Restrict the amount of Ether (or other tokens) that can be stored in a smart contract. If your source code, the compiler or the platform has a bug, these funds may be lost. If you want to limit your loss, limit the amount of Ether.

Simple and Modular#

Keep your contracts small and easily understandable. Single out unrelated functionality in other contracts or into libraries. General recommendations about source code quality of course apply: Limit the amount of local variables, the length of functions and so on. Document your functions so that others can see what your intention was and whether it is different than what the code does.

Use the Checks-Effects-Interactions Pattern#

Most functions will first perform some checks (who called the function, are the arguments in range, did they send enough Ether, does the person have tokens, etc.). These checks should be done first.

As the second step, if all checks passed, effects to the state variables of the current contract should be made. Interaction with other contracts should be the very last step in any function.

Early contracts delayed some effects and waited for external function calls to return in a non-error state. This is often a serious mistake because of the re-entrancy problem explained above.

Note that, also, calls to known contracts might in turn cause calls to unknown contracts, so it is probably better to just always apply this pattern.

Include a Fail-Safe Mode#

While making your system fully decentralised will remove any intermediary, it might be a good idea, especially for new code, to include some kind of fail-safe mechanism:

You can add a function in your smart contract that performs some self-checks like “Has any Ether leaked?”, “Is the sum of the tokens equal to the balance of the contract?” or similar things. Keep in mind that you cannot use too much gas for that, so help through off-chain computations might be needed there.

If the self-check fails, the contract automatically switches into some kind of “failsafe” mode, which, for example, disables most of the features, hands over control to a fixed and trusted third party or just converts the contract into a simple “give me back my money” contract.

Check Function Permissions Carefully#

Reasonable permissions should be set for different functions in the contract.

Check whether the functions in the contract use public and private keywords for visibility modification. Check whether the contract is correctly defined and uses modifiers to restrict access to key functions to avoid problems caused by unauthorized use.

function initContract() public OnlyOwner {    owner = msg.reader;}

Ask for Peer Review#

The more people examine a piece of code, the more issues are found. Asking people to review your code also helps as a cross-check to find out whether your code is easy to understand - a very important criterion for good smart contracts.

Other#

  1. More Security Recommendations
  2. Contract Best Practices

Security Tools#

  1. Ethereum formal verification tool SMT checker .
  2. Formal verification tools: offline VS Code plugin,and Online version .
  3. Remix integrated security scan plugin: MythX

Third Party Audit#

You can find a professional third-party audit company for security audits, such as:slow mist


- + \ No newline at end of file diff --git a/Economic_Model/index.html b/Economic_Model/index.html index 4a859d336..a016edb95 100644 --- a/Economic_Model/index.html +++ b/Economic_Model/index.html @@ -8,7 +8,7 @@ Economic model | PlatON - + @@ -18,7 +18,7 @@ -System security maintenance -Client Support Services -Pledge locks liquidity costs

Source of Incentive Fund#

Based on the PoS consensus public chain, in order to promote the maintenance of distributed ledgers by miners, to ensure that there are enough tokens to carry future strong and rich distributed ecological applications, and to promote user pledge to provide chain security, the general incentive funds for PoS blockchains are From inflation.

The sources of PlatON network incentives include the following:

Incentive rules#

reward_distribution

In PlatON, there are three types of incentive methods for the validator:

Punishment mechanism#

Unlike PoW public chains, PoS public chains generally do not rely on computing power to maintain system security. PoS public chains require participating nodes to pledge a certain amount of tokens as a guarantee. When a node behaves badly, the system will reduce the node's The pledged deposit is punished to increase the cost of evil, Lockup and regulate the behavior of nodes, and ensure the stability and security of the system. PlatON also introduced corresponding punishment mechanisms.

Punished behavior#

In PlatON, any node that attempts to fork the blockchain and stay offline for a long time may be penalized by Slash.

PlatON's way of punishment#

PlatON currently supports the following penalties:

  1. Deduct node own pledge

    A certain percentage or fixed amount of LAT is deducted from the node's own pledge (locked own pledge) as a penalty. After the deduction, if the node's remaining own pledge (including the locked and unlocked pledges in the hesitation period) does not meet the pledge threshold of the alternative validator candidate, the alternative validator candidate will immediately lose the qualification to participate in the validator and the system automatically revoke its pledge. The deduction rules are as follows:

    • Deduction of the node's own pledge deposit will only deduct the node's own pledge LAT which has been locked in the current epoch. Unlocked pledge LAT during the hesitation period will not participate in the deduction.

    • If a node pledges both the account balance and the locked balance of LAT, it will preferentially deduct the LAT pledged using the account balance, and then deduct the LAT of the locked balance pledge.

    • When deducting the LAT pledged from the account lock balance, the remaining unlocked amount of the account in the lock contract and the participating pledge amount are deducted correspondingly.

  2. Force exit alternative validator candidate

    Alternative validator candidate are passively withdrawn, they no longer participate in the election of alternative validators and validators, and are immediately revoked for pledges, withdrawing from the alternative validator candidate list. The LAT entrusted to this node is all invalidated and unlocked. The LAT entrusted to dismiss requires the user to apply for redemption by itself (too many principals, automatic return will greatly affect system performance). The node's remaining own pledge deposit will continue to be locked for 168 epochs and will automatically be returned to the node staking account.

    remove_from_candidate_validator_list
    • Nodes that are forced to withdraw do not participate in the allocation of Staking rewards for settlement blocks in this epoch.

    • When the pledge is revoked, the pledged LAT that is not locked in the hesitation period does not need to continue to lock for 168 epochs and will be returned immediately.

    • Upon cancellation of the pledge at the node, the principal is required to redeem the LAT that has been entrusted to node by oneself (see the section on entrusted redemption for details)..

    • A node that is forcibly withdrawn can only use the node ID to re-pledge after the lock-up period ends and the node pledged LAT returns.

  1. Restrict node qualification

    The node is temporarily disqualified as a verification node and locked for 56 settlement cycles. During the lock-up period, it is not eligible to become a verification node to participate in block production, and cannot participate in governance voting, and there is no staking reward.

PlatON's punishment mechanism#

DuplicatePrepare\DuplicateVote-Manual reporting and systematic penalties#

In PlatON, DuplicateVote means signing the same block height and different hash in the same view, which is manifested in CBFT, namely DuplicateVote ViewChangeVote and DuplicateVote PrepareVote. DuplicatePrepare indicates that the block node has two different hash blocks for the same height in the same view. In essence, the block is also verified by the signature of the block, so the node DuplicateVote and DuplicatePrepare in PlatON are unified as DuplicateVote.

The node has a DuplicateVote behavior. If it is found by any user, it can initiate a DuplicateVote report transaction, submit the type and evidence of the DuplicateVote (the evidence can be obtained through the query double-out, DuplicateVote evidence interface provided) to the system slashing contract, and slashing After the contract validator is confirmed to be true, the system will reduce 10‱ of the reported node's own pledge as a penalty, and at the same time, the reported node will forcibly withdraw from the alternative validator candidate and revoke the pledge. 50% of the fine is given to the whistleblower, and 50% is put into the reward pool for block production and staking rewards in the second year.

Zero block-the system automatically judges and punishes#

PlatON judges whether a node is online and whether the node's software, hardware, and network environment meets the requirements based on the level of block production. In the 410 block of each consensus round (430 blocks in one consensus round), the block rate of the last consensus round validator node is judged.

low_block_rate_verification

The validator node must meet the following two conditions and will be judged by the system as zero block:

The node will be punished by the system after producing zero blocks, deducted the equivalent of 2500 blocks of block rewards, and restricted node qualifications. If the pledge deposit after deduction is less than 100,000 LAT, the candidate node candidate will be forced to withdraw.

Transaction Fees#

Every application running on PlatON consumes certain resources (including computing power, bandwidth, storage, data, etc.). In order to achieve fair and reasonable use of resources and avoid misuse of resources, the Gas mechanism of Ethereum is used to achieve reasonable scheduling and validity validator of resources.

Gas fee mechanism#

To prevent the exponential explosion and infinite loop of the code, PlatON uses the Gas mechanism of Ethereum to measure the resources (memory, CPU, bandwidth) consumed by each transaction execution. When submitting transactions, users can set GasPrice, which is the price of each Gas, in order to control the transaction fee for submitting transactions.

Gas Expense Description#

In addition to ordinary transfer transactions, PlatON also supports the following built-in contract transactions related to economics and governance. We adopt a custom fixed gas consumption according to the interface plus a customizable floating gas consumption based on input parameters.

Transfer transaction#

The transfer transaction is fixed at 21000Gas.

Built-in transactions#

Gas calculation rules for built-in transactions are:

Built-in transaction gas consumption = transaction fixed gas consumption + transaction dynamic gas consumption rules + (number of non-zero value bytes in data * 68) + (number of zero value bytes in data * 4)
Interface nameTransaction fixed gas consumptionTrading dynamic gas consumption rules
create staking59000N
edit staking39000N
increase staking47000N
Revoke staking47000N
Initiate a delegate43000N
Underweight/Revoke deleagte35000N

To limit the malicious submission of text proposals, parameter proposals, upgrade proposals, and cancel proposals, increase the minimum GasPrice limit.

Interface nameTransaction fixed gas consumptionTrading dynamic gas consumption rulesMinimum GasPrice(GVon)
Submit text proposal350000N1500000
Submit parameter proposal530000N2000000
Submit upgrade proposal480000N2100000
Cancel proposal530000N3000000
Vote on proposal32000NN
Version declaration33000NN
Interface nameTransaction fixed gas consumptionTrading dynamic gas consumption rules
Report duplicate signatures63000N
Name of TradeTransaction fixed gas consumptionTrading dynamic gas consumption rules
Create a Lockup plan68000Unlock times of this lockup×21000
Name of TradeTransaction fixed gas consumptionTrading dynamic gas consumption rules
Receive delegate award8000Number of delegated nodes(nodeid+stakingNum) x 1000 + Number of epoch without delegated reward x 100
- + \ No newline at end of file diff --git a/Explorer_API/index.html b/Explorer_API/index.html index 677bea25a..6d35e11aa 100644 --- a/Explorer_API/index.html +++ b/Explorer_API/index.html @@ -8,7 +8,7 @@ Explorer API | PlatON - + @@ -18,7 +18,7 @@ body={'pageNo': 0, 'pageSize': 0, 'queryStatus': 'all'}

  • Address details

  • FAQ#

    - + \ No newline at end of file diff --git a/Go_SDK/index.html b/Go_SDK/index.html index dbda92dee..6d20ff495 100644 --- a/Go_SDK/index.html +++ b/Go_SDK/index.html @@ -8,7 +8,7 @@ Go SDK | PlatON - + @@ -166,7 +166,7 @@ time.Sleep(time.Duration(10) * time.Second) result, err := instance.Items(nil, key) if err != nil { log.Fatal(err) } fmt.Println(string(result[:])) // kitty}

    to sum up#

    In this article, we demonstrated how to deploy the contract and call the view method and non-view method in the contract.

    - + \ No newline at end of file diff --git a/GraphQL_Server/index.html b/GraphQL_Server/index.html index 0fa78b719..1457dbf47 100644 --- a/GraphQL_Server/index.html +++ b/GraphQL_Server/index.html @@ -8,14 +8,14 @@ GraphQL Server | PlatON - +
    Skip to main content

    GraphQL Server

    In addition to the JSON-RPC APIs, PlatON supports the GraphQL API as specified by EIP-1767. GraphQL lets you specify which fields of an objects you need as part of the query, eliminating the extra load on the client for filling in fields which are not needed. It also allows for combining several traditional JSON-RPC requests into one query which translates into less overhead and more performance.

    The GraphQL endpoint piggybacks on the HTTP transport used by JSON-RPC. Hence you'll have to enable and configure the relevant --http flags, and the --graphql flag itself:

    platon --http --graphql

    Now you can start querying against http://localhost:6789/graphql. To change the port, you'll need to provide --http.port, e.g.:

    platon --http --http.port 9545 --graphql

    Since PlatON provides support for EIP55 and bech32 dual address formats, if you want to use bech32 addresses in graphql, you need to add platon to the url, such as http://localhost:6789/platon/graphql, otherwise the default is EIP55 address format.

    GraphiQL#

    An easy way to get started right away and try out queries is the GraphiQL interface shipped with PlatON. To open it visit http://localhost:6789/graphql/ui. To see how this works let's read the sender, recipient and value of all transactions in block number 6000000. Try this out in GraphiQL:

    query txInfo {    block (number: 6000000) { transactions { hash from { address } to { address } value } }}

    GraphiQL also provides a way to explore the schema PlatON provides to help you formulate your queries, which you can see on the right sidebar. Under the title Root Types click on Query to see the high-level types and their fields.

    Since PlatON provides support for EIP55 and bech32 dual address formats, if you want to use bech32 addresses in GraphiQL, you need to add platon to the url, such as http://localhost:6789/graphql/ui, otherwise the default is EIP55 address format.

    Query#

    Reading out data from PlatON is the biggest use-case for GraphQL. However after trying out queries in the UI you may want to do it programmatically. You can consult the official docs to find bindings for your language. Or use your favorite tool for sending HTTP requests. For sake of completeness we briefly touch on two approaches here. First via cURL, and second via a JS script.

    Here's how you'd get the latest block's number via cURL. Note the use of a JSON object for the data section:

    curl -X POST http://localhost:6789/graphql -H "Content-Type: application/json" --data '{ "query": "query { block { number } }" }'{"data":{"block":{"number":6004069}}}

    Alternatively store the JSON-ified query in a file (let's call it block-num.query) and do:

    curl -X POST http://localhost:6789/graphql -H "Content-Type: application/json" --data '@block-num.query'

    Executing a simple query in JS looks like the following. Here we're using the lightweight library graphql-request to perform the request. Note the use of variables instead of hardcoding the block number in the query:

    const { request, gql } = require('graphql-request')
     const query = gql`    query blockInfo($number: Long) {        block (number: $number) { hash stateRoot }    }`request('http://localhost:6789/graphql', query, { number: '6004067' })    .then((res) => { console.log(res) })    .catch((err) => { console.log(err) })
    - + \ No newline at end of file diff --git a/Install_PlatON/index.html b/Install_PlatON/index.html index 259c32af1..a3913fe15 100644 --- a/Install_PlatON/index.html +++ b/Install_PlatON/index.html @@ -8,13 +8,13 @@ Source Installation PlatON | PlatON - +
    Skip to main content

    Source Installation PlatON

    This document is intended for users with the ability to compile source code on the PlatON blockchain.

    • PlatON supports source code compilation and installation under Windows and Ubuntu.

    Windows source code compilation#

    Windows compilation environment requirements :

    • git: 2.19.1 and above
    • Go language development kit: go (1.16+)
    • mingw: mingw (V8.1.0)
    • cmake: 3.0 +

    You can install the above compilation environment yourself. Please make sure the above environment can run normally before compiling PlatON source code.

    You can also use Chocolatey to install the compilation environment (if you do not already have chocolatey, you can follow the instructions on https://chocolatey.org to install), start PowerShell as an administrator, and then execute the following command:

    Install git:

    choco install git

    Install golang:

    choco install golang

    Install mingw:

    choco install mingw

    Install cmake:

    choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System'

    Most softwares installed using the chocolatey package manager have a default installation path, and some software may have various paths, depending on the publisher of the software. Installing these packages will modify the Path environment variable. The final installation path can be viewed in the PATH. Some machine environments may not find the installation path of these tools in the PATH, and you need to add it manually at this time. After installation, please make sure the installed Go version is 1.16 (or higher).

    Note: The following commands need to be run in the Git-bash environment. In any directory, right-click and select Git Bash Here to bring up the Git Bash running window.

    • Get the source code

    Get the source code and put it in the GOPATH path, where master is the branch name, then switch to the actual branch:

    mkdir -p $GOPATH/src/github.com/PlatONnetworkcd $GOPATH/src/github.com/PlatONnetworkgit clone -b master https://github.com/PlatONnetwork/PlatON-Go.git --recursive
    • Add bls dependent library to environment variables
    echo 'export PATH=$PATH:"$GOPATH/src/github.com/PlatONnetwork/PlatON-Go/crypto/bls/bls_win/lib"' >> ~/.bashrcsource ~/.bashrc
    • Compile
    cd $GOPATH/src/github.com/PlatONnetwork/PlatON-Gogo run build/ci.go install ./cmd/platongo run build/ci.go install ./cmd/platonkey

    After compiling, platon, platonkey executable files will be generated in the PlatON-Go/build/bin directory. Copy these executable files to your working directory and run.

    Repeated compilation will overwrite the previously generated executable file.

    Note: It is recommended that the windows version be used for development testing only, and that the ubuntu version be used for the official production environment.

    Ubuntu source code compilation#

    step1. Ubuntu compilation environment requirements:

    • System version: Ubuntu 18.04 or higher
    • git: 2.19.1 or higher
    • Compilers: gcc (4.9.2+), g ++ (5.0+)
    • Go language development kit: go (1.16+)
    • cmake: 3.0 +

    step2. Get the PlatON source:

    git clone -b master https://github.com/PlatONnetwork/PlatON-Go.git --recursive

    step3. Install dependency library:

    install golang

    cd /usr/localsudo wget https://go.dev/dl/go1.18.7.linux-amd64.tar.gzsudo rm -rf /usr/local/go && tar -C /usr/local -xzf go1.18.7.linux-amd64.tar.gzsudo vim /etc/profile// Add a line at the endexport PATH=$PATH:/usr/local/go/binsource /etc/profile
    sudo apt update sudo apt install -y cmake llvm g++ libgmp-dev libssl-dev

    step4. compilation:

    cd PlatON-Go make all

    After compiling, a series of executable files such as platon, platonkey and so on will be generated in the ./build/bin directory.

    step5. Copy binary:

    sudo cp -f ./build/bin/platon /usr/bin/ sudo cp -f ./build/bin/platonkey /usr/bin/

    To this step, congratulations, the source code compilation completed!

    - + \ No newline at end of file diff --git a/JS_SDK/index.html b/JS_SDK/index.html index 251a2ec3d..ccf9b8992 100644 --- a/JS_SDK/index.html +++ b/JS_SDK/index.html @@ -8,7 +8,7 @@ JS SDK | PlatON - + @@ -147,7 +147,7 @@ When parsing, ver needs to be converted into 4 bytes. Major version: second byte; minor version: third byte, patch version, fourth byte.

    Query The Cumulative Voteable Number Of Proposals#

    Query the cumulative voteable number of proposals through calling operation.

    Parameters:

    FieldTypeRemark
    funcTypeuint16(2bytes)Method type code(2105)
    proposalIDcommon.Hash(32bytes)Proposal ID
    blockHashcommon.Hash(32bytes)块 hash

    Returns:

    Array - []uint16: An array.

    FieldTypeRemark
    uint16Number of cumulative votes
    uint16Number of in favour votes
    uint16Number of negative votes
    uint16Number of Abstained votes

    Definition#

    ProposalType#

    TypeDefinitionDescription
    TextProposal0x01Text proposal
    VersionProposal0x02Upgrade proposal
    CancelProposal0x04Cancel proposal

    ProposalStatus#

    For text proposals, there are three states: 0x01, 0x02, 0x03; For the upgrade proposal, there are four states: 0x01, 0x03, 0x04, 0x05, 0x06. For cancellation proposals, there are three states: 0x01, 0x02, 0x03;

    TypeDefinitionDescription
    Voting0x01Voting
    Pass0x02Voted successfully
    Failed0x03Vote failed
    PreActive0x04(Upgrade Proposal) Pre-Effective
    Active0x05(Upgrade Proposal) Effective
    Canceled0x06(Upgrade proposal) cancelled

    VoteOption#

    TypeDefinitionDescription
    Yeas0x01agree
    Nays0x02Against
    AbstentionsOther valuesAbstain

    Proposal(TextProposal)#

    FieldTypeRemark
    ProposalIDcommon.Hash(32bytes)Proposal ID
    Proposercommon.NodeID(64bytes)Proposal Node ID
    ProposalTypebyteProposal type, 0x01: text proposal; 0x02: upgrade proposal; 0x03 parameter proposal; 0x04 cancel proposal.
    PIPIDstringProposal PIPID
    SubmitBlock8bytesSubmitted blockNumber
    EndVotingBlock8bytesBlockNumber of proposal voting ended, according to SubmitBlock

    Proposal(VersionProposal)#

    FieldTypeRemark
    ProposalIDcommon.Hash(32bytes)Proposal ID
    Proposercommon.NodeID(64bytes)Proposal Node ID
    ProposalTypebyteProposal type, 0x01: text proposal; 0x02: upgrade proposal; 0x03 parameter proposal; 0x04 cancel proposal.
    PIPIDstringProposal PIPID
    SubmitBlock8bytesSubmitted blockNumber
    EndVotingRounds8bytesNumber of voting consensus cycles
    EndVotingBlock8bytesThe block height at the end of proposal voting is calculated by the system according to SubmitBlock, EndVotingRounds
    ActiveBlock8bytesProposal effective block height, calculated by the system based on EndVotingBlock
    NewVersionuintupdated version

    Proposal CancelProposal#

    FieldTypeRemark
    ProposalIDcommon.Hash(32bytes)Proposal ID
    Proposercommon.NodeID(64bytes)Proposal Node ID
    ProposalTypebyteProposal type, 0x01: text proposal; 0x02: upgrade proposal; 0x03 parameter proposal; 0x04 cancel proposal.
    PIPIDstringProposal PIPID
    SubmitBlock8bytesSubmitted blockNumber
    EndVotingRounds8bytesNumber of voting consensus cycles
    EndVotingBlock8bytesThe block height at the end of proposal voting is calculated by the system according to SubmitBlock, EndVotingRounds
    TobeCanceledcommon.Hash(32bytes)ID of the promotion proposal to cancel

    Vote#

    FieldTypeRemark
    voter64bytesVote validator
    proposalIDcommon.Hash(32bytes)Proposal ID
    optionVoteOptionVoting options

    TallyResult#

    FieldTypeRemark
    proposalIDcommon.Hash(32bytes)Proposal ID
    yeasuint16(2bytes)Approve
    naysuint16(2bytes)Against
    abstentionsuint16(2bytes)Abstention
    accuVerifiersuint16(2bytes)Total number of validators who have qualified to vote during the entire voting period
    statusbytestatus
    canceledBycommon.Hash(32bytes)When status = 0x06, the ProposalID of the record that initiated the cancellation

    Exposure/Punishment Module#

    Report Double Sign#

    Report a double sign by sending a transaction.

    Parameters:

    FieldTypeRemark
    funcTypeuint16(2bytes)Method type code(3000)
    typuint8Stands for double sign type
    1:prepareBlock,2:prepareVote,3:viewChange
    datastringThe json value of a single evidence. The format is [RPC interface Evidences][evidences_interface]

    Query Whether Node Has Been Reported As Oversigned#

    Query whether a node has been reported as oversigned by sending a transaction.

    Parameters:

    FieldTypeRemark
    funcTypeuint16(2bytes)Method type code(3001)
    typuint32Stands for double sign type,
    1:prepareBlock,2:prepareVote,3:viewChange
    addr20bytesReporting node address
    blockNumberuint64Multi-Signed BlockNumber

    Returns:

    TypeRemark
    StringReported Transaction Hash

    Lockout Module#

    Create Hedging Plan#

    Create hedging plan by sending a transaction.

    Parameters:

    FieldTypeRemark
    account20bytesLock release to account
    plan[]RestrictingPlanplan is a list (array) of type RestrictingPlan. RestrictingPlan is defined as follows:
    type RestrictingPlan struct {
    Epoch uint64
    Amount: \ big.Int
    }
    Among them, Epoch : Represents a multiple of the settlement cycle. The product of the number of blocks per settlement cycle indicates the release of locked funds at the height of the target block. Epoch \
    The number of blocks per cycle must be at least greater than the highest irreversible block height.
    Amount: indicates the amount to be released on the target block.

    Get Lock Information#

    Get lock information by calling.

    Note: This interface supports the acquisition of historical data. The block height can be attached to the request. By default, the latest block data is queried.

    Parameters:

    FieldTypeRemark
    account20bytesThe account that was posted after the lockout was released

    Returns:

    Returns a json format string with the following fields:

    FieldTypeRemark
    balancestring(Hex)Amount of remaining locked positions
    pledgestring(Hex)Pledge / mortgage amount
    debtstring(Hex)Amount due for release
    plansbytesLocked entry information, json array:[{"blockNumber":"","amount":""},...,{"blockNumber":"","amount":""}]. among:
    blockNumber:*big.Int,Release blockNumber
    amount:\string(Hex string), Release amount

    Reward Interface#

    Withdraw Delegate Reward#

    Withdraw all currently available delegate rewards from the account and send the transaction.

    Parameters:

    FieldTypeRemark
    funcTypeuint16(2bytes)Method type code(5000)

    Returns:

    Note: The transaction results are stored in the logs.data of the transaction receipt. If the transaction is successful, rlp.Encode (byte {[] byte (status code 0), rlp.Encode (node income list)}). If the transaction is unsuccessful, it is consistent with the previous method.

    The returned node income list is an array

    FieldTypeRemark
    NodeIDdiscover.NodeID(64bytes)Node ID
    StakingNumuint64Node stake block Number
    Reward*big.IntReceived reward

    Query Delegate Reward#

    The query account did not withdraw the delegate reward at each node, and call query.

    Parameters:

    FieldTypeRemark
    funcTypeuint16(2bytes)Method type code(5100)
    address20bytesThe address of the account to be queried
    nodeIDs[]discover.NodeIDThe node to be queried, if it is empty, all nodes entrusted by the account are queried

    Returns:

    Is a []Reward array

    FieldTypeRemark
    nodeIDdiscover.NodeID(64bytes)Node ID
    stakingNumuint64Node stake block Number
    rewardstring(0x hex string)Did not withdraw the delegate reward

    Error Code Description#

    ErrorCodeRemark
    301000Wrong bls public key
    301001Wrong bls public key proof
    301002The Description length is wrong
    301003The program version sign is wrong
    301004The program version of the relates node's is too low
    301005DeclareVersion is failed on create staking
    301006The address must be the same as initiated staking
    301100Staking deposit too low
    301101This candidate is already exist
    301102This candidate is not exist
    301103This candidate status was invalided
    301104IncreaseStake von is too low
    301105Delegate deposit too low
    301106The account is not allowed to be used for delegating
    301107The candidate does not accept the delegation
    301108Withdrew delegation von is too low
    301109This delegation is not exist
    301110The von operation type is wrong
    301111The von of account is not enough
    301112The blockNumber is disordered
    301113The von of delegation is not enough
    301114Withdrew delegation von calculation is wrong
    301115The validator is not exist
    301116The fn params is wrong
    301117The slashing type is wrong
    301118Slashing amount is overflow
    301119Slashing candidate von calculate is wrong
    301200Getting verifierList is failed
    301201Getting validatorList is failed
    301202Getting candidateList is failed
    301203Getting related of delegate is failed
    301204Query candidate info failed
    301205Query delegate info failed

    English Translation Contributors @WillXing

    - + \ No newline at end of file diff --git a/Java_SDK/index.html b/Java_SDK/index.html index 95132fe5e..527c080f3 100644 --- a/Java_SDK/index.html +++ b/Java_SDK/index.html @@ -8,7 +8,7 @@ Java SDK | PlatON - + @@ -57,7 +57,7 @@ RawTransactionManager needs to specify the chain ID. Prevent transactions on one chain from being rebroadcasted to another chain:

    TransactionManager transactionManager = new RawTransactionManager(web3j, credentials, 100L);

    In addition to RawTransactionManager, the Java SDK also provides a client transaction manager ClientTransactionManager, which will hand over your transaction signing work to the PlatON client you are connecting to. In addition, there is a ReadonlyTransactionManager, which is used to query data from the smart contract only and not to trade with it.

    GasProvider#

    The handling fee of the contract is set through GasProvider, because the gas consumption of the contract is dynamic and related to the logic of the contract. It is recommended to use a larger value for the first deployment call, such as 999999. Later adjust according to the actual situation.

    BigInteger GAS_LIMIT = BigInteger.valueOf(999999);BigInteger GAS_PRICE = BigInteger.valueOf(1000000000L);
     GasProvider gasProvider  = new ContractGasProvider(GAS_PRICE, GAS_LIMIT);

    Invoking Transactions And Events#

    For all transactions methods, only the transaction receipt associated with the transaction is returned.

    TransactionReceipt transactionReceipt = contract.someMethod(<param1>, ...).send();

    With transaction receipts, you can extract indexed and non-indexed event parameters.

    List<SomeEventResponse> events = contract.getSomeEvents(transactionReceipt);

    Alternatively, you can use Observable filters to listen to events associated with smart contracts:

    contract.someEventObservable(startBlock, endBlock).subscribe(event -> ...);

    Call Constant Method#

    Constant methods only do queries without changing the state of the smart contract.

    Type result = contract.someMethod(<param1>, ...).send();
    - + \ No newline at end of file diff --git a/Join_Dev_Network/index.html b/Join_Dev_Network/index.html index c391cb565..207367e53 100644 --- a/Join_Dev_Network/index.html +++ b/Join_Dev_Network/index.html @@ -8,13 +8,13 @@ Dev Network | PlatON - +
    Skip to main content

    Dev Network

    This article will describe how to debug local applications by connecting to the PlatON DevNet(development Network).

    ChainId: 2206132

    openapi:

    https://devnet2openapi.platon.network/rpc or wss://devnet2openapi.platon.network/ws

    faucet:

    https://devnet2faucet.platon.network/faucet

    explorer:

    https://devnet2scan.platon.network

    How to access the dev network to debug local applications?#

    Step 1: Connect to the DevNet via RPC address#

    https://devnet2openapi.platon.network/rpc or wss://devnet2openapi.platon.network/ws

    Access method 1: Connect to the DevNet via the local PlatON node#

    on the ubuntu 18.04 server, download and install the PlatON binary with the following command:

    sudo wget https://download.platon.network/platon/platon/1.4.4/platon -P /usr/bin    

    Connect to the development network by.

    platon attach https://devnet2openapi.platon.network/rpc

    Access method 2: Connect to the PlatON DevNet through the SDKs#

    • Use the Java SDK to connect to the DevNet, for example, as follows.
    Web3j platonWeb3j = Web3j.build(new HttpService("https://devnet2openapi.platon.network/rpc"));
    • Use Python SDK to access the DevNet, the example is as follows.
    w3 = Web3(HTTPProvider("https://devnet2openapi.platon.network/rpc"))
    • Use JS SDK to access the DevNet, the example is as follows.
    var Web3 = require('web3');var web3 = new Web3('http://https://devnet2openapi.platon.network/rpc');
    • Using JSON RPC to access the DevNet, the example is as follows.
    curl -X POST -H 'content-type: application/json' --data '{"jsonrpc": "2.0", "method": "web3_clientVersion", "params":[], "id":67}' https://devnet2openapi.platon.network/rpc

    Not limited to the above language SDKs, you also have access through SDKs in other languages.

    Step 2: Apply for DevNet Test Token#

    Click faucet to receive the Test Token. If you have a large Test Token request, please send an email to support@latticex.foundation using the following format.

     Title: PlatON Development Network Token Request Your Name: Contact information: Wechart ID (or other instant messaging software) Amount: Use: Receiving addressA: Remarks:

    After successfully accessing the DevNet, you can send transactions after completing the test Token collection to start your test journey and can check the transactions in DevNet Browser.

    How to deploy a devnet node?#

    If you want to deploy a DevNet verification node, please refer to Run a dev node.

    - + \ No newline at end of file diff --git a/Json_Rpc/index.html b/Json_Rpc/index.html index d7674eb49..6f26f37ab 100644 --- a/Json_Rpc/index.html +++ b/Json_Rpc/index.html @@ -8,7 +8,7 @@ JSON-RPC | PlatON - + @@ -65,7 +65,7 @@ //Result{ "id": 1, "jsonrpc": "2.0", "result": "0x62e05075829655752e146a129a044ad72e95ce33e48ff48118b697e15e7b41e4"}

    personal_ecRecover#

    Returns the address associated with the private key that was used to calculate the signature in personal_sign.

    Parameters#
    1. Data - The data which hash was signed.
    2. Data - Signed data.
    params: [  "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675",  "0xe7225f986f192f859a9bf84e34b2b7001dfa11aeb5c7164f81a2bee0d79943e2587be1faa11502eba0f803bb0ee071a082b6fe40fba025f3309263a1eef52c711c"]
    Returns#

    Address - Address of the signer of the message.

    Example#
    //Requestcurl --data '{"method":"personal_ecRecover","params":["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675","0xe7225f986f192f859a9bf84e34b2b7001dfa11aeb5c7164f81a2bee0d79943e2587be1faa11502eba0f803bb0ee071a082b6fe40fba025f3309263a1eef52c711c"],"id":1,"jsonrpc":"2.0","bech32":true}' -H "Content-Type: application/json" -X POST localhost:6789
     //Result{  "id": 1,  "jsonrpc": "2.0",  "result": "lat1kc8gm4sut5etaqzchw8tjuy8purjxv24msxq7q"}

    personal_importRawKey#

    Imports the given private key into the key store, encrypting it with the passphrase.

    Parameters#
    1. String - An unencrypted private key (hex string).
    2. String - The password of the account.
    Returns#

    String - The address of the account.

    Example#
    //Requestcurl --data '{"method":"personal_importRawKey","params":["cd3376bb711cb332ee3fb2ca04c6a8b9f70c316fcdf7a1f44ef4c7999483295e","password1234"],"id":1,"jsonrpc":"2.0","bech32":true}' -H "Content-Type: application/json" -X POST localhost:6789
     //Result"lat1kc8gm4sut5etaqzchw8tjuy8purjxv24msxq7q"

    personal_listAccounts#

    Lists all stored accounts.

    Parameters#

    no

    Returns#

    Array - A list of 20 byte account identifiers.

    Example#
    //Requestcurl --data '{"method":"personal_listAccounts","params":[],"id":1,"jsonrpc":"2.0","bech32":true}' -H "Content-Type: application/json" -X POST localhost:6789//Result{  "id": 1,  "jsonrpc": "2.0",  "result": [    "lat1kc8gm4sut5etaqzchw8tjuy8purjxv24msxq7q",    "lat1e2q84y8avn0w6as0hx9lpp5mgawydy6g4lups0"  ]}

    personal_listWallets#

    list all your accounts you’ve used before + 1 empty new one

    Parameters#

    no

    Returns#

    rawWalletArray - A list of raw wallets.

    Example#
    //Requestcurl --data '{"method":"personal_listWallets","params":[],"id":1,"jsonrpc":"2.0","bech32":true}' -H "Content-Type: application/json" -X POST localhost:6789//Result{  accounts: [{      address: "atp1v79he42uvxghmmajx4r2gxqrckl7l0r6w2pwk8",      url: "keycard://044d/m/44'/60'/0'/0/0"  }],  status: "Online",  url: "keycard://044def09"}

    personal_lockAccount#

    Locks the given account.

    Parameters#
    1. String - The account address.
    2. Function - (optional) Optional callback, returns an error object as first parameter and the result as second.
    Returns#

    Boolean - true if the account was successfully locked, otherwise false.

    Example#
    //Requestcurl --data '{"method":"personal_lockAccount","params":["lat1v79he42uvxghmmajx4r2gxqrckl7l0r6huhkfg"],"id":1,"jsonrpc":"2.0","bech32":true}' -H "Content-Type: application/json" -X POST localhost:6789//Result{  result: true}

    personal_newAccount#

    Creates new account.

    Note: it becomes the new current unlocked account. There can only be one unlocked account at a time.

    Parameters#
    1. String - Password for the new account.
    Returns#

    Address - 20 Bytes - The identifier of the new account.

    Example#
    //Requestcurl --data '{"method":"personal_newAccount","params":["abc123"],"id":1,"jsonrpc":"2.0","bech32":true}' -H "Content-Type: application/json" -X POST localhost:6789//Result{  "id": 1,  "jsonrpc": "2.0",  "result": "lat13upz04zc2wjsam753h20asjatvlay227nmyk6p"}

    personal_sign#

    Calculates an PlatON specific signature with: sign(keccak256("Ethereum Signed Message: " + len(message) + message))).

    Parameters#
    1. Data - The data to sign
    2. Address - 20 Bytes - The address of the account to sign with
    3. String - Passphrase to unlock the from account.
    Returns#

    Data - Signed data.

    Example#
    //Requestcurl --data '{"method":"personal_sign","params":[0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675","lat1kc8gm4sut5etaqzchw8tjuy8purjxv24msxq7q","hunter"],"id":1,"jsonrpc":"2.0","bech32":true}' -H "Content-Type: application/json" -X POST localhost:6789//Result{  "id": 1,  "jsonrpc": "2.0",  "result": "0xe7225f986f192f859a9bf84e34b2b7001dfa11aeb5c7164f81a2bee0d79943e2587be1faa11502eba0f803bb0ee071a082b6fe40fba025f3309263a1eef52c711c"}

    personal_signTransaction#

    Signs a transaction without dispatching it to the network. It can later be submitted using platon_sendRawTransaction. The account does not need to be unlocked to make this call, and will not be left unlocked after.

    Parameters#
    1. Object - Transaction object with optional condition field. see platon_sendRawTransaction.
    2. String - Passphrase to unlock the from account.
    Returns#

    Object - Signed transaction and its details:

    Example#
    //Requestcurl --data '{"method":"personal_signTransaction","params":[{"from":"lat1gp7h8k9ynm4ct5ev73j4qlwhr4g8zqxpunjvg7","to":"lat14984xa8uuhkmer32s6tuz5e3valxa0ct4z0qkm","data":"0x41cd5add4fd13aedd64521e363ea279923575ff39718065d38bd46f0e6632e8e","value":"0x186a0"},"hunter2"],"id":1,"jsonrpc":"2.0","bech32":true}' -H "Content-Type: application/json" -X POST localhost:6789//Result{  "id": 1,  "jsonrpc": "2.0",  "result": {    "raw": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675",    "tx": {      "hash": "0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b",      "nonce": "0x0",      "blockHash": "0xbeab0aa2411b7ab17f30a99d3cb9c6ef2fc5426d6ad6fd9e2a26a6aed1d1055b",      "blockNumber": "0x15df",      "transactionIndex": "0x1",      "from": "lat1gp7h8k9ynm4ct5ev73j4qlwhr4g8zqxpunjvg7",      "to": "lat1s5l58k9ynm4ct5ev73j4qlwhr4g8zqxpkhv75y",      "value": "0x7f110",      "gas": "0x7f110",      "gasPrice": "0x09184e72a000",      "input": "0x603880600c6000396000f300603880600c6000396000f3603880600c6000396000f360"    }  }}

    personal_unlockAccount#

    Decrypts the key with the given address from the key store.This method is disabled by default in the PlatON 1.1.1 version and above, and needs to be enabled by adding --allow-insecure-unlock to the startup parameters.

    The unencrypted key will be held in memory until the unlock duration expires. If the unlock duration defaults to 300 seconds. An explicit duration of zero seconds unlocks the key until geth exits.

    The account can be used with platon_sign and platon_sendTransaction while it is unlocked.

    Parameters#
    1. Address - 20 Bytes - The address of the account to unlock.
    2. String - Passphrase to unlock the account.
    3. Quantity - (default: 300) Integer or null - Duration in seconds how long the account should remain unlocked for.
    Returns#

    Boolean - whether the call was successful

    Example#
    //Requestcurl --data '{"method":"personal_unlockAccount","params":["lat13upz04zc2wjsam753h20asjatvlay227nmyk6p","hunter2",null],"id":1,"jsonrpc":"2.0","bech32":true}' -H "Content-Type: application/json" -X POST localhost:6789//Result{  "id": 1,  "jsonrpc": "2.0",  "result": true}

    miner_setGasPrice#

    Sets the minimal accepted gas price when mining transactions. Any transactions that are below this limit are excluded from the mining process.

    Parameters#
    1. Uint - number of gas.
    Returns#

    Boolean - whether the gas price was successfully set.

    Example#
    //Requestcurl --data '{"method":"miner_setGasPrice","params":[19999999],"id":1,"jsonrpc":"2.0","bech32":true}' -H "Content-Type: application/json" -X POST localhost:6789//Result{  "id": 1,  "jsonrpc": "2.0",  "result": true}

    txpool_status#

    The status property of txPool can be used to query information such as the number of transactions in the transaction pool waiting to be packaged into the next block.

    Parameters#

    none

    Returns#

    Object - The value of the status property is an object containing two fields, pending and Queued, each of which is an associative array.

    Example#
    //Requestcurl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","bech32":true,"method":"txpool_status","params":[],"id":1}' http://127.0.0.1:6789//Result{  "id": 1,  "jsonrpc": "2.0",  "result": {        "pending": "0x0",        "queued": "0x0"    }}

    txpool_content#

    The content property of txPool can be used to list pending and queued transactions currently in the pool.

    Parameters#

    none

    Returns#

    Object - The value is an object containing two fields: Pending and Queued, each of which is an associative array.

    Example#
    //Requestcurl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","bech32":true,"method":"txpool_content","params":[],"id":1}' http://127.0.0.1:6789//Result{  "id": 1,  "jsonrpc": "2.0",  "result": {        "pending": {            "lat1fx2pjucpzk3zm7fdyqez4yhxyqkrqlzhgpzcf7": {                806: [{                        blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",                        blockNumber: null,                        from: "lat1fx2pjucpzk3zm7fdyqez4yhxyqkrqlzhgpzcf7",                        gas: "0x5208",                        gasPrice: "0xba43b7400",                        hash: "0xaf953a2d01f55cfe080c0c94150a60105e8ac3d51153058a1f03dd239dd08586",                        input: "0x",                        nonce: "0x326",                        to: "lat1c7kuxvr4wdswy89p049spsk6ddwtqhjqcp4uef",                        transactionIndex: null,                        value: "0x19a99f0cf456000"                }]            }        },        "queued": {            "lat1h926hjvmfnhenwrx7tzr2mcwk2wq80dvzzeqjj": {                2: [{                    blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",                    blockNumber: null,                    from: "lat1h926hjvmfnhenwrx7tzr2mcwk2wq80dvzzeqjj",                    gas: "0x15f90",                    gasPrice: "0xba43b7400",                    hash: "0x3a3c0698552eec2455ed3190eac3996feccc806970a4a056106deaf6ceb1e5e3",                    input: "0x",                    nonce: "0x2",                    to: "lat1smxhhr3ufxnqv55agjtq3cjsng4rqx489p6d0m",                    transactionIndex: null,                    value: "0xebec21ee1da40000"                }],            }        }    }}

    txpool_inspect#

    The inspect property of TXPool lists the summary of transactions in the transaction pool that are currently waiting to be packaged into the next block.

    Parameters#

    none

    Returns#

    Object - The value of the Inspect property is an object containing two fields, pending and Queued, each of which is an associative array.

    Example#
    //Requestcurl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","bech32":true,"method":"txpool_inspect","params":[],"id":1}' http://127.0.0.1:6789//Result{    "jsonrpc": "2.0",    "id": 1,    "result": {        "pending": {            "lat1wv9jphl4gxj8jyazl63qvfzp4sq2zv82u0zl2n": {                "13975": "lat1d5cqy3j8462xrywh9h08jndpfky78rt82qapul: 1 von + 21000 gas × 1000000000 von",                "13976": "lat1qtyzgqm8n0vcv2cnmyvqnvzeures9ggr38yf9k: 1 von + 21000 gas × 1000000000 von",                "13977": "lat1j5zyyyztejn7d67f4vk3c0uydhgx8qu0quhj7e: 1 von + 21000 gas × 1000000000 von",                "13978": "lat1jvy3w9ps7t076w4pclhv9n9x3ng4zjxedhwdcj: 1 von + 21000 gas × 1000000000 von",                "13979": "lat1ft23z88sfdqaphp6u7lt5eaaha3x9tqpwq6geu: 1 von + 21000 gas × 1000000000 von"            },            "lat1z9ayvyxhtepectk92gd8rkfzuk48wq3pxyexrs": {                "13829": "lat1896fjn0fsun8xnpy58jcku9zpgdpzta07565v4: 1 von + 21000 gas × 1000000000 von",                "13830": "lat1e2aew0nh6dcung2mg0xuqtdp0fl5x9sm36jmvl: 1 von + 21000 gas × 1000000000 von",                "13831": "lat1kvyd32vqqwtrnw0687hvccjezm5jnl8a5lm5hf: 1 von + 21000 gas × 1000000000 von"            }        },        "queued": {            "lat1g62rmjcmd5v8ezyp0levzakp2t3g2x3qfjeeyy": {                "13813": "lat16z74lt8sj75mdw9lxpjpce22x9u6h5tslealgp: 1 von + 21000 gas × 1000000000 von",                "13814": "lat1hff2xwvh7p34rayy695xg48f78j7nmkwctgqld: 1 von + 21000 gas × 1000000000 von"            },            "lat14zgzfkz6sfh5sy3csvwsfcphg458kgdhhc3e5r": {                "14192": "lat1wyfjc62wp9axjcjg6jupeclnrklzhk2m58he44: 1 von + 21000 gas × 1000000000 von",                "14193": "lat1rz5dq9ea8ay6mj4chlzq9cn6qkvunad6ezynnn: 1 von + 21000 gas × 1000000000 von",                "14194": "lat1lvcl6w2nfhjhachqsncfe4nvafe5seykfj05vm: 1 von + 21000 gas × 1000000000 von"            }        }    }}

    debug_getWaitSlashingNodeList#

    Get all nodes with zero production blocks, and a list of nodes that have been observed because of zero production blocks.

    Parameters#

    no

    Returns#

    array - The node list of the zero production block, each structure contains three fields, NodeId: the node ID of the zero production block, Round: the number of consensus rounds in the first zero production during the observation period, CountBit: the zero production block Bitmap of the number of times (starting from Round, 1 means that no block is produced in this round).

    Example#
    // Requestcurl -X POST --data '{ "jsonrpc": "2.0", "method": "debug_getWaitSlashingNodeList", "params": [], "id": 74}'// Result{  "id": 74,  "jsonrpc": "2.0",  "result": "[{    "NodeId": "8e91f562c1798dc8c567a5c4a99a840eb86e43324b622fd0a4a8defdf873baf8f822313d7f35227fe15b6f4a2767dfb9ea7f7968d0a3a243e57b4d1090f6fc6c",    "Round": 1000,    "CountBit": 7  }]"}

    debug_getValidatorByBlockNumber#

    Get the list of validators of the specified consensus round, pass in any block height in a consensus round, the system will automatically calculate the consensus round to which the block height belongs and return the list of validators of that consensus round, or return the empty string if there is no data.

    Parameters#

    Uint64 - blockNumber

    Returns#

    array - Validator List, Address: address of node; NodeId:id of node;BlsPubKey:bls public key of node.

    Example#
    // Requestcurl -X POST --data '{ "jsonrpc": "2.0", "method": "debug_getValidatorByBlockNumber", "params": [1000], "id": 75}'// Result{  "jsonrpc": "2.0",  "id": 75,  "result": "[{    "Address": "0xc6a99e99978ac78333897e2117ec9747f010b827",    "NodeId": "2d016c3c2dd0ffb4c251940e255a90cd4541c553710c0b5b594595d1eaa660cb8109c1cd90ac864665852abffc7fd47343b03d0156d81501b838be7c4e354d6d",    "BlsPubKey": "21a9fc05c3b349e9a50f0966d5c338082f52e72639778d6ed5d11ce544efc2ba8b8f463d03eb4d02934937da603d0f109a08e5c4c82c835fc7f4209ad0d5c551853dd9fbfab08345346696e09124c19e0d08e01a4b5d841eea896fd3ae982995"  }]"}
    - + \ No newline at end of file diff --git a/Ledger-hardware-wallet/index.html b/Ledger-hardware-wallet/index.html index bf2510ec8..aba0cedfd 100644 --- a/Ledger-hardware-wallet/index.html +++ b/Ledger-hardware-wallet/index.html @@ -8,13 +8,13 @@ Ledger hardware wallet | PlatON - +
    Skip to main content

    Ledger hardware wallet



    Recently, PlatON has initially integrated Ledger hardware wallet (currently in developer mode for the time being), and will subsequently provide hardware wallet services to a wide range of PlatON users.Ledger, one of the most popular hardware wallets on the market today, provides the highest level of security and reliability for PlatON’s network assets through a state-of-the-art security chip that holds private keys.
    Samurai, PlatON’s open-source web browser plug-in wallet, has completed support for the Lager hardware wallet, providing users with a more secure way to store and use their assets.
    - Authentication and authorization of transactions
    - Provide a cold storage option for creating wallets and storing private keys offline

    By using the Ledger hardware wallet to store private keys and sign transactions, the private keys will not come into contact with your software wallet, making the transaction signing process more secure and simple.
    Note: The ATON mobile wallet will also support the Ledger hardware wallet in the future, so stay tuned!

    This article will guide you through the process of configuring the Ledger hardware wallet and signing Samurai transactions using the Ledger Nano hardware wallet.Here are the details of the process.

    Prepare the environment for Ledger Hardware Wallets#

    Initialization and program installation#



    Ledger hardware wallets, Ledger Live Desktop, Samurai Wallet;

    [Ledger Nano S and Ledger Nano X are operated basically in the same way. Here we take Ledger Nano X as an example]

    Ledger hardware wallet initialization#



    [Operation instructions: press the black and white buttons respectively to switch between options. Press the black and white buttons at the same time to confirm]
    ① Set the PIN identification code: Long press the black button to start the Ledger hardware wallet, enter and confirm the PIN identification code setting, as shown in Figure 1.1.1;

    Figure1.1.1


    ② Between the two options, [Set up as new device] and [Restore from Recovery phrase], here we choose Restore from Recovery phrase (mnemonic phrase), as shown in Figure 1.1.2;

    Figure1.1.2

    ③ In the recovery phrase (mnemonic phrase), the PlatON network can generate multiple types of mnemonic phrases. To facilitate ATON HD Wallet to import mnemonic phrase, here we choose [12 words], as shown in Figure 1.1.3;

    Figure1.1.3


    Or we can choose 24 words to restore from the recovery phrase self-generated by Ledger. Enter the Ledger hardware wallet after creating/recovering the phrase, as shown in Figure 1.1.4;You need to install Ledger hardware wallet in Ledger Live Desktop.

    Figure1.1.4


    Note: Ledger and ATON mnemonics are not compatible with Samurai mnemonics, please use your wallet private key to import each other.

    Prepare the environment for Ledger Live Desktop#



    Download Ledger Live and install it locally; download link:
    https://www.ledger.com/ledger-live/download
    Steps of operation and installation are as shown in Figures 1.1.5 and 1.1.6.

    Figure1.1.5


    Figure1.1.6

    To prepare the environment for Samurai Wallet#



    ① Download and unpack Samurai Wallet from
    https://github.com/AlayaNetwork/Samurai/releases
    as shown in Figure 1.1.7;

    Figure1.1.7


    ② Open the Chrome browser, enter chrome://extensions/ in the address bar and press Enter to enter the page of Extensions. [Activate] developer mode, select [Load unpacked], import the directory where the Samurai plug-in wallet is unpacked, as shown in Figures 1.1.8.

    Figure1.1.8

    Install PlatON hardware Drivers (Method 1)#



    Use Ledger Live Desktop to add [PlatON] to the Ledger hardware wallet

    1) Open Ledger Live Desktop and select the corresponding Ledger hardware device, as shown in Figure 1.2.1. You need to set the PIN identification code for the first use, and the previously set options are directly synchronized to the application;

    Figure1.2.1


    2)To connect to the desktop program for pairing, you need to enter the PIN identification code, and authorize the pairing, as shown in Figure 1.2.2;

    Figure1.2.2


    3)Download and install the PlatON application in Ledger Live Desktop: Since the PlatON application has not been officially launched on Ledger Live, it is currently in a beta phase for professional enthusiasts/community members. So you need to manually activate the developer mode before you can search [PlatON]. Large transactions are not suggested in the current testing phase;
    ① Enter Ledger Live Desktop, and activate the developer mode in the settings, as shown in Figure 1.2.3;

    Figure1.2.3


    ② Then find and install [PlatON] in Manager, as shown in Figure 1.2.4. After that, we need Samurai/MetaMask;

    Figure1.2.4

    Install PlatON hardware Drivers (Method 2)#



    Adding the [PlatON] hardware driver to the Ledger Hardware Wallet — Use the Ledger live App pairing to add the [PlatON] app to the Ledger Hardware Wallet.

    1)Open the Ledger Live app and select the corresponding Ledger hardware device, as shown in Figure 1.3.1. You need to set the PIN identification code for the first use, and the previously set options are directly synchronized to the application;

    Figure1.3.1


    2)It is necessary to pair the Ledger hardware wallet with the Ledger Live app, as shown in Figure 1.3.1.1;

    Figure1.3.1.1


    You need to confirm the pairing on both your Ledger hardware wallet and the Ledger Live app, as shown in Figures 1.3.2, 1.3.3, and 1.3.4.;

    Figure1.3.2


    Figure1.3.3


    Figure1.3.4


    Pairing can be successful only after confirmation, as shown in Figure 1.3.5.;

    Figure1.3.5

    Before pairing, you need to make sure that the Ledger hardware wallet is unlocked and Bluetooth is turned on. Under normal circumstances, the Ledger hardware wallet remains unlocked, without the need of manual setting. Here is a precondition: the setting prescribed in [1.1] has been completed.

    3)In the Ledger Live app, add [PlatON] to the Ledger hardware wallet:
    Portfolio page: Tap [Settings] in the upper right corner, as shown in Figure 1.3.6. Select [Experimental Function], and activate [Developer mode], as shown in Figure 1.3.7;

    Figure1.3.6


    Figure1.3.7


    Manager page: Select your Ledger hardware wallet device, and open the application catalog, as shown in Figure 1.3.8. Find and download [PlatON], as shown in Figure 1.3.9. After that, we need Samurai/MetaMask;

    Figure1.3.8


    Figure1.3.9


    Use the Ledger hardware wallet signature to complete the transaction#


    [Samurai Wallet and MetaMask Wallet are operated basically in the same way. Here we take Samurai Wallet as an example]

    Select PlatON hardware driver application#



    Prerequisites: Prepare the environment stated in the above [1.]; then the Ledger hardware wallet needs to enter the PlatON application, till it reads [application is ready], as shown in Figure 2.1.1;

    Figure2.1.1


    Samurai pair and unlock Ledger hardware wallet#



    Create an account randomly with Samurai, enter the main page of Samurai Wallet, and select [Link Hardware Wallet] to pair, as shown in Figure 2.2.1; after the link is successfully paired, select the account to unlock the hardware wallet, as shown in Figure 2.2.2;

    Figure2.2.1


    Figure2.2.2


    Ledger hardware wallet completes signature transfer transaction#



    Now that Samurai reads and enters the hardware wallet page, you can send the transfer, as shown in Figure 2.3.1. The Ledger hardware wallet receives the signature and confirms it, as shown in Figures 2.3.2 and 2.3.3. After confirmation, the transfer is completed, as shown in Figure 2.3.4;

    Figure2.3.1


    Figure2.3.2


    Figure2.3.3


    Figure2.3.4


    Change PIN identification code and reset Ledger hardware wallet#

    Change the PIN identification code in the Ledger hardware wallet#



    Press and hold the black and white buttons at the same time for 3 seconds, select [Setting Manage device], as shown in Figure 3.1.1. Select [Security], as shown in Figure 3.1.2. Select [Change PIN] as shown in Figure 3.1.3. Finally, set a new PIN identification code.

    Figure3.1.1


    Figure3.1.2


    Figure3.1.3


    Reset Ledger hardware wallet#



    Press and hold the black and white buttons at the same time for 3 seconds, and select [Setting Manage device], as shown in Figure 3.1.1. Select [Security], as shown in Figure 3.1.2. Select [Reset device] as shown in Figure 3.2.1. To reset, select [Restore from Recovery phrase] (mnemonic phrase) as shown in Figure 1.1.2.

    Figure3.2.1


    Tip#



    When the Ledger hardware wallet enters the PlatON application, if it is [Pending] without displaying [application is ready], as shown in Figure 4.1.1, you need to unplug the USB and plug it in again or restart it to re-enter the application, until you see [application is ready], as shown in Figure 4.1.2.

    Figure4.1.1


    Figure4.1.2

    - + \ No newline at end of file diff --git a/MetaMask/index.html b/MetaMask/index.html index 37101f76d..dc9eb9a6e 100644 --- a/MetaMask/index.html +++ b/MetaMask/index.html @@ -8,13 +8,13 @@ MetaMask Configure PlatON/Alaya Network | PlatON - +
    Skip to main content

    MetaMask Configure PlatON/Alaya Network

    What is MetaMask#

    MetaMask is a wallet extension application embedded in the browser, which helps you interact with decentralized applications (dApps).

    MetaMask allows you to easily access the Ethereum network and add other public chains compatible with the EVM.

    Why PlatON|Alaya uses MetaMask#

    MetaMask, the most widely used browser plug-in wallet on the market, is well-received in the community.

    To lower the threshold for community users, PlatON | Alaya is compatible with the core tools of the Ethereum ecosystem, including MetaMask, after its upgrade to the Ethereum-compatible version.

    MetaMask makes operations such as transfer, signing, and contract interaction more convenient.

    Notices#

    1. The address generated via MetaMask starts with 0x, that is, one in the Ethereum format. To view the address in the PlatON|Alaya format, please check in PlatON|Alaya.

      PlatON MainNet:https://scan.platon.network/

      PlatON DevNet2: https://devnet2scan.platon.network/

      Alaya MainNet:https://scan.alaya.network/

      Alaya DevNet: https://devnetscan.alaya.network/

    2. Mnemonics of ATON and those of MetaMask are incompatible with each other as they are generated through different paths. Private keys are compatible.

    3. MetaMask cannot be called by WASM contracts, but EVM contracts only.

    4. Starting from PlatON version 1.3.0 (effective time 2022.11.9,For details see:https://forum.latticex.foundation/t/topic/6548 ), PlatON MainNet has been completely switched to ChainID: 210425, the original ChainID: 100 is no longer supported!

    This document will guide you through PlatON | Alaya network configuration using MetaMask.

    MetaMask installation and use#

    There are many detailed introductions about the installation and use of MetaMask on the Internet, hence no need of further elaboration.

    You may refer to:

    Installation, configuration and use of MetaMask

    How To Use MetaMask: Ethereum Wallet in your Browser

    After creating a wallet using MetaMask, you're advised to back up the private key of the wallet so that it can be imported into ATON for later use.

    Steps of backup:

    image-20220112183347293image-20220112183413762image-20220112183659326

    How to manually add PlatON network#

    PlatON MainNet#

    First, you need to install a MetaMask plugin on your Chrome browser.

    Then register the wallet and save your mnemonics and private key.

    Then click the drop-down menu in the upper right corner.

    image-20220112183808168

    Then scroll to the end and click "Add Network"

    image-20220112183837332image-20220112183901268

    Fill in the above information one by one. The configuration content is as follows:

    • PlatON ChainID:210425 Configuration Information ( Recommended )
    Network Name: PlatON MainNetworkNew RPC URL: https://openapi2.platon.network/rpcChain ID210425Currency SymbolLATBlock Explorer URL: https://scan.platon.network/
    • PlatON ChainID:100 Configuration information -- Disabled
    Network Name: PlatON MainNetworkNew RPC URL: https://openapi.platon.network/rpcChain ID100Currency SymbolLATBlock Explorer URL: https://scan.platon.network/

    Then click Save and wait for it to finish.

    Now, the PlatON MainNet has been successfully added to MetaMask.

    image-20220112184025579

    You can also transfer assets as usual.

    image-20220112184503864image-20220112184532084

    Done! It is worth mentioning that only Hex addresses are supported on the mainnet. In other words, you have a LAT Address and Hex Address in your ATON wallet, and the one that starts with 0x is your Hex address!

    PlatON DevNet#

    Similarly, you can add and configure the PlatON DevNet2 according to the following information:

    Network Name: PlatON Dev2 NetworkNew RPC URL: https://devnet2openapi.platon.network/rpc   OR wss://devnet2openapi.platon.network/wsChain ID2206132Currency SymbolLATBlock Explorer URL: https://devnet2scan.platon.network/

    After the settings are saved, it will automatically jump to PlatON DevNet, and the following will appear:

    image-20220112184723277

    Next, we can apply for test tokens on the PlatON DevNet faucet (https://devnet2faucet.platon.network/faucet) to test the transfer operation.

    image-20220112184859903

    First, we create the No.2 test wallet:

    image-20220112185037936

    After it is saved, we will see:

    image-20220112185056331

    Then we use the No. 1 test wallet to transfer 50 LAT to the No. 2 wallet:

    image-20220112185347872

    Click "Confirm"

    image-20220112185403356

    Transferring...

    image-20220112185439816

    Done! 50 LATs have been transferred through the testnet. We can also see a contract interaction below, which is the interaction with the showme application.

    image-20220112185459908

    Alaya MainNet#

    By the same token, let's fill in the following information to add the network to MetaMask.

    Network Name: Alaya MainNetworkNew RPC URL: https://openapi.alaya.network/rpcChain ID201018 Currency SymbolATPBlock Explorer URL: https://scan.alaya.network/

    Other available RPC nodes on the Alaya MainNet:

    https://rpc.alayascan.com (provided by itokenpool)

    Successfully added:

    image-20220112190053868

    Transfer succeeds as well.

    Alaya DevNet#

    Fill out the form with the following information in order:

    Network Name: Alaya Dev NetworkNew RPC URL: https://devnetopenapi.alaya.network/rpcChain ID201030Currency SymbolATPBlock Explorer URL: https://devnetscan.alaya.network/

    After the information is added, create a new Alaya test wallet, and then apply for test tokens on the Alaya DevNet faucet (https://faucet.alaya.network/faucet/) to test the transfer operation.

    image-20220112191841275

    After receiving the test ATP from the faucet, we can start testing transfer:

    Start transferring

    image-20220112192819523image-20220112192843056

    Transferring...

    image-20220112192856706

    Done. Now we can see 5 ATP has been received by the Alaya DevNet-2.

    image-20220112192930266

    Add a network using ChainList#

    First, open ChainList and click "Connect Wallet" to authorize the connection to MetaMask.

    e27a930f30709e719b147ac64dcaaacaf904b93a_2_690x338

    Then, enter PlatON in the input box to search,

    and we can see:

    9800bbe80cff52b23b102f36b0eae9e0c05a7bbd_2_690x338

    Next, click "Add tTo MetaMask" to add the network.

    0acc9a52bb0d63ed11f2fb9063a12e059c754298_2_690x338

    Then click switch network to jump to the PlatON DevNet!

    image-20220112193135951

    Now let's add the Alaya Dev Testnet to MetaMask in the same way.

    e67da043d7028ad99c9f1048a37b65d13a1f8ad9_2_690x338

    Similarly, click Approve and then switch network. The Alaya Dev Testnet has been added.

    A quick way to add MetaMask to Blockchain Explorer#

    Enter the PlatON or Alaya blockchain explorer, find [MORE] in the navigation menu, click [Add to Extension], and select the network to be configured:

    Blockchain explorer on the PlatON MainNet: https://scan.platon.network/add-to-extension

    Blockchain explorer on the PlatON DevNet: https://devnetscan.platon.network/add-to-extension

    Blockchain explorer on the Alaya MainNet: https://scan.alaya.network/add-to-extension

    Blockchain explorer on the Alaya DevNet: https://devnetscan.alaya.network/add-to-extension

    [Figure-4.1.1]

    Connect with MetaMask in the web browser#

    1) After entering the Add to Extension page in the blockchain explorer, click [Connect MetaMask].

    [Prerequisite: MetaMask needs to be installed in the explorer in advance]

    [Figure-4.1.2.1]

    2) Click [Next] in MetaMask, and then click [Connect] to establish communication with MetaMask.

    [Figure-4.1.2.2][Figure-4.1.2.3]

    Add network configuration to MetaMask#

    1) After the connection is successful, [Connect MetaMask] turns into [Add to MetaMask]. Click [Add to MetaMask].

    [Figure-4.1.3.1]

    2) Click [Approve] to add the network configuration to MetaMask.

    [Figure-4.1.3.2]

    3) The plug-in wallet will prompt you to switch to this network. Click [Switch Network] to switch the corresponding network for later use.

    [Figure-4.1.3.3]

    This tutorial is contributed by @LeQianQian @Dengxin46

    - + \ No newline at end of file diff --git a/NET_SDK/index.html b/NET_SDK/index.html index 3d4963fea..c1283a512 100644 --- a/NET_SDK/index.html +++ b/NET_SDK/index.html @@ -8,13 +8,13 @@ PlatONet:.NET SDK for PlatON/Alaya networks | PlatON - +
    Skip to main content

    PlatONet:.NET SDK for PlatON/Alaya networks

    To be translated, feel free to submit contributions

    - + \ No newline at end of file diff --git a/Network_Description/index.html b/Network_Description/index.html index d6b4a03a7..3e59eaa1c 100644 --- a/Network_Description/index.html +++ b/Network_Description/index.html @@ -8,13 +8,13 @@ Networks | PlatON - +
    Skip to main content

    Networks

    PlatON is a protocol, which means that multiple independent “networks” can be built based on it.

    You can use different PlatON networks depending on your purpose. PlatON mainnet and PlatON development network is currently available.

    Note: The generation of the wallet account does not depend on the network. The same account can be used in different networks. When using the same account in different networks, you need to pay attention to the security of funds on the mainnet!

    Mainnet#

    The PlatON mainnet is a public chain with real economic value operated by the LatticeX Foundation. Anyone can create a mainnet wallet account and can query or create transactions with it, or verify transactions in progress.

    If you want to connect to the mainnet as a validator, please refer to Becoming a mainnet validator.

    Development network#

    The PlatON development network shares the same features with the mainnet and may be ahead of the mainnet in terms of version. It can be used for testing before going online on the mainnet, and can also provide a development and testing environment for developers or validators.

    If you want to connect to the development network as a validator, please refer to Becoming a development network validator.

    Note: Since the development network is also a test ground, therefore, instability and network reset may occur!

    Development network faucet#

    If you need to use test LAT on the development network, you have to obtain it through the faucet at

    devnet1:Original Devnet1 (ChainID:210309) has been disabled, please change it to Devnet2 (ChainID:2206131) if needed.

    devnet2:https://devnet2faucet.platon.network/faucet/

    Note: LAT on the development network has no real value and is for testing only!

    Private network#

    PlatON private network is an independent network that is not connected to the mainnet or development network. You can test your application by deploying a private network locally, which can speed up your testing progress.

    For building a private test network, please refer to Deploying a Private Network .

    - + \ No newline at end of file diff --git a/OffLine_MTool_Manual/index.html b/OffLine_MTool_Manual/index.html index 8f58cd85c..407ffbb5d 100644 --- a/OffLine_MTool_Manual/index.html +++ b/OffLine_MTool_Manual/index.html @@ -8,7 +8,7 @@ MTool offline tutorial | PlatON - + @@ -19,7 +19,7 @@ SUCCESS wallet created at: C:\platon_mtool\mtool\current\keystore\staking_observed.json

    View wallet list#

    platon_mtool account list

    Query balance according to wallet name#

    platon_mtool account balance $keystorename --config $PLATON_MTOOLDIR/validator/validator_config.json

    $keystorename: wallet file name, such as staking.json

    Check balance based on address#

    platon_mtool account balance -a $address --config $PLATON_MTOOLDIR/validator/validator_config.json

    a: wallet address

    Offline PlatON MTool transaction process#

    The main process of PlatON MTool offline signature method is: generate the file to be signed on the online machine, then sign the transaction on the offline machine, and finally send the signed transaction on the online machine. Taking the transfer transaction as an example, the steps are as follows. For the operation of generating the file to be signed for other transactions, refer to the [PlatON MTool Transaction Command Details] (# PlatON MTool Transaction Command Details) chapter.

    Generate transaction pending signature file#

    Execute on online machine:

    platon_mtool tx transfer --address $PLATON_MTOOLDIR/keystore/staking_observed.json --amount "1" --recipient $to_address --config $PLATON_MTOOLDIR/validator/validator_config.json

    address: Observation wallet path for sending transactions;

    amount: transfer amount, unit: LAT;

    recipient: recipient address;

    The following information is printed, indicating successful execution:

    Transfer unsigned raw: H4sIAAAAAAAAAGWOPW/DIBRF/8ubPfDhGsdrp0oZMmSrMiCMDUGADTiGRPnvoVGHSn3T1ZHuPe8Ba/j0ozwH7iIXSXt31DHB8P0Abv3masTo3zUgFNfua4SBIIxoBVPwFgbgKeM9pLweppERJTrGXH+n1KY+5Wtujckfy247JqF2NvdWnssiYagjM49HbXWVEvzWVHAKWsg/XzTgvPshtIHkf5UlxKL2tBVkCJnZnNWtm/dyn/qbiIdrNHFlysDzUjvaypi4Xepmh2jbMor6luLnC0n7ZKsMAQAAFile generated on: $PLATON_MTOOLDIR/transaction_details/transaction_detail_20191108114241.csv

    Among them, transaction_detail_20191108114241.csv is the file to be signed for the transfer transaction, which needs to be copied to the offline machine for signature;

    Signature transaction#

    Execute on the offline machine where the cold wallet is kept:

    platon_mtool offlinesign --filelocation $PLATON_MTOOLDIR/transaction_details/transaction_detail_20191108114241.csv

    Note: $PLATON_MTOOLDIR/transaction_details/transaction_detail_20191108114241.csv is the file to be signed generated in the previous step, modified to the actual file to be signed.

    Enter the corresponding cold wallet password and return the signed file. The content of the file is as follows:

     ┌────────┬───────┬────────┬────────┬────────┬──── ────┬────────┬───────┬──────┐│Type │From │To │Account │Amount │Fee │Nonce │Create │Chain ││ │ │ │Type │ │ │ │Time │Id │├────────┼────────┼────────┼────────┼────────┼──── ────┼────────┼───────┼───────┤│STAKING │0xa1548d│0x100000│FREE_AMO│5000000.│0.043210│0 │2019-10│100 ││ │d61010a7│00000000│UNT_TYPE│00000000│00000000│ │-11T13:│ ││ │42cd66fb│00000000│ │00000000│0000 │ │54:06.8│ ││ │86324ab3│00000000│ │00 │ │ │97 │ ││ │e2935586│00000000│ │ │ │ │ │ ││ │4a │02 │ │ │ │ │ │ │└────────┴────────┴────────┴────────┴────────┴──── ────┴────────┴───────┴──────┘Need load 1 wallets for address: [0xa1548dd61010a742cd66fb86324ab3e29355864a]
     operation finishedSUCCESSFile generated on transaction_signature/transaction_signature_20191108114625.csvtotal: 1, to be signed: 1success: 1, failure: 0

    Note: transaction_signature/transaction_signature_20191108114625.csv is the signed transaction file, copy the transaction signature file to the online machine;

    Send signed transaction#

    Send transaction in online machine:

    platon_mtool send_signedtx --filelocation $PLATON_MTOOLDIR/transaction_signature/transaction_signature_20191108114625.csv --config $PLATON_MTOOLDIR/validator/validator_config.json

    Note: transaction_signature_20191108114625.csv is the transaction signature file generated in the previous step, modified to the actual signature file.

    Enter yes to return the transaction result:

    Send Transaction? (yes|no)yestransaction 1 successtransaction hash: 0xf14f74386e6ef9027c48582d7faed3b50ab1ffdd047d6ba3afcf27791afb4e9bSUCCESStotal: 1success: 1, failure: 0

    Note: Prompt success and return transaction hash means that the signature transaction is sent successfully, otherwise the signature transaction fails.

    Detailed explanation of PlatON MTool trading commands#

    This chapter mainly describes the relevant commands for generating the csv format transaction to-be-signed file on the online machine. The generated csv file will be saved in the $PLATON_MTOOLDIR/transaction_details directory. For the complete transaction process of sending offline signatures, please refer to the [Offline PlatON MTool Transaction Process] (#Offline PlatON MTool Transaction Process) chapter.

    Ordinary transfer operations#

    platon_mtool tx transfer --address $PLATON_MTOOLDIR/keystore/staking_observed.json --amount "1" --recipient $to_address --config $PLATON_MTOOLDIR/validator/validator_config.json

    address: Observation wallet path for sending transactions;

    amount: transfer amount, unit: LAT;

    recipient: recipient address;

    Create a new Lockup plans#

    Creating a new Lockup plan, node's LATs will be transferred to a specified precompiled contract. The LATs will be transferred to the specified account multiple times at specified intervals. Before creating a new Lockup plan, you need to create a Lockup plan description file in json format.

    {  "account":"lat12jn6835z96ez93flwezrwu4xpv8e4zathsyxdn",  "plans":[    {"epoch": 5000,"amount": 100},    {"epoch": 6000,"amount": 100},    {"epoch": 7000,"amount": 100}  ]}

    account:the specified account that will received LAT from the estricting plan.

    epoch:the number of epoch to wait for a transfer plan (Greater than or equal to 1)

    amount:the number of LAT to be transferred. Unit: LAT

    platon_mtool create_restricting --config $PLATON_MTOOLDIR/validator/validator_config.json --address $PLATON_MTOOLDIR/keystore/staking_observed.json --file ./restricting_plans.json

    config:node configuration file

    address: observation wallet file

    file: Lockup plan description file

    Initiate a pledge operation#

    If the consensus node deployment is complete and the blocks have been successfully synchronized, you can use PlatON MTool to pledge operations. After the pledge fund application is completed, ensure that the pledge account balance is sufficient, and replace the pledge deposit amount according to the user's situation. The minimum pledge threshold is 100,000 LAT.

    Note: Please keep enough LAT in the pledge account to prepare for the subsequent transactions managed by the initiating node to have sufficient transaction fees, such as voting for upgrade proposals, unstaking transactions and other transactions.

    platon_mtool staking --config $PLATON_MTOOLDIR/validator/validator_config.json --address $PLATON_MTOOLDIR/keystore/staking_observed.json --amount 100000 --benefit_address xxx196278ns22j23awdfj9f2d4vz0pedld8a2fzwwj --delegated_reward_rate 5000 --node_name myNode --website www.mywebsite.com --details myNodeDescription --external_id 121412312

    config:node configuration file

    address: pledge observation wallet file

    amount: pledge amount, no less than 100000LAT-pledge threshold, no more than 8 decimal places (use free amount pledge)

    restricted amount: not less than 100000LAT-pledge threshold, no more than 8 decimal places (using locked balance pledge)

    autoamount: Not less than 100000LAT-Priority to use the lock-up balance staking, if the lock-up balance is not enough for the staking deposit, then use free amount staking

    benefit_address: benefit account to receive block-packing reward and staking reward

    delegated_reward_rate:Delegated bonus ratio, type is integer range is [0,10000], unit: ten thousand percent, e.g. enter 5000, it means the bonus ratio is 50%

    nodename:node name,30 bytes(beginning with a letter, including alphabet, number, space, , -, #)

    website:node website, 30 bytes

    details:node description, 280 bytes

    external_id:node Icon ID of keybase.io, or identity authentication ID

    Modify validator information operation#

    platon_mtool update_validator --config $PLATON_MTOOLDIR/validator/validator_config.json --address $PLATON_MTOOLDIR/keystore/staking_observed.json --node_name myNode --website www.mywebsite.com --external_id 121412312 --delegated_reward_rate 6000 --benefit_address lax1x0f9xwr9steccekttqvml0d26zgsxwdnhq3fkv --details "Modify the verifier information operation"

    config:node configuration file

    address: pledge observation wallet file

    benefit_address[option]: benefit account to receive block-packing reward and staking reward

    delegated_reward_rate[option]:Delegated bonus ratio, type is integer range is [0,10000], unit: ten thousand percent, e.g. enter 5000, it means the bonus ratio is 50%

    nodenam[option]e:node name,30 bytes(beginning with a letter, including alphabet, number, space, , -, #)

    website[option]:node website, 30 bytes

    details[option]:node description, 280 bytes

    external_id[option]:node Icon ID of keybase.io, or identity authentication ID

    Unpledge operation#

    **It takes 168 settlement cycles to withdraw from the pledge, please be careful!**
    platon_mtool unstaking --address $PLATON_MTOOLDIR/keystore/staking_observed.json --config $PLATON_MTOOLDIR/validator/validator_config.json

    None

    Increase pledge operation#

    platon_mtool increasestaking --amount 5000000 --address $PLATON_MTOOLDIR/keystore/staking_observed.json --config $PLATON_MTOOLDIR/validator/validator_config.json

    amount: Use the account balance to increase the pledge amount (LAT), no less than 10 minimum increase value, no more than 8 decimal places

    restricted amount: Use the account lock balance to increase the pledge amount, no less than 10 pledge threshold, no more than 8 decimal places (use locked balance pledge)

    Submit text proposal operation#

    platon_mtool submit_textproposal --pid_id 100 --address $PLATON_MTOOLDIR/keystore/staking_observed.json --config $PLATON_MTOOLDIR/validator/validator_config.json

    pid_id: GitHub ID

    Submit an upgrade proposal operation#

    platon_mtool submit_versionproposal --newversion 0.15.1 --end_voting_rounds 345 --pid_id 100 --address $PLATON_MTOOLDIR/keystore/staking_observed.json --config $PLATON_MTOOLDIR/validator/validator_config.json

    newversion: target upgrade version, x.x.x, number plus punctuation

    end_voting_rounds: the number of voting consensus rounds, the number of voting consensus rounds N, must satisfy 0 <N <= 4838 (about 2 weeks)

    pid_id: GitHub ID

    Submit proposal cancellation#

    platon_mtool submit_cancelproposal --proposalid 0x444c3df404bc1ce4d869166623514b370046cd37cdfa6e932971bc2f98afd1a6 --end_voting_rounds 12 --pid_id 100 --address $PLATON_MTOOLDIR/keystore/staking_observed.json --config $PLATON_MTOOLDIR/validator/validator/validator

    proposalid: proposal ID that needs to be cancelled, that is, the hash used to initiate the proposal transaction, 66 characters, alphanumeric

    end_voting_rounds: the number of voting consensus rounds, the number of voting consensus rounds N, must satisfy 0 <N <= 4838 (about 2 weeks)

    pid_id: GitHub ID

    Text proposal voting operation#

    platon_mtool vote_textproposal --proposalid 0x444c3df404bc1ce4d869166623514b370046cd37cdfa6e932971bc2f98afd1a6 --opinion yes --address $PLATON_MTOOLDIR/keystore/staking_observed.json --config $PLATON_MTOOLDIR/validator/validator_config.json

    proposalid: text proposal ID, which is the hash used to initiate the proposal transaction, 66 characters, alphanumeric

    opinion: voting options, yes, no, abstain-choose one of three

    Upgrade proposal voting operation#

    platon_mtool vote_versionproposal --proposalid 0x444c3df404bc1ce4d869166623514b370046cd37cdfa6e932971bc2f98afd1a6 --address $PLATON_MTOOLDIR/keystore/staking_observed.json --config $PLATON_MTOOLDIR/validator/validator_config.json

    proposalid: upgrade proposal ID, that is, the hash used to initiate the proposal transaction, 66 characters, alphanumeric

    Cancel proposal voting operation#

    platon_mtool vote_cancelproposal --proposalid 0x444c3df404bc1ce4d869166623514b370046cd37cdfa6e932971bc2f98afd1a6 --opinion yes --address $PLATON_MTOOLDIR/keystore/staking_observed.json --config $PLATON_MTOOLDIR/validator/validator_config.json

    proposalid: cancel proposal ID, that is, the hash used to initiate the proposal transaction, 66 characters, alphanumeric composition

    opinion: voting options, yes, no, abstain-choose one of three

    Submit parameter proposal operation#

    platon_mtool submit_paramproposal --pid_id 200 --module $module --paramname $paramname --paramvalue $paramvalue --address $PLATON_MTOOLDIR/keystore/staking_observed.json --config $PLATON_MTOOLDIR/validator/validator_config.json

    module: management module parameters

    paramname: management module parameter name, pay attention to letter case

    paramvalue: governance module parameter value

    pid_id: GitHub ID

    Parameter proposal voting operation#

    platon_mtool vote_paramproposal --proposalid 0x444c3df404bc1ce4d869166623514b370046cd37cdfa6e932971bc2f98afd1a6 --opinion yes --address $PLATON_MTOOLDIR/keystore/staking_observed.json --config $PLATON_MTOOLDIR/validator/validator_config.json

    proposalid: cancel proposal ID, that is, the hash used to initiate the proposal transaction, 66 characters, alphanumeric

    opinion: voting options, yes, no, abstain-choose one of three

    Version statement operation#

    platon_mtool declare_version --address $PLATON_MTOOLDIR/keystore/staking_observed.json --config $PLATON_MTOOLDIR/validator/validator_config.json

    None

    View help#

    platon_mtool -h

    None

    - + \ No newline at end of file diff --git a/OnLine_MTool_Manual/index.html b/OnLine_MTool_Manual/index.html index 2d13dadaf..f2e655971 100644 --- a/OnLine_MTool_Manual/index.html +++ b/OnLine_MTool_Manual/index.html @@ -8,14 +8,14 @@ MTool online tutorial | PlatON - +
    Skip to main content

    MTool online tutorial

    Introductory#

    To facilitate node transfer, pledge, delegate, and governance operations, PlatON provides MTool to assist users:

    • PlatON MTool supports Ubuntu 18.04 and Windows 10. This document describes the installation and use of Windows and Ubuntu, respectively. Users can choose from their own resources.

    • PlatON MTool provides two signature methods for transactions such as pledge: online signature and offline signature.This document describes online signing operations. For offline signing operations, refer to the Offline PlatON MTool Manual

    Install PlatON MTool#

    In addition, this document introduces the operation of PlatON MTool under Windows and Ubuntu respectively. Users can choose according to their own resources.

    Install PlatON MTool under Windows#

    Preparation before installation#

    execute command:

    platon_mtool --version

    If the execution result shows error message, it indicates that the PlatON MTool has not been installed and you can skip the following instructions on how to uninstall the older version.

    If the execution result shows the version number, timestamp and other information, it indicates that PlatON MTool has been installed. If the PlatON MTool is an old version, you need to back up important information at this time, and then manually uninstall the old version. The instructions are as follows:

    Step1. Backup directory

    Back up the C:\platon_mtool\mtool\current\keystore and C:\platon_mtool\mtool\current\validator directories to other directories (do not back them up to C:\platon_mtool). After installing the new version, you need to copy the backup directory back to the C:\platon_mtool\mtool\current\ directory. (If the installation directory is a custom directory, the actual one shall prevail)

    Step2. Uninstall old version

    Double-click C:\platon_mtool\unins000.exe to uninstall all old versions of PlatON MTool and other business platon_mtool.

    Start installation#

    Step1. Download PlatON MTool installation package

    On the online machine, copy the link https://download.platon.network/platon/mtool/windows/1.1.1/platon_mtool.exe to the browser and download the PlatON MTool installation package.

    Step2. Install PlatON MTool

    Double-click platon_mtool.exe to install it. The default installation directory is C:\platon_mtool, and it is recommended not to change this installation directory. The pop-up interface displays the message Completing the mtool Setup Wizard, indicating that the installation was successful. Click Finish.

    Step3. Restart the terminal

    After installation is complete, you need to restart the terminal (do not restart the server, close the CMD window or PowerShell window and reopen the window) for the newly added environment variables to take effect.

    Install PlatON MTool under Ubuntu#

    Preparation before installation#

    Back up the ~/platon_mtool/keystore and ~/platon_mtool/validator directories to other directories (do not back them up to ~/platon_mtool). After installing the new version, you need to copy the backup directory back to the ~/platon_mtool/ directory. (If the installation directory is a custom directory, the actual one shall prevail)

    start installation#

    Proceed as follows:

    Step1. Download PlatON MTool toolkit

    wget https://download.platon.network/platon/mtool/linux/1.1.1/platon_mtool.zip

    Step2. Extract the PlatON MTool toolkit

    (if ! command -v unzip;then sudo apt install unzip; fi;) && unzip platon_mtool.zip && cd platon_mtool

    Step3. Download script

    The script is downloaded to the platon_mtool directory, otherwise the script cannot find the path of the new version of mtool.

    wget https://download.platon.network/platon/scripts/mtool_install.sh

    Step4. Execute command

    chmod +x mtool_install.sh && ./mtool_install.sh
    • When the message Install platon mtool succeed. is displayed, PlatON MTool is successfully installed. If it is not successfully installed, please contact our official customer service to provide feedback on specific issues.

    Step5. Restart the session window

    After installation is complete, you need to restart the session window (do not restart the server, close the session window or SSH tool to reopen the window) for the newly added environment variables to take effect.

    PlatON MTool Environment Variable Description#

    The environment variables of PlatON MTool directories under Windows and Ubuntu are different:

    • PlatON MTool directory
      • Windows: %PLATON_MTOOLDIR%
      • Ubuntu: $PLATON_MTOOLDIR

    Note:Users choose according to their installed system.

    PlatON MTool Command Details#

    Note: The follow-up command is the command format under Ubuntu. Under Windows, you need to modify $PLATON_MTOOLDIR to %PLATON_MTOOLDIR%.

    • Original Devnet1 (ChainID:210309) has been disabled, please change it to Devnet2 (ChainID:2206131) if needed.
    • If you are connecting to the Development 2 network, you need to modify the domainid of the config.properties configuration file in the PlatON MTool installation directory to 2206131.

    Create A Wallet#

    • Execute the command:
    platon_mtool account new staking
    • Parameter description

    staking: The name of the wallet to be created. Once the wallet is created successfully, a wallet file named staking.json will be generated in the directory $PLATON_MTOOLDIR/keystore, And print the following information:

    -name: staking-type: NORMAL-address: lat124xmsmd0uf5cvk7v3s36eytqezqsjfcxfw2lmr-public key: 0x9521cd81ba28d5d1c23bb7ddb7042d146375203d35000c0289178027abd4dc09bca30257739df166201e73497485242f41d5f50d46bc3c7e4385f81bde560db0Important write this Private Key in a safe place.It is the important way to recover your account if you ever forget your password.4630b6d86bc74bffd4ca8cfc18bceec562cb40fc5080c258452a04a69bc1ee07
     Important write this mnemonic phrase in a safe place.It is the important way to recover your account if you ever forget your password.worry jewel penalty jealous expect embark outer eternal verb rebuild rice kidney

    Wallet address format adjusted to Bech32, among them:

    lat124xmsmd0uf5cvk7v3s36eytqezqsjfcxfw2lmr: account address;

    4630b6d86bc74bffd4ca8cfc18bceec562cb40fc5080c258452a04a69bc1ee07 : the private key of the wallet;

    worry jewel penalty jealous expect embark outer eternal verb rebuild rice kidney: the mnemonic words.

    For security reasons, users need to back up the wallet private key or mnemonic words (both can be backed up, or one of them can be backed up). When the wallet is lost, it can be used for recovery. It is recommended that users back up mnemonic words or private keys to a secure storage medium, such as an offline machine.

    Recover wallet file#

    If the wallet file is lost, you can restore it with the backed up private key or mnemonic as follows:

    • Execute the command:

      Recovery via private key:

      platon_mtool account recover -k staking

      Prompt to enter the new wallet password and backup private key, as follows:

      Enter a passphrase to encrypt your key to disk:Repeat the passphrase:Enter your 64bit Private Key:4630b6d86bc74bffd4ca8cfc18bceec562cb40fc5080c258452a04a69bc1ee07

      or

      Recovery through mnemonics:

      platon_mtool account recover -m staking

      Prompt to enter a new wallet password and backup mnemonic words, as follows:

       Enter a passphrase to encrypt your key to disk: Repeat the passphrase: Enter your bip39 mnemonic: worry jewel penalty jealous expect embark outer eternal verb rebuild rice kidney
    • Parameter description

      staking:wallet name.

      After successful restoration, the wallet file staking.json will be generated under the directory $PLATON_MTOOLDIR/keystore.

    Ordinary transfer operation#

    • Command line
    platon_mtool tx transfer --keystore $PLATON_MTOOLDIR/keystore/staking.json --amount "1" --recipient $ to_address --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter Description

    keystore: path of the wallet sending the transaction

    amount: transfer amount, unit: LAT

    recipient: receiving address

    View wallet list#

    • Command line
    platon_mtool account list

    Query balance based on wallet name#

    • Command line
    platon_mtool account balance $keystorename --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter description

    $ keystorename: wallet file name,example:staking.json

    Query balance based on address#

    • Command line
    platon_mtool account balance -a $address --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter description

    a: wallet address

    Create a new Lockup plans#

    Creating a new Lockup plan, node's LATs will be transferred to a specified precompiled contract. The LATs will be transferred to the specified account multiple times at specified intervals. Before creating a new Lockup plan, you need to create a Lockup plan description file in json format.

    • Lockup plan description file,retricting_plans.json
    {  "account":"lat12jn6835z96ez93flwezrwu4xpv8e4zathsyxdn",  "plans":[    {"epoch": 5000,"amount": 100},    {"epoch": 6000,"amount": 100},    {"epoch": 7000,"amount": 100}  ]}

    account:the specified account that will received LAT from the estricting plan.

    epoch:the number of epoch to wait for a transfer plan (Greater than or equal to 1)

    amount:the number of LAT to be transferred. Unit: LAT

    • command line
    platon_mtool create_restricting --config $PLATON_MTOOLDIR/validator/validator_config.json --keystore $PLATON_MTOOLDIR/keystore/staking.json --file ./restricting_plans.json
    • Parameter Description

    config:node configuration file

    keytore: wallet file

    file: Lockup plan description file

    Initiate a staking operation#

    If the deployment of the consensus node is complete and the block has been synchronized successfully, you can use MTool for staking operations. After the staking fund application is completed, ensure that the balance of the staking account is sufficient, and replace the staking amount according to the user's situation. The minimum threshold for staking is one hundred thousand LAT.

    Note: Please keep enough LAT in the staking account, so that the transactions initiated by the subsequent node management have sufficient transaction fees, such as voting for upgrading proposals, and unsecured transactions.

    • Command line
    platon_mtool staking --config $PLATON_MTOOLDIR/validator/validator_config.json --keystore $PLATON_MTOOLDIR/keystore/staking.json --amount 100000 --benefit_address xxx196278ns22j23awdfj9f2d4vz0pedld8a2fzwwj --delegated_reward_rate 5000 --node_name myNode --website www.mywebsite.com --details myNodeDescription --external_id 121412312

    Prompt:please input keystore password:Enter the password of the staking wallet and press Enter. If the following information is displayed, the staking is successful:

    operation finishedtransaction hash:0x89b964d27d0caf1d8bf268f721eb123c4af57aed36187bea90b262f4769eeb9bSUCCESS
    • Parameters Description

    config:node configuration file

    keystore: staking wallet file

    amount: staking amount, not less than 100000LAT-staking threshold, no more than 8 decimal places

    restrictedamount: not less than 100000LAT-staking threshold, no more than 8 decimal points (staking using locked balance)

    autoamount: Not less than 100000LAT-Priority to use the lock-up balance staking, if the lock-up balance is not enough for the staking deposit, then use free amount staking

    benefit_address: benefit account to receive block-packing reward and staking reward

    delegated_reward_rate:Delegated bonus ratio, type is integer range is [0,10000], unit: ten thousand percent, e.g. enter 5000, it means the bonus ratio is 50%

    nodename:node name,30 bytes(beginning with a letter, including alphabet, number, space, , -, #)

    website:node website, 30 bytes

    details:node description, 280 bytes

    external_id:node Icon ID of keybase.io, or identity authentication ID

    Modify validator information operation#

    • Command line
    platon_mtool update_validator --config $PLATON_MTOOLDIR/validator/validator_config.json --keystore $PLATON_MTOOLDIR/keystore/staking.json --node_name myNode --website www.mywebsite.com --external_id 121412312 --delegated_reward_rate 6000 --benefit_address lax1x0f9xwr9steccekttqvml0d26zgsxwdnhq3fkv --details "Modify the verifier information operation"
    • Parameters Description

    config:node configuration file

    keystore: staking wallet file

    benefit_address[option]: benefit account to receive block-packing reward and staking reward

    delegated_reward_rate[option]:Delegated bonus ratio, type is integer range is [0,10000], unit: ten thousand percent, e.g. enter 5000, it means the bonus ratio is 50%

    nodenam[option]e:node name,30 bytes(beginning with a letter, including alphabet, number, space, , -, #)

    website[option]:node website, 30 bytes

    details[option]:node description, 280 bytes

    external_id[option]:node Icon ID of keybase.io, or identity authentication ID

    Decommissioning operation#

    It takes 168 settlement cycles to withdraw from the pledge, please be careful!

    • Command line
    platon_mtool unstaking --keystore $PLATON_MTOOLDIR/keystore/staking.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter Description

    None

    Increase staking operation#

    • Command line
    platon_mtool increasestaking --amount 5000000 --keystore $PLATON_MTOOLDIR/keystore/staking.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameters Description

    amount: Use the account balance to increase the staking amount (LAT), the minimum added value is not less than 10, and the decimal point does not exceed 8 digits

    restrictedamount: use the account balance to increase the amount of staking, not less than 10 staking threshold, the decimal point does not exceed 8

    Submit Text Proposal#

    • Command line
    platon_mtool submit_textproposal --pid_id 100 --keystore $PLATON_MTOOLDIR/keystore/staking.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter Description

    pid_id: GitHub ID

    Submit upgrade proposal operation#

    • Command line
    platon_mtool submit_versionproposal --newversion 0.15.1 --end_voting_rounds 345 --pid_id 100 --keystore $PLATON_MTOOLDIR/keystore/staking.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameters Description

    newversion: target upgrade version, x.x.x, number punctuation

    end_voting_rounds: the number of voting consensus rounds, the number of voting consensus rounds N, must satisfy 0 < N <= 4838 (about 2 weeks)

    pid_id: GitHub ID

    Submit Cancel Proposal#

    • Command line
    platon_mtool submit_cancelproposal --proposalid 0x444c3df404bc1ce4d869166623514b370046cd37cdfa6e932971bc2f98afd1a6 --end_voting_rounds 12 --pid_id 100 --keystore $PLATON_MTOOLDIR/keystore/staking.json --config $PLATON_MTOOLDIR_validator/validator
    • Parameters Description

    proposalid: the ID of the proposal that needs to be cancelled

    end_voting_rounds: the number of voting consensus rounds, the number of voting consensus rounds N, must satisfy 0 < N <= 4838 (about 2 weeks)

    pid_id: GitHub ID

    Text proposal voting operation#

    • Command line
    platon_mtool vote_textproposal --proposalid 0x444c3df404bc1ce4d869166623514b370046cd37cdfa6e932971bc2f98afd1a6 --opinion yes --keystore $PLATON_MTOOLDIR/keystore/staking.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameters Description

    proposalid: text proposal ID, that is, the hash of the proposal transaction, 66 characters, alphanumeric

    opinion: voting options, yes, no, abstain-choose one

    Upgrade proposal voting operation#

    • Command line
    platon_mtool vote_versionproposal --proposalid 0x444c3df404bc1ce4d869166623514b370046cd37cdfa6e932971bc2f98afd1a6 --keystore $PLATON_MTOOLDIR/keystore/staking.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter Description

    proposalid: upgrade proposal ID, that is, the hash of the proposed transaction, 66 characters, alphanumeric

    Cancel proposal voting#

    • Command line
    platon_mtool vote_cancelproposal --proposalid 0x444c3df404bc1ce4d869166623514b370046cd37cdfa6e932971bc2f98afd1a6 --opinion yes --keystore $PLATON_MTOOLDIR/keystore/staking.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameters Description

    proposalid: Cancel the proposal ID, that is, the hash of the proposed transaction, 66 characters, composed of alphanumeric characters

    opinion: voting options, yes, no, abstain-choose one

    Submit parameter proposal operation#

    • Command line
    platon_mtool submit_paramproposal --pid_id 200 --module $ module --paramname $ paramname --paramvalue $ paramvalue --keystore $PLATON_MTOOLDIR/keystore/staking.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameters Description

    module: governance module parameters

    paramname: the name of the governance module parameter, pay attention to the case of the letters

    paramvalue: Governance module parameter value

    pid_id: GitHub ID

    Parameter proposal voting operation#

    • Command line
    platon_mtool vote_paramproposal --proposalid 0x444c3df404bc1ce4d869166623514b370046cd37cdfa6e932971bc2f98afd1a6 --opinion yes --keystore $PLATON_MTOOLDIR/keystore/staking.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameters Description

    proposalid: Cancel the proposal ID, that is, the hash of the proposed transaction, 66 characters, composed of alphanumeric characters

    opinion: voting options, yes, no, abstain-choose one

    Version declaration operation#

    • Command line
    platon_mtool declare_version --keystore $PLATON_MTOOLDIR/keystore/staking.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter Description

    None

    View help#

    • Command line
    platon_mtool -h
    • Parameter Description

    None

    - + \ No newline at end of file diff --git a/PRC20_contract/index.html b/PRC20_contract/index.html index be19b135a..e2a6de132 100644 --- a/PRC20_contract/index.html +++ b/PRC20_contract/index.html @@ -8,7 +8,7 @@ PRC-20 | PlatON - + @@ -17,7 +17,7 @@ If a Smart Contract implements the following methods and events it can be called an PRC-20 Token Contract and, once deployed, it will be responsible to keep track of the created tokens on PlatON.

    contract PRC20 {
         //required    function totalSupply() constant returns (uint theTotalSupply);    function balanceOf(address _owner) constant returns (uint balance);    function transfer(address _to, uint _value) returns (bool success);    function transferFrom(address _from, address _to, uint _value) returns (bool success);    function approve(address _spender, uint _value) returns (bool success);    function allowance(address _owner, address _spender) constant returns (uint remaining);        //optional    function name() public view returns (string);    function symbol() public view returns (string);    function decimals() public view returns (uint8);        //events    event Transfer(address indexed _from, address indexed _to, uint _value);    event Approval(address indexed _owner, address indexed _spender, uint _value);}

    Required APIs#

    Returns the total token supply.

    Returns the account balance of another account with address _owner.

    Transfers _value amount of tokens to address _to, and MUST fire the Transfer event. The function SHOULD throw if the message caller's account balance does not have enough tokens to spend.

    Note Transfers of 0 values MUST be treated as normal transfers and fire the Transfer event.

    Allows _spender to withdraw from your account multiple times, up to the _value amount. If this function is called again it overwrites the current allowance with _value..

    Transfers _value amount of tokens from address _from to address _to, and MUST fire the Transfer event.

    The transferFrom method is used for a withdraw workflow, allowing contracts to transfer tokens on your behalf. This can be used for example to allow a contract to transfer tokens on your behalf and/or to charge fees in sub-currencies. The function SHOULD throw unless the _from account has deliberately authorized the sender of the message via some mechanism.

    Note Transfers of 0 values MUST be treated as normal transfers and fire the Transfer event.

    Returns the amount which _spender is still allowed to withdraw from _owner.

    Optional APIs#

    Returns the name of the token - e.g. "MyToken".

    Returns the symbol of the token. E.g. "HAHA".

    Returns the number of decimals the token uses - e.g. 8, means to divide the token amount by 100000000 to get its user representation.

    Events#

    MUST trigger when tokens are transferred, including zero value transfers.

    A token contract which creates new tokens SHOULD trigger a Transfer event with the _from address set to 0x0 when tokens are created.

    MUST trigger on any successful call to approve(address _spender, uint256 _value).

    Implementation#

    Refer OpenZeppelin implementation.

    View#

    It can be viewed via PlatON browser and also via ATON to view the PRC-20 contract transactions.

    Deploy#

    please refer to Solidity Contracts Getting Started Manual

    Invoking functions#

    Using python as an example:

    Installing Dependencies#

    Use the following command to install the PlatON python library,Python version 3.7.5+ is recommended:

    pip install client-sdk-python

    During the installation process, some dependency packages will require c++14 compilation, please download cppbuildtools after you see the relevant prompt, use the default value to install, and then re-execute the pip install command.

    Instantiation#

    from client_sdk_python import Web3, HTTPProvider
     rpc, chain_id, hrp = 'http://127.0.0.1:6789', 210425, 'lat'w3 = Web3(HTTPProvider(rpc), chain_id=chain_id, hrp_type=hrp)abi = []            # ABIprc20 = w3.eth.contract(address='contract address', abi=abi)# View all functions and events of the contractprint([func for func in prc20.functions])print([event for event in prc20.events])

    Query the total number of tokens issued#

    prc20.functions.totalSupply().call()

    Check the token balance of your account#

    prc20.functions.balanceOf('you address').call()

    Transfer#

    tx = {    'chainId': w3.chain_id,    'nonce': w3.eth.getTransactionCount('your address'),    'gas': 4012388,    'value': 0,    'gasPrice': 1000000000,}txn = prc20.functions.transfer(to='to address', value=1 * 10 ** 18).buildTransaction(tx)signed_txn = w3.eth.account.signTransaction(txn, private_key='your private key')tx_hash = w3.eth.sendRawTransaction(signed_txn.rawTransaction).hex()receipt = w3.eth.waitForTransactionReceipt(tx_hash)

    Get contract events#

    As an example of transfer transaction events, other events can be obtained in a similar way.

    events = prc20.events.Transfer().processReceipt(receipt)
    - + \ No newline at end of file diff --git a/PRC721_contract/index.html b/PRC721_contract/index.html index f6cc42886..f590bc840 100644 --- a/PRC721_contract/index.html +++ b/PRC721_contract/index.html @@ -8,7 +8,7 @@ PRC-721 | PlatON - + @@ -19,7 +19,7 @@ rpc, chain_id, hrp = 'http://127.0.0.1:6789', 210425, 'lat'w3 = Web3(HTTPProvider(rpc), chain_id=chain_id, hrp_type=hrp)abi = [ { "inputs": [ { "internalType": "string", "name":"_name", "type": "string"} {"internalType": "string", "name":"_symbol", "type": "string"} ], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [ { "internalType": "address", "name": "_to", "type": "address" } {"internalType": "uint256", "name":"_tokenId", "type": "uint256"}, {"internalType": "uint256", "name":"_tokenId", "type": "uint256"}, {"internalType": "string", "name":"_uri", "type": "string"} ], "name": "mint", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{"internalType": "address", "name": "_owner", "type": "address"}], "name": "balanceOf", "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], "stateMutability": "view", "type": "function" }, { "inputs": [{"internalType": "uint256", "name": "_tokenId", "type": "uint256"}], "name": "ownerOf", "outputs": [{"internalType": "address", "name": "_owner", "type": "address"}], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_from", "type": "address" } {"internalType": "address", "name":"_to", "type": "address"}, {"internalType": "address", "name":"_to", "type": "address"}, {"internalType": "address", "name":"_to", "type": "address"}, {"internalType": "uint256", "name":"_tokenId", "type": "uint256"}, {"internalType": "uint256", "name":"_tokenId", "type": "uint256"} ], "name": "safeTransferFrom", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "_from", "type": "address" } {"indexed": true, "internalType": "address", "name":"_to", "type": "address"}, "indexed": true, "internalType": "address", "name":"_to", "type": "address"}, {"indexed": true, "internalType": "uint256", "name":"_tokenId", "type": "uint256"} ], "name": "Transfer", "type": "event" },]prc721 = w3.eth.contract(address='contract address', abi=abi)# View all functions and events of the contractprint([func for func in prc721.functions])print([event for event in prc721.events])

    Query contract information#

    With balanceOf, ownerOf example, other query methods are similar to this.

    # Count the number of NFTs held by usersprc721.functions.balanceOf('your address').call()# Query the holder of NFTsprc721.functions.ownerOf('your token id').call()

    Sending contract transactions#

    Using the safeTransferFrom example, other transaction methods are similar to this.

    # Transfer ownership of NFT from one address to anothertx = {    'chainId': w3.chain_id,    'nonce': w3.eth.getTransactionCount('your address'),    'gas': 4012388,    'value': 0,    'gasPrice': 1000000000,}txn = prc721.functions.safeTransferFrom(_from='your address', _to='to address', _tokenId='your token id').buildTransaction(tx)signed_txn = w3.eth.account.signTransaction(txn, private_key='your private key')tx_hash = w3.eth.sendRawTransaction(signed_txn.rawTransaction).hex()receipt = w3.eth.waitForTransactionReceipt(tx_hash)

    Get contract events#

    Using the safeTransferFrom transaction event example, other event fetching methods are similar to this.

    events = prc721.events.Transfer().processReceipt(receiveipt)

    Upload Metadata to IPFS network#

    Metadata is the metadata of NFT tokens in order to display more detailed information about NFT assets, stored under the chain, generally the issuance of an NFT token will specify a URI path to the Metadata data of this token.

    1. Install IPFS#

    Refer to the IPFS installation instructions to install and start.

    2. Adding files to ipfs#

    Prepare an image, name it PlatON.jpeg, and upload it to the ipfs node

    $ ipfs add PlatON.jpegadd QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy PlatON.jpeg//QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy is the unique ID of the file, generated after adding it to ipfs

    If you open the link to the image in your browser and see the image, it means that the image was successfully downloaded: https://ipfs.io/ipfs/QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy?filename=PlatON.jpeg

    With the image link above, you can use it to construct the metadata for NFT.

    First, follow the instructions in the PRC-721 document metadata to create a json file named PlatON.json:

    {    "name": "PlatON.jpg",    "author": "PlatON",    "description": "use for prc721",    "image": "https://ipfs.io/ipfs/QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy?filename=PlatON.jpeg"}

    Upload to the ipfs node:

    $ ipfs add PlatON.jsonadded QmQXqTVCb1w7CmdsYxHWR1T1qyaCHHgWwiPmoZDcQL39Px PlatON.json

    Open the uri of the metadata file in your browser: https://ipfs.io/ipfs/QmQXqTVCb1w7CmdsYxHWR1T1qyaCHHgWwiPmoZDcQL39Px?filename=PlatON.json

    Above, the upload is complete.

    - + \ No newline at end of file diff --git a/Particle_Network_Integration_for_PlatON/index.html b/Particle_Network_Integration_for_PlatON/index.html index 826f91d4f..3dd546f80 100644 --- a/Particle_Network_Integration_for_PlatON/index.html +++ b/Particle_Network_Integration_for_PlatON/index.html @@ -8,7 +8,7 @@ Integrating Particle Network within dApps on PlatON | PlatON - + @@ -37,7 +37,7 @@ notification.success({ message: txReceipt.transactionHash }) }; return ( <div className="App"> {!userInfo ? ( <div className="login-section"> <button className="sign-button" onClick={() => handleLogin('google')}>Sign in with Google</button> <button className="sign-button" onClick={() => handleLogin('twitter')}>Sign in with Twitter</button> </div> ) : ( <div className="profile-card"> <h2>{userInfo.name}</h2> <div className="balance-section"> <small>{balance} LAT</small> <button className="sign-message-button" onClick={executeTx}>Execute Transaction</button> <button className="disconnect-button" onClick={() => disconnect()}>Logout</button> </div> </div> )} </div> );}; export default App;

    Thus, Particle Network's Wallet-as-a-Service can be plugged in and used as you would any other standard wallet on PlatON, enabling social logins in just a few lines of code.

    Learn More#

    - + \ No newline at end of file diff --git a/PlaTrust-wallet-js-sdk-api/index.html b/PlaTrust-wallet-js-sdk-api/index.html index 4a8f9b74d..ac89112ff 100644 --- a/PlaTrust-wallet-js-sdk-api/index.html +++ b/PlaTrust-wallet-js-sdk-api/index.html @@ -8,7 +8,7 @@ PlaTrust Wallet js-sdk-API | PlatON - + @@ -16,7 +16,7 @@
    Skip to main content

    PlaTrust Wallet js-sdk-API

    1. Enumerations (enum)#

    1. Operation: Transaction call methods
    CALL: Cross-contract callDElEGATECALL: Cross-contract delegatecall
    1. SignatureMode: Signature composition modes
    guardians: Multi-signature must be wallet's guardian membersowner: Multi-signature must be wallet's owner memberssession: Single-signature under session mode without multi-signature

    2. Classes (class)#

    1. WalletLib: Wallet base library
    2. Bundler: Bundler RPC library
    3. Paymaster: Paymaster operation library
    4. UserOperation: Encapsulation of user operations structure
    5. Callbase: Base class for assembling wallet function calls in UserOperation
    6. ERC20: UserOperation entry for assembling ERC20 related function calls (Depends on Callbase class)
    7. ERC721: UserOperation entry for assembling ERC721 related function calls (Depends on Callbase class)
    8. ERC1155: UserOperation entry for assembling ERC1155 related function calls (Depends on Callbase class)
    9. LAT: UserOperation entry for assembling LAT transfer related function calls (Depends on Callbase class)

    3. Interfaces (interface)#

    1. ApproveToken: Encapsulation of ERC20 approve parameters
    2. ExecutionResult: Encapsulation of transaction normal execution results
    3. ValidationResult: Definition of the execution verification userOp result according to EIP-4337
    4. FailedOp: Exception information
    5. Result: Wrapper information for ExecutionResult, ValidationResult, and FailedOp
    6. StakeInfo: Staking information
    7. ReturnInfo: Gas and content returned when simulating a transaction
    8. EstimateUserOpGas: Estimation result of userOp gas
    9. ParsedTransaction: Encapsulation of transaction receipt
    10. UserOperationReceipt: Execution receipt information of userOp
    11. Logs: Encapsulation of transaction receipt logs

    4. Global Functions#

    1. encodeSignature: Encodes the signature information of userOp.
    encodeSignature(signatureMode, signature, validAfter?, validUntil?, aggregator?): string

    Input Parameters:

    Field NameTypeDescriptionRequired
    signatureModeBigNumberSignature mode, 0: owner; 1: guardians; 2: sessionY
    signaturestringHexadecimal signature informationY
    aggregatorstringAggregator address for aggregate signatures (optional)N
    validAfterBigNumberSignature's valid-after timestamp (optional)N
    validUntilBigNumberSignature's valid-until timestamp (optional)N

    Return Parameters:

    Field NameTypeDescription
    packedSignaturestringSignature information of userOp
    1. decodeSignature: Decodes the signature information of userOp.
    decodeSignature(packedSignature): Object

    Input Parameters:

    Field NameTypeDescriptionRequired
    packedSignaturestringSignature information of userOpY

    Return Parameters:

    | Field Name    | Type      | Description                                        || ------------- | --------- | -------------------------------------------------- || signatureMode | BigNumber | Signature mode, 0: owner; 1: guardians; 2: session || signature     | string    | Hexadecimal signature information                  || aggregator    | string    | Aggregator address for aggregate signatures        || validAfter    | BigNumber | Signature's valid-after timestamp                  || validUntil    | BigNumber | Signature's valid-until timestamp                  |
    1. packSignatureHash: Computes the signature information of a data hash.
    packSignatureHash(hash, signatureMode?, validAfter?, validUntil?, aggregator?): string

    Input Parameters:

    Field NameTypeDescriptionRequired
    hashstringData hash to be signedY
    signatureModeBigNumberSignature mode, 0: owner; 1: guardians; 2: sessionN
    aggregatorstringAggregator address for aggregate signatures (optional)N
    validAfterBigNumberSignature's valid-after timestamp (optional)N
    validUntilBigNumberSignature's valid-until timestamp (optional)N

    Return Parameters:

    Field NameTypeDescription
    _hashstringkeccak256(abi.encodePacked(hash,signatureMode,aggregator&validAfter&validUntil))
    1. recoverAddress: Resolves the signer's account address.
    recoverAddress(msg, signature): string

    Input Parameters:

    Field NameTypeDescriptionRequired
    msgstringData used for signingY
    signaturestringSignature informationY

    Return Parameters:

    Field NameTypeDescription
    -stringSigner's account address
    1. signMessage: Signs a message using a private key.
    signMessage(msg, privateKey): string

    Input Parameters:

    Field NameTypeDescriptionRequired
    msgstringMessage to be signedY
    privateKeystringPrivate keyY

    Return Parameters:

    Field NameTypeDescription
    -stringSignature

    5. WalletLib External Functions#

    1. Constructor
    new WalletLib(singletonFactory?)

    Input:

    Field NameTypeDescriptionRequired
    singletonFactorystringWallet factory contract addressNo

    Output:

    WalletLib

    1. singletonFactory Get the wallet's factory contract address
    singletonFactory(): string

    Input:

    None

    Output:

    Field NameTypeDescription
    -stringWallet factory contract address
    1. getInitCode Get the wallet's initCode
    getInitCode(walletFactory, walletLogic, initializer, salt): string

    Input:

    Field NameTypeDescriptionRequired
    walletFactorystringWallet factory contract addressYes
    walletLogicstringWallet logic contract addressYes
    initializerstringWallet initialization encoding (setUp function encoding)Yes
    saltstringSalt (controls create2-generated wallet address)Yes

    Output:

    Field NameTypeDescription
    -stringWallet's initCode
    1. getNonce Get the wallet's nonce value
    getNonce(walletAddress, etherProvider, defaultBlock?): Promise<number>

    Input:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet contract addressYes
    etherProviderethers.providers.BaseProviderethers.js provider (e.g., ethers.provider)Yes
    defaultBlockstringearliest, latest, pending, default: latestNo

    Output:

    Field NameTypeDescription
    -numberWallet's nonce value
    1. getPaymasterData Get the paymaster call information for assembling userOp
    getPaymasterData(payMasterAddress, token, maxCost): string

    Input:

    Field NameTypeDescriptionRequired
    payMasterAddressstringPaymaster addressYes
    tokenstringPaymaster's accepted token addressYes
    maxCostBigNumberMaximum costYes

    Output:

    Field NameTypeDescription
    -numberPaymaster call information
    1. getSetupCode Get the setup call encoding for the wallet instance
    getSetupCode(entryPoint, owners, threshold, to, data, fallbackHandler, lockPeriod): string

    Input:

    Field NameTypeDescriptionRequired
    entryPointstringEntryPoint contract addressYes
    ownersstring[]Multiple owners of the wallet, at least one is requiredYes
    thresholdBigNumberMultisig threshold of the wallet ownersYes
    tostring'to' parameter for the module call in the walletYes
    datastring'calldata' information for the module call in the wallet (in hexadecimal)Yes
    fallbackHandlerstringWallet's fallback handler contract addressYes
    lockPeriodBigNumberWallet's lock duration, [recommended to be 1 week] (unit: ms)Yes

    Output:

    Field NameTypeDescription
    -stringSetup call encoding
    1. getWalletCode Get the wallet's deployment encoding
    getWalletCode(walletLogicAddress, walletProxyConfig?): string

    Input:

    Field NameTypeDescriptionRequired
    walletLogicAddressstringWallet logic contract addressYes
    walletProxyConfigstructProxy configuration (including proxy's ABI and proxy's bytecode)No

    Output:

    Field NameTypeDescription
    -stringActual walletproxy encoding (includes the bytecode from walletProxyConfig)
    1. activateWalletOp Assemble userOp for deploying the wallet
    activateWalletOp(walletLogic, initializer, paymasterAndData, salt, walletFactory, maxFeePerGas, maxPriorityFeePerGas, callGasLimit, verificationGasLimit, preVerificationGas): UserOperation

    Input:

    Field NameTypeDescriptionRequired
    walletLogicstringWallet logic contract addressYes
    initializerstringInitialization function call encoding for the walletYes
    paymasterAndDatastringPaymaster call informationYes
    saltstringSalt (controls create2-generated wallet address)Yes
    walletFactorystringWallet factory contract addressYes
    maxFeePerGasnumberMaximum fee per gas (similar to EIP-1559 max_fee_per_gas)Yes
    maxPriorityFeePerGasnumberMaximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas)Yes
    callGasLimitnumberGas allocated for the main execution call (calculated locally, executing callData's gas)Yes
    verificationGasLimitnumberGas allocated for the verification step (used in functions validateUserOp()/validatePaymasterUserOp())Yes
    preVerificationGasnumberGas paid for compensating pre-verification execution and call data bundling (extra gas prepared to handle some routine logic gas consumption)Yes

    Output:

    Field NameTypeDescription
    -UserOperationAssembled userOp
    1. calculateWalletAddress Calculate the wallet address (create2-generated address)
    calculateWalletAddress(walletLogic, initializer, salt, walletFactory): string

    Input:

    Field NameTypeDescriptionRequired
    walletLogicstringWallet logic contract addressYes
    initializerstringInitialization function call encoding for the walletYes
    saltstringSalt (controls create2-generated wallet address)Yes
    walletFactorystringWallet factory contract addressYes

    Output:

    Field NameTypeDescription
    -stringWallet address
    1. addOwnerWithThresholdOp Add a wallet owner and update the multisig threshold
    addOwnerWithThresholdOp(walletAddress, etherProvider, owner, threshold, paymasterAndData, maxFeePerGas, maxPriorityFeePerGas, callGasLimit, verificationGasLimit, preVerificationGas): Promise<UserOperation>

    Input:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressYes
    etherProviderethers.providers.BaseProviderethers.js provider (e.g., ethers.provider)Yes
    ownerstringNew wallet ownerYes
    thresholdnumberWallet multisig thresholdYes
    paymasterAndDatastringPaymaster contract address and data sent to paymaster, currently, the implementation of paymaster is not clear, if we use our own paymaster, this value is not required, fixed to 0x0No
    maxFeePerGasnumberMaximum fee per gas (similar to EIP-1559 max_fee_per_gas)No
    maxPriorityFeePerGasnumberMaximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas)No
    callGasLimitnumberGas allocated for the main execution call (calculated locally, executing callData's gas)No
    verificationGasLimitnumberGas allocated for the verification step (used in functions validateUserOp()/validatePaymasterUserOp())No
    preVerificationGasnumberGas paid for compensating pre-verification execution and call data bundling (extra gas prepared to handle some routine logic gas consumption)No

    Output:

    Field NameTypeDescription
    -UserOperationAssembled userOp
    1. changeThresholdOp Update the multisig threshold
    changeThresholdOp(walletAddress, etherProvider, threshold, paymasterAndData, maxFeePerGas, maxPriorityFeePerGas, callGasLimit, verificationGasLimit, preVerificationGas): Promise<UserOperation>

    Input:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressYes
    etherProviderethers.providers.BaseProviderethers.js provider (e.g., ethers.provider)Yes
    thresholdnumberWallet multisig thresholdYes
    paymasterAndDatastringPaymaster contract address and data sent to paymaster, currently, the implementation of paymaster is not clear, if we use our own paymaster, this value is not required, fixed to 0x0No
    maxFeePerGasnumberMaximum fee per gas (similar to EIP-1559 max_fee_per_gas)No
    maxPriorityFeePerGasnumberMaximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas)No
    callGasLimitnumberGas allocated for the main execution call (calculated locally, executing callData's gas)No
    verificationGasLimitnumberGas allocated for the verification step (used in functions validateUserOp()/validatePaymasterUserOp())No
    preVerificationGasnumberGas paid for compensating pre-verification execution and call data bundling (extra gas prepared to handle some routine logic gas consumption)No

    Output:

    Field NameTypeDescription
    -UserOperationAssembled userOp
    1. getThreshold - Get the threshold of the wallet's multisig.

    getThreshold(walletAddress, etherProvider): Promise

    markdown Copy code

    Input Parameters:

    FieldTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY

    Return Parameters:

    FieldTypeDescription
    -numberMultisig threshold
    1. swapOwnerOp - Replace an owner of a wallet.
    swapOwnerOp(walletAddress, etherProvider, prevOwner, oldOwner, newOwner, paymasterAndData, maxFeePerGas, maxPriorityFeePerGas, callGasLimit, verificationGasLimit, preVerificationGas): Promise<UserOperation>

    Input Parameters:

    FieldTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY
    prevOwnerstringPrevious owner of the owner to be replacedY
    oldOwnerstringOwner to be replacedY
    newOwnerstringNew ownerY
    paymasterAndDatastringPaymaster contract address and data to send to it (currently unclear implementation of paymaster, set to 0x0 if using our own paymaster)N
    maxFeePerGasnumberMaximum fee per gas for each type of gas (similar to EIP-1559 max_fee_per_gas)N
    maxPriorityFeePerGasnumberMaximum priority fee per gas for each type of gas (similar to EIP-1559 max_priority_fee_per_gas)N
    callGasLimitnumberGas allocated for main execution call (simulated locally, gas for executing callData)N
    verificationGasLimitnumberGas allocated for verification steps (used in functions validateUserOp()/validatePaymasterUserOp())N
    preVerificationGasnumberGas paid for compensating pre-verification execution and call data bundler (extra gas to handle regular gas consumption, e.g., in loops)N

    Return Parameters:

    FieldTypeDescription
    -UserOperationAssembled userOp
    1. removeOwnerOp - Remove an owner from the wallet.
    removeOwnerOp(walletAddress, etherProvider, prevOwner, owner, threshold, paymasterAndData, maxFeePerGas, maxPriorityFeePerGas, callGasLimit, verificationGasLimit, preVerificationGas): Promise<UserOperation>

    Input Parameters:

    FieldTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY
    prevOwnerstringPrevious owner of the owner to be removedY
    ownerstringOwner to be removedY
    thresholdnumberNew multisig threshold (if no update needed, provide the old value)Y
    paymasterAndDatastringPaymaster contract address and data to send to it (currently unclear implementation of paymaster, set to 0x0 if using our own paymaster)N
    maxFeePerGasnumberMaximum fee per gas for each type of gas (similar to EIP-1559 max_fee_per_gas)N
    maxPriorityFeePerGasnumberMaximum priority fee per gas for each type of gas (similar to EIP-1559 max_priority_fee_per_gas)N
    callGasLimitnumberGas allocated for main execution call (simulated locally, gas for executing callData)N
    verificationGasLimitnumberGas allocated for verification steps (used in functions validateUserOp()/validatePaymasterUserOp())N
    preVerificationGasnumberGas paid for compensating pre-verification execution and call data bundler (extra gas to handle regular gas consumption, e.g., in loops)N

    Return Parameters:

    FieldTypeDescription
    -UserOperationAssembled userOp
    1. getOwners - Get the list of owners of the wallet.
    getOwners(walletAddress, etherProvider): Promise<Array<string>>

    Input Parameters:

    FieldTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY

    Return Parameters:

    FieldTypeDescription
    -Array\<string>List of wallet owners
    1. isOwner - Check if an account is an owner of the wallet.
    isOwner(owner, walletAddress, etherProvider): Promise<boolean>

    Input Parameters:

    FieldTypeDescriptionRequired
    ownerstringAccount address to be checkedY
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY

    Return Parameters:

    FieldTypeDescription
    -booleanWhether it is a wallet owner
    1. startSessionOp - Start a multisig-free session.
    startSessionOp(walletAddress, etherProvider, sessionUser, duration, paymasterAndData, maxFeePerGas, maxPriorityFeePerGas, callGasLimit, verificationGasLimit, preVerificationGas): Promise<UserOperation>

    Input Parameters:

    FieldTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY
    sessionUserstringOwner of the wallet sessionY
    durationnumberValid duration of the wallet session (in ms)Y
    paymasterAndDatastringPaymaster contract address and data to send to it (currently unclear implementation of paymaster, set to 0x0 if using our own paymaster)N
    maxFeePerGasnumberMaximum fee per gas for each type of gas (similar to EIP-1559 max_fee_per_gas)N
    maxPriorityFeePerGasnumberMaximum priority fee per gas for each type of gas (similar to EIP-1559 max_priority_fee_per_gas)N
    callGasLimitnumberGas allocated for main execution call (simulated locally, gas for executing callData)N
    verificationGasLimitnumberGas allocated for verification steps (used in functions validateUserOp()/validatePaymasterUserOp())N
    preVerificationGasnumberGas paid for compensating pre-verification execution and call data bundler (extra gas to handle regular gas consumption, e.g., in loops)N

    Return Parameters:

    FieldTypeDescription
    -UserOperationAssembled userOp
    1. clearSessionOp - End a multisig-free session.
    clearSessionOp(walletAddress, etherProvider, paymasterAndData, maxFeePerGas, maxPriorityFeePerGas, callGasLimit, verificationGasLimit, preVerificationGas): Promise<UserOperation>

    Input Parameters:

    FieldTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY
    paymasterAndDatastringPaymaster contract address and data to send to it (currently unclear implementation of paymaster, set to 0x0 if using our own paymaster)N
    maxFeePerGasnumberMaximum fee per gas for each type of gas (similar to EIP-1559 max_fee_per_gas)N
    maxPriorityFeePerGasnumberMaximum priority fee per gas for each type of gas (similar to EIP-1559 max_priority_fee_per_gas)N
    callGasLimitnumberGas allocated for main execution call (simulated locally, gas for executing callData)N
    verificationGasLimitnumberGas allocated for verification steps (used in functions validateUserOp()/validatePaymasterUserOp())N
    preVerificationGasnumberGas paid for compensating pre-verification execution and call data bundler (extra gas to handle regular gas consumption, e.g., in loops)N

    Return Parameters:

    FieldTypeDescription
    -UserOperationAssembled userOp
    1. enableModuleOp - Enable a module.
    enableModuleOp(walletAddress, etherProvider, module, paymasterAndData, maxFeePerGas, maxPriorityFeePerGas, callGasLimit, verificationGasLimit, preVerificationGas): Promise<UserOperation>

    Input Parameters:

    FieldTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY
    modulestringModule addressY
    paymasterAndDatastringPaymaster contract address and data to send to it (currently unclear implementation of paymaster, set to 0x0 if using our own paymaster)N
    maxFeePerGasnumberMaximum fee per gas for each type of gas (similar to EIP-1559 max_fee_per_gas)N
    maxPriorityFeePerGasnumberMaximum priority fee per gas for each type of gas (similar to EIP-1559 max_priority_fee_per_gas)N
    callGasLimitnumberGas allocated for main execution call (simulated locally, gas for executing callData)N
    verificationGasLimitnumberGas allocated for verification steps (used in functions validateUserOp()/validatePaymasterUserOp())N
    preVerificationGasnumberGas paid for compensating pre-verification execution and call data bundler (extra gas to handle regular gas consumption, e.g., in loops)N

    Return Parameters:

    FieldTypeDescription
    -UserOperationAssembled userOp
    1. disableModuleOp - Disable a module.
    disableModuleOp(walletAddress, etherProvider, prevModule, module, paymasterAndData, maxFeePerGas, maxPriorityFeePerGas, callGasLimit, verificationGasLimit, preVerificationGas): Promise<UserOperation>

    Input Parameters:

    FieldTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY
    prevModulestringPrevious module address to be disabledY
    modulestringModule address to be disabledY
    paymasterAndDatastringPaymaster contract address and data to send to it (currently unclear implementation of paymaster, set to 0x0 if using our own paymaster)N
    maxFeePerGasnumberMaximum fee per gas for each type of gas (similar to EIP-1559 max_fee_per_gas)N
    maxPriorityFeePerGasnumberMaximum priority fee per gas for each type of gas (similar to EIP-1559 max_priority_fee_per_gas)N
    callGasLimitnumberGas allocated for main execution call (simulated locally, gas for executing callData)N
    verificationGasLimitnumberGas allocated for verification steps (used in functions validateUserOp()/validatePaymasterUserOp())N
    preVerificationGasnumberGas paid for compensating pre-verification execution and call data bundler (extra gas to handle regular gas consumption, e.g., in loops)N

    Return Parameters:

    FieldTypeDescription
    -UserOperationAssembled userOp
    1. isEnabledModule - Check if an address is a valid module.
    isEnabledModule(module, walletAddress, etherProvider): Promise<boolean>

    Input Parameters:

    FieldTypeDescriptionRequired
    modulestringModule addressY
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY

    Return Parameters:

    FieldTypeDescription
    -booleanWhether it is a valid module
    1. isEnabledModules - Check a group of addresses for valid modules.
    isEnabledModules(modules, walletAddress, etherProvider): Promise<boolean>

    Input Parameters:

    FieldTypeDescriptionRequired
    modulesstring[]A group of module addressesY
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY

    Return Parameters:

    FieldTypeDescription
    -booleanWhether all are valid modules
    1. getModulesPaginated Paginated retrieval of an array of modules
    getModulesPaginated(start: string, pageSize: number, walletAddress: string, etherProvider: ethers.providers.BaseProvider): Promise<any[]>

    Input Parameter:

    Field NameTypeDescriptionRequired
    startstringStarting address of the paginationY
    pageSizenumberPage sizeY
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderEthers.js provider, e.g., ethers.providerY

    Return Parameter:

    Field NameTypeDescription
    -any[]Array of modules returned, and the address of the next page of modules (The first element is the list of modules, and the second element is the address of the next page)
    1. lockWalletOp Lock the wallet
    lockWalletOp(walletAddress: string, etherProvider: ethers.providers.BaseProvider, paymasterAndData: string, maxFeePerGas: number, maxPriorityFeePerGas: number, callGasLimit: number, verificationGasLimit: number, preVerificationGas: number): Promise<UserOperation>

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderEthers.js provider, e.g., ethers.providerY
    paymasterAndDatastringPaymaster contract address and data sent to paymaster (The current implementation of paymaster is not yet clear. If we use our own paymaster, this value is not required and can be fixed to 0x0.)N
    maxFeePerGasnumberMaximum fee per unit of gas, similar to EIP-1559 max_fee_per_gasN
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, similar to EIP1559 max_priority_fee_per_gasN
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)N
    verificationGasLimitnumberGas allocated for the verification step (used in functions validateUserOp() and validatePaymasterUserOp())N
    preVerificationGasnumberGas paid for compensating the pre-verification execution and call data bundler (additional gas reserved to deal with some regular gas consumption, such as loops)N

    Return Parameter:

    Field NameTypeDescription
    -UserOperationAssembled UserOperation
    1. unlockWalletOp Unlock the wallet
    unlockWalletOp(walletAddress: string, etherProvider: ethers.providers.BaseProvider, paymasterAndData: string, maxFeePerGas: number, maxPriorityFeePerGas: number, callGasLimit: number, verificationGasLimit: number, preVerificationGas: number): Promise<UserOperation>

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderEthers.js provider, e.g., ethers.providerY
    paymasterAndDatastringPaymaster contract address and data sent to paymaster (The current implementation of paymaster is not yet clear. If we use our own paymaster, this value is not required and can be fixed to 0x0.)N
    maxFeePerGasnumberMaximum fee per unit of gas, similar to EIP-1559 max_fee_per_gasN
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, similar to EIP1559 max_priority_fee_per_gasN
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)N
    verificationGasLimitnumberGas allocated for the verification step (used in functions validateUserOp() and validatePaymasterUserOp())N
    preVerificationGasnumberGas paid for compensating the pre-verification execution and call data bundler (additional gas reserved to deal with some regular gas consumption, such as loops)N

    Return Parameter:

    Field NameTypeDescription
    -UserOperationAssembled UserOperation
    1. isLocked Verify if the wallet is locked
    isLocked(walletAddress: string, etherProvider: ethers.providers.BaseProvider): Promise<boolean>

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderEthers.js provider, e.g., ethers.providerY

    Return Parameter:

    Field NameTypeDescription
    -booleanWhether the wallet is locked or not (true: locked; false: not locked)
    1. getLock Retrieve the lock duration of the wallet

    getLock(walletAddress: string, etherProvider: ethers.providers.BaseProvider): Promise Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderEthers.js provider, e.g., ethers.providerY

    Return Parameter:

    Field NameTypeDescription
    -numberLock duration of the wallet (in ms)
    1. setFallbackHandlerOp Set the wallet's fallback handler for additional functionalities
    setFallbackHandlerOp(walletAddress: string, etherProvider: ethers.providers.BaseProvider, handler: string, paymasterAndData: string, maxFeePerGas: number, maxPriorityFeePerGas: number, callGasLimit: number, verificationGasLimit: number, preVerificationGas: number): Promise<UserOperation>

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderEthers.js provider, e.g., ethers.providerY
    handlerstringWallet extension contract addressY
    paymasterAndDatastringPaymaster contract address and data sent to paymaster (The current implementation of paymaster is not yet clear. If we use our own paymaster, this value is not required and can be fixed to 0x0.)N
    maxFeePerGasnumberMaximum fee per unit of gas, similar to EIP-1559 max_fee_per_gasN
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, similar to EIP1559 max_priority_fee_per_gasN
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)N
    verificationGasLimitnumberGas allocated for the verification step (used in functions validateUserOp() and validatePaymasterUserOp())N
    preVerificationGasnumberGas paid for compensating the pre-verification execution and call data bundler (additional gas reserved to deal with some regular gas consumption, such as loops)N

    Return Parameter:

    Field NameTypeDescription
    -UserOperationAssembled UserOperation
    1. getEntryPoint Retrieve the EntryPoint address of the wallet
    getEntryPoint(walletAddress: string, etherProvider: ethers.providers.BaseProvider): Promise<string>

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderEthers.js provider, e.g., ethers.providerY

    Return Parameter:

    Field NameTypeDescription
    -stringEntryPoint address
    1. withdrawDepositOp Withdraw the wallet's own pledge to the amount advanced to the EntryPoint
    withdrawDepositOp(walletAddress: string, etherProvider: ethers.providers.BaseProvider, withdrawAddress: string, amount: number, paymasterAndData: string, maxFeePerGas: number, maxPriorityFeePerGas: number, callGasLimit: number, verificationGasLimit: number, preVerificationGas: number): Promise<UserOperation>

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderEthers.js provider, e.g., ethers.providerY
    withdrawAddressstringWithdraw addressY
    amountnumberAmount of the pledge to be withdrawnY
    paymasterAndDatastringPaymaster contract address and data sent to paymaster (The current implementation of paymaster is not yet clear. If we use our own paymaster, this value is not required and can be fixed to 0x0.)N
    maxFeePerGasnumberMaximum fee per unit of gas, similar to EIP-1559 max_fee_per_gasN
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, similar to EIP1559 max_priority_fee_per_gasN
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)N
    verificationGasLimitnumberGas allocated for the verification step (used in functions validateUserOp() and validatePaymasterUserOp())N
    preVerificationGasnumberGas paid for compensating the pre-verification execution and call data bundler (additional gas reserved to deal with some regular gas consumption, such as loops)N

    Return Parameter:

    Field NameTypeDescription
    -UserOperationAssembled UserOperation
    1. addDeposit Pledge the wallet's own deposit to the EntryPoint
    addDeposit(walletAddress: string, signer: ethers.Wallet, value: string): Promise<any>

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    signerethers.WalletEthers.js WalletY
    valuestringThe amount of the pledgeY

    Return Parameter:

    None

    1. getDeposit Query the balance of the wallet's own deposit
    getDeposit(walletAddress: string, etherProvider: ethers.providers.BaseProvider): Promise<number>

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderEthers.js provider, e.g., ethers.providerY

    Return Parameter:

    Field NameTypeDescription
    -numberBalance of the wallet's own deposit

    6. Bundler External Functions#

    1. Constructor
    new Bundler(entryPoint: string, etherProvider: ethers.providers.BaseProvider, bundlerApiURL: string, timeout?: ApiTimeOut)

    Input Parameters:

    NameTypeDescriptionRequired
    entryPointstringAddress of the entryPoint contractY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY
    bundlerApiURLstringURL of the bundlerY
    timeoutApiTimeOutTimeout options: web3ApiRequestTimeout, web3ApiResponseTimeout, bundlerApiRequestTimeout, bundlerApiResponseTimeoutN

    Return Parameters:

    NameTypeDescription
    -BundlerBundler object
    1. platon_chainId (EIP-4337 specification) - Returns the EIP-155 chain ID
    platon_chainId(timeout?: number): Promise<string>

    Input Parameters:

    NameTypeDescriptionRequired
    timeoutnumberTimeoutN

    Return Parameters:

    NameTypeDescription
    -stringChain ID
    1. platon_estimateUserOperationGas (EIP-4337 specification) - Estimates gas for UserOperation
    platon_estimateUserOperationGas(userOp: UserOperation, timeout?: number): Promise<EstimateUserOpGas>

    Input Parameters:

    NameTypeDescriptionRequired
    userOpUserOperationUserOperation objectY
    timeoutnumberTimeoutN

    Return Parameters:

    NameTypeDescription
    -EstimateUserOpGasGas estimation result
    1. platon_getUserOperationByHash (EIP-4337 specification) - Returns a UserOperation based on the hash returned by eth_sendUserOperation
    platon_getUserOperationByHash(userOpHash: string, timeout?: number): Promise<null | UserOperationReceipt>

    Input Parameters:

    NameTypeDescriptionRequired
    userOpHashstringUserOp's hashY
    timeoutnumberTimeoutN

    Return Parameters:

    NameTypeDescription
    -UserOperationReceiptEIP-4337 specification-defined response
    1. platon_getUserOperationReceipt (EIP-4337 specification) - Returns a UserOperation receipt based on the hash returned by eth_sendUserOperation
    platon_getUserOperationReceipt(userOpHash: string, timeout?: number): Promise<null | UserOperationReceipt>

    Input Parameters:

    NameTypeDescriptionRequired
    userOpHashstringUserOp's hashY
    timeoutnumberTimeoutN

    Return Parameters:

    NameTypeDescription
    -UserOperationReceiptEIP-4337 specification-defined response
    1. platon_sendUserOperation (EIP-4337 specification) - Submits a UserOperation object to the bundler's User Operation pool
    platon_sendUserOperation(userOp: UserOperation, timeout?: number): Promise<string>

    Input Parameters:

    NameTypeDescriptionRequired
    userOpUserOperationUserOperation informationY
    timeoutnumberTimeoutN

    Return Parameters:

    NameTypeDescription
    -stringEIP-4337 userOpHash
    1. platon_supportedEntryPoints (EIP-4337 specification) - Returns an array of entryPoint contract addresses supported by the bundler
    platon_supportedEntryPoints(timeout?: number): Promise<string[]>

    Input Parameters:

    NameTypeDescriptionRequired
    timeoutnumberTimeoutN

    Return Parameters:

    NameTypeDescription
    -string[]Array of entryPoint contract addresses
    1. sendUserOperation Submits a UserOperation object to the bundler's User Operation pool and appends a listener
    sendUserOperation(userOp: UserOperation, timeout?: number, receiptTimeout?: number, receiptInterval?: number): EventEmitter

    Input Parameters:

    NameTypeDescriptionRequired
    userOpUserOperationUserOperation informationY
    timeoutnumberTimeout for bundler requestN
    receiptTimeoutnumberTimeout for listenerN
    receiptIntervalnumberListener intervalN

    Return Parameters:

    NameTypeDescription
    -EventEmitterJS event listener
    1. simulateHandleOp Simulates the execution of a userOp
    simulateHandleOp(op: UserOperation, target?: string, targetCallData?: string): Promise<Result>

    Input Parameters:

    NameTypeDescriptionRequired
    opUserOperationUserOperation informationY
    targetstringTarget address if non-zero, indicating a call to be made after the userOp simulation. If called, targetSuccess and TargetResult are set to the return value of the callN
    targetCallDatastringCallData to be passed to the target addressN

    Return Parameters:

    NameTypeDescription
    -ResultExecution result
    1. simulateValidation Simulates the validation of a userOp
    simulateValidation(op: UserOperation): Promise<Result>

    Input Parameters:

    NameTypeDescriptionRequired
    opUserOperationUserOperation informationY

    Return Parameters:

    NameTypeDescription
    -ResultExecution result

    7. Paymaster External Functions#

    1. Constructor
    new Paymaster(payMasterAddress: string, wallet: ethers.Wallet)

    Input Parameters:

    NameTypeDescriptionRequired
    payMasterAddressstringPaymaster addressY
    walletethers.Walletethers.js wallet instance (owner of the paymaster)Y

    Return Parameters:

    NameTypeDescription
    -PaymasterPaymaster object
    1. addSupportedToken Add supported token category
    addSupportedToken(token: string, priceOracle: string): Promise<any>

    Input Parameters:

    NameTypeDescriptionRequired
    tokenstringToken addressY
    priceOraclestringToken's price oracle addressY

    Return Parameters:

    NameTypeDescription
    -transaction receiptTransaction receipt
    1. removeSupportedToken Remove supported token category
    removeSupportedToken(token: string): Promise<any>

    Input Parameters:

    NameTypeDescriptionRequired
    tokenstringToken addressY

    Return Parameters:

    NameTypeDescription
    -transaction receiptTransaction receipt
    1. paymasterSupportedToken Check supported token category
    paymasterSupportedToken(tokens: string[]): Promise<string[]>

    Input Parameters:

    NameTypeDescriptionRequired
    tokensstring[]Token addressesY

    Return Parameters:

    NameTypeDescription
    -string[]Token addresses
    1. entryPoint Get the entrypoint contract address of the paymaster
    entryPoint(): Promise<any>

    Input Parameters:

    NameTypeDescriptionRequired
    --None-

    Return Parameters:

    NameTypeDescription
    -addressEntrypoint address
    1. addStake Add stake
    addStake(extraUnstakeDelaySec: number, value: string): Promise<any>

    Input Parameters:

    NameTypeDescriptionRequired
    extraUnstakeDelaySecnumberDelay in seconds for unstakingY
    valuestringHex value of the staking amount (in lat)Y

    Return Parameters:

    NameTypeDescription
    -transaction receiptTransaction receipt
    1. deposit Add deposit amount
    deposit(value: string): Promise<any>

    Input Parameters:

    NameTypeDescriptionRequired
    valuestringHex value of the deposit amount (in lat)Y

    Return Parameters:

    NameTypeDescription
    -transaction receiptTransaction receipt
    1. unlockStake Unlock stake
    unlockStake(): Promise<any>

    Input Parameters:

    NameTypeDescriptionRequired
    --None-

    Return Parameters:

    NameTypeDescription
    -transaction receiptTransaction receipt
    1. withdrawStake Withdraw stake amount
    withdrawStake(withdrawAddress: string): Promise<any>

    Input Parameters:

    NameTypeDescriptionRequired
    withdrawAddressstringAccount address to receive the withdrawn stakeY

    Return Parameters:

    NameTypeDescription
    -transaction receiptTransaction receipt
    1. withdrawTo Withdraw deposit amount
    withdrawTo(withdrawAddress: string, amount: string): Promise<any>

    Input Parameters:

    NameTypeDescriptionRequired
    withdrawAddressstringAccount address to receive the withdrawn depositY
    amountstringHex value of the withdrawn deposit amount (in lat)Y

    Return Parameters:

    NameTypeDescription
    -transaction receiptTransaction receipt
    1. withdrawToken Withdraw compensated tokens
    withdrawToken(token: string, to: string, amount: string): Promise<any>

    Input Parameters:

    NameTypeDescriptionRequired
    tokenstringToken address to be withdrawnY
    tostringAccount address to receive the withdrawn tokensY
    amountstringAmount of tokens to be withdrawn (in lat)Y

    Return Parameters:

    NameTypeDescription
    -transaction receiptTransaction receipt
    1. getDeposit Get remaining deposit balance
    getDeposit(): Promise<any>

    Input Parameters:

    NameTypeDescriptionRequired
    --None-

    Return Parameters:

    NameTypeDescription
    -numberDeposit balance
    1. getExchangePrice Get token price information
    getExchangePrice(token: string, fetchTokenDecimals?: boolean): Promise<{ decimals: number; price: BigNumber; tokenDecimals: undefined | number }>

    Input Parameters:

    NameTypeDescriptionRequired
    tokenstringToken addressY
    fetchTokenDecimalsbooleanWhether to fetch token decimalsN

    Return Parameters:

    NameTypeDescription
    priceBigNumberToken price
    decimalsnumberToken price decimals
    tokenDecimalsnumberToken decimals

    8. UserOperation External Functions#

    1. Constructor
    new UserOperation(sender?, nonce?, initCode?, callData?, callGasLimit?, maxFeePerGas?, maxPriorityFeePerGas?, paymasterAndData?, verificationGasLimit?, preVerificationGas?, signature?)

    Return Parameters:

    Field NameTypeDescriptionRequired
    senderstringWallet address that performs the operation (the address of the wallet contract, but the sender's EOA address during the first deployment)N
    noncenumberAnti-replay parameter set in the wallet, also used as salt for the initial creation of the walletN
    initCodestringAll wallet creation in this design is deployed by the predefined wallet template contract (EIP-1167), so this field is emptyN
    callDatastringData passed by the sender to the main execution call (opcode converted by the wallet from the user's request)N
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)N
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)N
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)N
    paymasterAndDatastringPaymaster contract address and data sent to the paymaster, the implementation of the paymaster is not clear yet, and if we use our own paymaster, this value is not needed, set to 0x0N
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())N
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)N
    signaturestringSignatures of multiple Owners, multiple Owners sign the UserOperationN

    Return Parameter:

    UserOperation

    1. addSupportedToken Serialize UserOperation
    Serialized(): void

    Input Parameter:

    None

    Return Parameter:

    None

    1. callDataCost Calculate the call cost
    callDataCost(): number

    Input Parameter:

    None

    Return Parameter:

    Field NameTypeDescription
    -BigNumberCall cost
    1. getStruct Get the serialized UserOperation
    getStruct(): SerializedUserOperation

    Input Parameter:

    None

    Return Parameter:

    Field NameTypeDescription
    senderstringWallet address that performs the operation (the address of the wallet contract, but the sender's EOA address during the first deployment)
    noncenumberAnti-replay parameter set in the wallet, also used as salt for the initial creation of the wallet
    initCodestringAll wallet creation in this design is deployed by the predefined wallet template contract (EIP-1167), so this field is empty
    callDatastringData passed by the sender to the main execution call (opcode converted by the wallet from the user's request)
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)
    paymasterAndDatastringPaymaster contract address and data sent to the paymaster, the implementation of the paymaster is not clear yet, and if we use our own paymaster, this value is not needed, set to 0x0
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)
    signaturestringSignatures of multiple Owners, multiple Owners sign the UserOperation
    1. getUserOpHash Get UserOperation Hash
    getUserOpHash(entryPointAddress, chainId): string

    Input Parameter:

    Field NameTypeDescriptionRequired
    entryPointAddressstringEntrypoint contract addressY
    chainIdnumberChain IDY

    Return Parameter:

    Field NameTypeDescription
    -stringUserOperation hash value
    1. getUserOpHashFromContract Get UserOperation Hash
    getUserOpHashFromContract(entryPointAddress, etherProvider, defaultBlock?): Promise<string>

    Input Parameter:

    Field NameTypeDescriptionRequired
    entryPointAddressstringEntrypoint contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY
    defaultBlockstring'earliest', 'latest', 'pending', default: 'latest'N

    Return Parameter:

    Field NameTypeDescription
    -stringUserOperation hash value
    1. packUserOp Assemble EIP-712 information of UserOperation
    packUserOp(forSignature?): string

    Input Parameter:

    Field NameTypeDescriptionRequired
    forSignaturebooleanWhether it is for computing the EIP-712 information for signature value, true: does not include the signature value; false: includes the signature valueN

    Return Parameter:

    Field NameTypeDescription
    -stringEIP-712 information of UserOperation
    1. signWithSignature Fill in the value of the 'signature' field of UserOperation based on the signature, signature mode, validity period start time, and validity period end time
    signWithSignature(signature, signatureMode?, validAfter?, validUntil?): void

    Input Parameter:

    Field NameTypeDescriptionRequired
    signaturestringSignature messageY
    signatureModeSignatureModeSignature mode, 0: owner; 1: guardians; 2: sessionN
    validAfternumberValidity period start timeN
    validUntilnumberValidity period end timeN

    Return Parameter:

    None

    1. toJSON Convert UserOperation to JSON format information
    toJSON(): string

    Input Parameter:

    None

    Return Parameter:

    Field NameTypeDescription
    -stringJSON format information of UserOperation
    1. toTuple Convert UserOperation to tuple format information
    toTuple(): string

    Input Parameter:

    None

    Return Parameter:

    Field NameTypeDescription
    -stringTuple format information of UserOperation
    1. fromJSON Convert JSON format information to UserOperation
    fromJSON(json): UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    jsonstringJSON format information of UserOperationY

    Return Parameter:

    Field NameTypeDescription
    -UserOperationUserOperation information
    1. fromObject Convert object format information to UserOperation
    fromObject(obj): UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    objobjectObject format information of UserOperationY

    Return Parameter:

    Field NameTypeDescription
    -UserOperationUserOperation information

    9. Callbase External Functions#

    1. createOp Create UserOperation for calling the wallet (executeFromModule)
    createOp(        walletAddress: string,        nonce: NumberLike,        paymasterAndData: string,        maxFeePerGas: NumberLike,        maxPriorityFeePerGas: NumberLike,        callGasLimit: NumberLike,        verificationGasLimit: NumberLike,        preVerificationGas: NumberLike,        data: string,    ) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet address that performs the operation (the address of the wallet contract, but the sender's EOA address during the first deployment)Y
    noncenumberAnti-replay parameter set in the wallet, also used as salt for the initial creation of the walletY
    paymasterAndDatastringPaymaster contract address and data sent to the paymaster, the implementation of the paymaster is not clear yet, and if we use our own paymaster, this value is not needed, set to 0x0Y
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    datastringParameter for calling the wallet contract's executeFromModule (i.e., the encoded call for other wallet functions)Y

    Return Parameter:

    UserOperation

    1. createOpByBatch Create UserOperation for calling the wallet (executeBatchFromModule)
    createOpByBatch(        walletAddress: string,        nonce: NumberLike,        paymasterAndData: string,        maxFeePerGas: NumberLike,        maxPriorityFeePerGas: NumberLike,        callGasLimit: NumberLike,        verificationGasLimit: NumberLike,        preVerificationGas: NumberLike,        datas: string[],    ) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet address that performs the operation (the address of the wallet contract, but the sender's EOA address during the first deployment)Y
    noncenumberAnti-replay parameter set in the wallet, also used as salt for the initial creation of the walletY
    paymasterAndDatastringPaymaster contract address and data sent to the paymaster, the implementation of the paymaster is not clear yet, and if we use our own paymaster, this value is not needed, set to 0x0Y
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    datasstring[]Parameters for calling the wallet contract's executeBatchFromModule (i.e., the encoded calls for other wallet functions)Y

    Return Parameter:

    UserOperation

    10. ERC20 External Functions#

    1. Constructor
    new ERC20()

    Input Parameter:

    None

    Return Parameter:

    ERC20

    1. approve Create UserOperation for calling the 'approve' function of ERC20
    approve(walletAddress: string, nonce: NumberLike, paymasterAddress: string,            maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, callGasLimit: NumberLike,            verificationGasLimit: NumberLike, preVerificationGas: NumberLike, _token: string, _spender: string, _value: string) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    _tokenstringERC20 token address to operate onY
    _spenderstringThe _spender parameter for 'approve'Y
    _valuestringThe _value parameter for 'approve'Y

    Return Parameter:

    UserOperation

    1. transferFrom Create UserOperation for calling the 'transferFrom' function of ERC20
    transferFrom(walletAddress: string, nonce: NumberLike, paymasterAddress: string,                 maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, callGasLimit: NumberLike,                 verificationGasLimit: NumberLike, preVerificationGas: NumberLike, _token: string, _from: string, _to: string, _value: string) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    _tokenstringERC20 token address to operate onY
    _fromstringThe _from parameter for 'transferFrom'Y
    _tostringThe _to parameter for 'transferFrom'Y
    _valuestringThe _value parameter for 'transferFrom'Y

    Return Parameter:

    UserOperation

    1. transfer Create UserOperation for calling the 'transfer' function of ERC20
    transfer(walletAddress: string, nonce: NumberLike, paymasterAddress: string,             maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, callGasLimit: NumberLike,             verificationGasLimit: NumberLike, preVerificationGas: NumberLike, _token: string, _to: string, _value: string) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    _tokenstringERC20 token address to operate onY
    _tostringThe _to parameter for 'transfer'Y
    _valuestringThe _value parameter for 'transfer'Y

    Return Parameter:

    UserOperation

    11. ERC721 External Functions#

    1. Constructor
    new ERC721();

    Input Parameter:

    None

    Return Parameter:

    ERC721

    1. approve Create UserOperation for calling the 'approve' function of ERC721
    approve(walletAddress: string, nonce: NumberLike, paymasterAddress: string,        maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, callGasLimit: NumberLike,        verificationGasLimit: NumberLike, preVerificationGas: NumberLike, _token: string, _spender: string, _tokenId: string) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    _tokenstringERC20 token address to operate onY
    _spenderstringThe _spender parameter for 'approve'Y
    _tokenIdstringThe _tokenId parameter for 'approve'Y

    Return Parameter:

    UserOperation

    1. transferFrom Create UserOperation for calling the 'transferFrom' function of ERC721
    transferFrom(walletAddress: string, nonce: NumberLike, paymasterAddress: string,             maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, callGasLimit: NumberLike,             verificationGasLimit: NumberLike, preVerificationGas: NumberLike, _token: string, _from: string, _to: string, _tokenId: string) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    _tokenstringERC20 token address to operate onY
    _fromstringThe _from parameter for 'transferFrom'Y
    _tostringThe _to parameter for 'transferFrom'Y
    _tokenIdstringThe _tokenId parameter for 'transferFrom'Y

    Return Parameter:

    UserOperation

    1. transfer Create UserOperation for calling the 'transfer' function of ERC721
    transfer(walletAddress: string, nonce: NumberLike, paymasterAddress: string,         maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, callGasLimit: NumberLike,         verificationGasLimit: NumberLike, preVerificationGas: NumberLike, _token: string, _to: string, _tokenId: string) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    _tokenstringERC20 token address to operate onY
    _tostringThe _to parameter for 'transfer'Y
    _tokenIdstringThe _tokenId parameter for 'transfer'Y

    Return Parameter:

    UserOperation

    1. safeTransferFrom Create UserOperation for calling the 'safeTransferFrom' function of ERC721
    safeTransferFrom(walletAddress: string, nonce: NumberLike, paymasterAddress: string,                 maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, callGasLimit: NumberLike,                 verificationGasLimit: NumberLike, preVerificationGas: NumberLike, _token: string, _from: string, _to: string, _tokenId: string) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    _tokenstringERC20 token address to operate onY
    _fromstringThe _from parameter for 'safeTransferFrom'Y
    _tostringThe _to parameter for 'safeTransferFrom'Y
    _tokenIdstringThe _tokenId parameter for 'safeTransferFrom'Y

    Return Parameter:

    UserOperation

    1. setApprovalForAll Create UserOperation for calling the 'setApprovalForAll' function of ERC721
    setApprovalForAll(walletAddress: string, nonce: NumberLike, paymasterAddress: string,                  maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, callGasLimit: NumberLike,                  verificationGasLimit: NumberLike, preVerificationGas: NumberLike, _token: string, _operator: string, _approved: boolean) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    _tokenstringERC20 token address to operate onY
    _operatorstringThe _operator parameter for 'setApprovalForAll'Y
    _approvedbooleanThe _approved parameter for 'setApprovalForAll'Y

    Return Parameter:

    UserOperation

    12. ERC1155 External Functions#

    1. Constructor
    new ERC1155();

    Input Parameter:

    None

    Return Parameter:

    ERC1155

    1. safeTransferFrom Create UserOperation for calling the 'safeTransferFrom' function of ERC1155
    safeTransferFrom(walletAddress: string, nonce: NumberLike, paymasterAddress: string,                 maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, callGasLimit: NumberLike,                 verificationGasLimit: NumberLike, preVerificationGas: NumberLike, _token: string, _from: string, _to: string, _id: string, _value: string, _data: string)  : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    _tokenstringERC20 token address to operate onY
    _fromstringThe _from parameter for 'safeTransferFrom'Y
    _tostringThe _to parameter for 'safeTransferFrom'Y
    _idstringThe _id parameter for 'safeTransferFrom'Y
    _valuestringThe _value parameter for 'safeTransferFrom'Y
    _datastringThe _data parameter for 'safeTransferFrom'Y

    Return Parameter:

    UserOperation

    1. safeBatchTransferFrom Create UserOperation for calling the 'safeBatchTransferFrom' function of ERC1155
    safeBatchTransferFrom(walletAddress: string, nonce: NumberLike, paymasterAddress: string,                      maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, callGasLimit: NumberLike,                      verificationGasLimit: NumberLike, preVerificationGas: NumberLike, _token: string, _from: string, _to: string, _ids: string, _values: string, _data: string) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    _tokenstringERC20 token address to operate onY
    _fromstringThe _from parameter for 'safeBatchTransferFrom'Y
    _tostringThe _to parameter for 'safeBatchTransferFrom'Y
    _idsstringThe _ids parameter for 'safeBatchTransferFrom'Y
    _valuesstringThe _values parameter for 'safeBatchTransferFrom'Y
    _datastringThe _data parameter for 'safeBatchTransferFrom'Y

    Return Parameter:

    UserOperation

    1. setApprovalForAll Create UserOperation for calling the 'setApprovalForAll' function of ERC1155
    setApprovalForAll(walletAddress: string, nonce: NumberLike, paymasterAddress: string,                  maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, callGasLimit: NumberLike,                  verificationGasLimit: NumberLike, preVerificationGas: NumberLike, _token: string, _operator: string, _approved: boolean) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    _tokenstringERC20 token address to operate onY
    _operatorstringThe _operator parameter for 'setApprovalForAll'Y
    _approvedstringThe _approved parameter for 'setApprovalForAll'Y

    Return Parameter:

    UserOperation

    13. LAT External Functions#

    1. Constructor
    new LAT();

    Input Parameter:

    None

    Return Parameter:

    LAT

    1. transfer Create UserOperation for calling the 'transfer' function of LAT
    transfer(walletAddress: string,        nonce: NumberLike, paymasterAddress: string,        maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, to: string, value: string) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    tostringRecipient's LAT account addressY
    valuestringAmount of LAT to transferY

    Return Parameter:

    UserOperation

    - + \ No newline at end of file diff --git a/PlaTrust-wallet-js-sdk/index.html b/PlaTrust-wallet-js-sdk/index.html index 9a7cb0876..986763f05 100644 --- a/PlaTrust-wallet-js-sdk/index.html +++ b/PlaTrust-wallet-js-sdk/index.html @@ -8,7 +8,7 @@ PlaTrust Wallet js-sdk | PlatON - + @@ -21,7 +21,7 @@ const bundlerEvent = bundler.sendUserOperation(activateOp); bundlerEvent.on('error', (err: any) => { console.log(err); }); bundlerEvent.on('send', (userOpHash: string) => { console.log('send: ' + userOpHash); }); bundlerEvent.on('receipt', (receipt: IUserOpReceipt) => { console.log('receipt: ' + JSON.stringify(receipt)); }); bundlerEvent.on('timeout', () => { console.log('timeout'); });} main();

    PlatON Testnet Configuration#

    TestnetURL: 'https://devnet2openapi2.platon.network/rpc'bundleURL: 'https://testbundler.platon.network'
     walletLogic: '0x3b682b956E65b5F5b8150f75F2235f156A8F4b7B'walletFactory: '0x97429FFFdE9223C92Cb00F66D8352B0642f70FA4' // wallet proxy factory contract addressrelayerManagerAddr: '0xD7998fC16185cC619b0918028D9BBc77A844a880'
    - + \ No newline at end of file diff --git a/PlaTrust_Wallet/index.html b/PlaTrust_Wallet/index.html index 2339586a5..1fc96f728 100644 --- a/PlaTrust_Wallet/index.html +++ b/PlaTrust_Wallet/index.html @@ -8,13 +8,13 @@ PlaTrust Wallet | PlatON - +
    Skip to main content

    PlaTrust Wallet

    Preface#

    Web3 is undoubtedly one of the hottest technology topics in recent years. The key to entering the Web3 world is a private key. However, for many users who are still using Web2, accustomed to logging in with account names and passwords, the concept of a private key can be a hurdle that prevents them from entering Web3. The long string of hexadecimal characters or random mnemonic phrases can be overwhelming. Another problem introduced by private keys is that losing the private key means losing access to assets in Web3, making secure storage of private keys a major concern. Additionally, as the ecosystem of public blockchains expands and more dapps emerge, gas fees have become higher, making it difficult for regular users to participate in Web3 activities due to the high transaction costs. Is there a wallet that allows users to access Web3 without the need to record private keys or mnemonic phrases (seedless) and without incurring huge transaction fees (gasless)? The answer lies in delegating the tasks to others. However, delegating ownership to others can lead to trust issues concerning one's assets in the Web3 world. In this scenario, a multi-signature contract wallet based on EIP-4337 perfectly addresses the pain points mentioned above.

    Main use cases include:

    1. Companies and contracts can safely hold their funds and require the consent of a majority of owners to transfer funds. This way, no single owner can run away with the funds.
    2. Companies can execute sensitive transactions with the consensus of the majority of owners.
    3. Individuals can use multisig to have redundant keys. One feature of multisig is that if you lose one key, you can recover the wallet with the remaining two keys.

    What is PlaTrust Wallet#

    PlaTrust Wallet is a multi-signature contract wallet that follows the EIP-4337 specification. It lowers the barriers for Web2 users to enter Web3 and offers the following main features:

    1. Threshold-based Multisig: Manage assets in a multi-signature form based on the specified threshold.
    2. Session without Multi-Signature: Enable exemption from multi-signature operation within a specific time window to provide convenience for user wallet transactions.
    3. Wallet Lock: Allows wallet locking when owners suspect their account (device) has been compromised (lost, stolen, etc.).
    4. Custom Modules: Support user-defined modules that can be added to the wallet to introduce custom extensions.
    5. Wallet Recovery: Recover the wallet's ownership by replacing the lost private key with a new one through multi-signature initiated by other owners.
    6. Custom Role Control: Users can define different role information to control asset operation permissions in the wallet.
    7. Gasless: Users can operate the wallet without paying native tokens as gas fees.
    8. Wallet Upgrade: Upgrade the wallet to the latest version when new features or significant vulnerabilities arise.
    9. Account Whitelist: Set up a whitelist of accounts, allowing certain accounts to execute cross-account operations or transfers without considering trust issues.
    10. Censorship Resistance: Users have full control over their accounts without relying on any third-party services.
    11. Multi-chain Support: Compatible with all EVM-compatible public blockchains, ensuring the same wallet address across different EVM-compatible chains.

    Feature Overview#

    1. Threshold-based Multisig#

    Explanation#

    PlaTrust Wallet is a multi-signature contract wallet based on the EIP-4337 specification. It supports multiple owners and provides various wallet operations based on a multisig threshold. The concept of multisig is illustrated as follows:

    For each wallet operation (especially asset management), it must be signed by at least the threshold number of owners. Only when the required number of owner signatures is collected, the wallet operation can be successfully executed.

    Functions and Use Cases#

    1. Maximizing Asset Protection when a Private Key is Lost: By holding multiple private keys, users can significantly reduce the risk of asset loss due to the loss or theft of a single private key. Even if one of the private keys is compromised, the funds will still be secure.
    2. Preventing Erroneous Transactions with Multiple Verifications: When a user initiates a transaction, other private key holders can prevent the execution of erroneous transactions by refusing to sign them. The more people involved in the verification process, the lower the possibility of erroneous transactions.
    3. Facilitating Collective Decision Making and Arbitration: When many co-signers jointly maintain the keys, fund control becomes more secure and organized. In this format, only unanimous decisions can be formed and executed, effectively implementing good decisions.
    4. Diversifying the Risk of Theft: By distributing keys across different geographical locations and multiple devices, users create a secure environment. Hackers will be unable to crack multiple distributed keys, thus keeping encrypted assets secure in the hands of users.

    2. Session without Multi-Signature#

    Explanation#

    In certain scenarios, multisig introduces inconvenience for operations. Every time a wallet operation is performed, it requires signatures from the threshold number of owners to be effective. If a user wishes to perform numerous transactions within a specific time window and seeks to exempt from multisig and obtain permission from other owners, this can be achieved by creating a session without Multi-Signature. A session defines a temporary session key held by a specific owner, and as long as the session key is valid, the owner holding the session can use it to bypass multisig and execute any wallet call. The duration of the session is defined by the owner when creating it, and the session key will automatically expire at the end of the session.

    Starting a session requires the number of signatures that satisfy the multisig threshold. The wallet's owners can close a session at any time before its expiration.

    Functions and Use Cases#

    1. Providing Convenience for Operations within a Specific Time Window: During the valid time window, the holder of the session can operate the wallet without requiring other owners to participate in multisig.
    2. Uniqueness: Only one session can exist in the wallet at a given time window, and the session can only be held by the designated owner, with other owners not enjoying exemption from multisig calls.
    3. Expiration: Sessions have a specific time window of validity, and the session key will automatically expire after the validity period.
    4. Interruptible: During the session's validity period, the holder of the session can close the session without multisig, or other owners can close the session through multisig.

    3. Wallet Lock#

    Explanation#

    The wallet supports a lock feature, which allows owners to initiate a locking period when they suspect that their account (device) has been compromised (lost, stolen, etc.). During the wallet's locked period, only specific restricted operations, such as the unlock process, are allowed. All other operations (changing owners, changing multisig threshold, asset transfers, etc.) will be blocked.

    To unlock the wallet before the security period ends, the owner needs to initiate a multisig unlock to trigger the wallet's unlocking.

    Functions and Use Cases#

    1. Protecting Asset Security: When there is a suspicion of security issues with the wallet, it can be locked to prevent potential asset transfers.
    2. Limiting Wallet Operations: When the wallet is under attack, it can be locked to restrict wallet calls.

    4. Custom Modules#

    Explanation#

    In PlaTrust Wallet, users can extend custom functional components to the wallet. By deploying custom module contracts and enabling them in the wallet through the "enable module" function, users can activate custom functional components for the wallet. Users can call functions from custom components and ultimately execute calls from the modules to the wallet using the executeFromModule function. It is important to note that each wallet contract instance will set the EIP-4337 entry contract RelayerManager as the default module during creation, and RelayerManager cannot be removed.

    Functions and Use Cases#

    1. Scalability: Users can append custom functional components to their wallets, facilitating diverse extensions for the wallet.
    2. Plug-and-play: Apart from the built-in EIP-4337 entry contract RelayerManager, other custom modules can be freely enabled and disabled.

    5. Wallet Recovery#

    Explanation#

    Ultimately, a contract wallet still requires an externally owned account (EOA) to perform operations. If the private key of the controlling contract owner is not properly saved, it can lead to a loss of the private key. When the control contract's owner's private key is lost, the user loses control of the wallet. To prevent this situation, the wallet includes a wallet recovery function. When an owner's private key is lost, the user can initiate the wallet recovery function to replace the old private key with a new one and regain control of the wallet. Changing to a new private key requires multisig from other owners in the wallet, and the number of signatures must meet the multisig threshold.

    Functions and Use Cases#

    1. Preventing Users from Losing Access to the Wallet due to Lost Owner Private Keys.

    6. Custom Role Control#

    Explanation#

    In many business scenarios, it is necessary to finely segment the functionality of a wallet based on different permissions, such as what admin users can do, what manager users can do, etc. Fine-grained functional permission has the advantage that different roles can perform different functions, ensuring each role fulfills its own responsibilities. In PlaTrust Wallet, users can add various custom roles and permissions, and specify the functions that can be called by each permission role, achieving fine-grained functional permission control.

    Functions and Use Cases#

    1. Support for Fine-Grained Permission Control.
    2. Convenient for Managing and Extending Permissions.

    7. Gasless#

    Explanation#

    PlaTrust Wallet is a multi-signature contract wallet based on EIP-4337, and the EIP-4337 standard natively supports "meta transactions." When owners of the wallet perform wallet-related functions, they assemble and sign what is called the "User Operation" message, then pass the User Operation to the relevant "Bundler" service for assembling and submitting the User Operation as a blockchain transaction. For wallet owners, they only need to sign the User Operation message with their corresponding owner private keys, without sending actual blockchain transactions. Hence, they do not need to pay any gas fees. For the Bundler service, upon receiving the User Operation and collecting the required multisig signatures, it assembles the User Operation and multisig signatures into a blockchain transaction and submits it to the chain, thereby incurring gas fees. The gas fees advanced by the Bundler are either covered by the tokens held by the wallet itself or filled in by the paymaster. Therefore, for wallet users (owners), PlaTrust Wallet exhibits gasless characteristics.

    Functions and Use Cases#

    1. Allows users to continue using the wallet without being affected by gas fees when gas fees are becoming increasingly high.
    2. Promotes fair extraction of MEV (Miner Extractable Value) and encourages the community to join the construction of layer 2 solutions, especially for operators maintaining the bundler.
    3. Reduces barriers for Web2 users to use wallets.

    8. Wallet Upgrade#

    Explanation#

    The contract wallet itself is a smart contract written by humans, and code written by humans can potentially have vulnerabilities. Once the smart contract is deployed to the chain, it becomes transparent to all users and cannot be easily modified or revoked. Thus, when encountering significant security vulnerabilities or malicious attacks, an upgrade is necessary to fix the flaws. For users, the on-chain address of the wallet remains the same, but the functions have been switched to the logic after the upgrade.

    Functions and Use Cases#

    1. Flexibility in Functionality Changes.
    2. Ability to Fix Security Vulnerabilities.

    9. Account Whitelist#

    Explanation#

    The whitelist of the wallet is designed to facilitate business usage and provide convenience for users based on a certain level of trust. The whitelist is further divided into dapp whitelist and account whitelist. Contracts addresses added to the dapp whitelist can be directly called with trust. Similarly, account whitelist addresses can directly perform transfer operations.

    Functions and Use Cases#

    1. Increased Convenience.
    2. Based on Trust Premise.

    10. Censorship Resistance#

    Users can directly connect the functionality of the wallet to their own applications through the SDK, without relying on any third parties, and can directly use their own wallets.

    11. Multi-chain Support#

    The wallet is deployed using the create2 opcode, which allows for the creation of the same contract address (also called a "counterfactual address") based on the same input parameters. This has the advantage that the wallet address can be known before the wallet contract is actually deployed on various EVM-compatible blockchains, allowing early funding of the wallet. Additionally, in many cross-chain projects, having the same contract address on multiple different blockchains facilitates wallet account management across different chains.

    Reference#

    1. https://eips.ethereum.org/EIPS/eip-4337
    - + \ No newline at end of file diff --git a/PlatEye/index.html b/PlatEye/index.html index fa6764730..5d5b3de57 100644 --- a/PlatEye/index.html +++ b/PlatEye/index.html @@ -8,13 +8,13 @@ PlatEye | PlatON - +
    Skip to main content

    PlatEye

    PlatEye is a professional blockchain explorer for PlatON and Alaya networks. Based on the professional in-depth analysis of on-chain data, it provides the community with massive data and versatile data analysis and query functions. Through PlatEye, you can query information such as blocks, transactions, account addresses, nodes, large account addresses, and large transactions.

    Access to PlatON blockchain:https://www.plateye.com

    Major Technique#

    PlatEye employs Apache Flink, a high-throughput, low-latency distributed streaming data processing framework, for statistics on the latest data. Data that need to be retrieved, e.g. transactions and contracts, are processed and stored in the Elastic Search cluster. Data can be queried and retrieved within milliseconds using the MySql database. The front-end uses the Vue.js framework, while the back-end uses Java, separate from each other in development. The CDN uses Cloudflare. The information on the chain is accessed through the node rpc. Meanwhile, the client needs to be modified to obtain the transactions in the current transaction pool, which is used to work out the relationship between the time the transactions are packaged in the transaction pool and the gas.

    Function Description#

    Home page#

    • The home page of the explorer displays the latest information on the current ATP. The latest block and the list of the lastest transactions are displayed in scroll bars.
    • There is a block/address/transaction search bar where you can query block/address/transaction information through the query function provided by the explorer.

    Query#

    You can query specific information about a block, address, and transaction by entering the block height, address or transaction hash value respectively.

    Address holding ranking#

    PlatEye Browser provides a function to view the ranking of address positions. Addresses can be ranked by total amount, liquidity amount, locked position amount, and total pledged amount. Click on an address to jump to the address details page to see the details of that address.

    Transaction list and transaction details view#

    A list showing all transactions and you can view the detailed information of a given transaction.

    On-chain information monitoring#

    You can view the transaction list and detailed information, monitor large transactions, check lock-up balance and lock-up plans, etc.

    Ranking of nodes and node details#

    You can view the node list. The details page provides the relevant data of the node with a snapshot available for download.

    Token list and transactions#

    You can view the list of PRC20 and PRC721 tokens, with details of the token name, holder and corresponding contract, as well as the list of transactions corresponding to the token.

    Functions under Development#

    Gas station#

    For the statistics of gas consumed and the estimation of gas required for transactions.

    Smart contract module#

    To display smart contracts deployed on the Alaya network, open-source code, contract interface data, etc.

    DApp#

    To display DApps in the current ecosystem and submit a DApp.

    - + \ No newline at end of file diff --git a/PlatON_BlockChain_Browser/index.html b/PlatON_BlockChain_Browser/index.html index 5ce554693..6b5d941cf 100644 --- a/PlatON_BlockChain_Browser/index.html +++ b/PlatON_BlockChain_Browser/index.html @@ -8,13 +8,13 @@ PlatScan | PlatON - +
    Skip to main content

    PlatScan

    Block explorers are your portal to PlatON's data. You can use them to see real-time data on blocks, transactions, validators, accounts, and other on-chain activity.

    • PlatScan -- PlatON blockchain explorer and analysis platform, available in English and Chinese.

    Data#

    Blockchain is designed to be transparent, anyone can verify the data of blocks. The block explorers provides interface to access these data and visualize them.

    Here's a summary of the types of data you can get from a block explorer:

    Blocks#

    Every 1 to 2 seconds, a new block produced in PlatON network, newly generated data will continuously add to the block explorer. The block contains many important data, including:

    • Block height: The id of the block and the length of the blockchain when the current block creates. (block as a unit)
    • Timestamp: The time of the block creation.
    • Transactions:Transaction numbers contained in this block.
    • Block hash: Encrypted hash of the block head, it is the unique identifier of the block.
    • Parent hash: The previous block's hash
    • Producer: The name of the validator node that produced this block.
    • Block reward: The amount of the LAT that rewarded to the validator node which produced this block.

    Transactions#

    The block explorer provides transaction data accurate and in detail, it's very helpful for track transaction progress and checks the detail of the transaction. The transaction data including:

    • TxHash: A hash generated when the transaction is submitted.
    • Status: An indication of whether the transaction is pending, failed or successful.
    • Block Height: The height of the block in which the transaction has been included.
    • Timestamp: The time this transaction included in a block, it's also the time this transaction gets confirmed.
    • From: The address of the account that submitted the transaction.
    • To: The address of the recipient or smart contract that the transaction interacts with.
    • Amount: A total number of LAT being transferred.
    • Transaction fee: The amount paid to the validator to process the transaction (calculated by gas price*gas used)

    Accounts#

    There's a lot of data that you can access about an account. This is why it's often recommended to use multiple accounts so that your assets and value can't be easily tracked. There are also some solutions being developed to make transactions and account activity more private. But here's the data that's available for accounts:

    • Address: The public address you can use to send funds to.
    • Balance: The amount of available LAT associated with the account.
    • Locked-up balance: The amount of unavailable LAT associated with the account.
    • Stakes/Delegations: The amount of staked/delegated LAT associated with the account.
    • Unclaimed Reward: The amount of reward can be claimed by the account from the delegation in which the account participated.
    • Unredeemed delegation: The amount of LAT need to be redeemed when the delegation relationship dissolved.
    • Transactions: A list of all the transactions where this account was either the sender or the recipient.
    • PRC20 Tokens: The information of the PRC20 tokens associated with the account.
    • Delegations: The records of delegations associated with the account.
    • Reward details: The records of the rewards claimed by the account.

    Tokens#

    Tokens are a type of contract, compared to other contracts, token has value and can be traded:

    • Total supply: The number of tokens in circulation.
    • Contract address: The address of the token that was deployed to mainnet.
    • Decimals: PRC20 tokens are divisible and have decimal places.
    • Transfers: The number of times the token has been transferred between accounts.
    • Holders: The number of addresses that hold the token.

    PlatScan token list only display verified token, to get the token verified, please contact: support@platon.network.

    Network#

    By data provide by block explorer, you can intuitive understanding the network status and the status of network economy base on PPOS mechanism.

    • Total transactions: The number of transactions since PlatON network was created.
    • TPS: The number of transactions processable within a second.
    • Circulation: The amount of tradable LAT currently circulate in the network.
    • Total supply – Number of LAT in circulation – new LAT is created with the creation of every block and every epoch complete.
    • Total stakes: The amount of LAT staked by nodes participating validation in the network.
    • Addresses: The number of addresses with transactions history in PlatON network.
    • Ongoing proposal: The ongoing governance proposal in PlatON network.

    Validators#

    Validator take responsibility to create and validate the block, more information about validator refer to this page Introduction of PlatON validator.

    • Total stakes: The amount of LAT staked by validator and delegators.
    • Total delegated: The amount of delegated LAT received by the validator.
    • Delegators: The number of addresses delegating LAT to the validator.
    • Validator annualized yield: Estimated annualized yield base on most recent 4 epochs. (calculated by validator income/validator staking cost * annual epochs count * 100%)
    • Delegated annualized yield: Estimated annualized yield base on most recent 4 epochs. (calculated by delegation income distributed by validator/cost of the delegation received by validator * annual epochs count * 100%)
    • Status: The status of the validator
      • Active: The top 201 nodes can participate in validators election, they also called alternative validator.
      • Candidate: Candidate nodes that can not participate in validators election.
      • Verifying: Node chosen to become the validator of the consensus round, participating block verifying.
      • Producing: Node chosen to become the validator of the consensus round, participating block producing.

    Contributors#

    PlatON blockchain explorer#

    • PlatScan -- PlatON blockchain explorer and analysis platform, support English and Chinese.

    Know of a community resource that helped you? Edit this page and add it!

    - + \ No newline at end of file diff --git a/PlatON_Dev_Faucet/index.html b/PlatON_Dev_Faucet/index.html index 38377d8d9..aa680a0ed 100644 --- a/PlatON_Dev_Faucet/index.html +++ b/PlatON_Dev_Faucet/index.html @@ -8,13 +8,13 @@ DevNetwork Faucet | PlatON - +
    Skip to main content

    DevNetwork Faucet

    1. Usages of DevNetwork Faucet and Test Coin

    We set a faucet on DevNetwork to satisfy the requirements from developer. From faucet you can get the test coins for free. Then use the test coins to test the developing software(s) without loss of real tokens.

    Note:

    The test coins are worthless in real world. They can be used only when you really need to test your software(s) on DevNetwork.

    1. Link of faucet, how to apply for test coins and the rules of application.

    Link to apply for test coins on DevNetwork of PlatON: https://faucet.platon.network/faucet/。

    Note:

    Applying amount of test coins of an e-mail address is limited up to 200 everyday.

    1. The way to apply for huge amount test coins

    If you need to receive large amount of test LAT, please send an email to support@latticex.foundation according to the format requirements. The email requirements are:

    Title: PlatON Develop Network Token ApplicationName:Contact Information:WeChat ID (or other instant messaging software) :Application amount:USES:Receipt account:Remark:
    - + \ No newline at end of file diff --git a/PlatON_Governance_Solution/index.html b/PlatON_Governance_Solution/index.html index ca3bd2ea1..f81e0cb43 100644 --- a/PlatON_Governance_Solution/index.html +++ b/PlatON_Governance_Solution/index.html @@ -8,7 +8,7 @@ Governance mechanism | PlatON - + @@ -20,7 +20,7 @@ Non-referendum proposals are ordinary proposals that are produced by validator votes. The types of proposals can be divided into the following types:

    Governance process#

    governace-flow

    1) Initiate Proposal

    Referendum proposals can be initiated by anyone, and non-referendum proposals are initiated by validators. Each proposal should have a corresponding text description, which is stored in the PIP repository on github and managed by the core developer, similar to EIP.

    To control spam proposals, the initiation of all types of proposals requires a proposal fee as the cost of the proposal. For the referendum proposal, a token is required to be pledged as the deposit of the proposal. Other holders can also attach the proposal by increasing the deposit of the proposal to increase the chance of the proposal entering the voting period. The proposal deposit is returned to the original account when the proposal enters the voting period.

    2) Proposal Screening

    3) Vote for Proposal

    4) Voting results calculation

    When both: validator support rate> P%, Token support rate> Q%, and Token participation rate> K%, the proposal is approved, otherwise the proposal is not approved.

    When both: Validator support rate> M% and validator participation rate> N%, the proposal is voted through, otherwise the proposal fails to vote.

    Note: In the software upgrade proposal, the default validator participation rate is 100%.

    TypeParticipation RateSupport ratio
    Text proposal>50%>=66.7%
    Cancel proposal>50%>=66.7%
    Parameter proposal>50%>=66.7%
    Upgrade proposal=100%>=66.7%

    Upgrade mechanism#

    Overall mechanism#

    The upgrade mechanism is a guarantee that the network can continue to iterate and improve. For different situations that may occur during the operation of the blockchain system, we should provide targeted upgrade methods, mainly in the following four cases:

    Below we will focus on the on-chain voting upgrade mechanism.

    On-chain voting upgrade#

    The upgrade package corresponding to the software upgrade proposal is provided by the developer. The upgrade package must be compatible with the current chain version, and validators can participate in voting after upgrading the local node.

    Initiate Upgrade Proposal#

    The upgrade proposal can only be initiated by a validator. When it is initiated, a fee higher than the ordinary transaction fee must be paid. The following parameters need to be provided in the parameters of the software upgrade proposal:

    There can only be one software upgrade proposal in the chain, that is, when there is already a software upgrade proposal in the voting or under implementation on the chain, another software upgrade proposal cannot be initiated. If you encounter a special reason or emergency at this time and need to initiate a new software upgrade proposal immediately, you can initiate a cancellation proposal to cancel the software upgrade proposal.

    Cancellation proposal description: Cancellation proposal can be initiated only when there is an upgrade proposal being voted on the chain. The following parameters are required to cancel a proposed transaction.

    Vote on Upgrade Proposal#

    After the software upgrade proposal is successfully launched, it enters the voting phase. Only validators can participate in the voting, that is, the voting transaction can only be initiated by the node's pledged account. Before voting, the local node must be upgraded to count votes by one person and one vote.

    We did not set voting options for "support", "oppose", and "abstain" in the voting transaction for the software upgrade proposal, but expressed our position through node behavior, as follows:

    The following parameters are required to upgrade the proposal voting transaction:

    Although the node has been upgraded during the voting period, the logic currently running is still the logic of the old version. Wait until the implementation is complete before switching to the new version of the logic.

    Statistics on voting results of upgrade proposals#
    upgrade-statistics

    The voting result of the upgrade proposal is highly counted at the voting deadline block. If the voting situation in the voting cycle is as shown above:

    Then the final support rate: $SR=\frac{100%\times \sum_{i=1}^{n}M_i}{\sum_{i=1}^{n}P_i-P_1\cap P_2 \cap ... \cap P_n}$

    If $SR \geq 66.7%$, the proposal is voted through and the implementation phase is entered.

    Upgrade Proposal Implementation#

    Due to the randomness of VRF selection of candidate nodes and in order not to affect consensus, we need to ensure that the verification nodes in a consensus round are all upgraded nodes when implementing the upgrade.

    Therefore, when the proposal voting deadline is high, the proposal's approval rate reaches 66.7%, then the upgrade will be implemented in the first block of the next consensus round, and no non-upgraded nodes will no longer be selected to participate in the consensus. In the current settlement cycle, the eliminated non-upgraded nodes will just not be selected by VRF to participate in consensus, but still enjoy the pledged benefits of the current settlement cycle.

    Release Statement#

    As there may be data incompatibility between different versions, in order to avoid consensus failure due to version issues, the node version on the chain should be controlled, so we introduced a version declaration. A node initiates a version statement to indicate that its node version is consistent with the target version number in the current chain version or software upgrade proposal vote, so that it can have the opportunity to participate in consensus normally before and after the upgrade.

    Only candidate nodes and validator nodes can initiate version declarations. Newly added nodes need to be candidates before they can launch a version statement. The conditions for each stage version declaration are as follows:

    version-declare

    When the node version and the version on the chain are inconsistent (the first two digits of the version number are different), the node will not be selected to participate in the consensus, even if the pledge is high, at this time, the node can declare that its node is consistent with the chain version by initiating a version declaration transaction. In order to participate in consensus in the subsequent settlement cycle. When there is a voting software upgrade proposal on the chain, a version statement consistent with the upgrade version can be issued. The version statement does not represent a vote. After the upgrade proposal is voted through, the node that has the same version number as the upgrade destination is declared without voting. Can participate in consensus normally.

    Quick Upgrade#

    Initiating an upgrade vote on the chain is a serious matter. In theory, there should be no possibility of revoking the proposal. All the results should be submitted to the verifier to vote. However, we only allow one software upgrade proposal to be voted on the chain, so when an emergency situation needs to be upgraded quickly, if there are unprocessed proposals on the chain, it will directly affect the emergency processing speed. From this we introduce the cancellation proposal, which is initiated by the validator. The voting cycle can be determined by itself, but it must be within the voting cycle of the cancelled proposal. By initiating the cancellation proposal and the quick response of each node, the software upgrade proposal that is being voted on can be cancelled in a short time, thereby implementing the emergency plan quickly. Cancellation proposals can only be initiated when there is an upgrade proposal being voted on the chain. Cancellation proposals must be implemented once they are initiated, so we encourage the use of cancellation proposals only in emergencies.

    The following parameters are required to cancel a proposed transaction:

    Governance parameters#

    Alternative nodes can modify some system parameters by initiating a parameter governance proposal. To avoid problems caused by the cross-implementation of parameter proposals and upgrade proposals, when there are voting upgrade proposals or parameter proposals on the chain, it is not allowed to initiate new parameter modification proposals. The parameter proposal voting cycle is two weeks. As of now, the governance parameters we support are as follows:

    Keydescriptionrange
    stakeThresholdThe minimum number of staking tokens to become alternative node candidates[10w,1000w] LAT
    operatingThresholdMinimum number of tokens for each delegation and redemption by the client[10, 10000] LAT
    maxValidatorsNumber of alternative nodes[43, 10000]
    unStakeFreezeDurationVerify the number of settlement cycles when the node exits and the pledged money is frozen(maxEvidenceAge,336] Epoch
    rewardPerMaxChangeRange"Reward Rate of Commitment" The maximum range of rewards that can be adjusted per revision (‱)[1,2000]
    rewardPerChangeIntervalThe "Delegate Rewards Ratio" allows you to change the number of settlement cycles that need to wait again[2, 28]
    Keydescriptionrange
    slashBlocksRewardWhen the block generation rate is 0, the number of blocks rewarded by the reduced block[0, 50000) blocks
    slashFractionDuplicateSignProportion of penalty node own staking when dual signing behavior was reported(‱)(0,10000]
    duplicateSignReportRewardWhistleblower reward ratio(%)(0, 80]
    maxEvidenceAgeNumber of valid settlement cycles for evidence reported by dual signing(0, unStakeFreezeDuration)
    zeroProduceCumulativeTimeThe number of continuous consensus rounds of zero block out, and the number of zero block out is accumulated within this time[zeroProduceNumberThreshold , 50]
    zeroProduceNumberThresholdZero block times penalty threshold[1,zeroProduceCumulativeTime]
    ZeroProduceFreezeDurationNode zero block penalty is locked time[1, unStakeFreezeDuration)
    Keydescriptionrange
    MaxBlockGasLimitBlock GasLimit dynamically adjusts the maximum Gas limit that can be reached[9424776, 300000000] gas
    Keydescriptionrange
    increaseIssuanceRatioPercentage of annual increase in Platon Network LAT issuance (‱)[0, 2000]
    Keydescriptionrange
    minimumReleaseThe minimum value of the release amount in the release cycle of the lockup plan[100, 10000000]

    Reward and punishment mechanism#

    When designing a governance mechanism, a good system is needed to encourage more interested and capable professionals to participate in governance, and at the same time punish malicious acts such as occupying network resources.

    Reward#

    Punishment#

    If the dishonest node achieves the upgrade by disguising the version, when the chain upgrade is successful, the validator is selected to participate in the consensus, and the block generation rate will be low because the block cannot be consensus, which will result in system punishment. You can directly disqualify the node.

    Governance Fund#

    The governance fund comes from the foundation, and a fixed percentage of funds are transferred from the foundation's account to the governance account each year, and the balance of the governance account is allocated by way of voting on proposals for incentives and salary distribution. When the proposal is voted through, it will be automatically issued through multiple signatures.

    - + \ No newline at end of file diff --git a/PlatON_Overall_Solution/index.html b/PlatON_Overall_Solution/index.html index dd38dae52..b8bf8c898 100644 --- a/PlatON_Overall_Solution/index.html +++ b/PlatON_Overall_Solution/index.html @@ -8,7 +8,7 @@ Architecture | PlatON - + @@ -21,7 +21,7 @@ Responsible for production and verify blocks, validator nodes are randomly selected through PPoS + VRF, and run the CBFT protocol for consensus.

    Decentralized Application#

    To deploy DAPP applications (including blockchain), the following servers need to be deployed in the intranet environment:

    Validator pool#

    The validator pool deploys multiple validator nodes, and it is recommended to connect to the internet through a public front-end full node. For specific security deployment solution, see validator deployment.

    Operations platform#

    The Operations platform synchronizes all blocks, transactions, and events through a full node and perform monitoring.

    PlatScan Block Browser#

    The PlatScan block browser synchronizes all blocks, transactions, and events through a full node, and displays data such as blocks and transactions. The PlatScan block browser requires the following servers to be deployed:

    ATON wallet server#

    ATON is a mobile wallet which implements key management, signing transactions forwarded to the chain through the ATON server. The data including transaction, block, validator on the chain are synchronized by the ATON server through the full node and pushed to the mobile client. ATON wallet server needs to deploy the following servers:

    Validator Deployment#

    node_deployment

    Appropriate measures should be taken to ensure the security of validator for running stably:

    Core Modules#

    P2P Network#

    The basic implementation of PlatON network is a decentralized structured topology completely based on RELOAD (Resource Location And Discovery) protocol and the Kademlia protocol [Kademlia]. The overall PlatON network structure is shown as follows.

    p2p_protocal_stack

    Link Layer#

    The Link Layer ensures the secure transfer of data. A variety of transmission protocols are employed to prevent eavesdropping, tampering and spoofing; to provide secure and authenticated connections; and to verify the source of messages and ensure the integrity of the data.

    Transport Layer Security (TLS) and Datagram Transport Layer Security (DTLS) are implemented on this layer.

    Forwarding and Connection Management#

    The Forwarding and Connection Management layer stores and implements the Routing Table by providing packet forwarding services between nodes. It also handles establishing new links between nodes, setting up connections for overlay links across NATs using ICE.

    Topology Plug-in#

    RELOAD is a P2P network framework that supports the development of different topology algorithms for implementing a fully-distributed non-structured topological or fully-distributed structured topological network.

    The Topology Plug-in is responsible for implementing the specific overlay algorithm being used. It uses the Message Transport component to send and receive overlay management messages, the Storage component to manage data replication, and the forwarding and connection management layer to control hop-by-hop message forwarding.

    The Topology Plug-in allows RELOAD to support a variety of overlay algorithms. PlatON implements a DHT based on Kademlia algorithm.

    Data Storage#

    The Data Storage Layer is responsible for processing messages relating to the storage and retrieval of data. It talks directly to the Topology Plug-in to manage data replication and migration, and it talks to the Message Transport component to send and receive messages.

    The base RELOAD protocol currently defines three data models: single value, array and dictionary.

    Message Transport#

    The Message Transport layer is responsible for handling end-to-end reliability.

    PlatON uses RELOAD as the basis for developing a Regional Flooding algorithm that broadcasts messages quickly throughout the entire network.

    Application Layer#

    The communication and storage capabilities of the RELOAD base layer are used to provide service discovery and scaling as well as routing, computing, data, storage and blockchain services based on service discovery.

    Service Discovery#

    PlatON uses ReDiR (Recursive Distributed Rendezvous) [RFC7374] to implement the service discovery mechanism. ReDiR can support tens of thousands of service provider nodes and service query nodes.

    ReDiR Tree#

    ReDiR uses a tree structure to implement the P2P service discovery mechanism. At the same time, the storage capacity of the RELOAD overlay network is used to save the data. Each type of service is stored as a ReDiR tree, and the tree nodes save the information of the service providing nodes. When a node requests to find a specified service provider, a limited number of searches in the ReDiR tree can find the service provider node that best matches the requesting node.

    Each tree node in the ReDiR tree contains a dictionary of entries of peers providing a particular service. Each tree node in the ReDiR tree also belongs to some level in the tree. The root node of the ReDiR tree is located at level 0. The child nodes of the root nodes are located at level 1 of the ReDiR tree. The child nodes of the tree nodes at level 1 are located at level 2, and so forth.

    The number of nodes in each layer of the ReDiR tree depends on the branching factor b. Each layer can hold up to $b^{level}$ nodes. Each node is uniquely identified by $(level, j)$, where $level$ is the node location.The number of layers, $j$ means that the node is the $j$ node in the corresponding layer. In each layer, $b^{level}$ tree nodes divide the $level$ layer into $b^{level}$ KEY spaces.

    All services providers are mapped into corresponding key space. A tree node is responsible for the storage of each key space. Tree node contains key space

    $(2^{BitsInKEY}b^{-level}(j+\frac{b'}{b}), 2^{BitsInKEY}b^{-level}(j+\frac{b'+1}{b}))$

    for $0 ≤ b′ < b$, and the resource ID stored in the tree node $ (level, j) $ is $ID = hash(service, level, j)$.

    Service Registration#

    A node $n$ with key $k$ use the following procedure to register as a service provider in the RELOAD Overlay Instance:

    In the same way, node $n$ also performs a downward walk from level $l = l_{start}$ recursively until the following condition is satisfied:node $n$ is the only service provider in the tree node responsible for key space $I(l, k)$.

    Service Refresh#

    All state in the ReDiR tree is soft. Therefore, a service provider needs to periodically repeat the registration process to refresh its Resource Record. If a record expires, it must be dropped from the dictionary by the peer storing the tree node.

    Service Lookup#

    A service lookup is similar to service registration. It also starts from an initial layer $l = l_{start}$. At each step gets the list of service nodes in the current KEY space $I(l, k)$, and it is processed as follows:

    Account Model#

    Compared with the account model, UTXO does not support smart contracts, and many DAG projects are actively exploring smart contracts, but there is no mature and stable solution. Therefore, PlatON chooses mature and stable account models that support smart contracts. In PlatON, each account has a state associated with it and a 20-byte address. There are two types of accounts:

    Data Storage#

    In the original bitcoin blockchain, only ordinary transfer transactions need to be stored. Bitcoin is based on the UTXO model, which means that all the information stored on the chain is UTXO except for block-related information (hash, nonce, etc.) Smart contracts are generally supported in the blockchain 2.0 public chain represented by Ethereum. The content stored in the contract can be arbitrary. In addition to account-related information (such as tokens), users can also send text and pictures , videos, and so on.

    In some chains (such as Ethereum), in order to ensure data integrity, some state data (or historical data) is usually stored on the chain. These data are only useful in the corresponding block (height), and there is no other height. It is useful. The advantage of doing this is that at any time, I can trace what the full picture of the ledger looks like at a certain height in history, but the disadvantages are also obvious: the cost of storage is high. Therefore, there is a public chain storage solution similar to EOS. In addition to storing only the latest status data, EOS also uses the star file system to share the pressure on storage.

    PlatON believes that on-chain storage requires full consideration of costs. Only valuable information that requires consensus among all ledgers should be stored on the public ledger. Valuable information includes: blocks, transactions, and account data. For some information in the economic model, such as the validator list of the current consensus round, the candidate list, and the current block rate of each node, it is only necessary to store the latest data.

    PlatON's storage is divided into account data storage (statedb) and snapshot storage (snapshotdb).

    Account data storage (statedb)#

    PlatON's account data storage references Ethereum's MPT tree storage model, as shown below:

    MPT_tree_storage_model

    In PlatON, all account-related state information is stored and retrieved through StateDB. To support fast data query and block rollback operations, StateDB uses the MPT structure as its underlying storage method. All nodes in the MPT will eventually be stored in the disk database as key-value.

    statedb

    The top layer is StateDB. StateDB is responsible for making the most preliminary records of the data. The next layer is the Trie layer. Trie is responsible for structuring all data and subsequent operations such as rollback of storage queries. There are two types of Trie, State Trie and Storage Trie. The former is a status tree that records basic information such as the balance nonce of all accounts. The latter is used to record various contract storage data. There is only one state tree and many storage trees, because each contract has its own storage tree. Trie is TrieDB. TrieDB stores the order of the nodes in Trie in memory. TrieDB's main function is to act as a cache layer before finally inserting data into the hard disk. The last link in the entire structure is the database leveldb on the final hard disk.

    Snapshot Data Storage (snapshotdb)#

    Considering storage cost and read performance, part of the data in PlatON only retains the final state, which is stored and retrieved through snapshotdb. The data in snapshotdb will be finally stored in the disk database in the form of key-value.

    snapshotdb

    among them:

    Consensus mechanism#

    The scalability trilemma posits that blockchains in which every node processes every computation and in which every node comes to consensus about the order of those computations can have two of three properties: safety, scalability, and decentralization of block production.

    As a trade-off, PlatON uses a BFT-Style PoS mechanism.

    consensus_mechanism

    PlatON consensus runs in three stages:

    In PlatON, every LAT holder can participate in PPoS.

    For an LAT holder who wants to become a validator, he/she must stakes more than a pre-specified minimum number of LATs to first become an alternative validator candidate. One staked LAT means one vote, which must be voted for himself and no one else. In other words, alternative validator candidates aren’t allowed to vote for each other.

    Other LAT holders who want to participate in the election of alternative validators must stake LATs too. The number of LATs locked against them must be greater than or equal to 10 LATs. They can vote for any alternative validator candidates they choose.

    After all the votes are cast, alternative validator candidates are ranked according to how many votes they received. A pre-specified number of candidates receiving the most votes become alternative validators. The LATs staked by alternative validators and their supporters remain staked until the end of a pre-specified lock-up period. For other candidates and their supporters, their staked LATs can be un-staked immediately after the election. They won’t participate in current round of PPoS anymore and won’t get any compensation, either.

    The VRF is used to select a pre-specified number of validators within all the alternative validators. The details of the VRF are very complicated. But it is equivalent to the following experiment.

    Firstly, imagine every vote received by each alternative validator as a ball. Mark different alternative validators by different colors, and mix all the balls together. Secondly, randomly draw a ball from the pool, record its color, and put it back. Repeat this step for many times. Thirdly, count the color distribution of the balls drawn from the pool. Those alternative validators corresponding to the colors with the most occurrences become validators.

    It can be proved that the more votes an alternative validator receives, the more likely it will be selected by the VRF as a validator. However, the VRF introduces a considerable level of randomness. The validators selected may not correspond to the alternative validators with the most votes.

    Smart contract#

    From a technical perspective, PlatON is essentially a decentralized FaaS (Functions as a Service) platform. Accordingly, smart contracts can be considered as functions on FaaS. Smart contracts in PlatON fall into three categories.

    smart_contract

    Solidity Contract#

    Solidity contract Supports development using solidity language, compiled into evm bytecode for execution. The transactions that trigger the solidity contract are packaged by validators, and nodes across the network repeatedly perform verification. The status of solidity contracts is kept in the statedb.

    WASM Contract#

    Wasm contract Supports high-level language development, compiled into WASM bytecode for execution. The transactions that trigger the Wasm contract are packaged by validators, and nodes across the network repeatedly perform verification. The status of the Wasm contract is kept in the statedb.

    WASM Virtual Machine#

    PlatON uses wagon as the PlatON virtual machine. As a PlatON virtual machine, it needs to be transformed. To implement external functions on the chain and how GAS is calculated.

    Toolchain#

    PlatON first supports C ++ as a smart contract writing language, and gradually provides mainstream high-level development languages ​​such as Rust and Go. The following tool chains are provided for C ++:

    WASM contract execution process#
    wasm_compile_pub_tx
    GAS Billing for WASM Contracts#

    The execution of the WASM contract is performed in accordance with the called WASM instruction for GAS billing. Different WASM instructions have different GAS. The GAS value of the specific WASM instruction is supplemented later.

    Privacy Contract#

    Privacy contract scheme#

    The privacy contract also supports high-level language development, which is compiled into llvm ir intermediate language for execution. The input data of the privacy contract is stored locally in the data node, and the data node is secretly shared to multiple random computing nodes. The computing node performs privacy computations in a secure multi-party computing manner off-chain, and submits the computation results to the chain.

    privacy_contract
    Privacy contract execution process#
    privacy_contract_flow

    VC Contract#

    The development and release of a verifiable contract is no different from a Wasm contract, and it is eventually compiled into a WASM implementation. The state transition of the verifiable contract is performed asynchronously by the computing nodes off-chain. After the computation is completed, new states and state transition certificates are submitted to the chain. The nodes on the entire network can quickly verify the correctness and update the new state to the public ledger. Verifiable contracts can support complex and heavy computation logic without affecting the performance of the entire chain.

    Verifiable contract scheme#

    PlatON's verifiable solution is temporarily based on the zk-SNARK algorithm, and it is gradually replaced with a more optimized algorithm in the future.

    verifiable_contract
    Verifiable contract execution process#
    verifiable_contract_flow
    Incentive model#

    Users who need computing outsourcing need to mortgage the appropriate fees to the contract account first, and each computing node can compete for the computing task by itself (the order-changing model will be changed to the random ordering model later). Once the computation is successful, the result and proof are generated, and set_result is initiated. For a transaction request, the computing node needs to pay the miner fee for the transaction first. The node receives the request and executes set_result. Once the proof and result parameters carried in the transaction are verified, the transaction requester successfully calculates the result and the contract account will be mortgaged. Fees are transferred to the requester's account, failure will not be rewarded.

    - + \ No newline at end of file diff --git a/PlatON_Overview_DevGuide/index.html b/PlatON_Overview_DevGuide/index.html index 4f644ff26..ee36fb628 100644 --- a/PlatON_Overview_DevGuide/index.html +++ b/PlatON_Overview_DevGuide/index.html @@ -8,13 +8,13 @@ Development guide | PlatON - +
    Skip to main content

    Development guide

    PlatON is compatible with EVM and WASM virtual machines, so it can support contract development in more high-level languages, lowering the learning threshold for contracts while improving performance in processing contract transactions.This significantly lowers the learning curve for writing contracts, while improving performance for processing contract transactions. The documentation in this section helps developers quickly write, deploy, and debug contracts on the PlatON network, and develop various Dapp applications based on contracts.

    What is Dapp?#

    Dapp (Decentralized Application) is a decentralized application built on the blockchain.

    How to develop a Dapp?#

    From the developer's point of view, a Dapp application is essentially a process of interacting with a contract. You can call the contract directly through the web side, or you can interact with the contract through SDKs. The whole development process is roughly divided into three major processes: development environment preparation, contract development, front-end and back-end development.

    Development environment preparation#

    • Private Network-Build a private node or network locally, which can help you quickly develop and debug local applications.
    • Dev Network-Access to dev network can help you test your code in a more open environment.
    • Main_Network-When you are done testing on the private and development networks, you can seamlessly migrate to the PlatON main network and start using the application seamlessly.

    Contract Development#

    PlatON supports dual virtual machines, Wasm and EVM, so developers can choose their contract development language based on their area of expertise.

    Solidity Contract Development#

    • Getting Started with Development - You can learn how to deploy, compile, publish, and invoke contracts on the PlatON network
    • Best Practices - How to set reasonable fees, how to avoid deducting fees for failed transactions, and other contract writing specifications
    • Development Costs-Introduce the cost of fees for Slolidity contract deployment calls on PlatON and the comparison analysis with Ether fees.
    • Security Guide-Introduces how to improve the security of contracts
    • Contract Migration-In addition to writing your own contracts, you can also migrate contracts from Ether or other public chains that support Solidity contracts to PlatON network
    • System contract call-How to call system contract in Solidity contract

    WASM Contract Development#

    WASM contract currently only supports C++ language development, but you are welcome to continue to extend the contract in other major languages.

    • Getting Started-Introducing how to compile and publish calls to Wasm contracts on PlatON
    • Development Costs-Introduce the cost of Wasm contract deployment invocation on PlatON and the comparison analysis with Ether contract fees
    • Best Practices-Introduction to how to set reasonable fees, how to avoid deducting fees for failed transactions, and other contract writing specifications
    • Wasm API

    Front-end or back-end development#

    If you want to interact directly with the contract through the web front-end, please refer to the following documentation.

    • Samurai API - provides support for web wallet development
    • JS SDK-How to use JS to interact with contracts or PlatON network

    If you want to interact with a contract or PlatON network by writing backend code, the following SDKs in different languages can help.

    How to publish PRC Token?#

    Since PlatON inherits the EVM virtual machine, theoretically it can be compatible with all the Tokens of the Ethernet standard protocol, currently the commonly used Token protocols are PRC-20 and PRC-721.

    - + \ No newline at end of file diff --git a/PlatON_Solution/index.html b/PlatON_Solution/index.html index bd20378d1..5ba47d8ed 100644 --- a/PlatON_Solution/index.html +++ b/PlatON_Solution/index.html @@ -8,7 +8,7 @@ PlatON Consensus Solution | PlatON - + @@ -31,7 +31,7 @@

    B synchronizes the blocks produced based on A8 and A9 to other nodes at the same time. If other nodes receive all new blocks at the same time:

    ABCD
    D7(QC) commitD7(QC)commitD7(QC)commitD7(QC)commit
    A8(QC)lockA8(QC)lockA8(QC)lockA8(QC)lock
    A9(QC) B9:A8A9(QC) B9:A8A9(QC) B9:A8A9(QC) B9:A8
    B10:A8 B10:A9B10:A8 B10:A9B10:A8 B10:A9B10:A8 B10:A9
    B11:A9B11:A9B11:A9B11:A9

    After consensus, there are three possible outcomes:

    Review and Summary#

    This article discusses the current common BFT-type consensus algorithms, and proposes a CBFT protocol that can be more suitable for the public network environment. It can greatly improve the speed of block confirmation and satisfy the blockchain on the premise of meeting safety and liveness. There is a growing need for consensus speed.

    References#

    [1] M. J. Fischer, N. A. Lynch, and M. S. Paterson, "Impossibility of distributed consensus with one faulty process," J. ACM , 1985.

    [2] L. Lamport, R. Shostak, and M. Pease. The Byzantine Generals Problem. ACM Transactions on Programming Languages and Systems, 4 (3), 1982.

    [3] M. Castro and B. Liskov. Practical byzantine fault tolerance. In OSDI, 1999.

    [4] E. Kokoris-Kogias, P. Jovanovic, N. Gailly, I. Khoffi, L. Gasser, and B. Ford, “Enhancing Bitcoin Security and Performance with Strong Consistency via Collective Signing,” 2016.

    [5] TEAM T Z. Zilliqa TechnicalWhitepaper [J]. Zilliqa, 2017: 1–8.

    [6] Guy Golan Gueta, Ittai Abraham, Shelly Grossman, Dahlia Malkhi, Benny Pinkas, Michael K. Reiter, Dragos-Adrian Seredinschi, Orr Tamir, Alin Tomescu, "a Scalable and Decentralized Trust Infrastructure", 2018.

    [7] C. Unchained, “Tendermint Explained — Bringing BFT-based PoS to the Public Blockchain Domain.” [Online]. Available: https://blog.cosmos.network/tendermint-explained-bringing-bft-based-pos-to-the-public-blockchain-domain-f22e274a0fdb.

    [8] M. Yin, D. Malkhi, M. K. Reiterand, G. G. Gueta, and I. Abraham, “HotStuff: BFT consensus in the lens of blockchain,” 2019.

    [9] “EOS.IO Technical White Paper v2.” [Online]. Available: https://github.com/EOSIO/Documentation/blob/master/TechnicalWhitePaper.md.

    [10] Dan Boneh, Manu Drijvers, Gregory Neven. "BLS Multi-Signatures With Public-Key Aggregation", 2018.

    - + \ No newline at end of file diff --git a/PlatON_Validation_Introduce/index.html b/PlatON_Validation_Introduce/index.html index cb6f6a923..2a06a16ad 100644 --- a/PlatON_Validation_Introduce/index.html +++ b/PlatON_Validation_Introduce/index.html @@ -8,7 +8,7 @@ Intro to validator | PlatON - + @@ -16,7 +16,7 @@
    Skip to main content

    Intro to validator

    What is a validator?#

    PlatON is a blockchain project that implements democratic governance. Validators are jointly selected by all LAT holders to maintain and develop the PlatON network. The 201 nodes with the most votes will become alternative nodes, from which 43 validators will be randomly selected by VRF to participate in the management of the entire PlatON network. The responsibilities of a validator are:

    • Maintaining PlatON nodes and network
    • Production and validating the blocks
    • Proposal voting and decision-making

    Basic requirements to become a validator#

    Minimum staking requirements#

    Minimum staking of 100,000 LAT is required and additional staking can be made, but all staking can only be canceled at once. If the actual staking is lower than the minimum staking due to penalties or other reasons., the node will automatically be removed from the list of alternative node candidates.

    Recommended configurations#

    • Server: Server or backup server running PlatON software (firewall required)
    • Memory: 16GB RAM
    • Local storage: 100GB system disk, 200GB data disk (online scalable)
    • Processor: 64-Bit 4 core (each core 2.4 GHz or higher)
    • Bandwidth: 5 MB/s (online scalable)

    Software requirements#

    • Linux: Ubuntu 18.04 or higher
    • Clock synchronization: NTP
    • User tools: Node management tools (mtool or other open sources/ self-developed tools)

    Operation requirements#

    • Network monitoring and real-time support
    • 99.9% uptime
    • Cross-regional failure recovery and data backup
    • Safety and security measures
    • Support software upgrade

    How to be a validator?#

    Firstly, make sure you have a balance of 100,000 LAT in your staking account, locked or unlocked. Secondly, you have to own a server with recommended configurations mentioned above. When you meet the above two conditions, staking can be made Become a mainnet validator.

    Please refer to Role Description for node-related terms and role descriptions.

    What rewards will I get for being a validator?#

    Source of reward#

    The source of reward consists of two parts:

    • Offerings: Each year, 2.5% of the total of the previous year is offered in increments, and 80% of the offerings (which is 2% of the total) enter the reward pool
    • Foundation subsidy: Equivalent to 3% of the total initial allocation. Allocated in the first 10 years. Keep the node reward pool the same every year

    Node Rewards#

    Node reward consists of three parts:

    • Block generation reward: For each block produced, the validator will receive a fixed amount of LAT as a reward. 1/2 of the total annual node reward pool is used as block generation reward, which is distributed evenly based on the number of blocks per year (about 28,688,727).
    • Transaction Fee: The fees for packaging transactions are all charged by validators who package the blocks.
    • Staking reward: 1/2 of the total node reward pool is used as Staking reward, which is distributed evenly based on the number of Staking epochs per year (about 2668). Each staking epoch is (10,750 blocks, around 3 hours). Upon completion, the reward is distributed evenly to all alternative nodes.

    Delegator reward#

    Staking rewards are issued to validators and alternative nodes, which will distribute them to the relevant delegators according to the set dividend proportion.

    What acts will be punished#

    Zero block generation penalty#

    • A consensus round is selected as a validator, and if no blocks are produced or all blocks produced are not confirmed by other validators, it is determined that there are zero blocks generated;

    • Zero blocks were generated in a consensus round. If no blocks are produced in the following 20 consensus rounds (about 2 hours and a half), there will be a penalty equivalent to the block generation rewards of 2500 blocks, and the node qualification will be restricted. If the staking is less than 100,000 LAT after the penalty, the status as an alternative node candidate will be revoked.

    • A consensus round is selected as a validator, and if no blocks are produced or all blocks produced are not confirmed by other validators, it is determined that there are zero blocks generated;

    • If a node generates zero blocks in a consensus round and does not produce blocks for the next 20 consensus rounds (about 2 hours and a half), it will receive the penalty, which is a deduction of LAT equivalent to the block generation rewards of 2500 blocks,

    Dual signing#

    • Producing or signing multiple blocks in the same block height is deem as dual signing;
    • Except for the revocation of nodes, a dual signing requires a deduction of 10‰ of its staking;
    • Anyone can report a dual signing, and after the current validator verifies and reaches consensus, the reported person will be recognized as a violation and punished. 50% of the penalty is given to the informer and 50% is placed in the reward pool for the next year's block generation and Staking rewards.

    Restrict the status for nodes: Temporary disqualification of the nodes, locking 56 epochs, during which period one cannot be a validator and cannot participate in block generation, and there will be no Staking rewards. Revocation of nodes: The staking is forcibly unsecured and the violator would be kicked out from the list of alternative node candidates. The staking LAT is returned to the original staking account after 168 Epochs, and cannot be re-staked as a new node during the pledge freeze period, and the original delegation relationship is abolished after re-staking. Deduct Staking LAT: Deduct LAT from the staking of the node and place the amount into the reward pool for block generation and staking rewards in the second year. If the staking is less than 100,000 LAT after the penalty, the node would be revoked.

    How to participate in the governance#

    In PlatON, governance is done through on-chain proposal voting with the following types of proposals:

    • Text proposal: Decisions that could be implemented without code can be initiated with a text proposal.

    • Upgrade proposal: Used for initiating version upgrade voting on the chain for smooth upgrade purposes.

    • Parameter proposal: Used for modifying the governable parameters such as system parameters.

    • Cancel proposal: Used for canceling a software upgrade or parameter modification proposal which is being voted on the chain.

    - + \ No newline at end of file diff --git a/PlatON_system_contract/index.html b/PlatON_system_contract/index.html index ae3121819..3bbfa7d4c 100644 --- a/PlatON_system_contract/index.html +++ b/PlatON_system_contract/index.html @@ -8,13 +8,13 @@ System contracts | PlatON - +
    Skip to main content

    System contracts

    After the chain is started, some contracts have been built in the system. The addresses of these contracts have been fixed and the functions have been implemented. Some of the contracts are the realization of economic models, and various contract interfaces are provided to interact with the client.

    Staking contract#

    contract address:lat1zqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzsjx8h7

    PlatON's network based on the PoS mechanism relies on a set of verifiers to keep it running properly. Validators participate in consensus blocking among nodes and receive blocking and staking revenue. To become a verifier, one needs to staking at least 100,000 LAT to the Staking contract and have a running node.

    Delegates are those LAT holders who cannot or do not want to become a verifier. They can delegate LAT to the verifier and receive the proceeds. The LAT delegated by the principal to the verifier is only transferred to the Staking contract, not transferring their own LAT to the verifier, and the principal holds the ownership of the delegated LAT from the beginning to the end. If it is already a validator, it will not be able to become a principal again.

    The interaction between the validator and the delegator is mainly done through the Staking contract. The Staking contract has the following functions:

    • Staking nodes become validators
    • Modify validator information
    • Remove the pledge and exit the validator list
    • Query verifier information and other operations
    • Delegated validator
    • Reduced holdings entrusted
    • Query Staking information

    Contract interface#

    1. Create verification node

      This interface is used to make a node an authentication node by staking LAT to the Staking contract. Before staking, you need your own node to access the network and make sure that the node private key and bls private key are stored safely. When staking, you have to fill in the node information, the revenue account for receiving the block reward and the pledge reward, the reward share for the principal (the more the share, the more likely to attract more users to the principal), the amount of LAT you want to pledge (there is a threshold of 100,000 LAT for the pledge, if it is lower than that amount, the pledge will fail), and other information. If the pledge is successful, the pledge is transferred from the balance of the user account/locked contract account to the Staking contract and the node will participate in the election to become a block-out node in the next epoch. The total weight of the verifier is equal to the total amount of LAT pledged by itself plus the total amount of LAT delegated, and the higher the total weight the higher the probability of being elected as consensus.

      Interface parameters reference Java SDK: create validation node.

    1. Modify verification node information

      This interface is mainly used to modify the validator's income account, delegated share ratio, node information, etc. The interval for each modification of the share ratio must be greater than 10 consensus periods, and the magnitude of each modification cannot be greater than 5%.

      Interface parameters reference Java SDK: Modify verification node information.

    2. Increase the node Staking amount

      This interface is used to increase the node Staking amount and increase the node weight. The minimum amount of each increase is 10LAT. The validator’s new weight will take effect in the next epoch.

      Interface parameters reference Java SDK: Increase the node Staking amount.

    3. Release staking

      This interface is mainly used to exit the verification node. The user cannot reduce the staking and can only exit the staking completely. When a staking is released, the staking is unlocked according to the following rules.

      • The release of staking is in the same epoch as the staking/addition, and the related staking will be returned to the user's staking account from the Staking contract in real time.

      • If the release of the staking is not in the same epoch as the staking/addition, the staking will be locked for 168 cycles and then returned from the Staking Contract to the user's account at the time of the staking.

      After initiating a release of staking, the node will not be selected as a validator to participate in consensus.

      Interface parameters reference Java SDK: Release staking.

    1. Query the validator list of the current epoch

      This interface is used to query the validator information of the current epoch. At the end of each epoch, the list of validators for the next epoch will be updated based on the total weight of all candidate validators.

      Interface parameters reference Java SDK: Query the validator list of the current epoch.

    1. Query the list of validators in the consensus round

      This interface is used to query the list of verifiers that have been selected out of blocks for the current consensus cycle. Each consensus round is 430 blocks, and at 410 blocks will generate a list of verifiers from the verifier queue of the current Epoch that can participate in the next consensus round to get out the blocks.

      Interface parameters reference Java SDK: Query the list of validators in the consensus round.

    2. Query the list of candidate information

      This interface is used to query the list of all candidate verifier information. Any node that has successfully pledged is a candidate verifier.

      Interface parameters reference Java SDK: Query the list of candidate information.

    3. Query the validator entrusted by the delegator

      This interface is used to query which validators have been delegated by the specified delegator.

      Interface parameters reference Java SDK: Query the validator entrusted by the delegator.

    1. Query the staking information of a node

      This interface is used to query the staking information of the node.

      Interface parameters reference Java SDK: Query the staking information of a node.

    2. delegation

      This interface is used to delegate or incrementally delegate a verifier node. Users who have already pledged a node will not be able to delegate it. The user can delegate LAT to the verifier at any time with a minimum amount of 10 LAT per delegation. After a successful delegation, the LAT delegated by the delegator to the candidate verifier is transferred to the Staking contract. The new weight of the verifier will take effect in the next Epoch. When the verifier is selected to participate in the consensus, it will share the block-out and Staking rewards with the principal.

      Interface parameters reference Java SDK: delegation.

    1. Decrease/revoke delegation

      This interface is used to reduce or revoke the delegation operation. The delegator can reduce or revoke the delegation at any time. The minimum amount of the delegation for each reduction is 10 LAT. After the operation is completed, the LAT will be locked in the Staking contract for 56 settlement cycles. If it is less than 10LAT, the delegate's delegation will be revoked. The income obtained by the validator in the current cycle will be distributed to the delegator according to the delegated amount after the reduction.

      Interface parameters reference Java SDK: Decrease/revoke delegation.

    2. Receive the commission of unlocking

      This interface is used to receive the commission gold that is in the unlocking period.

    3. Query delegation

      This interface is used to query the user's delegation information.

      Interface parameters reference Java SDK: Query delegation.

    4. Inquiry account is at the commission amount of the lock -up and unlocking period

      The interface is used to query the commission amount of the account is in the lock -up and unlocking period.

    5. Query average time of packed blocks

      This interface is used to query the average time of packed blocks.

      Interface parameters reference Java SDK: Query average time of packed blocks.

    1. Query the block reward of the epoch

      This interface is used to query the block reward of the current epoch.

      Interface parameters reference Java SDK: Query the block reward of the epoc.

    1. Query the staking reward of the epoch

      This interface is used to query the staking reward of the current epoch.

      Interface parameters reference Java SDK: Query the staking reward of the epoch.

    Governance contract#

    contract address:lat1zqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq93t3hkm

    The on-chain governance method adopted by PlatON enables it to develop in accordance with the requirements of LAT holders. The goal of governance is to ensure that majority ownership can always control the network. Any governance modification plan discussed in the community can be initiated by a validator on the chain and voted for a referendum.

    • Text proposal can be used to vote on content discussed in certain communities. The process includes the voting stage, where the vote is passed and the vote fails.
    • Version proposal can be used to upgrade the version of the chain. The process includes the voting stage, voting failure, pre-validation, validation, and cancellation.
    • Cancel Proposal can be used to cancel previously initiated proposals. The process includes the voting stage, where the vote is passed and the vote fails.
    • Parameter proposal can be used to change some manageable parameters and optimize the ecology of the chain. The process includes the voting stage, where the vote is passed and the vote fails.

    Contract interface#

    1. Create a text proposal

      This interface is used to issue a text proposal. After the text proposal is issued, validators can vote for/against/abstain from the proposal. The voting deadline is about 2 weeks, and the proposal is passed when the voting rate is greater than 50% and the support rate among those who voted is greater than 66.7%.

      Interface parameters reference Java SDK: Create a text proposal.

    1. Create an version proposal

      This interface is used to initiate an version proposal. Proposals can only be initiated by validators. After the proposal is passed, the on-chain version will be upgraded. The validator’s vote is regarded as a support vote. After the voting deadline has passed, when the support rate is greater than 66.7%, the proposal enters the pre-validation stage and will come into effect in the next Epoch.

      Interface parameters reference Java SDK: Create an version proposal.

    1. Create an parameter proposal

      This interface is used to initiate parameter proposals. The parameter proposal is used to change some manageable parameters on the chain. The validator can vote for/again/abstaining votes. The voting deadline is about 2 weeks. When the voter turnout rate is greater than 50% and the voter approval rate is greater than 66.7%, the proposal is passed.

      Interface parameters reference Java SDK: Create an parameter proposal.

    1. Create an cancellation proposal

      This interface is used to initiate a cancellation proposal. Canceling a proposal can cancel the previously initiated text, parameters, and upgrade proposal. The voting deadline must be greater than the voting deadline of the cancelled proposal. After the voting deadline, when the voting rate is greater than 50

      Interface parameters reference Java SDK: Create an cancellation proposal.

    1. Vote

      This interface is used to vote on proposals in progress. Only yes votes can be voted for the version upgrade proposal, and the node needs to be upgraded to the new version before voting.

      Interface parameters reference Java SDK: Vote.

    2. DeclareVersion

      This interface is used to initiate version declarations. When the PlatON network is upgraded to a new version through an upgrade proposal, all verification nodes that have not voted need to upgrade their nodes to the latest version simultaneously, and update their version status in the network through a version statement, otherwise they will not be selected for consensus.

      Interface parameters reference Java SDK: Declare Version.

    1. Query proposal

      This interface is used to query the specified proposal.

      Interface parameters reference Java SDK: Query proposal.

    1. Query proposal status

      This interface is used to query the current status of the proposal

      Interface parameters reference Java SDK: Query proposal status.

    1. Query the list of proposals

      This interface is used to query the list of proposals that are in voting and have ended.

      Interface parameters reference Java SDK: Query the list of proposals.

    2. Query chain version

      This interface is used to query the current effective version of the chain.

      Interface parameters reference Java SDK: Query chain version.

    3. Query governance parameter values

      This interface is used to query the governance parameter value of the current block height

      Interface parameters reference Python SDK: Query governance parameter values.

    4. Query the cumulative number of votes available for a proposal

      This interface is used to query the cumulative number of votes available for a proposal.

      Interface parameters reference Python SDK: Query the cumulative number of votes available for a proposal.

    5. Query the list of governance parameters

      This interface is used to query all management parameters of a certain module.

      Interface parameters reference Python SDK: Query the list of governance parameters.

    Slashing contract#

    contract address:lat1zqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqyva9ztf

    The slashing contract is mainly for system security to monitor the behavior of each node, Penalties will be imposed on violating nodes that violate system security, the contract has the following two major functions:

    • Slashing nodes that can't produce blocks

      According to system rules, each consensus round will have a batch of nodes responsible for producing the blocks of that round, the number of blocks to be produced is fixed for each consensus round, each node is assigned a time window and the number of blocks that need to be produced, generate blocks in turn to complete the block production of the entire consensus round. When a node does not produce a block within the specified time window, will switch to the next node to continue producing blocks, this cycle continues until the number of blocks required to complete the consensus round. The entire consensus round is completed and a new batch of nodes starts the next consensus round.

      If a node has not produced a block in the entire consensus round, then the zero block behavior of the node will be recorded. The Punish conditions are:start recording when the node generates zero blocks for the first time, count the production of blocks in each consensus round in the next period of time, if during this period the node participates in the consensus round again and produces a block, then the previous zero block records will be cleared and exempted from penalties, otherwise, the node will be punished when the statistical time is up, Impose a fine (amount of fine = current block reward*n) and state lock (automatically unlock after a period of lock and return to the normal state. During the lock-up period, the node has no rewards and cannot perform any actions, including modifying information, revoking staking, participating in block production, and accepting delegation).

    • Slashing double-production or double-signed nodes

      Under normal circumstances, a node will only generate one block at the same block height or only sign one of the blocks for different blocks of the same block height, otherwise it is a violation of the rules and will be punished, when this happens to a node, the evidence of violation will be recorded locally by the received node, users can use the RPC to call the platon_evidences interface to obtain evidence of violations, then send the evidence to the chain in the form of a transaction, the system will judge the evidence, if the evidence is true, the node will be punished.

    Contract interface#

    1. Report double sign/double production

      This interface is used to report the double-signature or double-production behavior of a node, the user sends the evidence to the penalty contract in the form of a transaction, After the system verifies that the evidence is true, the node will be fined and the staking will be forcibly released (disqualification of validators and alternative nodes), Part of the fine (default:50%) will be awarded to the reporter as a reward and transferred to the account immediately (transferred to the account that initiated the reporting transaction).

      Interface parameters reference Java SDK: Report double sign/double production.

    1. Check whether the evidence has been reported

      This interface is used to check whether the evidence to be reported has been used before initiating a report (already reported), after the user obtains the evidence by calling the RPC interface, he can first call the interface to check whether the evidence has been reported to avoid repeated reporting. Because the reporting interface requires a lot of cost, and regardless of whether the evidence has been reported (used) or not, the cost of the transaction will still be spent. So this interface can provide pre-check, all input parameters of this interface are parsed from the evidence list returned by the RPC interface platon_evidences.

      Interface parameters reference Java SDK: Check whether the evidence has been reported.

    Lockup contract#

    contract address:lat1zqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqp7pn3ep

    This contract can be used to lock the asset to restrict its circulation within a certain period of time, it can control the total asset circulation within a certain period of time or other lock-in requirements of external personnel, When the lock-up period of the asset ends, the asset will be automatically transferred to the receiving account (the receiving account after unlocking entered when the lock plan was initiated), after the locked asset is transferred to the lock-up contract, the ownership of the asset will belong to the unlocked receiving account, the asset cannot be used for trading during the lock-up period, although it belongs to the receiving account, the funds are stored in the lock-up contract and the account balance cannot be queried, the asset can only be obtained by querying the lock-up record in the lock-up contract. The contract will release the assets to the designated unlock recipient according to the release rules specified by the person who initiated the lock, the release rule can be customized to unlock all at a certain point in time and transfer to the recipient's account, it can also be defined as splitting an asset into N shares and releasing them in M phases, setting the release time of each phase to release one part until all the locked assets are released after the M period, and each time the asset is released, the asset arrives in time. The user account can be used freely.

    Assets in the locked period cannot be transferred due to restrictions, in order to compensate users for the loss of asset liquidity and benefits, this asset can be used for staking nodes and delegation nodes to revitalize funds to obtain income and offset the value dilution caused by inflation. However, when the asset is used for staking or entrusted use, the asset will not be transferred to the recipient's account after the lock-up period has expired. Instead, the asset will be transferred to the recipient's account when the user releases the staking or the delegation, the release rules of the lockup contract will be handled differently according to the use of the asset. If the funds used for staking and delegation only use part of the assets in the locked position, then when the release period is reached, it will only be released from the funds that have never been misappropriated. If the released amount is not enough, it will not be released currently but wait for the user Only release when the misappropriated funds are cancelled.

    Contract interface#

    1. Create a lockup plan

      This interface is used to create an asset lock, transfer the specified amount from the initiator's account to the lock-up contract, and transfer it to the specified recipient account when the specified time is reached.

      Interface parameters reference Java SDK: Create a lockup plan.

    2. Query the lock-up plan

      This interface is used to query the lock-up plan under the specified account, and the specified account is the recipient's account after unlocking.

      Interface parameters reference Java SDK: Query the lock-up plan.

    DelegationReward contract#

    contract address:lat1zqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxlcypcy

    The contract is mainly used to deal with the business related to delegate income. When each user delegates a node, a delegation record will be generated, each delegation record will get dividends from the delegated node, the dividend amount is calculated from the node's income according to the dividend ratio set by the node to the delegator, the total dividends allocated will be divided equally according to the total delegations of the nodes, Each delegated unit will get a certain income, so the income that a single delegation can obtain is directly proportional to the delegated volume.

    In this process, at the end of each epoch, the system will automatically calculate the dividend rewards of each candidate node to all its delegators, all dividend rewards will be immediately transferred to this contract for temporary storage, that is, the income obtained by each principal is first stored in this contract, it is necessary to wait for the user to initiate a transaction for receiving revenue. At this time, the system will calculate how much delegation revenue this user has in this contract and immediately transfer it to the user's account.

    Contract interface#

    1. Receive delegated rewards

      This interface is used to extract delegated rewards that the user has not yet claimed, when a single user entrusts multiple nodes to generate multiple delegations, the interface can only process the rewards for 20 delegations at a time, the rest must be re-initiated to receive the operation (the rules for receiving 20 delegated rewards are sorted according to the number of Epochs that have not been claimed for each delegation, the more the number of unclaimed cycles, the priority to receive the delegated awards), if the number of delegated rewards waiting to be collected is less than 20, then directly collect all of them.

      Interface parameters reference Java SDK: Receive delegated rewards.

    1. Query delegation reward

      This interface can be used to query all pending delegation income details of the interface initiator, you can also specify to query a certain delegation or multiple delegations, the return result will be a sorted list of income details, the sorting rule is to sort in reverse order according to the number of unclaimed Epochs for each delegation (the return data will not be sorted if there are less than 20 delegated rewards to be received)。

      Interface parameters reference Java SDK: Query delegation reward.

    random number contract#

    contract address:lat1xqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpe9fgva

    This contract is mainly used to generate multiple random numbers. The parameter is the number of random numbers to be generated. It supports the generation of up to 500 random numbers. The return value is a []byte array, and every 32 bits is a random number.

    If only one random number is generated, it is obtained by the XOR of the random number of the current block and the transaction hash. If multiple random numbers need to be generated, the first random number is obtained by the XOR of the random number of the current block and the transaction hash. The random number is obtained by XORing the random number of the previous block in turn with the first random number.

    The random number generation principle of the block: After the PlatON node packs the block, it will use VRF to generate a random number and proof for the block, and store it in the Nonce field of the block. The random number seed is the random number of the previous block. number.

    - + \ No newline at end of file diff --git a/PlatON_system_contract_api/index.html b/PlatON_system_contract_api/index.html index 5fb543252..a34a1d0bf 100644 --- a/PlatON_system_contract_api/index.html +++ b/PlatON_system_contract_api/index.html @@ -8,7 +8,7 @@ System contract api | PlatON - + @@ -32,7 +32,7 @@ EIP55 address:0x1000000000000000000000000000000000000001

    1. CreateRestrictingPlan: Create a lock plan plan

    parameter:

    parametertypedescribemust
    funcTypeuint16(2bytes)Representing method type code(4000)Y
    account20bytesLocklet release to the account accountY
    plan[] RestrictingPLANPlan is a list of restrictingplan types (arrays), and restrictingplan is defined as follows: Type RestrictingPlan Struct {EPOCH UINT64 AMOUCT: BIG.INT} where EPOCH: Indicates the multiple of the settlement cycle, more than 0, EPOCH is 1 represented in the transaction The settlement cycle releases the lock bin. The product of the number of pieces per settlement period is represented in the target block height to release the locked funds. The number of EPOCHs is at least greater than the highest irreversible zone height. Amount: Indicates the amount to be released to the target block.Y
    1. GetRestrictingInfo: Get the lock information

    Note: This interface supports acquisition history data, which can be attached with a high block when requested, and the data of the latest block is queried by default.

    parameter:

    parametertypedescribemust
    funcTypeuint16(2bytes)Representing method type code(4100)Y
    account20bytesLocklet release to the account accountY

    return value:

    Returns the parameter to the JSON format string of the following fields

    nametypedescribeWill it be empty?
    balancestring(0x hexadecimal string)Total lock bin balance - released amountN
    pledgestring(0x hexadecimal string)Pledge / mortgageY, 默认为 0
    debtstring(0x hexadecimal string)DepositY, 默认为 0
    plansbytesLock-locking information, JSON array:[{"blockNumber":"","amount":""},...,{"blockNumber":"","amount":""}]。Among them: blocknumber: BIG.INT, release block height amount:\string(0x hexadecimal string), Release the amountN

    Reward contract interface parameter description#

    The contract address of the reward associated interface is:

    Main network:lat1zqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxlcypcy
    EIP55 address:0x1000000000000000000000000000000000000006

    1. withdrawDelegateReward: Extract all of the currently extracted delegation rewards

    parameter:

    parametertypedescribemust
    funcTypeuint16(2bytes)Representing method type code(5000)Y

    return value:

    Note: The trading results are stored in logs.data in the transaction receipt, such as transaction success, storage rlp.encode ([] byte {[] Byte (status code 0), rlp.encode (Node Receals list)}) If the transaction is unsuccessful, it is consistent with the previous manner.storage rlp.encode ([] byte {[] Byte (status code 0), rlp.encode (Node Receals list)}) If the transaction is unsuccessful, it is consistent with the previous manner.

    Node Reception List As an array, receive up to 20 nodes at a time at least one time.

    parametertypedescribeis nil
    NodeIDdiscover.NodeID(64bytes)Node IDN
    StakingNumuint64The decoration block of the node is highN
    Reward*big.IntReceiving incomeN
    1. getDelegateReward: The query account has not extracted a reward in each node.

    parameter:

    parametertypedescribemust
    funcTypeuint16(2bytes)Representing method type code(5100)Y
    address20bytesTo check the address of your accountY
    nodeIDs[]discover.NodeIDTo query the nodes, if you are empty, check all the nodes entrusted by your account.(Sort by returning all nodes, press DelegateEPoch ascending, the same time is arranged in the fast row results)N

    return value:

    Is a [] Reward array

    nametypedescribe
    nodeIDdiscover.NodeID(64bytes)Node ID
    stakingNumuint64The decoration block of the node is high
    rewardstring(0x hexadecimal string)Unpaged entrusted revenue

    PPOS RPC Interface Description#

    Query double out, double visa according to interface#

    parametertypedescribe
    jsonrpcstringRPC version number
    idintID serial number
    resultstringEvidence string

    Result is evidence string, including 3 evidence types, named: DuplicatePrepare, DuPlicateViewChange Each type contains multiple evidence, so it is an array structure and needs attention when parsing

    duplicatePrepare

    nametypedescribe
    prepareAepochuint64Connectic wheel EPOCH value
    viewNumberuint64Consensus wheel View value
    blockHashstringBlock Hash
    blockNumberuint64Block Number
    blockIndexuint32Index value of blocks in a round of VIEW
    blockDatastringBlock RLP encoding value
    validateNodeindexuint32Verify the index value in a round of EPOCH
    nodeIdstringVerifier NodeID
    blsPubKeyobjectVerifier BLS public key
    signaturebyte[]Message signature
    prepareBepochuint64Connectic wheel EPOCH value
    viewNumberuint64Consensus wheel View value
    blockHashstringBlock Hash
    blockNumberuint64Block Number
    blockIndexuint32Index value of blocks in a round of VIEW
    blockDatastringBlock RLP encoding value
    validateNodeindexuint32Verify the index value in a round of EPOCH
    nodeIdstringVerifier NodeID
    blsPubKeyobjectVerifier BLS public key
    signaturebyte[]Message signature

    duplicateVote

    nametypedescribe
    voteAepochuint64Connectic wheel EPOCH value
    viewNumberuint64Consensus wheel View value
    blockHashstringBlock Hash
    blockNumberuint64Block Number
    blockIndexuint32Index value of blocks in a round of VIEW
    validateNodeindexuint32Verify the index value in a round of EPOCH
    nodeIdstringVerifier NodeID
    blsPubKeyobjectVerifier BLS public key
    signaturebyte[]Message signature
    voteBepochuint64Connectic wheel EPOCH value
    viewNumberuint64Consensus wheel View value
    blockHashstringBlock Hash
    blockNumberuint64Block Number
    blockIndexuint32Index value of blocks in a round of VIEW
    validateNodeindexuint32Verify the index value in a round of EPOCH
    nodeIdstringVerifier NodeID
    blsPubKeyobjectVerifier BLS public key
    signaturebyte[]Message signature

    duplicateViewchange

    nametypedescribe
    viewAepochuint64Connectic wheel EPOCH value
    viewNumberuint64Consensus wheel View value
    blockHashstringBlock Hash
    blockNumberuint64Block Number
    validateNodeindexuint32Verify the index value in a round of EPOCH
    nodeIdstringVerifier NodeID
    blsPubKeyobjectVerifier BLS public key
    blockEpochuint32EPOCH value generated by blocks
    blockViewuint32VIEW value generated by blocks
    signaturebyte[]Message signature
    viewBepochuint64Connectic wheel EPOCH value
    viewNumberuint64Consensus wheel View value
    blockHashstringBlock Hash
    blockNumberuint64Block Number
    validateNodeindexuint32Verify the index value in a round of EPOCH
    nodeIdstringVerifier NodeID
    blsPubKeyobjectVerifier BLS public key
    blockEpochuint32EPOCH value generated by blocks
    blockViewuint32VIEW value generated by blocks
    signaturebyte[]Message signature

    Query block aggregate signature interface#

    parametertypedescribe
    jsonrpcstringRPC version number
    idintID serial number
    resultstringAggregate signature structure

    QuorumCert

    nametypedescribe
    epochuint64Connectic wheel EPOCH value
    viewNumberuint64Consensus wheel View value
    blockHashstringBlock Hash
    blockNumberuint64Block Number
    blockIndexuint32Index value of blocks in a round of VIEW
    signaturestringAggregate signature string
    validatorSetstringVerifier index collection

    Query code versions and signatures#

    parameterTypes ofdescribeWill it be empty?
    jsonrpcstringRPC version numberN
    idintID serial numberN
    resultstringStringN

    Result is a JSON string, contains two fields of Version and SIGN

    Query BLS certification#

    parameterTypes ofdescribeWill it be empty?
    jsonrpcstringRPC version numberN
    idintID serial numberN
    resultstringBLS proofN

    Open database garbage collection#

    Turn off database garbage collection#

    - + \ No newline at end of file diff --git a/PlatON_wallet_plugin/index.html b/PlatON_wallet_plugin/index.html index b164aa80a..a87624544 100644 --- a/PlatON_wallet_plugin/index.html +++ b/PlatON_wallet_plugin/index.html @@ -8,13 +8,13 @@ PlatON-Wallet - Operation_Manual | PlatON - +
    Skip to main content

    PlatON Wallet Plugin

    What is PlatON Wallet Plugin#

    The PlatON Wallet plugin integrates basic wallet functions, cross-chain, fiat channels, Swap and other functions. In the future, it will realize more functions such as cross-currency exchange, transaction authentication based on confidential payment, prepaid card sales, virtual VISA cards, etc.

    The PlatON Wallet plugin is compatible with various decentralized wallets. After integrating the PlatON Wallet plugin, the project party can enable its users to easily conduct cross-chain recharge, fiat purchase and other operations.

    In order to meet the various integration needs of the project parties, we will provide SDKs for a series of languages and frameworks, so that application developers can quickly complete integration according to different business scenarios.

    How to integrate#

    • PlatON wallet plugin SDK: Provides complete wallet functions and pages. Through simple one-point integration, you can quickly use all the functions in the wallet.

    We will also provide more integration methods to meet the integration needs of applications in different scenarios.

    How to use#

    Note: Since the PlatON Wallet plugin itself does not generate account addresses and relies on third-party wallets with accounts, such as Metamask, etc., all transactions will be completed through third-party wallets.

    1. Connect Wallet

    After the application integrates the PlatON Wallet plugin, the PlatON wallet will also synchronize and connect to Metamask after the application connects to Metamask. After connecting to Metamask, the PlatON Wallet plugin will display the asset status of the account on the PlatON network.

    connect

    2. Send and Receive

    The wallet plugin supports sending and receiving Tokens on the PlatON network.

    send-receive

    3. Recharge

    Currently there are two ways to recharge assets on the PlatON network:

    • Method 1: Transfer assets from other networks to the PlatON network through cross-chain bridges
    • Method 2: Purchase assets on the PlatON network by paying in fiat currency through integration with Alchemy Pay and FaTPay. We will support more convenient recharge methods in the future.
    • Method 3: Deposit through Interchain Transfer. After depositing assets to the specified address, the asset deposit on the PlatON network can be completed.
    deposit

    4. Withdraw

    Currently we have two ways to withdraw assets from PlatON:

    • Method 1: Withdraw PlatON network assets to other networks through cross-chain bridges.
    • Method 2: Purchase shopping cards through txnhub.io
    withdraw

    5. More Functions

    We will subsequently support more networks, more cross-chain of currencies, Swap between different currencies, transaction authentication based on confidential payment, virtual VISA cards and more functions.

    - + \ No newline at end of file diff --git a/PlatON_wallet_plugin_sdk/index.html b/PlatON_wallet_plugin_sdk/index.html index e401e977b..a3ed3f30e 100644 --- a/PlatON_wallet_plugin_sdk/index.html +++ b/PlatON_wallet_plugin_sdk/index.html @@ -8,7 +8,7 @@ PlatON-Wallet-Plugin-SDK - Access Manual | PlatON - + @@ -25,7 +25,7 @@ // Show Platon-Wallet.walletSDK.show(); // Destroy Platon-WalletwalletSDK.destroy();

    When the project is rendered for the server (e.g. using next.js, etc.), use the following import method:

    let walletSDK = null
     import('@platonnetwork/platon-wallet-sdk').then(module => {  walletSDK = new module.default({ env: 'PROD' })})

    Token Contract#

    PlatON Testnet#

    namesymboladdress
    Tether USDUSDT0x1e6E4b48F6F57Aa7cefd8239e8515694D110386B
    USD CoinUSDC0x229b68722bF16CCc7186Dc8760b3D8C5980fe609

    PlatON Mainnet#

    namesymboladdress
    Tether USDUSDT0xeac734fb7581D8eB2CE4949B0896FC4E76769509
    USD CoinUSDC0xdA396A3C7FC762643f658B47228CD51De6cE936d
    - + \ No newline at end of file diff --git a/Python_SDK/index.html b/Python_SDK/index.html index 4cf7c762d..edea249f0 100644 --- a/Python_SDK/index.html +++ b/Python_SDK/index.html @@ -8,7 +8,7 @@ Python SDK | PlatON - + @@ -62,7 +62,7 @@ The number of voting consensus rounds. Refer to the instructions for submitting the upgrade proposal. At the same time, the value of this parameter in this interface. cannot be greater than the value in the corresponding upgrade proposal.

  • tobe_canceled_proposal_id: Upgrade proposal ID to be cancelled.

  • pri_key: Private key for transaction.

  • transaction_cfg: Transaction basic configuration.

    type:     dictexample:    cfg = {         "gas":100000000,         "gasPrice":2000000000000,         "nonce":1,     }
  • Calling method

    pip.vote(verifier, proposal_id, option, program_version, version_sign, pri_key, transaction_cfg=None)

    Parameter Description

    Version Statement#

    Calling method

    pip.declareVersion(active_node, program_version, version_sign, pri_key, transaction_cfg=None)

    Parameter Description

    Query proposal#

    Calling method

    pip.getProposal(proposal_id, from_address=None)

    Parameter Description

    Query proposal results#

    Calling method

    pip.getTallyResult(proposal_id, from_address=None)

    Parameter Description

    Query the cumulative number of votes available for a proposal#

    Calling method

    pip.getAccuVerifiersCount(proposal_id, block_hash, from_address=None)

    Parameter Description

    Query the list of proposals#

    Calling method

    pip.listProposal(from_address=None)

    Parameter Description

    Query the effective version of the node's chain#

    Calling method

    pip.getActiveVersion(from_address=None)

    Parameter Description

    Query the governance parameter value of the current block height#

    Calling method

    pip.getGovernParamValue(module, name, from_address=None)

    Parameter Description

    Query the governance parameter list#

    Calling method

    pip.listGovernParam(self, module=None, from_address=None)

    Parameter Description

    - + \ No newline at end of file diff --git a/Samurai_API/index.html b/Samurai_API/index.html index 1f6cb2c18..a787ebf38 100644 --- a/Samurai_API/index.html +++ b/Samurai_API/index.html @@ -8,7 +8,7 @@ Samurai API | PlatON - + @@ -59,7 +59,7 @@ **Parameter** `WatchAssetParams` - The metadata of the asset to be observed. ```javascriptinterface WatchAssetParams { type: 'ERC20'; // In the future, other standards will be supported options: { address: string; // The address of the token contract 'symbol': string; // A ticker symbol or shorthand, up to 5 characters decimals: number; // The number of token decimals image: string; // A string url of the token logo }; }

    Return value

    boolean - If the token has been added, it returns true; otherwise it returns false.

    Description

    In Samurai, users track token requests. Boolean indicates whether the token has been successfully added.

    Most PlatON/Alaya wallets support certain token sets, usually obtained from a centrally planned token registry. wallet_watchAsset enables web3 application developers to require their users to track the tokens in their wallets at runtime. Once added, the token cannot be distinguished from the tokens added through traditional methods (such as centralized registration).

    Example

    platon.request({  method: 'wallet_watchAsset',  params: {    type: 'PRC20',    options: {      address: 'lat1alad2dlvkxvcyz02ag5vtxs9c678mvc5adr3vm',      symbol: 'FOO',      decimals: 18,      image: 'https://foo.io/token-image.svg',    },  },  });.then((success) => {  if (success) {    console.log('FOO successfully added to wallet!')  } else {    throw new Error('Something went wrong.')  }}).catch(console.error)

    Example#

    The following example demonstrates how to initiate common and contract transaction operations on the web console to evoke Samurai for transaction processing.

    After opening Samurai and importing the account, open a new page. Right-click -> check -> console to enter the debug mode (the following command lines are executed in the console). Samurai will inject platon and web3a objects when opening the page, so they can be used directly in the console.

    Ordinary Transaction#

    > platon.request({ method: 'platon_requestAccounts' });Promise {<pending>}> platon.selectedAddress"lat1mm09yjr8vwr2g78gselj03w2eks7atq2t4y83p"
    > web3a.platon.sendTransaction({from: platon.selectedAddress,to: "lat1dt2wx0xjkd2je8ev4t3ysmte6n90kc9gzndwuv", value: 1e16}, function(err, transactionHash) {if (err) { console.log(err); } else {console.log(transactionHash);}});

    DApp Development Integration#

    On the DApp development page, since Samurai will inject a platon object when opening the page, the object can be directly called through javascript to complete the corresponding operation during development. For the introduction and use of web3a objects, see js-sdk document.

    The following example shows the corresponding javascript script that is called after clicking a page button to initiate a transfer.

    var Web3A = require('web3');var web3platon = new Web3A(platon)contract = new web3platon.platon.Contract(abi, address);toAccount = "lat1dt2wx0xjkd2je8ev4t3ysmte6n90kc9gzndwuv";transferBalance = 1000000000000000;contract.methods.transfer(toAccount,transferBalance)  .send({from:platon.selectedAddress, gas:4712388})  .then (function(receipt){    console.log("receipt: ", receipt);  }).catch(function(err) {    console.log('err: ', err);  })
    - + \ No newline at end of file diff --git a/Samurai_user_manual/index.html b/Samurai_user_manual/index.html index 411c4707b..a5cb810d0 100644 --- a/Samurai_user_manual/index.html +++ b/Samurai_user_manual/index.html @@ -8,13 +8,13 @@ Samurai | PlatON - +
    Skip to main content

    Samurai

    Samurai is an open source browser plug-in wallet tool that supports the Alaya and PlatON networks, supporting wallet creation, sending and receiving ATP and LAT, and allowing web DApps to interact with the Alaya and PlatON networks.

    Samurai only generates wallet keys on your device, so only you can access your wallet account and data. You therefore need to keep your wallet key (private key, mnemonic) and wallet password safe. Samurai currently only supports Chrome.

    Note#

    Samurai is a browser plug-in wallet modified based on MetaMask's open source code version 8.0.10, which is mainly adapted to the Alaya network and PlatON network. Due to some bugs in the official MetaMask itself. Please pay attention when using Samurai:

    • Do not click the edit button to edit transaction related information on the transaction confirmation page.
    • On the transaction confirmation page, please make sure that the receiving address is correct before clicking the confirm button.

    Installation#

    • Download Samurai plug-in package from Release address.
    • Unzip Samurai plug-in package.
    • Open chrome browser,input chrome://extensions/ in the address bar and Enter,enter the management page of chrome extension program.
    chrome://extensions/
    • Open the switch of developer mode, select to load the unzipped extension program, import the unzipped catalogue of the 2nd step.

    Initial Use#

    1. Click the Samurai icon on the right side of browser address bar, when you use it for the first time, there will be a prompt as shown below:
    1. Click “Get Started”,there is two options - Create wallet and iImport wallet.
    • Import wallet:

    Click “import wallet”,enter the guide page, click “I agree” and enter the next step. Then input the Seed phrase and password of this wallet, and click “import”->Once all steps is completed, you can enter the mainpage.

    Note: The current Samurai mnemonic phrase generation path has problems, and the import of mnemonic phrases generated by external wallet applications is not supported. It is recommended to import it through the private key after the initial creation.

    • Create wallet:

    Click “create wallet”, enter the boot page, click “I agree” and enter the next step. Then input the password of new wallet, and click “create”.

    Go to the mnemonic backup page, click "CLICK HERE TO REVEAL SECRET WORDS" to show the mnemonic words of the new account (mnemonic words need to be prevented from being seen by others, Samurai uses the password you provided to encrypt this information locally and will never send it to the server), click “Reminder me later” to go directly to the Samurai mainpage of the new account(Skip not recommended).

    Click “ext step”, re-input the mnemonic words with the right sequence, click “confirm”->Once all steps is completed, you can enter the mainpage.

    Transaction Operation#

    Send LAT#

    • In the PlatON main network, click "send" on the mainpage, and you can see the Add Recipient page.
    • Enter or select the address for transfer between my accounts, and go to the transaction form page.
    • The transaction form must fill in the number of transaction LAT, and the system will give you the default transaction fee. You can also make appropriate adjustments to this value. After completing the form, click “next” to enter the page to be confirmed, which will show the total number of LAT spent (including the handling fee).
    • Click “Confirm” to complete the sending of LAT, and you can view the transaction status in the Activity on the mainpage.

    Add and send Token#

    Add Token#

    • Enter the mainpage, click Assets -> Add Token.
    • Pop-up the “Add Tokens” page, add the existed Token Contract Address of connected network, Samurai will automatically to get token’s symbol and exact decimal point, click “Next” when you completed all the steps.
    • Enter the confirm page of Add Tokens, there will show the balance of this token under this account, click “Add Tokens”to add successfully.
    • After the account is successfully added, go to the token display screen, which displays the balance of tokens, or you can click “send” to enter the token transfer page. At the same time, the asset list of the mainpage will display the token assets.

    Token Transfer#

    • You can click "send" in the account token display page to initiate the token transfer, or you can click "send" of the corresponding token in the asset list inof the mainpage.
    • Enter the add recipient page, enter or select the address for transfer between my accounts as you would for sending LAT, and enter the transaction form page.
    • The transaction form must enter the number of tokens for the transaction. Click “Next” to enter the transaction confirmation page.
    • Click “Confirm” to complete the sending of tokens, you can view the transaction status in the transaction list on the mainpage.

    Create and manage an account#

    Create Account#

    • Click on the wallet avatar at the top right of the Samurai homepage and click on Create Account in the drop down menu that appears.
    • Go to create account form page, enter account name (example below is wallet 2), click create button.
    • Successful creation will bring you to the mainpage of the newly created wallet, click on the wallet avatar at the top right to see a list of all wallet accounts.

    Import Account#

    • Click on the wallet avatar at the top right of the Samurai page and in the drop down menu that appears click on import account.
    • enter import account form page, you can choose two import modes (private key/keystore json file), choose private key mode, paste private key into the form, then click import button.
    • Choose import keystore file mode, select JSON file type, click select file, select keystore file from local directory, then enter keystore file passphrase, finally click import button.
    • If the import is successful you will enter the main page of the newly imported wallet, click on the wallet avatar at the top right to see a list of all wallet accounts.

    Network Management#

    By default, Samurai connects to the PlatON network, or it can connect to other networks.

    Choose networks#

    Samurai have added PlatON Main Network, PlatON dev network, PlatON Network, PlatON dev Network as default, you can choose a network to connect. Click “Networks” and choose a network from the four networks to connect.

    Add Custom Network#

    • Click “Networks”-> Custom RPC.

    • Enter the new network configuration page, and click “Save” after configuring the form.

    • Samurai will try to connect to the node, and if the node fails to connect, it will pop up a corresponding dialog prompt.

    • If the connection is successful, a network list option will be added to the network list.

    Switch language#

    • Click on the wallet avatar at the top right of the Samurai homepage and click on Settings in the drop down menu that appears.
    • Go to main settings page, then click General -> Go to Current Language drop down box to select (multiple languages supported).
    - + \ No newline at end of file diff --git a/Secure_Multi_Party_Computation/index.html b/Secure_Multi_Party_Computation/index.html index fc438fbff..d7202ee84 100644 --- a/Secure_Multi_Party_Computation/index.html +++ b/Secure_Multi_Party_Computation/index.html @@ -8,7 +8,7 @@ Secure Multi Party Computation | PlatON - + @@ -19,7 +19,7 @@ Now that Alice uses two input labels to encrypt the output label gate by gate. Taking the first row in the first table as the example, Alice takes $A0$ and $B_0$ as the input to double AES encrypt output label $E_0$, and obtains $AES{A0}(AES{B_0}(E_0))$. All left gates in this circuit are processed the same way as the first one, after finishing processing all gates, it will get the garbled table as shown in Figure 6 and obtain the garbled circuit $\widetilde{C}$ eventually.

    Figure 6: encryting output label with input labels

    3. Sending Alice's label according to her input#

    After generating the garbled circuit, Alice needs to encrypt her original input $s$. At first, she transforms $s$ into the boolean value corresponding to the input of $C$, then replaces each bit of the boolean value with $A_0$ and $A_1$ according to the input of $\widetilde{C}$. It will obtain the whole labels after replacing every bit. Afterward, Alice sends these labels and $\widetilde{C}$ to Bob together.

    Let Alice's original input is $s=s_0s_1=10$, she sends labels $A_1$ and $B_0$to Bob according her input.

    4. Receiving Bob's label according to his input#

    Now that Bob has both garbled circuit $\widetilde{C}$ and Alice's label, in order to decrypt $\widetilde{C}$, he still need the labels corresponding to his input. As the encryption process demonstrated before, Alice knows Bob's input labels but has no idea about his original input. Bob knows his own original input but has no idea about his input label. Bob achieve it by using 1-out-of-2 OT with Alice bit by bit according to her original input, where Alice is the sender, Bob is the receiver, Bob inputs 0 or 1 according to his actual input. Afterward, he obtains his whole input label according to his input while Bob learns no additional information and Alice is not able to know Bob's original input.

    Let Bob's original input is $t=t_0t_1=01$, after executing OT with Alice, he obtains $C_0$ and $D_1$ according his input. Then he is able to decrypt the garbled circuit by using both parties' input labels.

    5. Evaluating the garbled circuit#

    Bob now has already received the input labels corresponding to his original input, labels he owns are $A_1$, $B_0$, $C_0$ and $D_1$. Then he decrypts the garbled circuit gate by gate and delivers the output of each decrypted gate as the input to decrypt the next gate. After evaluating the garbled circuit, Bob obtains output label as shown in Figure 7.

    As for the first garbled table, Bob takes $A_1$ and $B_0$ as decryption key to get $E_0$; As for the second garbled table, he takes $A_1$ and $B_0$ as decryption key to get $F_1$; As for the third garbled table, Bob takes $C_0$ and $D_1$ as decryption key to get $G_1$; As for the fourth garbled table, Bob takes $F_1$ and $G_1$ as decryption key to get $H_0$; At last, he takes $E_0$ and $H_0$ as decryption key decrypt the last garbled table, and obtain the final output label $I_0$. Since Bob knows its corresponding relationship with 0/1, he is able to get the computing result and send it to Alice. So both of them have the final output result.

    Figure 7: decrypting gate by gate to obtain the output label

    Paradigm of Secure Two-party Computation#

    Figure 8: paradigm of secure two-party computation

    \ Figure 8 demonstrates an ordinary paradigm of secure two-party computation. The workflow is shown below.

    1. One of these two parties codes application algorithm by some common high-level programming languages, such as C++, Java, Python, etc. (depending on the MPC framework used)
    2. The Application algorithm will be compiled into the boolean circuit (consisting of AND, XOR and NOT gates) saved in a file by MPC Circuit Compiler.
    3. These two computing participants pre-process their own original input and transform them into the data format as the input of the boolean circuit.
    4. Both of them execute the boolean circuit by the installed MPC software and make the MPC computation.
    5. When MPC computation is done, both of them obtain the correct output result. Most importantly, it can be guaranteed that no more than the original input would be leaked.

    Paradigm of MPC in PlatON#

    MPC is one of the most important technologies used in PlatON, and secret contracts are implemented with MPC in PlatON, which can protect the privacy of original data belonging to each computing participant.

    Figure 9 demonstrates the computing architecture of Secure Two-party Computation in PlatON.

    Figure 9: Architecture of Secure Two-party Computation in PlatON

    \ Programming of secret contracts in PlatON is compatible with high-level programming languages. Instead of being compiled into redundant boolean circuit file, secret contracts will be compiled into more efficient LLVM IRs. And then LLVM IRs will be deployed onto PlatON network to be executed by JIT in MPC-VM on computing nodes. Input data of secret contracts are kept by data nodes in local, while computing nodes do MPC computation off-chain, and publish the output result onchain.

    Future plans#

    PlatON will optimize the current implemented MPC architecture in order to extend it to more innovational and efficient MPC protocols. PlatON will improve it in the following several ways.

    - + \ No newline at end of file diff --git a/Solidity_Contract_Best_Practice/index.html b/Solidity_Contract_Best_Practice/index.html index b8e26f1f7..449cbde06 100644 --- a/Solidity_Contract_Best_Practice/index.html +++ b/Solidity_Contract_Best_Practice/index.html @@ -8,13 +8,13 @@ Best practices | PlatON - +
    Skip to main content

    Best practices

    Best Practice#

    Introduction#

    This guide introduces users with some key points that need to be paid attention in the development of smart contracts, mainly in the practice of actual development. Users can use this guide to quickly understand how to set a reasonable fee for a transaction, how to avoid losing the fee due to transaction failure, and how to encode a more standardized smart contract.

    Reasonable Cost Setting#

    When you need to deploy a contract on the main network of PlatON, you need to set a reasonable fee limit. The fee limit refers to the upper limit of the energy consumption cost of smart contract deployment/execution in PlatON. This restriction is mainly accomplished through Gas. Gas is the fuel value of the PlatON network world, which determines the normal operation of the PlatON network ecosystem. Gas is usually used to measure how much "work" is required to perform certain actions, and these workloads are the amount of fees that need to be paid to the PlatON network in order to perform the action. In a simple understanding, Gas is the commission for network miners, and is paid by LAT. Any transaction, contract execution, and data storage on the network need to use Gas.

    PlatON is similar to Ethereum's blockchain system. It uses LAT for payment and maintenance networks. One LAT is divided into:mLAT/uLAT/gVON/mVON/kVON/VON, and VON is the smallest unit.

    Gas consists of two parts: GasLimit and GasPrice. GasLimit is the maximum Gas consumption (minimum 21,000) that a user is willing to pay to perform an operation or confirm a transaction. GasPrice is the unit price of each Gas.

    When a user sends a transaction, GasLimit and GasPrice are set. GasLimit * GasPrice is the user's transaction cost, and the cost is rewarded to the miner as a commission.

    The higher the GasPrice of the transaction, the higher the execution priority of the transaction and the greater the transaction cost. After each transaction is completed, the remaining unused Gas will be returned to the sender's address account. It is important to note that if the execution of the transaction fails due to the GasLimit is too low, the Gas will not be returned to the user's address at this time, and the user still needs to pay the energy cost for the failed transaction. Therefore, regardless of whether the transaction is executed successfully, the transaction sender needs to pay a certain calculation fee to the miner.

    In the PlatON network, the maximum gas limit is 4,700,000 and the minimum is 22,000. Too low or too high will cause transaction failure. When deploying large contracts or calling complex functions in contracts, you can increase the gas limit, for example: 1,000,000. If it is a normal transfer, set it to the lowest value. The specific value needs to be estimated according to the size and complexity of the contract. Before the contract is released, the interface platon_estimateGas can be called for approximate estimation to avoid failure due to insufficient Gas. Click to view JSON-RPC reference documentation.

    LAT Unit Conversion

    UnitVON ValueVON
    VON11 VON
    kVON1e3 VON1,000
    mVON1e6 VON1,000,000
    gVON1e9 VON1,000,000,000
    LAT1e18 VON1,000,000,000,000,000,000
    mLAT1e24 VON1,000,000,000,000,000,000,000,000
    gLAT1e27 VON1,000,000,000,000,000,000,000,000,000

    Avoid Timeouts#

    Sending transactions on the PlatON network does not have the concept of timeout, but it will eventually stop according to the set gas limit value. If the limit value is lower than the consumption required for contract deployment, the transaction execution fails and the corresponding processing fee will be deducted. The fee setting cannot be infinite, because in the network, the block itself has a maximum GasLimit value. When the GasLimit of the transaction exceeds this value, the transaction will not be accepted.

    If the call function of a published contract is called (a call is a stateless operation in the contract logic), there is a 5s timeout limit. If the contract logic is not executed within 5s, a timeout will occur and the virtual machine will forcely exit , causing the query to fail.

    To avoid contract-related transaction failures, try breaking large contracts into smaller pieces and referencing each other as needed. To avoid infinite loops, be aware of common pitfalls and recursive calls.

    Punishment For Illegal Operations#

    If the smart contract is not compiled by a standard valid compiler, or the instruction code is changed at will, the opcode will be invalid. This type of contract not only fails to be deployed and executed successfully, but also generates a full amount (GasLimit * GasPrice) penalty. The transaction fee for the current transaction will be deducted. This is a very strong penalty. If the operator does not pay attention to this point and keep retrying, then the cost will be higher and the cost will be heavier.

    In general, invalid opcodes have the following conditions:

    1. Manually changed the instruction code for the normally compiled contract;
    2. The contract compiler version is not consistent with the contract version supported by the network lock;

    When operating a contract in the PlatON network. First, you must confirm the smart contract version supported by the current network, and then select the compiler of the corresponding version pair.

    The normal operation is to use the latest Truffle/PlatON-CDT officially provided by PlatON to compile/deploy/execute the contract. At the same time, before switching to the main network, it must be validated on the test network.

    Coding Standards#

    Naming Rules#

    Basic Rules:

    • Use complete descriptive information that accurately describes variables, fields, classes, interfaces, etc.
    • Use mixed case (except special characters) to improve the readability of the name.
    • Use terminology within the blockchain industry.
    • Use as few abbreviations as possible. If you must use them, it is recommended to use public abbreviations and custom abbreviations.
    • Avoid using names that are similar or just distinguish between upper and lower case.
    • The directory uses lowercase uniformly, without special symbols.
    • For smart contracts, the file name is consistent with the contract name.
    • The naming suggestion is to use the hump name uniformly.

    Document Format For Smart Contracts#

    File Layout Rules:

    • Generally more than 1000 lines of program code is difficult to read, try to avoid the situation that the number of lines of code in a file is too long. Each contract document should contain only a single contract class or contract interface.

    Order Of Files:

    • Notes on files: All contract source files have a note at the beginning, which lists the copyright statement, file name, function description, and creation and modification records of the file.
    • File/Package reference: In the contract source file, the first non-comment line is the compiler version, followed by the reference statement.
    • Remarks for class or interface: Comments should be made before class and interface definitions, including descriptions of classes and interfaces, latest modifiers, version numbers, reference links, etc.
    • The order of member variables: first the public level, then the protection level, and finally the private level.
    • Functions: Functions within a contract should be grouped by module, not by scope or access permissions.

    Suggestions#

    • In the smart contract, to get the value of the state variable modified by the public, there is no need to write a function of get.
    • In a smart contract, if an anonymous function modified by payable is added to the contract, the contract address can accept LAT transfers.

    - + \ No newline at end of file diff --git a/Solidity_Contract_Dev_Costs/index.html b/Solidity_Contract_Dev_Costs/index.html index 1bfbb679e..09e901803 100644 --- a/Solidity_Contract_Dev_Costs/index.html +++ b/Solidity_Contract_Dev_Costs/index.html @@ -8,14 +8,14 @@ Development costs | PlatON - +
    Skip to main content

    Development costs

    Introduction#

    In a blockchain system, developing smart contracts based on any public chain system involves the development cost of resource expenditure. For example, deploying/calling smart contracts on the network, performing energy conversion, pledge/delegation and other operations all require a certain cost. Different blockchain network development costs are different. The cost of developing smart contracts on the PlatON network is similar to that of developing on Ethereum. This manual will analyze and compare in an intuitive format, allowing users to have a clearer understanding of development costs.

    Summary#

    This article will use a table to compare different development costs of small, medium and large contracts, and compare PlatON with Ethereum. In terms of contracts, a simple SET/GET function contract is used as a small test contract. The medium-sized contract example will use an open source(eth-tweet) contract The large contract is a smart contract that complies with the PRC20 standard.

    Data Overview#

    Simple Storage Contract

    PlatformContract LevelSizeGasUsedGasPriceAmountRemark
    PlatONSmall-sized0.3 kb769535,000,000,000 VON384765 gVON0.000384765 LAT
    EthereumSmall-sized0.3 kb1271735,000,000,000 wei635865 Gwei0.000635865 ETH

    eth-tweet Contract

    PlatformContract LevelSizeGasUsedGasPriceAmountRemark
    PlatONMedium-sized2.08 kb2570655,000,000,000 VON1285325 gVON0.001285325 LAT
    EthereumMedium-sized2.08 kb6213855,000,000,000 wei3106925 Gwei0.003106925 ETH

    PRC20 Token Contract

    PlatformContract LevelSizeGasUsedGasPriceAmountRemark
    PlatONLarge-sized4.45 kb5528235,000,000,000 VON2764115 gVON0.002764115 LAT
    EthereumLarge-sized4.45 kb12821715,000,000,000 wei6410855 Gwei0.006410855 ETH

    Small-sized Contract#

    Simple Storage Contract#

    Sample Code

    pragma solidity ^0.4.12;
     contract SimpleTest {        uint public age;     function setAge(uint _input) public {        age = _input;    }     function getAge() public constant returns (uint) {        return age;    }}

    ByteCode

    608060405234801561001057600080fd5b50610117806100206000396000f3006080604052600436106053576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063262a9dff146058578063967e6e65146080578063d5dcf1271460a8575b600080fd5b348015606357600080fd5b50606a60d2565b6040518082815260200191505060405180910390f35b348015608b57600080fd5b50609260d8565b6040518082815260200191505060405180910390f35b34801560b357600080fd5b5060d06004803603810190808035906020019092919050505060e1565b005b60005481565b60008054905090565b80600081905550505600a165627a7a7230582079e51340567895e1097e1c9115e778c3d982b8e71b6997c57f1ba497c56c8b3b0029

    ByteSize:311 byte => 0.3 kb

    Cost#

    PlatON

    • GasUsed: 76953
    • GasPrice: 5,000,000,000 (5 gVON)
    • Costs: 384765 gVON(0.000384765 LAT

    Ethereum

    • GasUsed: 127173
    • GasPrice: 5,000,000,000 (5 Gwei)
    • Costs: 635865 Gwei(0.000635865 ETH

    Medium-sized Contract#

    Eth-Tweet#

    Sample Code

    Click to view code

    ByteCode

    6060604052341561000f57600080fd5b5b600060018190555033600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b6107e88061006a6000396000f3006060604052361561008c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630c4f65bd146100915780633e450fff146100e65780635c3e426c146100fb578063ae978f0814610134578063b6db75a0146101d1578063c3ad5ecb146101fe578063ca7dc5b1146102a2578063fb46d4c5146102cb575b600080fd5b341561009c57600080fd5b6100a461033c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100f157600080fd5b6100f9610367565b005b341561010657600080fd5b610132600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506103b2565b005b341561013f57600080fd5b610147610411565b6040518080602001848152602001838152602001828103825285818151815260200191508051906020019080838360005b838110156101945780820151818401525b602081019050610178565b50505050905090810190601f1680156101c15780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b34156101dc57600080fd5b6101e46104f7565b604051808215151515815260200191505060405180910390f35b341561020957600080fd5b61021f6004808035906020019091905050610550565b6040518080602001838152602001828103825284818151815260200191508051906020019080838360005b838110156102665780820151818401525b60208101905061024a565b50505050905090810190601f1680156102935780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b34156102ad57600080fd5b6102b5610628565b6040518082815260200191505060405180910390f35b34156102d657600080fd5b610326600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610633565b6040518082815260200191505060405180910390f35b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505b90565b61036f6104f7565b156103af57600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b5b565b6103ba6104f7565b1561040d578073ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050505b5b50565b610419610703565b600080600080600180540381526020019081526020016000206001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104c95780601f1061049e576101008083540402835291602001916104c9565b820191906000526020600020905b8154815290600101906020018083116104ac57829003601f168201915b505050505092506000806001805403815260200190815260200160002060000154915060015490505b909192565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161490505b90565b610558610703565b60008060008481526020019081526020016000206001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106035780601f106105d857610100808354040283529160200191610603565b820191906000526020600020905b8154815290600101906020018083116105e657829003601f168201915b505050505091506000808481526020019081526020016000206000015490505b915091565b600060015490505b90565b600061063d6104f7565b151561066b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90506106fd565b60a08251111561069d577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe90506106fc565b4260008060015481526020019081526020016000206000018190555081600080600154815260200190815260200160002060010190805190602001906106e4929190610717565b50600160008154809291906001019190505550600090505b5b5b919050565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061075857805160ff1916838001178555610786565b82800160010185558215610786579182015b8281111561078557825182559160200191906001019061076a565b5b5090506107939190610797565b5090565b6107b991905b808211156107b557600081600090555060010161079d565b5090565b905600a165627a7a7230582004bd291e77dd5f2bfd4822ec9590d7da613bf3ef8cb6270dc7d553fa687ab1780029

    ByteSize: 2130.5 byte => 2.08 kb

    Cost#

    PlatON

    • GasUsed: 257065
    • GasPrice: 5,000,000,000 (5 gVON)
    • Costs: 1285325 gVON(0.001285325 LAT

    Ethereum

    • GasUsed: 621385
    • GasPrice: 5,000,000,000 (5 Gwei)
    • Costs: 3106925 Gwei(0.003106925 ETH

    Large-sized Contract#

    PRC20 Token Contract#

    Sample Code

    Click to view code

    ByteCode

    6060604052604060405190810160405280600481526020017f56302e3100000000000000000000000000000000000000000000000000000000815250600690805190602001906200005292919062000139565b5034156200005c57fe5b604051620011cd380380620011cd833981016040528080519060200190919080518201919060200180519060200190919080518201919050505b83600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550836000819055508260039080519060200190620000f992919062000139565b5081600460006101000a81548160ff021916908360ff16021790555080600590805190602001906200012d92919062000139565b505b50505050620001e8565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200017c57805160ff1916838001178555620001ad565b82800160010185558215620001ad579182015b82811115620001ac5782518255916020019190600101906200018f565b5b509050620001bc9190620001c0565b5090565b620001e591905b80821115620001e1576000816000905550600101620001c7565b5090565b90565b610fd580620001f86000396000f300606060405236156100ad576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100c3578063095ea7b31461015c57806318160ddd146101b357806323b872dd146101d9578063313ce5671461024f57806354fd4d501461027b57806370a082311461031457806395d89b411461035e578063a9059cbb146103f7578063cae9ca511461044e578063dd62ed3e146104e8575b34156100b557fe5b6100c15b60006000fd5b565b005b34156100cb57fe5b6100d3610551565b6040518080602001828103825283818151815260200191508051906020019080838360008314610122575b805182526020831115610122576020820191506020810190506020830392506100fe565b505050905090810190601f16801561014e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561016457fe5b610199600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506105ef565b604051808215151515815260200191505060405180910390f35b34156101bb57fe5b6101c36106e2565b6040518082815260200191505060405180910390f35b34156101e157fe5b610235600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106e8565b604051808215151515815260200191505060405180910390f35b341561025757fe5b61025f610969565b604051808260ff1660ff16815260200191505060405180910390f35b341561028357fe5b61028b61097c565b60405180806020018281038252838181518152602001915080519060200190808383600083146102da575b8051825260208311156102da576020820191506020810190506020830392506102b6565b505050905090810190601f1680156103065780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561031c57fe5b610348600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a1a565b6040518082815260200191505060405180910390f35b341561036657fe5b61036e610a64565b60405180806020018281038252838181518152602001915080519060200190808383600083146103bd575b8051825260208311156103bd57602082019150602081019050602083039250610399565b505050905090810190601f1680156103e95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103ff57fe5b610434600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b02565b604051808215151515815260200191505060405180910390f35b341561045657fe5b6104ce600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610c70565b604051808215151515815260200191505060405180910390f35b34156104f057fe5b61053b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610f21565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105e75780601f106105bc576101008083540402835291602001916105e7565b820191906000526020600020905b8154815290600101906020018083116105ca57829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190505b92915050565b60005481565b600081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156107b5575081600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156107c15750600082115b156109585781600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610962565b60009050610962565b5b9392505050565b600460009054906101000a900460ff1681565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a125780601f106109e757610100808354040283529160200191610a12565b820191906000526020600020905b8154815290600101906020018083116109f557829003601f168201915b505050505081565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610afa5780601f10610acf57610100808354040283529160200191610afa565b820191906000526020600020905b815481529060010190602001808311610add57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610b535750600082115b15610c605781600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610c6a565b60009050610c6a565b5b92915050565b600082600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff1660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e01905060405180910390207c01000000000000000000000000000000000000000000000000000000009004338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828051906020019080838360008314610ec0575b805182526020831115610ec057602082019150602081019050602083039250610e9c565b505050905090810190601f168015610eec5780820380516001836020036101000a031916815260200191505b5094505050505060006040518083038160008761646e5a03f1925050501515610f155760006000fd5b600190505b9392505050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b929150505600a165627a7a723058200cefa2ee536584300e6123cee2abeafcf9ab9388caf67ee95580f02e5587008d0029

    ByteSize: 4557.5 byte => 4.45 kb

    Cost#

    PlatON

    • GasUsed: 552823
    • GasPrice: 5,000,000,000 (5 gVON)
    • Costs: 2764115 gVON(0.002764115 LAT

    Ethereum

    • GasUsed: 1282171
    • GasPrice: 5,000,000,000 (5 Gwei)
    • Costs: 6410855 Gwei(0.006410855 ETH

    - + \ No newline at end of file diff --git a/Solidity_Contract_Migrate/index.html b/Solidity_Contract_Migrate/index.html index 44c418e00..ef0ab36e6 100644 --- a/Solidity_Contract_Migrate/index.html +++ b/Solidity_Contract_Migrate/index.html @@ -8,7 +8,7 @@ Migration tutorial | PlatON - + @@ -33,7 +33,7 @@ /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; }}

    Operation Procedure#

    Step1. Create new directory for example project

    mkdir example && cd example

    After the command is executed,project directory structure is as follows:

    Step2. Init project

    platon-truffle init

    After the command is executed,project directory structure is as follows:

    Step3. Move ERC200513Token contract compiled in to example/contracts

    ls contracts/

    Step4. Modify the compilation version number and chain-dependent configuration in truffle-config.js

    module.exports = {  networks: {     development: {      host: "10.1.1.6",     // chain address      port: 8806,            // chain rpc port      network_id: "*",       // Any network (default: none)      from: "lat1wxadw8yzr6qxdw5yl3f2surp6ue6f03e07kcqc", // the wallet address of deployment contract       gas: 999999,      gasPrice: 50000000004,              },  },
       compilers: {    solc: {       version: "0.5.13",    // the version number used in compiling the contract is the same as the contract definition       docker: false,        // Use "0.5.1" you've installed locally with docker    }  }}

    Step5. Compile contract

    platon-truffle compile

    The following is the output of the successful compilation:

    Compiling your contracts...Compiling ./contracts/ERC200513Token.solCompiling ./contracts/Migrations.sol  compilation warnings encountered:
     Warning: This is a pre-release compiler version, please do not use it in production.Artifacts written to /home/guest/example/build/contractsCompiled successfully using:   solc: 0.5.13-develop.2020.1.2+commit.9ff23752.mod.Emscripten.clang

    Step6. Create deploy script

    cd migrations && touch 2_initial_ERC200513Token.js

    Deploy script 2_initial_ERC200513Token.js content is as follows:

    const ERC200513Token = artifacts.require("ERC200513Token"); //contract class namemodule.exports = function(deployer) {  deployer.deploy(ERC200513Token,100,'PLA','PLAT'); //ERC200513Token abstract and constructor params};  

    Step7. Deploy contract

    platon-truffle migrate

    After deploying successfully, you will see log info as follows:

    Compiling your contracts...Everything is up to date, there is nothing to compile.2_initial_ERC200513Token.js   Deploying 'ERC200513Token'     transaction hash:    0xa1770aecf4cffb0e75a172e06e75a9e9cb2d36bf89291b57d504e8c054985e99     Blocks: 0            Seconds: 0     contract address:    lat1uetshtp4tp6l067tl02e4x435py9ajrfdhsrd4//new contract address     block number:        265657     block timestamp:     1581742216965     account:             lat1wxadw8yzr6qxdw5yl3f2surp6ue6f03e07kcqc     balance:             90000000.826385379994114416     gas used:            638876     gas price:           50.000000004 gVON     value sent:          0 LAT     total cost:          0.031943800002555504 LAT     Saving migration to chain.     Saving artifacts     Total cost:     0.031943800002555504 LATSummary Total deployments:   2 Final cost:          0.037844150003027532 LAT

    - + \ No newline at end of file diff --git a/Solidity_Contract_Security_Dev_Guide/index.html b/Solidity_Contract_Security_Dev_Guide/index.html index 5fe8ce53c..8cdc9dd7c 100644 --- a/Solidity_Contract_Security_Dev_Guide/index.html +++ b/Solidity_Contract_Security_Dev_Guide/index.html @@ -8,7 +8,7 @@ Contract security | PlatON - + @@ -29,7 +29,7 @@ function writeMap(uint _map, uint _key, uint _value) public { array[_map][_key] = _value; } function readMap(uint _map, uint _key) public view returns (uint) { return array[_map][_key]; } function eraseMaps() public { delete array; }}

    Consider the example above and the following sequence of calls: allocate(10), writeMap(4, 128, 256). At this point, calling readMap(4, 128) returns 256. If we call eraseMaps, the length of state variable array is zeroed, but since its mapping elements cannot be zeroed, their information stays alive in the contract’s storage. After deleting array, calling allocate(5) allows us to access array[4] again, and calling readMap(4, 128) returns 256 even without another call to writeMap.

    If your mapping information must be deleted, consider using a library similar to iterable mapping, which allows you to traverse the keys and delete their values in the appropriate mapping.

    Permission Control Error#

    In smart contracts, contract developers usually set some permission for the contract owner, but if the developer negligently writes wrong function permissions, it may lead to serious consequences such as transfer of the owner.

    function initContract() public {    owner = msg.reader;}

    The above code function needs to be set onlyOwner.

    Reasonable permissions should be set for different functions in the contract.

    Address Initialization Problem#

    In EVM, all address-related initializations are given an initial value of 0.

    If an address variable is equal to 0, the variable may not be initialized or an unknown error may occur.

    If the developer initializes an address variable in the code but does not assign an initial value, or the user does not assign the address variable by mistake when initiating an operation, but this variable needs to be handled in the following code, it is possible Cause unnecessary security risks.

    For functions that involve addresses, it is recommended to add require (_to! = Address (0)) verification to effectively avoid unnecessary losses caused by user misoperations or unknown errors.

    Transaction Order Dependent#

    Since transactions are first stored in mempool in a short period of time, it is possible to know what action will take place before miners package them into blocks. This is troublesome for a decentralized market, because the transaction information of the token can be viewed, and the transaction order can be changed before it is packaged into a block. Avoiding this is difficult because it comes down to the specific contract itself.

    For example, in the market, it is best to implement batch auctions (this also prevents high frequency trading issues). Another method is using a pre-commit scheme.

    Minor Details#

    Types that do not occupy the full 32 bytes might contain “dirty higher order bits”. This is especially important if you access msg.data - it poses a malleability risk: You can craft transactions that call a function f(uint8 x) with a raw byte argument of 0xff000001 and with 0x00000001. Both are fed to the contract and both will look like the number 1 as far as x is concerned, but msg.data will be different, so if you use keccak256(msg.data) for anything, you will get different results.

    Security Recommendations#

    Take Warnings Seriously#

    If the compiler warns you about something, you should better change it. Even if you do not think that this particular warning has security implications, there might be another issue buried beneath it. Any compiler warning we issue can be silenced by slight changes to the code.

    Always use the latest version of the compiler to be notified about all recently introduced warnings.

    Restrict the Amount of Ether#

    Restrict the amount of Ether (or other tokens) that can be stored in a smart contract. If your source code, the compiler or the platform has a bug, these funds may be lost. If you want to limit your loss, limit the amount of Ether.

    Simple and Modular#

    Keep your contracts small and easily understandable. Single out unrelated functionality in other contracts or into libraries. General recommendations about source code quality of course apply: Limit the amount of local variables, the length of functions and so on. Document your functions so that others can see what your intention was and whether it is different than what the code does.

    Use the Checks-Effects-Interactions Pattern#

    Most functions will first perform some checks (who called the function, are the arguments in range, did they send enough Ether, does the person have tokens, etc.). These checks should be done first.

    As the second step, if all checks passed, effects to the state variables of the current contract should be made. Interaction with other contracts should be the very last step in any function.

    Early contracts delayed some effects and waited for external function calls to return in a non-error state. This is often a serious mistake because of the re-entrancy problem explained above.

    Note that, also, calls to known contracts might in turn cause calls to unknown contracts, so it is probably better to just always apply this pattern.

    Include a Fail-Safe Mode#

    While making your system fully decentralised will remove any intermediary, it might be a good idea, especially for new code, to include some kind of fail-safe mechanism:

    You can add a function in your smart contract that performs some self-checks like “Has any Ether leaked?”, “Is the sum of the tokens equal to the balance of the contract?” or similar things. Keep in mind that you cannot use too much gas for that, so help through off-chain computations might be needed there.

    If the self-check fails, the contract automatically switches into some kind of “failsafe” mode, which, for example, disables most of the features, hands over control to a fixed and trusted third party or just converts the contract into a simple “give me back my money” contract.

    Check Function Permissions Carefully#

    Reasonable permissions should be set for different functions in the contract.

    Check whether the functions in the contract use public and private keywords for visibility modification. Check whether the contract is correctly defined and uses modifiers to restrict access to key functions to avoid problems caused by unauthorized use.

    function initContract() public OnlyOwner {    owner = msg.reader;}

    Ask for Peer Review#

    The more people examine a piece of code, the more issues are found. Asking people to review your code also helps as a cross-check to find out whether your code is easy to understand - a very important criterion for good smart contracts.

    Other#

    1. More Security Recommendations
    2. Contract Best Practices

    Security Tools#

    1. Ethereum formal verification tool SMT checker .
    2. Formal verification tools: offline VS Code plugin,and Online version .
    3. Remix integrated security scan plugin: MythX

    Third Party Audit#

    You can find a professional third-party audit company for security audits, such as:slow mist


    - + \ No newline at end of file diff --git a/Solidity_Dev_Manual/index.html b/Solidity_Dev_Manual/index.html index 5cd0cb0f3..beec62c25 100644 --- a/Solidity_Dev_Manual/index.html +++ b/Solidity_Dev_Manual/index.html @@ -8,7 +8,7 @@ Getting started | PlatON - + @@ -52,7 +52,7 @@ //Give all donations from the contract to the beneficiary beneficiaryAddress.transfer(amountRaised); emit FundTransfer(beneficiaryAddress, amountRaised, false); } }}

    Compile Crowdfunding Contract

    Step1. Create new directory for Crowdfunding project

    mkdir myCrowdFunding && cd myCrowdFunding

    The following commands are performed in the myCrowdFunding directory without special instructions.

    Step2. Init project

    platon-truffle init

    After the command is executed, project directory structure is as follows:

    Step3. Move crowdfunding contract compiled in to myCrowdFunding/contracts/

    ls myCrowdFunding/contracts/

    Files in the directory: crowdFunding.sol.

    Step4. Fix compile version same as the version setted in truffle-config.js

    vim truffle-config.js

    Truffle-config.js content is as follows:

    compilers: {     solc: {        version: "0.5.17",    //same as the version declared in CrowdFunding.sol    }}

    Step5. Compile contract

    platon-truffle compile

    After the command is executed, project directory structure is as follows:

    Deploly crowdfunding Contract

    Step1. Create deploy script

    cd migrations/ && touch 2_initial_CrowdFunding.js

    Deploy script 2_initial_crowdFunding.js,content is as follows:

    const CrowdFunding = artifacts.require("CrowdFunding"); //deployment contract class namemodule.exports = function(deployer) {      deployer.deploy(CrowdFunding);};

    Step2. Setting config information for blockchain in truffle-config.js

    vim truffle-config.js

    Set blockchain network info

    networks: {    development: {       host: "10.1.1.6",     // blockchain server address       port: 8806,            // server port       network_id: "*",       // Any network (default: none)       from: "lat1wxadw8yzr6qxdw5yl3f2surp6ue6f03e07kcqc", //the accout address of deploying contract       gas: 999999,       gasPrice: 50000000004,    },}

    Step3. Deploy contract

    platon-truffle migrate

    After deploying successfully, you will see log info as follows:

    Compiling your contracts... Everything is up to date, there is nothing to compile. 3_initial_CrowdFunding.js     Deploying 'CrowdFunding'     transaction hash:    0x3a6419cd4169d7cfb430a1fc5632239ac4a01845827f20df9b3229a334c5488b     Blocks: 0            Seconds: 0     contract address:    lat1qtgycm7jkrq8csa2rgef6enlru0u02g8u82kpt //contract address     block number:        280532     block timestamp:     1581751224032     account:             lat1wxadw8yzr6qxdw5yl3f2surp6ue6f03e07kcqc     balance:             90000000.806077629992489796     gas used:            379154     gas price:           50.000000004 gVON     value sent:          0 LAT     total cost:          0.018957700001516616 LAT      Saving migration to chain.     Saving artifacts     Total cost:     0.018957700001516616 LAT

    Crowdfounding Query:

    Step1. Enter the platon-truffle console

    platon-truffle console

    You can execute command in platon-truffle console

    Step2. Create contract object

    var abi = [...]; //ABI of CrowdFunding contract,can get from build/contracts/CrowdFunding.jsonvar contractAddr = 'lat1qtgycm7jkrq8csa2rgef6enlru0u02g8u82kpt'; //CrowdFundsing contract addressvar crowdFunding = new web3.platon.Contract(abi,contractAddr);

    Step3. Query the amount raised

    crowdFunding.methods.amountRaised().call(null,function(error,result){console.log("result:" + result);}); //query the amount raised

    Step4. Crowdfunder judge the success of crowdfunding

    crowdFunding.methods.safeWithdrawal().send({from:'lat1wxadw8yzr6qxdw5yl3f2surp6ue6f03e07kcqc'}).on('data', function(event){ console.log(event);}).on('error', console.error); 

    Call contract command description:


    FAQ#

    About Compile#

    1. How many commands in platon-truffle?

      Refer to platon-truffle develop guide Reference here.

    2. Why contract syntax cannot be verified?

      Solidity 0.4.x has a great different with 0.5.x, detail info refer to Reference here.

    3. Why truffle doesn't compile?

      Confirm the contract version same as the version specified in the truffle-config.js. Contract syntax be writed in a wrong way.

    4. Why the contract can not be deployed by truffle migrate?

      Confrim the blockchain network info be configured correctly. Confirm the account address be configured correctly.

    5. Deploying a contract with a parameter constructor using the command truffle migrate failed.

      For example, A.sol

      Constructor(uint256 a, string memory b, string memory c) public {}

      2_initial_A.js configured as follow:

      const A = artifacts.require("A");  module.exports = function(deployer) {        deployer.deploy(A,100,'PLA','PLAT');//pass the corresponding construction parameters};
    - + \ No newline at end of file diff --git a/Solidity_Inner_Contract/index.html b/Solidity_Inner_Contract/index.html index ac8b9ceef..a2582b5df 100644 --- a/Solidity_Inner_Contract/index.html +++ b/Solidity_Inner_Contract/index.html @@ -8,7 +8,7 @@ Call Inner Contract | PlatON - + @@ -22,7 +22,7 @@ function assemblyCallppos(bytes memory data,address addr) public { uint256 len = data.length; uint retsize; bytes memory resval; assembly { if iszero(call(gas, addr, 0, add(data, 0x20), len, 0, 0)) { invalid() } retsize := returndatasize() } resval = new bytes(retsize); assembly { returndatacopy(add(resval, 0x20), 0, returndatasize()) } returnValue = resval; } function getReturnValue() public view returns(bytes memory ){ return returnValue; } }

    Note: The RLP codes are required for the parameters of the system contract, so it is recommended to complete it under the chain.

    - + \ No newline at end of file diff --git a/Third_Party_Walle/index.html b/Third_Party_Walle/index.html index 39f3136f0..9cc979337 100644 --- a/Third_Party_Walle/index.html +++ b/Third_Party_Walle/index.html @@ -8,13 +8,13 @@ Third-party wallets | PlatON - +
    Skip to main content

    Third-party wallets

    As the wallet specific for PlatON and Alaya, ATON does not support multi-chain and functions are relatively simple. Therefore, we hope the community can provide more third-party wallets with rich features and user-friendly experience that support PlatON and Alaya network.

    Following are third party wallets maintain and support by the community which able to transfer and store LAT on PlatON network, please research the security of them yourself before use, we listing the following information only for the convenience of downloading, it does not mean we responsible for the security of the wallet.

    • COBO Wallet-Cobo - Cobo wallet is a professional digital currency management wallet, it supports cloud wallet and HD wallet, it can store digital currencies of 40+ public chain including PlatON.

    • Math Plug-in Wallet - Math plug-in wallet supports PlatON main network and dev network, not only can support asset management, but also can be used as a development tool, and is also the Dapp application portal.

    • HashKey Me Wallet - HashKey Me wallet is a decentralized identity wallet that uses MPC, threshold signature and other technologies to provide users with a simple and secure experience of using a senseless private key, and currently supports a number of mainstream public chain digital assets including PlatON.

    - + \ No newline at end of file diff --git a/Verifiable_Computation/index.html b/Verifiable_Computation/index.html index 33838d935..2f7610192 100644 --- a/Verifiable_Computation/index.html +++ b/Verifiable_Computation/index.html @@ -8,7 +8,7 @@ Verifiable Computation | PlatON - + @@ -19,7 +19,7 @@ The processes of compling verifiable contract are:

    1. The vc compiler compiles the contract coded by users to IRs, and then converted to SSA, finally, it would be transformed into ggs, which is the gadget representation supported by libcsnark.
    2. Combines gss and keygenTemp.cpp to generate keygen.
    3. The vclang generates $pk$ and $vk$ (CRS construction) by keygen. This process performs a large number of elliptic curve multiplication operations, and after finishing generating $pk$ and $vk$, both of them would be serialized into the contract template, where $pk$ is used to generate trusted parameters, and $vk$ is the trusted parameter for verification.
    4. The vclang serializes $pk$ and $vk$ into vccTemp.cpp to generate vcc.cpp.
    5. The vclang compiles vcc.cpp to obtain vcc.wasm.

    How it works#

    vc-work

    Figure 4: The workflow of verifiable contract

    \ Here is the workflow of verifiable contract:

    1. After finishing compiling the contract, $pk$ and $vk$ would be obtained and would be deployed onto PlatON for storge to make them accessible to other nodes, and from being tampered.
    2. When executes the vc compute transaction, a vc task would be created, which is combined with nonce of the transaction and the input parameter x corresponding its key taskid.
    3. Once the compute transaction succeed being confirmed, the transaction parsing event would be invoked by the vc pool to check whether this task could be added to the vc pool or not.
    4. Waiting for 20 blocks confirmation, it starts to execute real_compute, which is off-chain computation making it no fee cost. The processes of real_compute are two steps. Firstly, computing the witness $s$ according to the obtained gadget sequence in the previous compilation. Secondly, with the additional pk got in step 1, the computing node can generate the final proof, which is a sequence of proofs combined with $\pi_A$, $\pi_B$, $\pi_C$, etc.
    5. The result and proof are deployed onto PlatON by Set_result(proof,result), which is mainly executing verify (vk,proof,input). Once validated, the transaction initiator would be rewarded for its computing contribution. The verify time of zkSNARK is relatively short compared to the time of proof generation, but it is also related to the length of the input parameter, so it is necessary to pay attention to limiting the length of the input parameter, preventing the gas cost of the transaction from being too high, and increasing the cost of the verifier.

    The incentive mechanism of verifiable contract#

    Users who have the requirement to outsource their computation need to mortgage the appropriate fees to the contract. Each node in the PlatON network can compete for the computing task. Once the computing node succeeds in finishing the computing task and obtain the result and the corresponding proof, the set_result transaction request would be initiated after that the computing node finished paying the miner fee. As the verifying node receives this request, the set_result would be executed in the meantime, and the proof and result parameters encapsulated in the transaction would be validated their legitimacy. If yes, it could be considered that the computing node obtains the correct result. Meanwhile, the mortgage fee would be transferred to the requester's account as the incentive, and no incentive would be offered if fails.

    Analysis to the VC solution#

    Performance analysis#

    computing stageoperationusercomputing node
    keygen constructionexponentialO(m+n)0
    real_computeexponential0O(m)
    set_resulthyperbolic matching operation, exponentialO(1),O(n)0

    where $m$ is the degree of polynomials $A$,$B$ and $C$, $n$ is the length of input parameter.

    1. keygen construction: homomorphic hiding the sampled value to generate trusted parameters. Since $m$ is a large number commonly, and it is an exponential operation, then it would take a relatively long time. As this process is done after compiling the contract, it would not affect the performance of contract executing.
    2. real_compute: $O(m)$ times of exponential operations are required to generate the witness and proof. And this can be distributed to third parties for fast computation.
    3. set_result: According to the specific input, the verify process generate parts of the proof, requiring $O(n)$ times of operations, and then take the fixed hyperbolic matching operation to make the verification. Since this process is done on-chain, it needs to be optimized to assure it at an acceptable computing cost.

    Comparison of different VC technologies#

    time(Setup)key len(Setup)time(Proving)memory(Proving)time(Verifying)proof len(Verifying)
    zkSNARK~28min~18GB~18min~216GB<10ms230B
    zkSNARK(Zcash-Sprout)~27hr(6 player)~900MB~37s~1.5GB<10ms~300B
    zkSNARK(Zcash-Sapling)months-MPC<800MB~7s~40MB<10ms~200B
    zkSTARK<0.1s16B6min131GB~0.1s~1.2MB
    Bulletproof2min~1MB~3s~1.5KB
    ZKBoo()~33ms~MBs~38ms~200KB
    Ligero()~140ms~MBs~60ms~34KB

    Future plans#

    PlatON will implement more optimized VC algorithm, it would be optimized in the following several ways:

    1. Cutting the ZK property off from SNARK to improve its efficiency, decreases the proof generation and verification time.
    2. Implementing privacy-preserving computing combining with MPC and HE.
    3. Considering adopting more optimized elliptic curves to increase the speed of encryption on ECC.
    4. Optimizing the verification process, including pre-processing the hyperbolic matching operation and presetting intermediate values to keep it from the repeated computation.
    5. Adopting some algorithms like MPC to guarantee security during the process of Setup.

    Reference#

    [1]. https://vitalik.ca/

    - + \ No newline at end of file diff --git a/WASM_Contract_1/index.html b/WASM_Contract_1/index.html index 5ef38e1f7..c85d10403 100644 --- a/WASM_Contract_1/index.html +++ b/WASM_Contract_1/index.html @@ -8,13 +8,13 @@ PlatON WASM contract (1) - Introduction | PlatON - +
    Skip to main content
    - + \ No newline at end of file diff --git a/WASM_Contract_2/index.html b/WASM_Contract_2/index.html index d613afbd3..5f06ba590 100644 --- a/WASM_Contract_2/index.html +++ b/WASM_Contract_2/index.html @@ -8,13 +8,13 @@ PlatON WASM contract (2) - Cross contracts Interaction | PlatON - +
    Skip to main content

    PlatON WASM contract (2) - Cross contracts Interaction

    EN is under construction#

    - + \ No newline at end of file diff --git a/WASM_Contract_3/index.html b/WASM_Contract_3/index.html index 99ccf6cba..08f6055cc 100644 --- a/WASM_Contract_3/index.html +++ b/WASM_Contract_3/index.html @@ -8,13 +8,13 @@ PlatON WASM contract (3) - Contract Event | PlatON - +
    Skip to main content
    - + \ No newline at end of file diff --git a/WASM_Contract_4/index.html b/WASM_Contract_4/index.html index bdcf31e49..9ba9dfff7 100644 --- a/WASM_Contract_4/index.html +++ b/WASM_Contract_4/index.html @@ -8,13 +8,13 @@ PlatON WASM contract (4) - Parameters | PlatON - +
    Skip to main content

    PlatON WASM contract (4) - Parameters

    EN is under construction#

    - + \ No newline at end of file diff --git a/WASM_Contract_5/index.html b/WASM_Contract_5/index.html index c5cf6f24c..e985671fb 100644 --- a/WASM_Contract_5/index.html +++ b/WASM_Contract_5/index.html @@ -8,13 +8,13 @@ PlatON WASM contract (5) - Proxy | PlatON - +
    Skip to main content
    - + \ No newline at end of file diff --git a/WASM_Contract_6/index.html b/WASM_Contract_6/index.html index 8eb091948..bfc3a0eb9 100644 --- a/WASM_Contract_6/index.html +++ b/WASM_Contract_6/index.html @@ -8,13 +8,13 @@ PlatON WASM contract (6) - Proxy Event | PlatON - +
    Skip to main content

    PlatON WASM contract (6) - Proxy Event

    EN is under construction#

    - + \ No newline at end of file diff --git a/WASM_Contract_7/index.html b/WASM_Contract_7/index.html index deef2c66a..1fde625ff 100644 --- a/WASM_Contract_7/index.html +++ b/WASM_Contract_7/index.html @@ -8,13 +8,13 @@ PlatON WASM contract (7) - General Proxy | PlatON - +
    Skip to main content

    PlatON WASM contract (7) - General Proxy

    EN is under construction#

    - + \ No newline at end of file diff --git a/WASM_Contract_8/index.html b/WASM_Contract_8/index.html index 69a7737b2..e125b9cab 100644 --- a/WASM_Contract_8/index.html +++ b/WASM_Contract_8/index.html @@ -8,13 +8,13 @@ PlatON WASM contract (8) - Build-in Type | PlatON - +
    Skip to main content
    - + \ No newline at end of file diff --git a/WASM_Contract_9/index.html b/WASM_Contract_9/index.html index 47950c1ca..5a8c6cc00 100644 --- a/WASM_Contract_9/index.html +++ b/WASM_Contract_9/index.html @@ -8,13 +8,13 @@ PlatON WASM contract (9) - Build-in Type Performance Test | PlatON - +
    Skip to main content

    PlatON WASM contract (9) - Build-in Type Performance Test

    - + \ No newline at end of file diff --git a/WASM_Smart_Contract/index.html b/WASM_Smart_Contract/index.html index 777526ac5..a49e708e0 100644 --- a/WASM_Smart_Contract/index.html +++ b/WASM_Smart_Contract/index.html @@ -8,13 +8,13 @@ WASM Smart Contract | PlatON - +
    Skip to main content

    WASM Smart Contract

    WebAssembly (wasm for short) is a binary instruction set designed for stacked virtual machines. Wasm was designed to be a compile target for platforms such as C / C ++ / Rust, and was originally designed to solve JavaScript performance issues. Wasm is a web standard being led by the W3C and supported by browser vendors such as Google, Microsoft, and Mozilla.

    This tutorial is mainly to guide users to create a WASM smart contract using wasm language on PlatON.

    It is mainly explained from the following aspects:

    - + \ No newline at end of file diff --git a/Wasm_Contract_API/index.html b/Wasm_Contract_API/index.html index dc5b32783..7a6e3b2a3 100644 --- a/Wasm_Contract_API/index.html +++ b/Wasm_Contract_API/index.html @@ -8,7 +8,7 @@ Wasm API | PlatON - + @@ -107,7 +107,7 @@ Modify data based on iterator, but cannot modify all index-related fields .

    struct Member {std::string name;uint8_t age;uint8_t sex;uint64_t $seq_;std::string Name() const { return name; }uint8_t Age() const { return age; }PLATON_SERIALIZE(Member, (name)(age)(sex))};MultiIndex<"table"_n, Member,  IndexedBy<"index"_n, IndexMemberFun<Member, std::string, &Member::Name,                                    IndexType::UniqueIndex>>,IndexedBy<"index2"_n, IndexMemberFun<Member, uint8_t, &Member::Age,                                      IndexType::NormalIndex>>>member_table;member_table.modify(r.first, [&](auto &m) { m.sex = 15; });

    contract api#

    platon_destroy()#

    bool platon::platon_destroy ( const Address & addr)

    Destory contract.

    platon_migrate_contract()#

    template<typename value_type , typename gas_type >bool platon::platon_migrate_contract ( Address & addr,const bytes & init_args,value_type  value,gas_type  gas)

    Migrate contract.

    cross_call_args()#

    template<typename... Args>bytes platon::cross_call_args ( const std::string & method,const Args &...  args)  

    Construct the Parameters of the call across contracts.

    platon_call()#

    template <typename value_type, typename gas_type, typename... Args>inline bool platon_call(const Address &addr, const value_type &value,const gas_type &gas, const std::string &method,const Args &... args)

    Cross-contract call without return value.

    platon_call_with_return_value()#

    template <typename return_type, typename value_type, typename gas_type, typename... Args>inline auto platon_call_with_return_value(const Address &addr,const value_type &value,const gas_type &gas,const std::string &method,const Args &... args)

    Cross-contract call with return value.

    platon_delegate_call()#

    template <typename gas_type, typename... Args>inline bool platon_delegate_call(const Address &addr, const gas_type &gas,const std::string &method,const Args &... args) 

    Cross-contract proxy call without return value.

    platon_delegate_call_with_return_value()#

    template <typename return_type, typename gas_type, typename... Args>inline auto platon_delegate_call_with_return_value(const Address &addr,const gas_type &gas,const std::string &method,const Args &... args) 

    Cross-contract proxy call with return value.

    get_call_output()#

    template<typename T >void platon::get_call_output ( T & t)

    Gets the return value of calling contract methods across contracts.

    platon_event#

    void platon_event(const uint8_t *topic, size_t topic_len, const uint8_t *args,                  size_t args_len);

    Post event to VM

    exception api#

    platon_panic#

    void platon_panic(void);

    Terminate transaction, deduct all gas given by transaction

    platon_revert#

    void platon_revert(void);

    Terminate the transaction and deduct the gas consumed

    other api#

    platon_sha3()#

    h256 platon::platon_sha3 ( const bytes & data )

    Sh3 algorithm.


    - + \ No newline at end of file diff --git a/Wasm_Contract_Best_Practice/index.html b/Wasm_Contract_Best_Practice/index.html index 6d508321a..42d89c02f 100644 --- a/Wasm_Contract_Best_Practice/index.html +++ b/Wasm_Contract_Best_Practice/index.html @@ -8,7 +8,7 @@ Best practices | PlatON - + @@ -70,7 +70,7 @@ containers and iterators can simplify code. For example:

    std::map<std::string, std::string> my_map;for (auto it = my_map.begin(); it != my_map.end(); it++) {    // ignore}
    Reference Arguments#

    Suggest using reference arguments as function parameters. Reference parameters can reduce unnecessary replication and reduce unnecessary memory allocation. For us WASM virtual machines, memory allocation is an expensive operation.

    Containers#

    The C ++ standard library provides some commonly used containers (map, vector, list, etc.), and you should carefully read the corresponding interface documentation when using it. It is important to note that the operator[] oper ator of map, according to the interface documentation, when the key does not exist, the insert action will be performed. For contract development, when using StorageType to store the map, do not useoperator []to determine whether the key exists, but usefind () .


    - + \ No newline at end of file diff --git a/Wasm_Contract_Dev_Costs/index.html b/Wasm_Contract_Dev_Costs/index.html index 2800b2412..62f03eb41 100644 --- a/Wasm_Contract_Dev_Costs/index.html +++ b/Wasm_Contract_Dev_Costs/index.html @@ -8,7 +8,7 @@ Development Costs | PlatON - + @@ -47,7 +47,7 @@ CONST std::string getSymbol(){ return symbol.self(); } CONST uint64_t getTotalSupply(){ return totalSupply.self(); } // Approves and then calls the receiving contract. ACTION bool approveAndCall(Address _spender, uint64_t _value, const bytes& _extraData) { Address sender = platon_caller(); allowed.self()[sender][_spender] = _value; PLATON_EMIT_EVENT2(Approval, sender, _spender, _value); // call the receiveApproval function on the contract you want to be notified. This // crafts the function signature manually so one doesn't have to include a contract // in here just for this. // define: receiveApproval(Address _from, uint64_t _value, Address _tokenContract, bytes& _extraDaa) // it is assumed that when does this that the call should succeed. return true; }}; PLATON_DISPATCH(LATToken,(init)(balanceOf)(transfer)(transferFrom)(approve)(allowance)(getName)(getDecimals)(getSymbol)(getTotalSupply)(approveAndCall))

    ByteCode

    Click to view bincode

    ByteSize: 36764 byte => 35.9 kb


    Costs#

    PlatON-EVM

    Ethereum

    PlatON-WASM


    - + \ No newline at end of file diff --git a/Wasm_Dev_Manual/index.html b/Wasm_Dev_Manual/index.html index 988fe4689..08379ee91 100644 --- a/Wasm_Dev_Manual/index.html +++ b/Wasm_Dev_Manual/index.html @@ -8,7 +8,7 @@ Getting started | PlatON - + @@ -39,7 +39,7 @@ supported?

    The following C ++ standard library types are supported:

  • How do custom types support RLP serialization/deserialization?

       struct Base {   int a;   std::string b;
        PLATON_SERIALIZE(Base, (a)(b));   };
    struct Derived : public Base {  int c;  int d;
       PLATON_SERIALIZE_DERIVED(Derived, Base, (c)(d));};
  • - + \ No newline at end of file diff --git a/Wasm_Operation_Principle/index.html b/Wasm_Operation_Principle/index.html index 63728c941..cb54bce9f 100644 --- a/Wasm_Operation_Principle/index.html +++ b/Wasm_Operation_Principle/index.html @@ -8,13 +8,13 @@ WebAssembly(Wasm) | PlatON - +
    Skip to main content

    WebAssembly(Wasm)

    Preface#

    WASM (WebAssembly) is not a language, but a new bytecode format, a brand-new underlying binary grammar, and instruction code compiled by the compiler. Small in size, portable, fast in loading, and compatible with the latest format of the Web, WASM is a new technology to run portable programs safely and effectively. This article analyzes the introduction, advantages, operation mechanism and use of the PlatON WASM contract in detail.

    Introduction of WASM#

    WASM was mainly applied on the Web in the early days. As it continues to develop, it is used as the final format of smart contracts by increasing projects, and runs with the corresponding VM loaded, such as wavm and wagon. Bytecodes are parsed and operate in the core virtual machine module.

    The virtual machine (VM) refers to a complete computer system that is simulated by software, has functions of a complete hardware system and runs in an isolated environment, such as the Vmware virtual machine for operating system virtualization and the JVM virtual machine for the software operating environment. The virtual machine in the blockchain is a code operating environment built on the blockchain, mainly to process the smart contracts of the blockchain.

    Why does PlatON introduce the WASM virtual machine as a supplement to the EVM?

    As the demand for virtual machines and smart contracts in blockchain applications grows, the blockchain virtual machine technology is being improved as time goes by. At present, WASM-based virtual machines have been significantly improved in terms of speed and performance, and support multiple high-level development languages such as C, C++, Rust, and Golang, lowering the development threshold.

    To facilitate the development of blockchain applications, PlatON has launched a dual virtual machine engine that supports the WASM virtual machine and the EVM at the same time. Blockchain applications that originally run on public chains that support EVM, such as Ethereum, can migrate easily and seamlessly if they need to use PlatON due to performance and other reasons.

    EVM is essentially a script program, a stack-based virtual machine, which needs to be executed after being translated into instructions by a compiler, which is quite inefficient. At the same time, EVM also has some problems in its architecture and use, such as:

    • Strong coupling and difficult scalability: The chain and the EVM are internally dependent upon each other;
    • Lack of a standard library: There is basically no standard library in solidity, and you must independently code corresponding functions, such as string comparison.

    Compared with EVM, WASM, as a kind of intermediate code, runs smart contracts faster, and can be developed in any familiar programming language (C/C++/Rust/Golang). It also has many other features:

    • Efficient performance: Binary coding adopted has superior performance during program execution;
    • Support by multiple languages: You can use C/C++/Rust/Golang and other languages to write the contract and then compile the contract into bytecode;
    • Abundant standard libraries: There are abundant standard libraries available for use in different languages.

    At the same time, WASM has been applied by a growing number of projects, including Ethereum that has introduced the EVM. The popularity of WASM has driven its community ecosystem to improve.

    In order to adapt the existing WASM applications and developers familiar with WASM to the PlatON ecosystem, PlatON decided after comprehensive consideration to adopt dual virtual machines, that is, to introduce the WASM virtual machine as a supplement to the EVM.

    Advantages of PlatON to Introduce WASM#

    PlatON factored in some of the disadvantages of the EVM upon its decision to introduce the virtual machine. Right after the EVM was introduced, PlatON began the design and development of the WASM virtual machine, and kept making innovations and improvements in terms of scalability, stability, and operating efficiency. The main functions include:

    • With a complete set of contract development kit PlatON-CDT;
    • Smaller contract bytecode. WASM binary code compiled by CDT suite is half smaller compared with other projects;
    • With a smart contract framework PlatON-Truffle for rapid development;
    • With support for string, address, hash, u128 and other data types;
    • The gas mechanism introduced. Every time a contract instruction is executed, the corresponding gas will be deducted to ensure that the execution of the contract instruction can be terminated after a limited number of operations, thereby effectively preventing code from attacks of the infinite loop;
    • Contract nested call introduced, which can immediately obtain the result of another contract call, making calls between contracts as convenient as function calls;
    • With support for the automatic expansion of linear memory and caching WASM module to optimize the loading performance of the contract, thereby greatly improving the operating performance of the virtual machine.

    Based on the application and optimization of WASM, PlatON's smart contract module boasts higher compatibility and performance, as well as better security and flexibility. After successfully integrating WASM and applying dual virtual machines, PlatON tested the performance of the EVM and WASM for comparison under the same environment.

    The test results show that the execution efficiency of the WASM virtual machine is much higher than that of the EVM. EVM uses 256-bit machine code that greatly affects the performance of the execution and at the same time increases the memory usage.

    PlatON has the following advantages after introducing the WASM virtual machine as part of the dual virtual machines:

    • Mainstream WASM smart contracts can be easily and quickly migrated to the PlatON network;

    • The threshold for contract developers is lowered, with little learning cost;

    • Developers who use other WASM-based networks can be well-adapted to the WASM virtual machine and get started quickly;

    • The execution of smart contracts is more efficient;

    • Abundant development libraries can improve the efficiency of smart contract development.

    The Operating Mechanism of WASM#

    The WASM virtual machine is a completely independent sandbox. Fully isolated from the outside, the contract code runs inside the virtual machine, and cannot access the network, file system or other processes. At the same time, to prevent the virtual machine from executing too many computation instructions and falling into an infinite loop, both the gas mechanism and the timeout mechanism are introduced as dual controls.

    The working principle of dual virtual machines:

    As shown in the figure: Smart contracts written in languages such as solidity/c/c++ are compiled into bytecode by a compiler. At the same time, different types of contracts come with different bytecode features. By recognizing the features, the engine of the dual virtual machines of PlatON can select a specific virtual machine to load the bytecode, parse it, and then execute the corresponding function according to the instruction.

    Usage process of the smart contract:

    As shown in the figure, you can use C++ to write a smart contract based on WASM, or solidity to write a smart contract that belongs to the EVM, then compile and generate bytecode and other information through the toolset, and then send it to a node on the PlatON network by the transaction through the SDK development toolset. That is a complete process of a contract-related transaction.

    PlatON provides a complete WASM contract development kit named PlatON-CDT. Using this kit, you can quickly write smart contracts for the WASM virtual machine. The kit encapsulates various types of data, and is equipped with a simple API interface and detailed interface documentation. At the same time, you can also use the smart contract testing framework PlatON-Truffle for development, compilation, deployment, contract interface testing and other functions, which is convenient for developers to develop and test contracts.

    PlatON provides an automated Contract SDK generation tool, which can automatically generate the code for the back-end system to call the contract interface and can shield the parameter encoding and decoding details when calling the contract. In this way, it helps developers quickly integrate contract business into the system, so that they can be more focused on developing the business logic of smart contracts.

    Summary#

    This article mainly discusses the background and original intention of PlatON to support the WASM virtual machine and introduces the unique advantages brought by the introduction of WASM. It also briefly explains the basic principles and operating mechanisms of the WASM virtual machine. With this article, the author hopes to provide some useful experience for community users, developers, and blockchain professionals participating in PlatON. From a bust to a boom, WASM will be applied in increasing projects as the underlying level of distributed application development in the future.

    - + \ No newline at end of file diff --git a/adapting_to_new_chainid/index.html b/adapting_to_new_chainid/index.html index c7592f8ea..80399d976 100644 --- a/adapting_to_new_chainid/index.html +++ b/adapting_to_new_chainid/index.html @@ -8,7 +8,7 @@ Adapting to new chainid | PlatON - + @@ -16,7 +16,7 @@
    Skip to main content

    Adapting to new chainid

    How new DApp can be adapted to PlatON's new ChainId#

    The PlatON mainnet proposal to support the new ChainId PIP-7has been adopted and the first phase has been implemented in the mainnet, which means that the ChainId of the PlatON mainnet will be gradually switched from 100 to the new value 210425. In order to minimise the impact on applications during subsequent version upgrades, new applications should try to support the new ChainId from the beginning ChainId.

    However, at this stage the ChainId returned to the contract by the PlatON EVM virtual machine is still 100 (after which it will return 210425), so in the process of developing the application if there is logic related to the ChainId special adaptations need to be made. The following examples will introduce the adaptations from two scenarios, the first is the PRC20 token permit method and the second governance token voting rights proxy.

    PRC20 permit func#

    Usually Swap needs to use metamask's eth_signTypedData_v4 interface to sign the client first each time it removes liquidity (the signature contains the ChainId), and then use the signature as an argument to call the router contract's removeLiquidityWithPermit, which is used to do PRC20 contract's permit (allowing the contract to deduct the user's PRC20 assets)

    The adaptation code is shown below.

    constructor() function adds DOMAIN_SEPARATOR_NEW, generating method containing the ChainId of 210425

    ......DOMAIN_SEPARATOR = keccak256(    abi.encode(        keccak256('EIP712Domain(string name,string version,uint256 ChainId,address verifyingContract)'),        keccak256(bytes(name)),        keccak256(bytes('1')),        ChainId,        address(this)    ));DOMAIN_SEPARATOR_NEW = keccak256(    abi.encode(        keccak256('EIP712Domain(string name,string version,uint256 ChainId,address verifyingContract)'),        keccak256(bytes(name)),        keccak256(bytes('1')),        210425,        address(this)    ));......

    permit function adds verification of two ChainId related signatures

    require(deadline >= block.timestamp, 'EXPIRED');bytes32 digest = keccak256(    abi.encodePacked(        '\x19\x01',        DOMAIN_SEPARATOR_NEW,        keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner], deadline))    ));address recoveredAddress = ecrecover(digest, v, r, s);if (recoveredAddress == address(0) || recoveredAddress != owner) {    digest = keccak256(        abi.encodePacked(            '\x19\x01',            DOMAIN_SEPARATOR,            keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner], deadline))        )    );    recoveredAddress = ecrecover(digest, v, r, s);    require(recoveredAddress != address(0) && recoveredAddress == owner, 'INVALID_SIGNATURE');}
     nonces[owner] += 1;......

    Governance Token Voting Proxy#

    Similar signature and verification logic is used when governing the token voting rights proxy. The code is modified as follows.

    The delegateBySig function adds validation for the signatures associated with the two ChainId

    constructor(address account, address minter_) public {        ......        DOMAIN_SEPARATOR = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));        DOMAIN_SEPARATOR_NEW = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), 210425, address(this)));}    ......
     function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {    bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));    bytes32 digest = keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR_NEW, structHash));    address signatory = ecrecover(digest, v, r, s);    if (signatory == address(0) || nonce != nonces[signatory]) {        digest = keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, structHash));        signatory = ecrecover(digest, v, r, s);        require(signatory != address(0), "delegateBySig: invalid signature");        require(nonce == nonces[signatory], "delegateBySig: invalid nonce");    }    nonces[signatory] += 1;    require(now <= expiry, "delegateBySig: signature expired");    return _delegate(signatory, delegatee);}
    - + \ No newline at end of file diff --git a/assets/js/ebf40b11.2715c803.js b/assets/js/ebf40b11.287f2a0d.js similarity index 99% rename from assets/js/ebf40b11.2715c803.js rename to assets/js/ebf40b11.287f2a0d.js index e7cba0373..8887468a7 100644 --- a/assets/js/ebf40b11.2715c803.js +++ b/assets/js/ebf40b11.287f2a0d.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[1736],{5680:(e,t,n)=>{n.d(t,{xA:()=>d,yg:()=>y});var a=n(6540);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},g=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,l=e.originalType,s=e.parentName,d=r(e,["components","mdxType","originalType","parentName"]),c=p(n),g=o,y=c["".concat(s,".").concat(g)]||c[g]||u[g]||l;return n?a.createElement(y,i(i({ref:t},d),{},{components:n})):a.createElement(y,i({ref:t},d))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var l=n.length,i=new Array(l);i[0]=g;var r={};for(var s in t)hasOwnProperty.call(t,s)&&(r[s]=t[s]);r.originalType=e,r[c]="string"==typeof e?e:o,i[1]=r;for(var p=2;p{n.r(t),n.d(t,{contentTitle:()=>i,default:()=>c,frontMatter:()=>l,metadata:()=>r,toc:()=>s});var a=n(8168),o=(n(6540),n(5680));const l={id:"Become_PlatON_Main_Verification",title:"Run a validator node",sidebar_label:"Run a validator node"},i=void 0,r={unversionedId:"Become_PlatON_Main_Verification",id:"Become_PlatON_Main_Verification",isDocsHomePage:!1,title:"Run a validator node",description:"This guide demonstrates how to install the PlatON Node software on Linux.",source:"@site/../docs/\u6210\u4e3a\u4e3b\u7f51\u9a8c\u8bc1\u8282\u70b9.md",sourceDirName:".",slug:"/Become_PlatON_Main_Verification",permalink:"/docs/Become_PlatON_Main_Verification",editUrl:"https://github.com/PlatONnetwork/docs/tree/master/docs/\u6210\u4e3a\u4e3b\u7f51\u9a8c\u8bc1\u8282\u70b9.md",version:"current",frontMatter:{id:"Become_PlatON_Main_Verification",title:"Run a validator node",sidebar_label:"Run a validator node"},sidebar:"docs",previous:{title:"Intro to validator",permalink:"/docs/PlatON_Validation_Introduce"},next:{title:"MTool online tutorial",permalink:"/docs/OnLine_MTool_Manual"}},s=[{value:"System Requirements",id:"system-requirements",children:[]},{value:"Installation Overview",id:"installation-overview",children:[]},{value:"Installing on Ubuntu",id:"installing-on-ubuntu",children:[]},{value:"Generate keys",id:"generate-keys",children:[]},{value:"Join the PlatON main network",id:"join-the-platon-main-network",children:[{value:"Join the Main Network",id:"join-the-main-network",children:[]},{value:"View node status",id:"view-node-status",children:[]}]},{value:"Upgrade to Validator Node",id:"upgrade-to-validator-node",children:[{value:"Install PlatON MTool",id:"install-platon-mtool",children:[]},{value:"Configure PlatON MTool",id:"configure-platon-mtool",children:[]},{value:"Initiate a staking operation",id:"initiate-a-staking-operation",children:[]}]}],p={toc:s},d="wrapper";function c(e){let{components:t,...n}=e;return(0,o.yg)(d,(0,a.A)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.yg)("p",null,"This guide demonstrates how to install the PlatON Node software on Linux."),(0,o.yg)("h3",{id:"system-requirements"},"System Requirements"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"Server: Server and backup server running PlatON software (both have a firewall)"),(0,o.yg)("li",{parentName:"ul"},"Memory: 16GB RAM"),(0,o.yg)("li",{parentName:"ul"},"Local storage: 100GB system disk, 200GB data disk (can be expanded online)"),(0,o.yg)("li",{parentName:"ul"},"Processor: 64-bit 4 cores (each core above 2.4 GHz)"),(0,o.yg)("li",{parentName:"ul"},"Bandwidth: 5 MB/sec (can be expanded online)")),(0,o.yg)("h3",{id:"installation-overview"},"Installation Overview"),(0,o.yg)("p",null,"It takes three or four steps to install a new node, which depends on the operating system used. The detailed procedures are list below."),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"Installing on Ubuntu (18.04)")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},(0,o.yg)("strong",{parentName:"p"},"Note: Use the normal user to execute the following command."))),(0,o.yg)("h3",{id:"installing-on-ubuntu"},"Installing on Ubuntu"),(0,o.yg)("h4",{id:"install-and-run-ntp-service"},"Install and run NTP service"),(0,o.yg)("h5",{id:"open-a-terminal-and-run-the-following-commands"},"Open a terminal and run the following commands"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"sudo apt-get update &&\nsudo apt-get install -y gnupg2 curl software-properties-common ntp &&\nsudo systemctl enable ntp && sudo systemctl start ntp\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"Notes:"),(0,o.yg)("p",{parentName:"blockquote"},"NTP service is used for time synchronization, incorrect system time will affect the normal operation of PlatON")),(0,o.yg)("h5",{id:"validate-the-ntp-time-synchronization"},"Validate the NTP time synchronization"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"ntpq -4c rv | grep leap_none\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"Notes:"),(0,o.yg)("p",{parentName:"blockquote"},"Display ",(0,o.yg)("strong",{parentName:"p"},"associd=0 status=0615 ",(0,o.yg)("font",{color:"red"},"leap_none"),", sync_ntp, 1 event, clock_sync,")," where ",(0,o.yg)("inlineCode",{parentName:"p"},"leap_none")," is red, indicating that the NTP time synchronization is normal.")),(0,o.yg)("h4",{id:"install-platon"},"Install PlatON"),(0,o.yg)("p",null,"Ubuntu 18.04\uff1a"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"sudo wget https://download.platon.network/platon/platon/1.4.4/platon -O /usr/bin/platon\nsudo wget https://download.platon.network/platon/platon/1.4.2/platonkey -O /usr/bin/platonkey\n")),(0,o.yg)("p",null,"Ubuntu 20.04\uff1a"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"sudo wget https://download.platon.network/platon/platon/ubuntu20.04/1.4.4/platon -O /usr/bin/platon\nsudo wget https://download.platon.network/platon/platon/ubuntu20.04/1.4.2/platonkey -O /usr/bin/platonkey\n")),(0,o.yg)("p",null,"Ubuntu 22.04\uff1a"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"sudo wget https://download.platon.network/platon/platon/ubuntu22.04/1.4.4/platon -O /usr/bin/platon\nsudo wget https://download.platon.network/platon/platon/ubuntu22.04/1.4.2/platonkey -O /usr/bin/platonkey\n")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"sudo chmod +x /usr/bin/platon /usr/bin/platonkey\nplaton version\n")),(0,o.yg)("p",null,"After executing the commands above, ",(0,o.yg)("inlineCode",{parentName:"p"},"platon")," and",(0,o.yg)("inlineCode",{parentName:"p"}," platonkey")," binary should be successfully installed in the ",(0,o.yg)("inlineCode",{parentName:"p"},"/usr/bin")," directory on your system. You can execute corresponding commands in any directory."),(0,o.yg)("p",null,"After you execute the platon version, please double check whether your Git Commit value is consistent with the following, if it is consistent, it means that it has been installed correctly:"),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"PlatON",(0,o.yg)("br",null),"\nVersion: 1.4.4-unstable",(0,o.yg)("br",null),"\nGit Commit: ",(0,o.yg)("font",{color:"red"},"af1168d0b62febf53913cb1ceebaa6413d3ba9b3"),(0,o.yg)("br",null),"\nGit Commit Date: 20230719",(0,o.yg)("br",null),"\nArchitecture: amd64",(0,o.yg)("br",null),"\nGo Version: go1.22.8",(0,o.yg)("br",null),"\nOperating System: linux",(0,o.yg)("br",null),"\n...",(0,o.yg)("br",null))),(0,o.yg)("h3",{id:"generate-keys"},"Generate keys"),(0,o.yg)("h4",{id:"public-and-private-keys"},"Public and private keys"),(0,o.yg)("p",null,"Each node in the network has an unique identity to distinguish it from others. This identity is a public and private key pair, generated in the node's working directory ( ",(0,o.yg)("inlineCode",{parentName:"p"},"~/platon-node"),") by the following command:"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"mkdir -p ~/platon-node/data && platonkey genkeypair | tee >(grep \"PrivateKey\" | awk '{print $2}' > ~/platon-node/data/nodekey) >(grep \"PublicKey\" | awk '{print $3}' > ~/platon-node/data/nodeid)\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"Remark:"),(0,o.yg)("p",{parentName:"blockquote"},"Displays the following, indicating that the key pair has been successfully generated (x stands for number or letter) :"),(0,o.yg)("p",{parentName:"blockquote"},"PrivateKey: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),(0,o.yg)("p",{parentName:"blockquote"},"PublicKey: : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")),(0,o.yg)("p",null," ",(0,o.yg)("inlineCode",{parentName:"p"},"PrivateKey")," is the private key of the node, and",(0,o.yg)("inlineCode",{parentName:"p"}," PublicKey")," is the public key of the node. The public key is used to identify the identity of the node and can be made public."),(0,o.yg)("p",null,"Two files will be generated in the subdirectory ",(0,o.yg)("inlineCode",{parentName:"p"},"data")," under the working directory of the node\uff1a"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"nodeid: node public key (ID) file, which holds the node's public key"),(0,o.yg)("li",{parentName:"ul"},"nodekey: node private key file, which holds the node's private key")),(0,o.yg)("h4",{id:"bls-public-and-private-key"},"BLS public and private key"),(0,o.yg)("p",null,"In addition to the public and private keys of the node, the PlatON node also needs a key pair called the BLS public and private key. This key pair will be used in the consensus protocol. The key pair can be generated in the node's working directory (such as ",(0,o.yg)("inlineCode",{parentName:"p"},"~/platon-node"),") by the following command:"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"mkdir -p ~/platon-node/data && platonkey genblskeypair | tee >(grep \"PrivateKey\" | awk '{print $2}' > ~/platon-node/data/blskey) >(grep \"PublicKey\" | awk '{print $3}' > ~/platon-node/data/blspub)\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"PrivateKey: f22a785c80bd1095beff1f356811268eae6c94abf0b2b4e2d64918957b74783e\nPublicKey : 4bf873a66df92ada50a8c6bacb132ffd63437bcde7fd338d2d8696170034a6332e404ac3abb50326ee517ec5f63caf12891ce794ed14f8528fa7c54bc0ded7c5291f708116bb8ee8adadf1e88588866325d764230f4a45929d267a9e8f264402")),(0,o.yg)("p",null," ",(0,o.yg)("inlineCode",{parentName:"p"},"PrivateKey")," is the BLS private key of the node, and",(0,o.yg)("inlineCode",{parentName:"p"}," PublicKey")," is the BLS public key of the node. The BLS public key is used to quickly verify the signature in the consensus protocol and can be published. The BLS private key cannot be made public and needs to be backed up."),(0,o.yg)("p",null,"Two files will be generated in the subdirectory ",(0,o.yg)("inlineCode",{parentName:"p"},"data")," under the working directory of the node:"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"blspub: Node BLS public key file, which holds the node's BLS public key")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"blskey: Node BLS private key file, which holds the node's BLS private key"))),(0,o.yg)("h2",{id:"join-the-platon-main-network"},"Join the PlatON main network"),(0,o.yg)("p",null,"PlatON mainnet launch date to be determined, Chainid to be determined."),(0,o.yg)("p",null,"This section assumes that the server is Ubuntu 18.04, and the working directory of the executable file is ",(0,o.yg)("inlineCode",{parentName:"p"},"~/platon-node"),". Note that all subsequent commands should be run under the same working directory."),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"cd ~/platon-node\n")),(0,o.yg)("h3",{id:"join-the-main-network"},"Join the Main Network"),(0,o.yg)("p",null,"Anyone or any organization can join PlatON main network."),(0,o.yg)("h4",{id:"start-as-a-validator-node"},"Start as a validator node"),(0,o.yg)("p",null,"Execute the following command to start the verification node to join the main network of Platon (please access it after the main network is online)"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},'nohup platon --identity platon --datadir ./data --port 16789 --http.port 6789 --http.api "platon,net,web3,admin,personal" --http --nodekey ./data/nodekey --cbft.blskey ./data/blskey --verbosity 1 --http.addr 127.0.0.1 --syncmode "fast" > ./data/platon.log 2>&1 &\n')),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Prompt:")),(0,o.yg)("table",null,(0,o.yg)("thead",{parentName:"table"},(0,o.yg)("tr",{parentName:"thead"},(0,o.yg)("th",{parentName:"tr",align:null},(0,o.yg)("strong",{parentName:"th"},"Parameters")),(0,o.yg)("th",{parentName:"tr",align:null},(0,o.yg)("strong",{parentName:"th"},"Description")))),(0,o.yg)("tbody",{parentName:"table"},(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--identity"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the network name")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--datadir"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the data directory path")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--port"),(0,o.yg)("td",{parentName:"tr",align:null},"Specifying the P2P port number, TCP and UDP protocol corresponding ports need to be open to all hosts on the host firewall")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--http.addr"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify rpc server address")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--http.port"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the RPC protocol communication port, and open the TCP protocol corresponding port on the host firewall where MTool is located")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--http.api"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the rpcapi name open by the node")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--http"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify http-rpc communication method")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--nodekey"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the node private key file")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--cbft.blskey"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the node bls private key file")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--verbosity"),(0,o.yg)("td",{parentName:"tr",align:null},"The level of logging, 0: CRIT; 1: ERROR; 2: WARN; 3: INFO; 4: DEBUG; 5: TRACE")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--syncmode"),(0,o.yg)("td",{parentName:"tr",align:null},"fast: Fast synchronization mode, full: All synchronous mode")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--db.nogc"),(0,o.yg)("td",{parentName:"tr",align:null},"Enable archive mode")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--allow-insecure-unlock"),(0,o.yg)("td",{parentName:"tr",align:null},"Enable unlockAccount function")))),(0,o.yg)("p",null,"See more parameters with the command ",(0,o.yg)("inlineCode",{parentName:"p"},"platon --help")),(0,o.yg)("h3",{id:"view-node-status"},"View node status"),(0,o.yg)("p",null,"When PlatON is successfully started, under normal circumstances, it will automatically establish a connection with the node closest to it through the node discovery protocol. After the connection is successful, block synchronization will be started. You can determine whether joining the network successfully by looking at the peers of the node and confirming whether the block height of the node is increasing."),(0,o.yg)("p",null,"If the key is not generated in advance, the node is automatically generated in the node's data directory at startup. If it is automatically generated, only the node private key and BLS private key will be generated, and the relevant public key will not be automatically generated."),(0,o.yg)("h4",{id:"enter-platon--console"},"Enter ",(0,o.yg)("inlineCode",{parentName:"h4"},"PlatON ")," console"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon attach http://localhost:6789\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"Print ",(0,o.yg)("inlineCode",{parentName:"p"},"Welcome to the Platon JavaScript Console!")," Relevant information, indicating successful access to the console, otherwise it will be deemed as failure to access the console, if there is any problem, you can contact the official customer service personnel.")),(0,o.yg)("h4",{id:"view-peers-of-a-node"},"View peers of a node"),(0,o.yg)("p",null,"View the connection node information by executing the following command in the Platon console."),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"admin.peers\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"If the related Peers information is printed, it means that the connected node is successful, as follows:"),(0,o.yg)("p",{parentName:"blockquote"},"[{\ncaps: ",'["cbft/1", "platon/66"]',',\nid: "c72a4d2cb8228ca6f9072daa66566bcafa17bec6a9e53765c85c389434488c393357c5c7c5d18cf9b26ceda46aca4da20755cd01bcc1478fff891a201042ba84",\nname: "PlatONnetwork/alaya-47.241.93.189/v1.0.0-unstable-62b9a900/linux-amd64/go1.13.4",\nnetwork: {\nconsensus: false,\ninbound: false,\nlocalAddress: "192.168.2.128:55572",\nremoteAddress: "47.241.93.189:16789",\nstatic: false,\ntrusted: false\n},\nprotocols: {\ncbft: {\ncommitBn: 1404934,\nhighestQCBn: 1407304,\nlockedBn: 1404935,\nprotocolVersion: 1\n},\nplaton: {\nhead: "0xf31395262f876935c94e33b1d9f3314b2cb6effc33fcffa3b17b725678fd525f",\nnumber: 1407295,\nversion: 63\n}\n}\n}'),(0,o.yg)("p",{parentName:"blockquote"},"...]"),(0,o.yg)("p",{parentName:"blockquote"},"If the printed information is empty, it means that the connection node failed. If there is any problem, you can contact the official customer service personnel.")),(0,o.yg)("h4",{id:"view-the-current-block-height"},"View the current block height"),(0,o.yg)("p",null,"View the block height of the current node by executing the following command in the Platon console."),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon.blockNumber\n")),(0,o.yg)("blockquote",null,(0,o.yg)("ul",{parentName:"blockquote"},(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"Execute this command several times, if the block height value increases continuously, then the connection is successful;")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"If it is a new node and the block height is always 0, it means that the node is in the synchronous block and there may be delay. You can use the command:"),(0,o.yg)("pre",{parentName:"li"},(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon.syncing\n")),(0,o.yg)("ul",{parentName:"li"},(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"If ",(0,o.yg)("inlineCode",{parentName:"p"},"false")," is printed, the node is not in a synchronous block state.")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"If the following message is printed, the node is in a synchronous block state;"),(0,o.yg)("pre",{parentName:"li"},(0,o.yg)("code",{parentName:"pre",className:"language-json"},"{\n currentBlock: 1412416,\n highestBlock: 1416699,\n knownStates: 522,\n pulledStates: 522,\n startingBlock: 1408247\n}\n"))))))),(0,o.yg)("h4",{id:"exit-console"},"Exit console"),(0,o.yg)("p",null,"Type Exit to exit the console."),(0,o.yg)("h2",{id:"upgrade-to-validator-node"},"Upgrade to Validator Node"),(0,o.yg)("p",null,"PlatON is a blockchain project that implements democratic governance. Verification nodes are jointly selected by all LAT holders to maintain and develop the PlatON network. The 201 nodes with the most votes will become candidate nodes, from which 43 verification nodes will be randomly selected using VRF to participate in the management of the entire PlatON network."),(0,o.yg)("p",null,"This section describes how to operate as a validator node."),(0,o.yg)("h3",{id:"install-platon-mtool"},"Install PlatON MTool"),(0,o.yg)("p",null,"Proceed as follows:"),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Step1. Download PlatON MTool toolkit")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"cd ~ && wget https://download.platon.network/platon/mtool/linux/1.1.1/platon_mtool.zip\n")),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Step2. Extract the PlatON MTool toolkit")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"(if ! command -v unzip;then sudo apt install unzip; fi;) && unzip platon_mtool.zip && cd platon_mtool\n")),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Step3. Download script")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"The script is downloaded to the ",(0,o.yg)("font",{color:"red"},"platon_mtool")," directory, otherwise the script cannot find the path of the new version of mtool.")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"wget https://download.platon.network/platon/scripts/mtool_install.sh\n")),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Step4. Execute command")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"chmod +x mtool_install.sh && ./mtool_install.sh\n")),(0,o.yg)("blockquote",null,(0,o.yg)("ul",{parentName:"blockquote"},(0,o.yg)("li",{parentName:"ul"},"When the message ",(0,o.yg)("font",{color:"red"},"Install platon mtool succeed.")," is displayed, PlatON MTool is successfully installed. If it is not successfully installed, please contact our official customer service to provide feedback on specific issues."))),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Step5. Restart the session window")),(0,o.yg)("p",null,"After installation is complete, you need to ",(0,o.yg)("font",{color:"red"},"restart the session window (do not restart the server, close the session window or SSH tool to reopen the window)")," for the newly added environment variables to take effect."),(0,o.yg)("h3",{id:"configure-platon-mtool"},"Configure PlatON MTool"),(0,o.yg)("h4",{id:"generate-wallet"},"Generate wallet"),(0,o.yg)("p",null,"To participate in the verification node to produce blocks, two wallets must be created. ",(0,o.yg)("font",{color:"red"}," If you want to create a node using an existing wallet, rename the wallet file for the mortgaging account to ",(0,o.yg)("inlineCode",{parentName:"p"},"staking.json"),", rename the wallet file for the income account to ",(0,o.yg)("inlineCode",{parentName:"p"},"reward.json"),", and copy the wallet file to the ",(0,o.yg)("inlineCode",{parentName:"p"},"$PLATON_MTOOLDIR/keystore")," directory to")," ",(0,o.yg)("a",{parentName:"p",href:"#configure-verification-node-information"},"skip this step"),"."),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"Staking wallet: The staking wallet is used to stake tokens. To become a candidate node, you must stake successfully. Run the following command to create a staking wallet:")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon_mtool account new staking\n")),(0,o.yg)("p",null,"Enter the password once and confirm the password again to create a wallet file. After the creation is successful, a staking wallet file ",(0,o.yg)("inlineCode",{parentName:"p"},"staking.json")," will be generated in the directory",(0,o.yg)("inlineCode",{parentName:"p"}," $PLATON_MTOOLDIR/keystore"),"."),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"Reward wallet: It is used to collect block rewards and staking rewards. Staking rewards are uniformly distributed to verification nodes, which are distributed by the verification nodes themselves. Run the following command to create a reward wallet")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon_mtool account new reward\n")),(0,o.yg)("p",null,"Enter the password once and confirm the password again to create the wallet file. After the creation is successful, the staking wallet file ",(0,o.yg)("inlineCode",{parentName:"p"},"reward.json")," will be generated in the directory",(0,o.yg)("inlineCode",{parentName:"p"}," $PLATON_MTOOLDIR/keystore"),"."),(0,o.yg)("h4",{id:"configure-verification-node-information"},"Configure verification node information"),(0,o.yg)("h5",{id:"download-the-script"},"Download the script"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"cd $PLATON_MTOOLDIR && wget https://download.platon.network/platon/scripts/validator_conf.sh\n")),(0,o.yg)("h5",{id:"run-the-script-configuration"},"Run the script configuration"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"chmod +x validator_conf.sh && ./validator_conf.sh\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},(0,o.yg)("strong",{parentName:"p"},"Note:")),(0,o.yg)("ul",{parentName:"blockquote"},(0,o.yg)("li",{parentName:"ul"},'When the prompt shows "Please enter the platon node IP address:", please enter the PlatON node server ip address.'),(0,o.yg)("li",{parentName:"ul"},'When the prompt shows "validator conf success", and when the validator_config.json content printed at the end is normal, it means that the script is executed successfully. If the script is not executed successfully, please contact our official customer service to feedback specific questions.'))),(0,o.yg)("h5",{id:"validator-node-information-configuration-file-description"},"Validator node information configuration file description"),(0,o.yg)("p",null,"After the configuration of the validator node information is completed, the validator node information file validator_config.json will be generated in the validator subdirectory of the PlatON MTool installation directory. The file content is as follows:"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-json"},'{\n "nodePublicKey": "0abaf3219f454f3d07b6cbcf3c10b6b4ccf605202868e2043b6f5db12b745df0604ef01ef4cb523adc6d9e14b83a76dd09f862e3fe77205d8ac83df707969b47",\n "blsPubKey": "82d740cbc0314ec558c5426f88fdad6f07a07f9846c6be4e40cd628b74b9f641ddad01e4c281a2c3693f8ff2a73a410297aff379ee0575127d51de99b97acc9a1b7bc8ca132ef6f0379a3ec9d76a603d623176e49e1c53e87fead36317895099",\n "nodeAddress": "http://192.168.120.146",\n "nodePort": "16789",\n "nodeRpcPort": "6789"\n}\n')),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},(0,o.yg)("strong",{parentName:"p"},"Parameter description:")),(0,o.yg)("ul",{parentName:"blockquote"},(0,o.yg)("li",{parentName:"ul"},"nodePublicKey: Node ID, which can be viewed in the nodeid file under the node data directory data"),(0,o.yg)("li",{parentName:"ul"},"blsPubKey: BLS public key, which can be viewed in the blspub file under the node data directory data."),(0,o.yg)("li",{parentName:"ul"},"nodeAddress: If PlatON MTool and the node are on the same machine or in the same local area network, you can use the intranet IP, otherwise use the public IP whose format is: ",(0,o.yg)("inlineCode",{parentName:"li"},"http://18.238.183.12"),"."),(0,o.yg)("li",{parentName:"ul"},"nodePort: Node P2P port, default is 16789."),(0,o.yg)("li",{parentName:"ul"},"nodeRpcPort: rpc port, the default port is 6789."))),(0,o.yg)("h5",{id:"custom-platscan-avatar"},"Custom PlatScan avatar"),(0,o.yg)("p",null,"If users do not need to display their specified avatar on PlatScan, they can skip this step. Otherwise, the following operations are required:"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},(0,o.yg)("strong",{parentName:"p"},"Register a keybase account")),(0,o.yg)("p",{parentName:"li"},"Users first need to register on the official website of ",(0,o.yg)("a",{parentName:"p",href:"https://keybase.io/"},"keybase.io")," . If they have already registered, they can log on the official website of keybase.")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},(0,o.yg)("strong",{parentName:"p"},"Upload specified avatar")),(0,o.yg)("p",{parentName:"li"},"Click the user avatar to upload the avatar.")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},(0,o.yg)("strong",{parentName:"p"},"Generate PGP key")),(0,o.yg)("p",{parentName:"li"},"If the user has a ",(0,o.yg)("inlineCode",{parentName:"p"},"PGP key"),", after a successful login, a series of 16-bit public keys will be displayed next to the user's avatar, such as: ",(0,o.yg)("inlineCode",{parentName:"p"},"EB621920A48D0699"),"; if the user does not already have a ",(0,o.yg)("inlineCode",{parentName:"p"},"PGP key"),", click ",(0,o.yg)("inlineCode",{parentName:"p"},"add a PGP key")," next to the user's avatar to generate.")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},(0,o.yg)("strong",{parentName:"p"},"Specify the externalId value")),(0,o.yg)("p",{parentName:"li"},"When issuing the staking operation, specify the ",(0,o.yg)("inlineCode",{parentName:"p"},"--external_id")," parameter to be the PGP key generated in the previous step."))),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"Note: After the user completes the staking operation, the avatar customized by the user can be displayed on PlatScan.")),(0,o.yg)("h3",{id:"initiate-a-staking-operation"},"Initiate a staking operation"),(0,o.yg)("p",null,"If the consensus node deployment is complete and is catching up the blocknumber of ",(0,o.yg)("a",{parentName:"p",href:"https://scan.platon.network/?lang=en"},"Platscan"),", you can use PlatON MTool for staking operations. Please ensure that the balance of the staking account is sufficient before staking. The minimum threshold for staking is one hundred thousand LAT. "),(0,o.yg)("p",null,"Note: "),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"Please keep at least 1 LAT in the staking account, so that the transactions initiated by the subsequent node management have sufficient transaction fees, such as voting for upgrade proposals, and unsecured transactions.")),(0,o.yg)("p",null,"Excuting command"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon_mtool staking --config $PLATON_MTOOLDIR/validator/validator_config.json --keystore $PLATON_MTOOLDIR/keystore/staking.json --autoamount 100000 --benefit_address xxx196278ns22j23awdfj9f2d4vz0pedld8a2fzwwj --delegated_reward_rate 5000 --node_name myNode --website www.mywebsite.com --details myNodeDescription --external_id 121412312\n")),(0,o.yg)("p",null,"Enter the password of the staking wallet and press Enter. If the following information is displayed, the staking is successful:"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"operation finished\ntransaction hash:\n0x89b964d27d0caf1d8bf268f721eb123c4af57aed36187bea90b262f4769eeb9b\nSUCCESS\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},(0,o.yg)("strong",{parentName:"p"},"Parameter description:")),(0,o.yg)("ul",{parentName:"blockquote"},(0,o.yg)("li",{parentName:"ul"},"config\uff1anode configuration file"),(0,o.yg)("li",{parentName:"ul"},"keystore: staking wallet file"),(0,o.yg)("li",{parentName:"ul"},"amount: staking amount, not less than 100000LAT-staking threshold, no more than 8 decimal places"),(0,o.yg)("li",{parentName:"ul"},"restrictedamount: not less than 100000LAT - staking threshold, no more than 8 decimal points (staking using locked balance)"),(0,o.yg)("li",{parentName:"ul"},"autoamount: Not less than 10000LAT-Priority to use the lock-up balance staking, if the lock-up balance is not enough for the staking deposit, then use free amount staking"),(0,o.yg)("li",{parentName:"ul"},"benefit_address: benefit account to receive block-packing reward and staking reward"),(0,o.yg)("li",{parentName:"ul"},"delegated_reward_rate\uff1aDelegated bonus ratio, type is integer range is ","[","0,10000","]",", unit: ten thousand percent, e.g. enter 5000, it means the bonus ratio is 50%"),(0,o.yg)("li",{parentName:"ul"},"node",(0,o.yg)("em",{parentName:"li"},"name\uff1anode name\uff0c30 bytes(beginning with a letter, including alphabet, number, space, "),", -, #)"),(0,o.yg)("li",{parentName:"ul"},"website\uff1anode website, 30 bytes"),(0,o.yg)("li",{parentName:"ul"},"details\uff1anode description, 280 bytes"),(0,o.yg)("li",{parentName:"ul"},"external_id\uff1anode Icon ID of ",(0,o.yg)("a",{parentName:"li",href:"https://keybase.io"},"keybase.io"),", or identity authentication ID"))))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[1736],{5680:(e,t,n)=>{n.d(t,{xA:()=>d,yg:()=>y});var a=n(6540);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},g=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,l=e.originalType,s=e.parentName,d=r(e,["components","mdxType","originalType","parentName"]),c=p(n),g=o,y=c["".concat(s,".").concat(g)]||c[g]||u[g]||l;return n?a.createElement(y,i(i({ref:t},d),{},{components:n})):a.createElement(y,i({ref:t},d))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var l=n.length,i=new Array(l);i[0]=g;var r={};for(var s in t)hasOwnProperty.call(t,s)&&(r[s]=t[s]);r.originalType=e,r[c]="string"==typeof e?e:o,i[1]=r;for(var p=2;p{n.r(t),n.d(t,{contentTitle:()=>i,default:()=>c,frontMatter:()=>l,metadata:()=>r,toc:()=>s});var a=n(8168),o=(n(6540),n(5680));const l={id:"Become_PlatON_Main_Verification",title:"Run a validator node",sidebar_label:"Run a validator node"},i=void 0,r={unversionedId:"Become_PlatON_Main_Verification",id:"Become_PlatON_Main_Verification",isDocsHomePage:!1,title:"Run a validator node",description:"This guide demonstrates how to install the PlatON Node software on Linux.",source:"@site/../docs/\u6210\u4e3a\u4e3b\u7f51\u9a8c\u8bc1\u8282\u70b9.md",sourceDirName:".",slug:"/Become_PlatON_Main_Verification",permalink:"/docs/Become_PlatON_Main_Verification",editUrl:"https://github.com/PlatONnetwork/docs/tree/master/docs/\u6210\u4e3a\u4e3b\u7f51\u9a8c\u8bc1\u8282\u70b9.md",version:"current",frontMatter:{id:"Become_PlatON_Main_Verification",title:"Run a validator node",sidebar_label:"Run a validator node"},sidebar:"docs",previous:{title:"Intro to validator",permalink:"/docs/PlatON_Validation_Introduce"},next:{title:"MTool online tutorial",permalink:"/docs/OnLine_MTool_Manual"}},s=[{value:"System Requirements",id:"system-requirements",children:[]},{value:"Installation Overview",id:"installation-overview",children:[]},{value:"Installing on Ubuntu",id:"installing-on-ubuntu",children:[]},{value:"Generate keys",id:"generate-keys",children:[]},{value:"Join the PlatON main network",id:"join-the-platon-main-network",children:[{value:"Join the Main Network",id:"join-the-main-network",children:[]},{value:"View node status",id:"view-node-status",children:[]}]},{value:"Upgrade to Validator Node",id:"upgrade-to-validator-node",children:[{value:"Install PlatON MTool",id:"install-platon-mtool",children:[]},{value:"Configure PlatON MTool",id:"configure-platon-mtool",children:[]},{value:"Initiate a staking operation",id:"initiate-a-staking-operation",children:[]}]}],p={toc:s},d="wrapper";function c(e){let{components:t,...n}=e;return(0,o.yg)(d,(0,a.A)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.yg)("p",null,"This guide demonstrates how to install the PlatON Node software on Linux."),(0,o.yg)("h3",{id:"system-requirements"},"System Requirements"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"Server: Server and backup server running PlatON software (both have a firewall)"),(0,o.yg)("li",{parentName:"ul"},"Memory: 16GB RAM"),(0,o.yg)("li",{parentName:"ul"},"Local storage: 100GB system disk, 200GB data disk (can be expanded online)"),(0,o.yg)("li",{parentName:"ul"},"Processor: 64-bit 4 cores (each core above 2.4 GHz)"),(0,o.yg)("li",{parentName:"ul"},"Bandwidth: 5 MB/sec (can be expanded online)")),(0,o.yg)("h3",{id:"installation-overview"},"Installation Overview"),(0,o.yg)("p",null,"It takes three or four steps to install a new node, which depends on the operating system used. The detailed procedures are list below."),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"Installing on Ubuntu (18.04)")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},(0,o.yg)("strong",{parentName:"p"},"Note: Use the normal user to execute the following command."))),(0,o.yg)("h3",{id:"installing-on-ubuntu"},"Installing on Ubuntu"),(0,o.yg)("h4",{id:"install-and-run-ntp-service"},"Install and run NTP service"),(0,o.yg)("h5",{id:"open-a-terminal-and-run-the-following-commands"},"Open a terminal and run the following commands"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"sudo apt-get update &&\nsudo apt-get install -y gnupg2 curl software-properties-common ntp &&\nsudo systemctl enable ntp && sudo systemctl start ntp\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"Notes:"),(0,o.yg)("p",{parentName:"blockquote"},"NTP service is used for time synchronization, incorrect system time will affect the normal operation of PlatON")),(0,o.yg)("h5",{id:"validate-the-ntp-time-synchronization"},"Validate the NTP time synchronization"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"ntpq -4c rv | grep leap_none\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"Notes:"),(0,o.yg)("p",{parentName:"blockquote"},"Display ",(0,o.yg)("strong",{parentName:"p"},"associd=0 status=0615 ",(0,o.yg)("font",{color:"red"},"leap_none"),", sync_ntp, 1 event, clock_sync,")," where ",(0,o.yg)("inlineCode",{parentName:"p"},"leap_none")," is red, indicating that the NTP time synchronization is normal.")),(0,o.yg)("h4",{id:"install-platon"},"Install PlatON"),(0,o.yg)("p",null,"Ubuntu 18.04\uff1a"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"sudo wget https://download.platon.network/platon/platon/1.4.4/platon -O /usr/bin/platon\nsudo wget https://download.platon.network/platon/platon/1.4.2/platonkey -O /usr/bin/platonkey\n")),(0,o.yg)("p",null,"Ubuntu 20.04\uff1a"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"sudo wget https://download.platon.network/platon/platon/ubuntu20.04/1.4.4/platon -O /usr/bin/platon\nsudo wget https://download.platon.network/platon/platon/ubuntu20.04/1.4.2/platonkey -O /usr/bin/platonkey\n")),(0,o.yg)("p",null,"Ubuntu 22.04\uff1a"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"sudo wget https://download.platon.network/platon/platon/ubuntu22.04/1.4.4/platon -O /usr/bin/platon\nsudo wget https://download.platon.network/platon/platon/ubuntu22.04/1.4.4/platonkey -O /usr/bin/platonkey\n")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"sudo chmod +x /usr/bin/platon /usr/bin/platonkey\nplaton version\n")),(0,o.yg)("p",null,"After executing the commands above, ",(0,o.yg)("inlineCode",{parentName:"p"},"platon")," and",(0,o.yg)("inlineCode",{parentName:"p"}," platonkey")," binary should be successfully installed in the ",(0,o.yg)("inlineCode",{parentName:"p"},"/usr/bin")," directory on your system. You can execute corresponding commands in any directory."),(0,o.yg)("p",null,"After you execute the platon version, please double check whether your Git Commit value is consistent with the following, if it is consistent, it means that it has been installed correctly:"),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"PlatON",(0,o.yg)("br",null),"\nVersion: 1.4.4-unstable",(0,o.yg)("br",null),"\nGit Commit: ",(0,o.yg)("font",{color:"red"},"af1168d0b62febf53913cb1ceebaa6413d3ba9b3"),(0,o.yg)("br",null),"\nGit Commit Date: 20230719",(0,o.yg)("br",null),"\nArchitecture: amd64",(0,o.yg)("br",null),"\nGo Version: go1.22.8",(0,o.yg)("br",null),"\nOperating System: linux",(0,o.yg)("br",null),"\n...",(0,o.yg)("br",null))),(0,o.yg)("h3",{id:"generate-keys"},"Generate keys"),(0,o.yg)("h4",{id:"public-and-private-keys"},"Public and private keys"),(0,o.yg)("p",null,"Each node in the network has an unique identity to distinguish it from others. This identity is a public and private key pair, generated in the node's working directory ( ",(0,o.yg)("inlineCode",{parentName:"p"},"~/platon-node"),") by the following command:"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"mkdir -p ~/platon-node/data && platonkey genkeypair | tee >(grep \"PrivateKey\" | awk '{print $2}' > ~/platon-node/data/nodekey) >(grep \"PublicKey\" | awk '{print $3}' > ~/platon-node/data/nodeid)\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"Remark:"),(0,o.yg)("p",{parentName:"blockquote"},"Displays the following, indicating that the key pair has been successfully generated (x stands for number or letter) :"),(0,o.yg)("p",{parentName:"blockquote"},"PrivateKey: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),(0,o.yg)("p",{parentName:"blockquote"},"PublicKey: : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")),(0,o.yg)("p",null," ",(0,o.yg)("inlineCode",{parentName:"p"},"PrivateKey")," is the private key of the node, and",(0,o.yg)("inlineCode",{parentName:"p"}," PublicKey")," is the public key of the node. The public key is used to identify the identity of the node and can be made public."),(0,o.yg)("p",null,"Two files will be generated in the subdirectory ",(0,o.yg)("inlineCode",{parentName:"p"},"data")," under the working directory of the node\uff1a"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"nodeid: node public key (ID) file, which holds the node's public key"),(0,o.yg)("li",{parentName:"ul"},"nodekey: node private key file, which holds the node's private key")),(0,o.yg)("h4",{id:"bls-public-and-private-key"},"BLS public and private key"),(0,o.yg)("p",null,"In addition to the public and private keys of the node, the PlatON node also needs a key pair called the BLS public and private key. This key pair will be used in the consensus protocol. The key pair can be generated in the node's working directory (such as ",(0,o.yg)("inlineCode",{parentName:"p"},"~/platon-node"),") by the following command:"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"mkdir -p ~/platon-node/data && platonkey genblskeypair | tee >(grep \"PrivateKey\" | awk '{print $2}' > ~/platon-node/data/blskey) >(grep \"PublicKey\" | awk '{print $3}' > ~/platon-node/data/blspub)\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"PrivateKey: f22a785c80bd1095beff1f356811268eae6c94abf0b2b4e2d64918957b74783e\nPublicKey : 4bf873a66df92ada50a8c6bacb132ffd63437bcde7fd338d2d8696170034a6332e404ac3abb50326ee517ec5f63caf12891ce794ed14f8528fa7c54bc0ded7c5291f708116bb8ee8adadf1e88588866325d764230f4a45929d267a9e8f264402")),(0,o.yg)("p",null," ",(0,o.yg)("inlineCode",{parentName:"p"},"PrivateKey")," is the BLS private key of the node, and",(0,o.yg)("inlineCode",{parentName:"p"}," PublicKey")," is the BLS public key of the node. The BLS public key is used to quickly verify the signature in the consensus protocol and can be published. The BLS private key cannot be made public and needs to be backed up."),(0,o.yg)("p",null,"Two files will be generated in the subdirectory ",(0,o.yg)("inlineCode",{parentName:"p"},"data")," under the working directory of the node:"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"blspub: Node BLS public key file, which holds the node's BLS public key")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"blskey: Node BLS private key file, which holds the node's BLS private key"))),(0,o.yg)("h2",{id:"join-the-platon-main-network"},"Join the PlatON main network"),(0,o.yg)("p",null,"PlatON mainnet launch date to be determined, Chainid to be determined."),(0,o.yg)("p",null,"This section assumes that the server is Ubuntu 18.04, and the working directory of the executable file is ",(0,o.yg)("inlineCode",{parentName:"p"},"~/platon-node"),". Note that all subsequent commands should be run under the same working directory."),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"cd ~/platon-node\n")),(0,o.yg)("h3",{id:"join-the-main-network"},"Join the Main Network"),(0,o.yg)("p",null,"Anyone or any organization can join PlatON main network."),(0,o.yg)("h4",{id:"start-as-a-validator-node"},"Start as a validator node"),(0,o.yg)("p",null,"Execute the following command to start the verification node to join the main network of Platon (please access it after the main network is online)"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},'nohup platon --identity platon --datadir ./data --port 16789 --http.port 6789 --http.api "platon,net,web3,admin,personal" --http --nodekey ./data/nodekey --cbft.blskey ./data/blskey --verbosity 1 --http.addr 127.0.0.1 --syncmode "fast" > ./data/platon.log 2>&1 &\n')),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Prompt:")),(0,o.yg)("table",null,(0,o.yg)("thead",{parentName:"table"},(0,o.yg)("tr",{parentName:"thead"},(0,o.yg)("th",{parentName:"tr",align:null},(0,o.yg)("strong",{parentName:"th"},"Parameters")),(0,o.yg)("th",{parentName:"tr",align:null},(0,o.yg)("strong",{parentName:"th"},"Description")))),(0,o.yg)("tbody",{parentName:"table"},(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--identity"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the network name")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--datadir"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the data directory path")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--port"),(0,o.yg)("td",{parentName:"tr",align:null},"Specifying the P2P port number, TCP and UDP protocol corresponding ports need to be open to all hosts on the host firewall")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--http.addr"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify rpc server address")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--http.port"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the RPC protocol communication port, and open the TCP protocol corresponding port on the host firewall where MTool is located")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--http.api"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the rpcapi name open by the node")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--http"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify http-rpc communication method")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--nodekey"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the node private key file")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--cbft.blskey"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the node bls private key file")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--verbosity"),(0,o.yg)("td",{parentName:"tr",align:null},"The level of logging, 0: CRIT; 1: ERROR; 2: WARN; 3: INFO; 4: DEBUG; 5: TRACE")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--syncmode"),(0,o.yg)("td",{parentName:"tr",align:null},"fast: Fast synchronization mode, full: All synchronous mode")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--db.nogc"),(0,o.yg)("td",{parentName:"tr",align:null},"Enable archive mode")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--allow-insecure-unlock"),(0,o.yg)("td",{parentName:"tr",align:null},"Enable unlockAccount function")))),(0,o.yg)("p",null,"See more parameters with the command ",(0,o.yg)("inlineCode",{parentName:"p"},"platon --help")),(0,o.yg)("h3",{id:"view-node-status"},"View node status"),(0,o.yg)("p",null,"When PlatON is successfully started, under normal circumstances, it will automatically establish a connection with the node closest to it through the node discovery protocol. After the connection is successful, block synchronization will be started. You can determine whether joining the network successfully by looking at the peers of the node and confirming whether the block height of the node is increasing."),(0,o.yg)("p",null,"If the key is not generated in advance, the node is automatically generated in the node's data directory at startup. If it is automatically generated, only the node private key and BLS private key will be generated, and the relevant public key will not be automatically generated."),(0,o.yg)("h4",{id:"enter-platon--console"},"Enter ",(0,o.yg)("inlineCode",{parentName:"h4"},"PlatON ")," console"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon attach http://localhost:6789\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"Print ",(0,o.yg)("inlineCode",{parentName:"p"},"Welcome to the Platon JavaScript Console!")," Relevant information, indicating successful access to the console, otherwise it will be deemed as failure to access the console, if there is any problem, you can contact the official customer service personnel.")),(0,o.yg)("h4",{id:"view-peers-of-a-node"},"View peers of a node"),(0,o.yg)("p",null,"View the connection node information by executing the following command in the Platon console."),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"admin.peers\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"If the related Peers information is printed, it means that the connected node is successful, as follows:"),(0,o.yg)("p",{parentName:"blockquote"},"[{\ncaps: ",'["cbft/1", "platon/66"]',',\nid: "c72a4d2cb8228ca6f9072daa66566bcafa17bec6a9e53765c85c389434488c393357c5c7c5d18cf9b26ceda46aca4da20755cd01bcc1478fff891a201042ba84",\nname: "PlatONnetwork/alaya-47.241.93.189/v1.0.0-unstable-62b9a900/linux-amd64/go1.13.4",\nnetwork: {\nconsensus: false,\ninbound: false,\nlocalAddress: "192.168.2.128:55572",\nremoteAddress: "47.241.93.189:16789",\nstatic: false,\ntrusted: false\n},\nprotocols: {\ncbft: {\ncommitBn: 1404934,\nhighestQCBn: 1407304,\nlockedBn: 1404935,\nprotocolVersion: 1\n},\nplaton: {\nhead: "0xf31395262f876935c94e33b1d9f3314b2cb6effc33fcffa3b17b725678fd525f",\nnumber: 1407295,\nversion: 63\n}\n}\n}'),(0,o.yg)("p",{parentName:"blockquote"},"...]"),(0,o.yg)("p",{parentName:"blockquote"},"If the printed information is empty, it means that the connection node failed. If there is any problem, you can contact the official customer service personnel.")),(0,o.yg)("h4",{id:"view-the-current-block-height"},"View the current block height"),(0,o.yg)("p",null,"View the block height of the current node by executing the following command in the Platon console."),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon.blockNumber\n")),(0,o.yg)("blockquote",null,(0,o.yg)("ul",{parentName:"blockquote"},(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"Execute this command several times, if the block height value increases continuously, then the connection is successful;")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"If it is a new node and the block height is always 0, it means that the node is in the synchronous block and there may be delay. You can use the command:"),(0,o.yg)("pre",{parentName:"li"},(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon.syncing\n")),(0,o.yg)("ul",{parentName:"li"},(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"If ",(0,o.yg)("inlineCode",{parentName:"p"},"false")," is printed, the node is not in a synchronous block state.")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"If the following message is printed, the node is in a synchronous block state;"),(0,o.yg)("pre",{parentName:"li"},(0,o.yg)("code",{parentName:"pre",className:"language-json"},"{\n currentBlock: 1412416,\n highestBlock: 1416699,\n knownStates: 522,\n pulledStates: 522,\n startingBlock: 1408247\n}\n"))))))),(0,o.yg)("h4",{id:"exit-console"},"Exit console"),(0,o.yg)("p",null,"Type Exit to exit the console."),(0,o.yg)("h2",{id:"upgrade-to-validator-node"},"Upgrade to Validator Node"),(0,o.yg)("p",null,"PlatON is a blockchain project that implements democratic governance. Verification nodes are jointly selected by all LAT holders to maintain and develop the PlatON network. The 201 nodes with the most votes will become candidate nodes, from which 43 verification nodes will be randomly selected using VRF to participate in the management of the entire PlatON network."),(0,o.yg)("p",null,"This section describes how to operate as a validator node."),(0,o.yg)("h3",{id:"install-platon-mtool"},"Install PlatON MTool"),(0,o.yg)("p",null,"Proceed as follows:"),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Step1. Download PlatON MTool toolkit")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"cd ~ && wget https://download.platon.network/platon/mtool/linux/1.1.1/platon_mtool.zip\n")),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Step2. Extract the PlatON MTool toolkit")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"(if ! command -v unzip;then sudo apt install unzip; fi;) && unzip platon_mtool.zip && cd platon_mtool\n")),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Step3. Download script")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"The script is downloaded to the ",(0,o.yg)("font",{color:"red"},"platon_mtool")," directory, otherwise the script cannot find the path of the new version of mtool.")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"wget https://download.platon.network/platon/scripts/mtool_install.sh\n")),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Step4. Execute command")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"chmod +x mtool_install.sh && ./mtool_install.sh\n")),(0,o.yg)("blockquote",null,(0,o.yg)("ul",{parentName:"blockquote"},(0,o.yg)("li",{parentName:"ul"},"When the message ",(0,o.yg)("font",{color:"red"},"Install platon mtool succeed.")," is displayed, PlatON MTool is successfully installed. If it is not successfully installed, please contact our official customer service to provide feedback on specific issues."))),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Step5. Restart the session window")),(0,o.yg)("p",null,"After installation is complete, you need to ",(0,o.yg)("font",{color:"red"},"restart the session window (do not restart the server, close the session window or SSH tool to reopen the window)")," for the newly added environment variables to take effect."),(0,o.yg)("h3",{id:"configure-platon-mtool"},"Configure PlatON MTool"),(0,o.yg)("h4",{id:"generate-wallet"},"Generate wallet"),(0,o.yg)("p",null,"To participate in the verification node to produce blocks, two wallets must be created. ",(0,o.yg)("font",{color:"red"}," If you want to create a node using an existing wallet, rename the wallet file for the mortgaging account to ",(0,o.yg)("inlineCode",{parentName:"p"},"staking.json"),", rename the wallet file for the income account to ",(0,o.yg)("inlineCode",{parentName:"p"},"reward.json"),", and copy the wallet file to the ",(0,o.yg)("inlineCode",{parentName:"p"},"$PLATON_MTOOLDIR/keystore")," directory to")," ",(0,o.yg)("a",{parentName:"p",href:"#configure-verification-node-information"},"skip this step"),"."),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"Staking wallet: The staking wallet is used to stake tokens. To become a candidate node, you must stake successfully. Run the following command to create a staking wallet:")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon_mtool account new staking\n")),(0,o.yg)("p",null,"Enter the password once and confirm the password again to create a wallet file. After the creation is successful, a staking wallet file ",(0,o.yg)("inlineCode",{parentName:"p"},"staking.json")," will be generated in the directory",(0,o.yg)("inlineCode",{parentName:"p"}," $PLATON_MTOOLDIR/keystore"),"."),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"Reward wallet: It is used to collect block rewards and staking rewards. Staking rewards are uniformly distributed to verification nodes, which are distributed by the verification nodes themselves. Run the following command to create a reward wallet")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon_mtool account new reward\n")),(0,o.yg)("p",null,"Enter the password once and confirm the password again to create the wallet file. After the creation is successful, the staking wallet file ",(0,o.yg)("inlineCode",{parentName:"p"},"reward.json")," will be generated in the directory",(0,o.yg)("inlineCode",{parentName:"p"}," $PLATON_MTOOLDIR/keystore"),"."),(0,o.yg)("h4",{id:"configure-verification-node-information"},"Configure verification node information"),(0,o.yg)("h5",{id:"download-the-script"},"Download the script"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"cd $PLATON_MTOOLDIR && wget https://download.platon.network/platon/scripts/validator_conf.sh\n")),(0,o.yg)("h5",{id:"run-the-script-configuration"},"Run the script configuration"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"chmod +x validator_conf.sh && ./validator_conf.sh\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},(0,o.yg)("strong",{parentName:"p"},"Note:")),(0,o.yg)("ul",{parentName:"blockquote"},(0,o.yg)("li",{parentName:"ul"},'When the prompt shows "Please enter the platon node IP address:", please enter the PlatON node server ip address.'),(0,o.yg)("li",{parentName:"ul"},'When the prompt shows "validator conf success", and when the validator_config.json content printed at the end is normal, it means that the script is executed successfully. If the script is not executed successfully, please contact our official customer service to feedback specific questions.'))),(0,o.yg)("h5",{id:"validator-node-information-configuration-file-description"},"Validator node information configuration file description"),(0,o.yg)("p",null,"After the configuration of the validator node information is completed, the validator node information file validator_config.json will be generated in the validator subdirectory of the PlatON MTool installation directory. The file content is as follows:"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-json"},'{\n "nodePublicKey": "0abaf3219f454f3d07b6cbcf3c10b6b4ccf605202868e2043b6f5db12b745df0604ef01ef4cb523adc6d9e14b83a76dd09f862e3fe77205d8ac83df707969b47",\n "blsPubKey": "82d740cbc0314ec558c5426f88fdad6f07a07f9846c6be4e40cd628b74b9f641ddad01e4c281a2c3693f8ff2a73a410297aff379ee0575127d51de99b97acc9a1b7bc8ca132ef6f0379a3ec9d76a603d623176e49e1c53e87fead36317895099",\n "nodeAddress": "http://192.168.120.146",\n "nodePort": "16789",\n "nodeRpcPort": "6789"\n}\n')),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},(0,o.yg)("strong",{parentName:"p"},"Parameter description:")),(0,o.yg)("ul",{parentName:"blockquote"},(0,o.yg)("li",{parentName:"ul"},"nodePublicKey: Node ID, which can be viewed in the nodeid file under the node data directory data"),(0,o.yg)("li",{parentName:"ul"},"blsPubKey: BLS public key, which can be viewed in the blspub file under the node data directory data."),(0,o.yg)("li",{parentName:"ul"},"nodeAddress: If PlatON MTool and the node are on the same machine or in the same local area network, you can use the intranet IP, otherwise use the public IP whose format is: ",(0,o.yg)("inlineCode",{parentName:"li"},"http://18.238.183.12"),"."),(0,o.yg)("li",{parentName:"ul"},"nodePort: Node P2P port, default is 16789."),(0,o.yg)("li",{parentName:"ul"},"nodeRpcPort: rpc port, the default port is 6789."))),(0,o.yg)("h5",{id:"custom-platscan-avatar"},"Custom PlatScan avatar"),(0,o.yg)("p",null,"If users do not need to display their specified avatar on PlatScan, they can skip this step. Otherwise, the following operations are required:"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},(0,o.yg)("strong",{parentName:"p"},"Register a keybase account")),(0,o.yg)("p",{parentName:"li"},"Users first need to register on the official website of ",(0,o.yg)("a",{parentName:"p",href:"https://keybase.io/"},"keybase.io")," . If they have already registered, they can log on the official website of keybase.")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},(0,o.yg)("strong",{parentName:"p"},"Upload specified avatar")),(0,o.yg)("p",{parentName:"li"},"Click the user avatar to upload the avatar.")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},(0,o.yg)("strong",{parentName:"p"},"Generate PGP key")),(0,o.yg)("p",{parentName:"li"},"If the user has a ",(0,o.yg)("inlineCode",{parentName:"p"},"PGP key"),", after a successful login, a series of 16-bit public keys will be displayed next to the user's avatar, such as: ",(0,o.yg)("inlineCode",{parentName:"p"},"EB621920A48D0699"),"; if the user does not already have a ",(0,o.yg)("inlineCode",{parentName:"p"},"PGP key"),", click ",(0,o.yg)("inlineCode",{parentName:"p"},"add a PGP key")," next to the user's avatar to generate.")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},(0,o.yg)("strong",{parentName:"p"},"Specify the externalId value")),(0,o.yg)("p",{parentName:"li"},"When issuing the staking operation, specify the ",(0,o.yg)("inlineCode",{parentName:"p"},"--external_id")," parameter to be the PGP key generated in the previous step."))),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"Note: After the user completes the staking operation, the avatar customized by the user can be displayed on PlatScan.")),(0,o.yg)("h3",{id:"initiate-a-staking-operation"},"Initiate a staking operation"),(0,o.yg)("p",null,"If the consensus node deployment is complete and is catching up the blocknumber of ",(0,o.yg)("a",{parentName:"p",href:"https://scan.platon.network/?lang=en"},"Platscan"),", you can use PlatON MTool for staking operations. Please ensure that the balance of the staking account is sufficient before staking. The minimum threshold for staking is one hundred thousand LAT. "),(0,o.yg)("p",null,"Note: "),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"Please keep at least 1 LAT in the staking account, so that the transactions initiated by the subsequent node management have sufficient transaction fees, such as voting for upgrade proposals, and unsecured transactions.")),(0,o.yg)("p",null,"Excuting command"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon_mtool staking --config $PLATON_MTOOLDIR/validator/validator_config.json --keystore $PLATON_MTOOLDIR/keystore/staking.json --autoamount 100000 --benefit_address xxx196278ns22j23awdfj9f2d4vz0pedld8a2fzwwj --delegated_reward_rate 5000 --node_name myNode --website www.mywebsite.com --details myNodeDescription --external_id 121412312\n")),(0,o.yg)("p",null,"Enter the password of the staking wallet and press Enter. If the following information is displayed, the staking is successful:"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"operation finished\ntransaction hash:\n0x89b964d27d0caf1d8bf268f721eb123c4af57aed36187bea90b262f4769eeb9b\nSUCCESS\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},(0,o.yg)("strong",{parentName:"p"},"Parameter description:")),(0,o.yg)("ul",{parentName:"blockquote"},(0,o.yg)("li",{parentName:"ul"},"config\uff1anode configuration file"),(0,o.yg)("li",{parentName:"ul"},"keystore: staking wallet file"),(0,o.yg)("li",{parentName:"ul"},"amount: staking amount, not less than 100000LAT-staking threshold, no more than 8 decimal places"),(0,o.yg)("li",{parentName:"ul"},"restrictedamount: not less than 100000LAT - staking threshold, no more than 8 decimal points (staking using locked balance)"),(0,o.yg)("li",{parentName:"ul"},"autoamount: Not less than 10000LAT-Priority to use the lock-up balance staking, if the lock-up balance is not enough for the staking deposit, then use free amount staking"),(0,o.yg)("li",{parentName:"ul"},"benefit_address: benefit account to receive block-packing reward and staking reward"),(0,o.yg)("li",{parentName:"ul"},"delegated_reward_rate\uff1aDelegated bonus ratio, type is integer range is ","[","0,10000","]",", unit: ten thousand percent, e.g. enter 5000, it means the bonus ratio is 50%"),(0,o.yg)("li",{parentName:"ul"},"node",(0,o.yg)("em",{parentName:"li"},"name\uff1anode name\uff0c30 bytes(beginning with a letter, including alphabet, number, space, "),", -, #)"),(0,o.yg)("li",{parentName:"ul"},"website\uff1anode website, 30 bytes"),(0,o.yg)("li",{parentName:"ul"},"details\uff1anode description, 280 bytes"),(0,o.yg)("li",{parentName:"ul"},"external_id\uff1anode Icon ID of ",(0,o.yg)("a",{parentName:"li",href:"https://keybase.io"},"keybase.io"),", or identity authentication ID"))))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.869f808a.js b/assets/js/runtime~main.44ec277b.js similarity index 99% rename from assets/js/runtime~main.869f808a.js rename to assets/js/runtime~main.44ec277b.js index 09dbe130f..b899bf7bf 100644 --- a/assets/js/runtime~main.869f808a.js +++ b/assets/js/runtime~main.44ec277b.js @@ -1 +1 @@ -(()=>{"use strict";var e,a,c,f,d,b={},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var c=t[e]={id:e,loaded:!1,exports:{}};return b[e].call(c.exports,c,c.exports,r),c.loaded=!0,c.exports}r.m=b,r.c=t,e=[],r.O=(a,c,f,d)=>{if(!c){var b=1/0;for(i=0;i=d)&&Object.keys(r.O).every((e=>r.O[e](c[o])))?c.splice(o--,1):(t=!1,d0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[c,f,d]},r.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return r.d(a,{a:a}),a},c=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,f){if(1&f&&(e=this(e)),8&f)return e;if("object"==typeof e&&e){if(4&f&&e.__esModule)return e;if(16&f&&"function"==typeof e.then)return e}var d=Object.create(null);r.r(d);var b={};a=a||[null,c({}),c([]),c(c)];for(var t=2&f&&e;"object"==typeof t&&!~a.indexOf(t);t=c(t))Object.getOwnPropertyNames(t).forEach((a=>b[a]=()=>e[a]));return b.default=()=>e,r.d(d,b),d},r.d=(e,a)=>{for(var c in a)r.o(a,c)&&!r.o(e,c)&&Object.defineProperty(e,c,{enumerable:!0,get:a[c]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((a,c)=>(r.f[c](e,a),a)),[])),r.u=e=>"assets/js/"+({9:"7c01219a",141:"47bf852f",182:"26f00032",266:"02a5bd6e",410:"de5a5c02",503:"ffc5bc4e",767:"00513cca",926:"1b068446",1003:"7e0360c4",1065:"2fd65cec",1117:"281e6da7",1147:"57134b77",1192:"4b49a9aa",1205:"45050860",1230:"40d6bc37",1293:"c5399940",1399:"90c1fbfa",1592:"2f159d55",1624:"8d917970",1656:"3753d290",1666:"a651144a",1736:"ebf40b11",1987:"ecfe08ed",2351:"844b6fa5",2543:"a6cdf279",2640:"2880f02a",2758:"036a08cd",2800:"8cbb4dac",2840:"c458cc87",3107:"08eba0e5",3110:"cab29a5d",3450:"ef89d78f",3563:"2da079c0",3637:"8811c6c2",3639:"2aef6c43",3740:"358b1e47",3805:"1f88cea0",4063:"1795b996",4191:"4d453fb0",4224:"6ef51888",4334:"a0eb819e",4336:"187563fc",4455:"c2741d85",4533:"c767ba33",4537:"a7d3d7e1",4628:"5f68a137",4736:"8f82a138",5041:"5744c87b",5234:"4b04a897",5260:"b76ab335",5362:"78533e48",5517:"fdc56f1c",5801:"65c9d618",5939:"0f657be9",5952:"088efce4",6128:"6fbe188c",6163:"3477cd5e",6246:"92824bd0",6519:"280b88e7",6674:"850568e0",7239:"a969db61",7589:"12753c0a",7819:"d024cf01",7906:"a11a4b2e",8078:"03a88bad",8123:"82833145",8199:"ab973480",8249:"4d9f9a52",8309:"23e63a37",8324:"d60b69ec",8401:"17896441",8581:"935f2afb",8714:"1be78505",8748:"a146a1e2",8772:"ee3e85c9",8991:"d630c820",9004:"7d827ebb",9146:"2d862f0a",9237:"61730ff7",9239:"31489098",9425:"3d44375b",9448:"467850cb",9572:"d6cba0fc",9632:"0ae93a6f"}[e]||e)+"."+{9:"00d35f15",141:"fc2fdaed",182:"e486ab66",266:"cc8a5b3b",410:"d9b846e7",503:"e07e3eba",596:"dfdcb649",767:"0b0f04db",926:"b62f75af",1003:"4a54ad4e",1065:"430e86e8",1117:"6dc34952",1147:"b82a0e9d",1192:"6f074538",1205:"3748b821",1230:"fd03a1b8",1293:"2d0d0bc1",1399:"ce09025e",1592:"90120142",1624:"42510d7b",1656:"02d97f31",1666:"23ec6886",1736:"2715c803",1987:"476f8d16",2351:"dd9015b8",2543:"8c90b840",2640:"a7e84f61",2758:"5113f13a",2800:"71f687d5",2840:"4cf2a1a5",3107:"6835f39c",3110:"94fc75a8",3450:"8548322d",3563:"d6744cbd",3637:"f81290dd",3639:"ba5cb48e",3740:"c212189c",3760:"b6d2456f",3805:"ea26438c",4063:"7f55b862",4191:"5264df0c",4224:"59cab0cf",4334:"945f5363",4336:"a6f025bc",4455:"b31676cf",4533:"3fb717b9",4537:"0e4e180a",4628:"57e16f20",4736:"c3ce08ac",5041:"a828827b",5130:"cb8451ca",5169:"91014125",5234:"f5d18a4b",5260:"d682bc71",5343:"476f8e03",5345:"4618d5bb",5362:"1d8c58cd",5517:"51cf891d",5801:"10809738",5939:"67a1d974",5952:"307e5796",6128:"623803fc",6163:"7ec5a5fc",6246:"26f610cb",6519:"a7e4c981",6674:"2d01be08",7239:"4203d65d",7589:"56bb732c",7819:"705745f5",7906:"b993ad3f",8078:"9221e8d2",8123:"8c0eed07",8199:"a9e1c719",8249:"424bb0cf",8309:"519e7876",8324:"91d7a391",8401:"751f566b",8581:"1d89d5b2",8714:"13b3e506",8748:"47429066",8772:"30bec10d",8913:"480b5b18",8991:"676d7dea",9004:"339819d0",9146:"53212576",9237:"ef2f7ee8",9239:"74e5e3c1",9425:"e916a75c",9448:"a18ac244",9572:"a9c1581c",9632:"8063a8fb"}[e]+".js",r.miniCssF=e=>"assets/css/styles.4b88b956.css",r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),f={},d="docs:",r.l=(e,a,c,b)=>{if(f[e])f[e].push(a);else{var t,o;if(void 0!==c)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(l);var d=f[e];if(delete f[e],t.parentNode&&t.parentNode.removeChild(t),d&&d.forEach((e=>e(c))),a)return a(c)},l=setTimeout(u.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=u.bind(null,t.onerror),t.onload=u.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/docs/",r.gca=function(e){return e={17896441:"8401",31489098:"9239",45050860:"1205",82833145:"8123","7c01219a":"9","47bf852f":"141","26f00032":"182","02a5bd6e":"266",de5a5c02:"410",ffc5bc4e:"503","00513cca":"767","1b068446":"926","7e0360c4":"1003","2fd65cec":"1065","281e6da7":"1117","57134b77":"1147","4b49a9aa":"1192","40d6bc37":"1230",c5399940:"1293","90c1fbfa":"1399","2f159d55":"1592","8d917970":"1624","3753d290":"1656",a651144a:"1666",ebf40b11:"1736",ecfe08ed:"1987","844b6fa5":"2351",a6cdf279:"2543","2880f02a":"2640","036a08cd":"2758","8cbb4dac":"2800",c458cc87:"2840","08eba0e5":"3107",cab29a5d:"3110",ef89d78f:"3450","2da079c0":"3563","8811c6c2":"3637","2aef6c43":"3639","358b1e47":"3740","1f88cea0":"3805","1795b996":"4063","4d453fb0":"4191","6ef51888":"4224",a0eb819e:"4334","187563fc":"4336",c2741d85:"4455",c767ba33:"4533",a7d3d7e1:"4537","5f68a137":"4628","8f82a138":"4736","5744c87b":"5041","4b04a897":"5234",b76ab335:"5260","78533e48":"5362",fdc56f1c:"5517","65c9d618":"5801","0f657be9":"5939","088efce4":"5952","6fbe188c":"6128","3477cd5e":"6163","92824bd0":"6246","280b88e7":"6519","850568e0":"6674",a969db61:"7239","12753c0a":"7589",d024cf01:"7819",a11a4b2e:"7906","03a88bad":"8078",ab973480:"8199","4d9f9a52":"8249","23e63a37":"8309",d60b69ec:"8324","935f2afb":"8581","1be78505":"8714",a146a1e2:"8748",ee3e85c9:"8772",d630c820:"8991","7d827ebb":"9004","2d862f0a":"9146","61730ff7":"9237","3d44375b":"9425","467850cb":"9448",d6cba0fc:"9572","0ae93a6f":"9632"}[e]||e,r.p+r.u(e)},(()=>{var e={5354:0,1869:0};r.f.j=(a,c)=>{var f=r.o(e,a)?e[a]:void 0;if(0!==f)if(f)c.push(f[2]);else if(/^(1869|5354)$/.test(a))e[a]=0;else{var d=new Promise(((c,d)=>f=e[a]=[c,d]));c.push(f[2]=d);var b=r.p+r.u(a),t=new Error;r.l(b,(c=>{if(r.o(e,a)&&(0!==(f=e[a])&&(e[a]=void 0),f)){var d=c&&("load"===c.type?"missing":c.type),b=c&&c.target&&c.target.src;t.message="Loading chunk "+a+" failed.\n("+d+": "+b+")",t.name="ChunkLoadError",t.type=d,t.request=b,f[1](t)}}),"chunk-"+a,a)}},r.O.j=a=>0===e[a];var a=(a,c)=>{var f,d,b=c[0],t=c[1],o=c[2],n=0;if(b.some((a=>0!==e[a]))){for(f in t)r.o(t,f)&&(r.m[f]=t[f]);if(o)var i=o(r)}for(a&&a(c);n{"use strict";var e,a,c,f,d,b={},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var c=t[e]={id:e,loaded:!1,exports:{}};return b[e].call(c.exports,c,c.exports,r),c.loaded=!0,c.exports}r.m=b,r.c=t,e=[],r.O=(a,c,f,d)=>{if(!c){var b=1/0;for(i=0;i=d)&&Object.keys(r.O).every((e=>r.O[e](c[o])))?c.splice(o--,1):(t=!1,d0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[c,f,d]},r.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return r.d(a,{a:a}),a},c=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,f){if(1&f&&(e=this(e)),8&f)return e;if("object"==typeof e&&e){if(4&f&&e.__esModule)return e;if(16&f&&"function"==typeof e.then)return e}var d=Object.create(null);r.r(d);var b={};a=a||[null,c({}),c([]),c(c)];for(var t=2&f&&e;"object"==typeof t&&!~a.indexOf(t);t=c(t))Object.getOwnPropertyNames(t).forEach((a=>b[a]=()=>e[a]));return b.default=()=>e,r.d(d,b),d},r.d=(e,a)=>{for(var c in a)r.o(a,c)&&!r.o(e,c)&&Object.defineProperty(e,c,{enumerable:!0,get:a[c]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((a,c)=>(r.f[c](e,a),a)),[])),r.u=e=>"assets/js/"+({9:"7c01219a",141:"47bf852f",182:"26f00032",266:"02a5bd6e",410:"de5a5c02",503:"ffc5bc4e",767:"00513cca",926:"1b068446",1003:"7e0360c4",1065:"2fd65cec",1117:"281e6da7",1147:"57134b77",1192:"4b49a9aa",1205:"45050860",1230:"40d6bc37",1293:"c5399940",1399:"90c1fbfa",1592:"2f159d55",1624:"8d917970",1656:"3753d290",1666:"a651144a",1736:"ebf40b11",1987:"ecfe08ed",2351:"844b6fa5",2543:"a6cdf279",2640:"2880f02a",2758:"036a08cd",2800:"8cbb4dac",2840:"c458cc87",3107:"08eba0e5",3110:"cab29a5d",3450:"ef89d78f",3563:"2da079c0",3637:"8811c6c2",3639:"2aef6c43",3740:"358b1e47",3805:"1f88cea0",4063:"1795b996",4191:"4d453fb0",4224:"6ef51888",4334:"a0eb819e",4336:"187563fc",4455:"c2741d85",4533:"c767ba33",4537:"a7d3d7e1",4628:"5f68a137",4736:"8f82a138",5041:"5744c87b",5234:"4b04a897",5260:"b76ab335",5362:"78533e48",5517:"fdc56f1c",5801:"65c9d618",5939:"0f657be9",5952:"088efce4",6128:"6fbe188c",6163:"3477cd5e",6246:"92824bd0",6519:"280b88e7",6674:"850568e0",7239:"a969db61",7589:"12753c0a",7819:"d024cf01",7906:"a11a4b2e",8078:"03a88bad",8123:"82833145",8199:"ab973480",8249:"4d9f9a52",8309:"23e63a37",8324:"d60b69ec",8401:"17896441",8581:"935f2afb",8714:"1be78505",8748:"a146a1e2",8772:"ee3e85c9",8991:"d630c820",9004:"7d827ebb",9146:"2d862f0a",9237:"61730ff7",9239:"31489098",9425:"3d44375b",9448:"467850cb",9572:"d6cba0fc",9632:"0ae93a6f"}[e]||e)+"."+{9:"00d35f15",141:"fc2fdaed",182:"e486ab66",266:"cc8a5b3b",410:"d9b846e7",503:"e07e3eba",596:"dfdcb649",767:"0b0f04db",926:"b62f75af",1003:"4a54ad4e",1065:"430e86e8",1117:"6dc34952",1147:"b82a0e9d",1192:"6f074538",1205:"3748b821",1230:"fd03a1b8",1293:"2d0d0bc1",1399:"ce09025e",1592:"90120142",1624:"42510d7b",1656:"02d97f31",1666:"23ec6886",1736:"287f2a0d",1987:"476f8d16",2351:"dd9015b8",2543:"8c90b840",2640:"a7e84f61",2758:"5113f13a",2800:"71f687d5",2840:"4cf2a1a5",3107:"6835f39c",3110:"94fc75a8",3450:"8548322d",3563:"d6744cbd",3637:"f81290dd",3639:"ba5cb48e",3740:"c212189c",3760:"b6d2456f",3805:"ea26438c",4063:"7f55b862",4191:"5264df0c",4224:"59cab0cf",4334:"945f5363",4336:"a6f025bc",4455:"b31676cf",4533:"3fb717b9",4537:"0e4e180a",4628:"57e16f20",4736:"c3ce08ac",5041:"a828827b",5130:"cb8451ca",5169:"91014125",5234:"f5d18a4b",5260:"d682bc71",5343:"476f8e03",5345:"4618d5bb",5362:"1d8c58cd",5517:"51cf891d",5801:"10809738",5939:"67a1d974",5952:"307e5796",6128:"623803fc",6163:"7ec5a5fc",6246:"26f610cb",6519:"a7e4c981",6674:"2d01be08",7239:"4203d65d",7589:"56bb732c",7819:"705745f5",7906:"b993ad3f",8078:"9221e8d2",8123:"8c0eed07",8199:"a9e1c719",8249:"424bb0cf",8309:"519e7876",8324:"91d7a391",8401:"751f566b",8581:"1d89d5b2",8714:"13b3e506",8748:"47429066",8772:"30bec10d",8913:"480b5b18",8991:"676d7dea",9004:"339819d0",9146:"53212576",9237:"ef2f7ee8",9239:"74e5e3c1",9425:"e916a75c",9448:"a18ac244",9572:"a9c1581c",9632:"8063a8fb"}[e]+".js",r.miniCssF=e=>"assets/css/styles.4b88b956.css",r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),f={},d="docs:",r.l=(e,a,c,b)=>{if(f[e])f[e].push(a);else{var t,o;if(void 0!==c)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(l);var d=f[e];if(delete f[e],t.parentNode&&t.parentNode.removeChild(t),d&&d.forEach((e=>e(c))),a)return a(c)},l=setTimeout(u.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=u.bind(null,t.onerror),t.onload=u.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/docs/",r.gca=function(e){return e={17896441:"8401",31489098:"9239",45050860:"1205",82833145:"8123","7c01219a":"9","47bf852f":"141","26f00032":"182","02a5bd6e":"266",de5a5c02:"410",ffc5bc4e:"503","00513cca":"767","1b068446":"926","7e0360c4":"1003","2fd65cec":"1065","281e6da7":"1117","57134b77":"1147","4b49a9aa":"1192","40d6bc37":"1230",c5399940:"1293","90c1fbfa":"1399","2f159d55":"1592","8d917970":"1624","3753d290":"1656",a651144a:"1666",ebf40b11:"1736",ecfe08ed:"1987","844b6fa5":"2351",a6cdf279:"2543","2880f02a":"2640","036a08cd":"2758","8cbb4dac":"2800",c458cc87:"2840","08eba0e5":"3107",cab29a5d:"3110",ef89d78f:"3450","2da079c0":"3563","8811c6c2":"3637","2aef6c43":"3639","358b1e47":"3740","1f88cea0":"3805","1795b996":"4063","4d453fb0":"4191","6ef51888":"4224",a0eb819e:"4334","187563fc":"4336",c2741d85:"4455",c767ba33:"4533",a7d3d7e1:"4537","5f68a137":"4628","8f82a138":"4736","5744c87b":"5041","4b04a897":"5234",b76ab335:"5260","78533e48":"5362",fdc56f1c:"5517","65c9d618":"5801","0f657be9":"5939","088efce4":"5952","6fbe188c":"6128","3477cd5e":"6163","92824bd0":"6246","280b88e7":"6519","850568e0":"6674",a969db61:"7239","12753c0a":"7589",d024cf01:"7819",a11a4b2e:"7906","03a88bad":"8078",ab973480:"8199","4d9f9a52":"8249","23e63a37":"8309",d60b69ec:"8324","935f2afb":"8581","1be78505":"8714",a146a1e2:"8748",ee3e85c9:"8772",d630c820:"8991","7d827ebb":"9004","2d862f0a":"9146","61730ff7":"9237","3d44375b":"9425","467850cb":"9448",d6cba0fc:"9572","0ae93a6f":"9632"}[e]||e,r.p+r.u(e)},(()=>{var e={5354:0,1869:0};r.f.j=(a,c)=>{var f=r.o(e,a)?e[a]:void 0;if(0!==f)if(f)c.push(f[2]);else if(/^(1869|5354)$/.test(a))e[a]=0;else{var d=new Promise(((c,d)=>f=e[a]=[c,d]));c.push(f[2]=d);var b=r.p+r.u(a),t=new Error;r.l(b,(c=>{if(r.o(e,a)&&(0!==(f=e[a])&&(e[a]=void 0),f)){var d=c&&("load"===c.type?"missing":c.type),b=c&&c.target&&c.target.src;t.message="Loading chunk "+a+" failed.\n("+d+": "+b+")",t.name="ChunkLoadError",t.type=d,t.request=b,f[1](t)}}),"chunk-"+a,a)}},r.O.j=a=>0===e[a];var a=(a,c)=>{var f,d,b=c[0],t=c[1],o=c[2],n=0;if(b.some((a=>0!==e[a]))){for(f in t)r.o(t,f)&&(r.m[f]=t[f]);if(o)var i=o(r)}for(a&&a(c);n Community Projects | PlatON - +

    Community Projects

    Below is a categorized list of projects that use the PlatON blockchain,meet your related development and use tool needs. We welcome more community members to participate and continue to expand the PlatON ecosystem.

    The LatticeX Foundation has now opened the Grants program, and you can contribute your value through Grants.

    Wallets#

    ATON

    ATON is the first secure and user-friendly mobile wallet for PlatON Network.

    Block Explorers#

    PlatScan

    PlatScan is a Block Explorer and Analytics Platform for PlatON.

    Node Tools#

    PlatON MTool

    PlatON's Node Management Tool.

    Developer Forums#

    LatticeX Forum

    PlatON Developer Forums. Need help implementing a solution on PlatON? Want to provide feedback? Check out PlatON’s developer forums.

    Cooperation projects#

    Biteye

    Gateway to Web3 Investing.

    Band

    Band Protocol is a cross-chain data oracle platform that aggregates and connects real-world data and APIs to smart contracts.

    BOXTradEx

    BOXTradEx is a one-stop crypto platform for GameFi, game players, and guilds, providing the Gamefi portal for web3. We support NFT API service, crypto exchange, NFT marketplace, wallet, and Guild DAO tool.

    StoneAeon

    Stone Aeon is a game that happens in the world of Stone Age. The primitive men gather here. All the items and creatures exist based on the NFT of blockchain that is used for digitizing the unique contents. The P2E feature of Stone Aeon will maximize players’ yield while they're having fun in the game. Decentralized game plans guarantee a fair game. Visual effects and features of Stone Aeon are absolutely original.

    Celer

    Celer is a blockchain interoperability protocol enabling a one-click user experience accessing tokens, DeFi, GameFi, NFTs, governance, and more across multiple chains.

    Gitcoin

    Gitcoin is a community for developers to collaborate and monetize their skills while working on Open Source projects through bounties and grants.

    Coin98

    All In One DeFi Platform.

    TofuNFT

    tofuNFT.com is an NFT marketplace focused on GameFi and collectibles, rebranded from SCV’s NFT market.

    UBOX

    The first NFT copyright certification marketplace and MEX(CEX+DEX) in the meta-universe world.

    WinKrypto

    The first post-investment services firm for crypto players in the APAC region.

    NFTScan

    NFTScan is a multi-chain NFT explorer and NFT data infrastructure.

    Double Protocol

    Rental Protocol for Utility NFTs.
    - + \ No newline at end of file diff --git a/contributing/index.html b/contributing/index.html index 35f7f769c..b9c84858c 100644 --- a/contributing/index.html +++ b/contributing/index.html @@ -8,14 +8,14 @@ Contributing to PlatON | PlatON - +

    Contributing to PlatON

    PlatON is an open-source tech community collectively maintained and built by community contributors from around the world.

    There are many ways to contribute to PlatON and bring real changes to the community, regardless of the field or level of your expertise.

    Here are some tasks you can undertake and tips about how you can get started.

    We accept all your contributions, even if what you want to do isn’t listed here. If you’re still unsure, create a GitHub Issue or post on the Forum to seek advice from our community.

    Run a Validator#

    PlatON is currently maintained by 201 validators and will expand to over 1,000 validators in the future.

    Join the PlatON validator network to help maintain our security and further decentralize PlatON.

    More About Running Validators

    Stake Your LAT#

    You can delegate your LAT to a PlatON validator to earn rewards and help protect PlatON.

    More About Staking LAT

    Code Programming#

    PlatON is an open financial infrastructure with privacy-preserving computation at its core. Our vast project requires more than just a few core developers. We look forward to having more community developers help us write and maintain our code. Diving straight into development can be overwhelming; therefore, we introduced the “Help Wanted” tag for functionalities or bug fixes where you can help us. This is the best way for you to start contributing code.

    Check Out Our Repository: https://github.com/PlatONnetwork

    The PlatON community hosts bounty programs and hackathons from time to time. You can follow and participate in our events through the forum to help solve technical issues and earn cryptos!

    Write Documentation#

    As more codes, products, tools, and applications are added to PlatON, we need plenty of concise documents to help users understand and learn. We are looking for more people to help us write clear documents (including video tutorials) needed by PlatON projects or translate documents into your local language.

    The PlatON documentation library is constantly being revised, and contributions are welcome.

    Community Support and Education#

    If you enjoy connecting with people, you can join PlatON’s chat and discussion community. Here, you can build connections with individuals who share your goals, help those in need, and jointly maintain a healthy and orderly community.

    Current channels for communication and discussion primarily include: ,LatticeX Foundation GithubDiscordLatticeX ForumRedditTelegram

    Specific contributions include but are not limited to:

    • Linking repeated questions and organizing problem tags.
    • Articulating open issues to drive discussions.
    • Helping answer questions about the project and responding to public questions. You can also organize meetups or events in your city to seek, train, and support developers and community members interested in PlatON.

    Graphic Design#

    You can tap into your artistic talents and graphic design skills to contribute to the community by designing logos, icons, banners, and other content. Your designs will enhance the project’s experience and aesthetics. You can also contribute to PlatON by designing websites and promotional materials or providing illustrations for our document guides.

    Build Apps/Protocols#

    You can build anything imaginable on PlatON or integrate existing applications with PlatON. Perhaps you will change the world.

    If you’re unsure about something, join the chat and discussion forum to seek help and feedback. You can also apply for LatticeX Foundation’s developer grants (https://latticex.foundation/grants) to support your project.

    Research#

    There remain many unsolved problems in blockchain, privacy-preserving computation, and AI technologies. If you’re interested in a particular technical issue, join the community research group and contribute to PlatON. Your ideas might change the entire technological landscape.

    Feel free to contact us via developer@latticex.foundation and tell us your areas of interest. We’ll help you engage in interesting and valuable work.

    - + \ No newline at end of file diff --git a/eip55-bech32-compatible/index.html b/eip55-bech32-compatible/index.html index 1c7b6cc04..96e5c72d9 100644 --- a/eip55-bech32-compatible/index.html +++ b/eip55-bech32-compatible/index.html @@ -8,13 +8,13 @@ EIP55 and Bech32 address format compatibility scheme | PlatON - +

    EIP55 and Bech32 address format compatibility scheme

    JSON RPC interface#

    The jsonrpc interface of PlatON node supports EIP55 (0xxxxx...) address and Bech32 (latxxxxx...) Two kinds of address formats, but the parameters and return values when calling a specific interface can only be selected a certain address format, can not be mixed, the use of different address formats are as follows.

    • EIP55 address

      PlatON is fully compatible with the jsonrpc interface of Ethernet. To use the address in EIP55 format, just follow the way of calling Ethernet jsonrpc. Note the following points.

      1. cannot use the interface prefixed with platon_, must be modified to prefix eth_

      2. for interfaces with prefixes other than platon_ and eth_, PlatON adds an optional field bech32, which marks whether the Bech32 address needs to be used, with the default value of EIP55, note that if you want to use the EIP55 format, you cannot take the bech32 field

        curl -X POST --data '{"jsonrpc":"2.0", "method": "txpool_contents", "params": [], "id": 1}'

        The return value is

        {"jsonrpc":"2.0","id":1,"result":["0x407d73d8a49eeb85d32cf465507dd71d507100c1"]}
      3. The address fields in both the input and return values are in EIP55 format

    • Bech32 address

      To use Bech32 addresses, note the following.

      1. you cannot use an interface prefixed with eth_, you must modify it to be prefixed with platon_

      2. for interfaces with prefixes other than platon_ and eth_, PlatON adds an optional field bech32 which marks whether or not a Bech32 address needs to be used, the default value is EIP55, note that if you want to use the Bench32 format, you must bring the bech32 field and set it to true

        curl -X POST --data '{"jsonrpc":"2.0","bech32":true, "method": "txpool_contents", "params": [], "id": 1}'

        The return value is

        {"jsonrpc":"2.0","id":1,"result":["lat1zqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqp7pn3ep"]}
      3. the address fields in both the input and return values are in Bench32 format

    SDK#

    PlatON can be called using the Ethernet SDK and the PlatON SDK, noting the following points.

    1. you can only use the EIP55 address with the Ethernet SDK, not the Bech32 address
    2. Using PlatON SDK can only use Bech32 address at the moment, not EIP55 address

    How DAPP is compatible with EIP55 and Bech32#

    DAPP can achieve business support for both EIP55 and Bech32 addresses through address translation as follows.

    • Use jsonrpc interface

      If the DAPP calls the jsonrpc interface directly, it can choose any of the following methods.

      1. convert the Bech32 address to EIP55 address and call the EIP55 address according to the call method introduced earlier
      2. convert the EIP55 address to Bech32 address, and call the Bech32 address according to the call method described above
    • Using SDK

      If the DAPP uses the SDK to call PlatON, it can choose any of the following methods.

      1. Convert the Bech32 address to an EIP55 address and call it using the Ethernet SDK
      2. Convert EIP55 address to Bech32 address and call with PlatON SDK

    Address conversion method#

    The interconversion between Bech32 addresses and EIP55 addresses is provided in PlatON's SDK, which supports three development languages.

    from platon_utils import to_bech32_address, to_checksum_addressto_bech32_address('0x0000000000000000000000000000000000000001', 'lat')to_checksum_address('lat1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpfr7f80')
    Bech32.addressEncode("lat","0x676c0d9b7da640a25dabd5788612f5faa16cc6b9"));Bech32.addressDecodeHex("lat1vakqmxma5eq2yhdt64ugvyh4l2ske34eay86pg"));
    web3.utils.decodeBech32Address('lat', 'lat1zg69v7yszg69v7yszg69v7yszg69v7y30mluqx');web3.utils.toBech32Address('lat', '0x1234567890123456789012345678901234567891');
    - + \ No newline at end of file diff --git a/en/404.html b/en/404.html index 69118b6e0..00d87ce66 100644 --- a/en/404.html +++ b/en/404.html @@ -8,13 +8,13 @@ Page Not Found | PlatON - +

    Page Not Found

    We could not find what you were looking for.

    Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

    - + \ No newline at end of file diff --git a/en/ATON-user-manual/index.html b/en/ATON-user-manual/index.html index de6405340..32f3b7dc8 100644 --- a/en/ATON-user-manual/index.html +++ b/en/ATON-user-manual/index.html @@ -8,13 +8,13 @@ ATON Wallet User Manual | PlatON - +

    ATON Wallet

    ATON is a secure and user-friendly mobile wallet for PlatON Network and Alaya Network. The ATON Mobile Wallet allows you to easily transfer LAT/ATP tokens to others, view your transaction history and account balance. At the same time, it provides convenient delegation service for you.

    All images in this manual are sample images on PlatON Network.

    Start#

    Create Wallet#


    1. Click [Create Wallet].
    2. Select "Normal" or "HD". Set the wallet name, and password.
    3. Click the [Create] button to create a wallet.
    4. After the wallet is successfully created, you can click [Start to Backup] to start the backup, or click [Skip] to do it later.

    Note
    1. Password is your credentials to use and manage the wallet. Servers of ATON does not store your password,Please make sure you keep it in mind.
    2. We strongly recommend you to back up your wallet after it is created.
    3. Click on the network name in the upper left corner of the page to switch networks.
    4. Amount of wallets cannot be larger than 200(including all normal wallets and all sub-wallets generated from HD).

    Wallet Backup#


    1. After creating the wallet, click [Backup] button for wallet backup. Or you can find it in [My]-[Wallet Management].
    2. Wallet password is reeuqired for backup. After the password verification is passed, the system will display 12 English words as the mnemonic words.
    3. Copy the mnemonic and keep them in a safe place. Click [Next] to verify the mnemonic. If the verification succeeds, the wallet backup is completed.

    Note
    1. You can restore and manage your wallet with mnemonics words, keep them in a safe place.

    Import Wallet#

    Import Using Keystore#


    1. Click the [...] button at the top right coner of the main interface, and select [Import Wallet]. Then move to [Keystore].
    2. Paster Input the keystore content, or scan the QR code to get the keystore file.
    3. Set the wallet name and password for this wallet.
    4. Click the [Start to Import] button. After the password verification is passed, the wallet is successfully imported.

    Note
    1. Password is required when import ing wallet Keystore.
    2. Your wallet password is not stored in the server. If you forget the password, please use mnemonic and private key to import it.
    3. You can also click the "[...]" button on the top right corner to import wallet.

    Import Using Mnemonics#


    1. Click the [...] button at the top right coner of the main interface, and select [Import Wallet]. Then move to [Mnemonic].
    2. Fill in the mnemonics in the correct order.
    3. Select type "Normal" or "HD". Set the wallet name and password.
    4. Click the [Start to Import] button. After the mnemonic verification is passed, the wallet is successfully imported.

    Note
    1. Password is your credentials to use and manage the wallet.Servers of ATON does not store your password, make sure you keep it in mind.
    2. Store your mnemonics in a safe place.
    3. You can also click the "[...]" button on the top right corner to import wallet.

    Import Using Private Key#


    1.Click the [...] button at the top right coner of the main interface, and select [Import Wallet]. Then move to [Private Key].
    2. Input your private key, or scan the QR code to get the private key.
    3. Set the wallet name and password.
    4. Click the [Start to Import] button. After the verification is passed, the wallet is successfully imported.

    Note
    1. Password is your credentials to use and manage the wallet. Servers of ATON does not store your password, make sure you keep it in mind.
    2. Store your private key in a safe place.
    3. You can also click the "[...]" button on the top right corner to import wallet.

    Import observed wallet#

    For details about importing observed wallets, please refer to the instructions of “Set observed wallet and cold wallet”.

    Address Book#


    1. Select [My-Settings],and you can see the list of wallet addresses stored in the address book.
    2. Click any of the address information to copy the selected address.
    3. Slide any of the address information to delete and edit it.
    4. Click the [+] button on the right side of the top navigation bar to manually add address information to the address book.
    5. At the same time, you can also check the [Deposit Address] button above the [Start Import] button on the [Create Wallet] and [Import Wallet] pages to enable the wallet to be stored in the address book automatically, and this option is checked by default.

    Select Wallet#


    1. Click the [...] button at the top right coner of the main interface, then click [Select Wallet].
    2. All your wallets can be classified and filtered as "All", "HD", "Normal", and you can also use fuzzy search with your wallet name or precise search with your wallet address.
    3. Select the wallet you need.
    4. Then you will be guide to the wallet page you selected.

    Wallet Assets#


    1. When you successfully created a wallet, you can find the valid wallet and asset info at the Wallet Asset page.
    2. ①The upper part shows the brief information of the current wallet.
    3. ②The brief wallet information includes the wallet name and wallet address,and [Switch Wallet] button.
    4. ③Click the [Copy] button to copy the wallet address.
    5. ④Click the [Wallet Management] button to manage the wallet.
    6. ⑤Click the [QR Code] button to enter the receiving page to receive the transfer.
    7. ⑥The network information of the current wallet is displayed at the top left corner, click to switch networks.
    8. ⑦By Click [...],you can create, import and select wallets, and click "Scan" to scan the QR code.
    9. The lower part of the page is [assets List].
    10. ⑧The first item is the LAT/ATP data, you can see the unit and balance, click it to enter the LAT/ATP assets details page.
    11. ⑨The PRC20/ARC20 assets, you can see the unit and balance, click it to enter the PRC20/ARC20 assets details page.
    12. ⑩The "Collectibles" tab is for PRC721/ARC721 assets, click on it to go to the PRC721/ARC721 assets list page.
    13. Click the [eye] button, it will show/hide the number of assets.

    LAT/ATP Assets Detail#


    1. The upper part is the current wallet information.
    2. The wallet information includes the balance, unit and locked-up balance, as well as the [Send] button and [Receive] button.
    3. Click the [Send] button to jump to the sending page for transfer.
    4. Click the [Receive] button to enter the receiving page to receive the transfer.
    5. The lower part of the page is [Transactions].
    6. The lower part of the page is the transaction records, click on a transaction record, you can get more transaction details.

    Collectibles(PRC721)#

    Collectible Set List#


    Click a Collectible Set to the page of Collectible Set Detail.

    Collectible Set Detail#


    1. At the top is the introduction about current shown Collectible Set.
    2. The rest part are Collectibles belong to current wallet. Click a picture of Collectible to the page of Collectible Detail.

    Collectible Detail#


    1. Top of this page is current collectible's name and ID.
    2. Middle part contains the detail and tradings of this collectible.
    3. At the bottom is the button for sending this collectible. To send this collectible to another address on sending page by clicking this button.

    Collectible Tradings' Record#


    1. After clicking Recent Trading tag, you can see the list of tradings of current collectible.
    2. Click one of these records to see trading detail.

    Receive#


    1. Select the asset at the Assets parts on the main interface for more details, and click the [Receive] button to check the wallet address and QR code.
    2. You can copy your wallet address with the copy button.
    3. Click [Save image and Share] to save the picture to the local album.
    4. Your friends can transfer LAT/ATP to you through your wallet address or scanning the QR code.

    Note
    1. This LAT/ATP address and QR code only accept LAT/ATP and assets on PlatON/Alaya, do not transfer assets on other networks to this wallet.
    2. Please make sure that you transfer assets to correct network.

    Sending#

    Send LAT/ATP#


    1. Click the [Send] button at the asset details page you selected.
    2. Enter a valid wallet address, or scan the QR code by clicking the scan button at the upper right corner of the interface, or select one wallet you stored.
    3. Enter the LAT/ATP amount you want to send.
    4. Set Select the transaction fee rate, you can move the slide bar to set the service fee.
    5. Click [Next] to confirm the transaction information,click [Send] to proceed the transaction.

    Send Collectible#


    1. On the page of Collectible Detail, click the [Send] button.
    2. Type in valid wallet address, or scan the QR code of the wallet to automatically fill in the address, or select a locally saved wallet address through the address book.
    3. Choose the transaction fee, and you can click to adjust it to be lower or higher.
    4. Click the [Next] button to confirm the transaction information, and click the [Send] button and enter the correct wallet password to send the transaction to the blockchain network.

    Choose Transaction Fee#


    1. The functions of sending, entrusting, redeeming and receiving rewards all incur transaction fees.
    2. Take the sending function as an example, click [Transaction Fee] to enter the transaction fee setting page.
    3. There are 5 choices for transaction fees (Fastest, Fast, Recommended, Cheap, Customize).
    4. [Recommended] configuration item is selected by default.
    5. The user can select the corresponding option according to actual needs.
    6. In the [Customize] column, users can enter Gas Price and Gas Limit independently to achieve flexible cost configuration.

    Validators#

    Validators List#


    1. Move to the [Delegate] tab at the main interface, and then opt for [Validators], you can view all validators.
    2. Usually, the nodes are sorted by rank. They can also be sorted by Delegated amount/Delegators/Expected delegation annualized yield.
    3. Active node: validators participating in the consensus election in the current settlement interval.
    4. Candidate node: validators do not participate in consensus election in the current settlement interval.

    Validator Details#


    1. Select a validator, you can check the related profit informaiton, like expected delegation annualized yield, reward ratio and total reward.
    2. Also you can check the basic information of validators, such as delegators, blocks info, etc.
    3. If you want to delegate your LAT/ATP to this validator, you can click the [Delegate] button to start it.

    Note:
    1. The validators funded by Foundation do not accept delegations.
    2. The "locked validators" not accept delegation.

    Delegate#

    Participate in Delegation#


    1. Select a validator to delegate. If you’ve delegated, then you can check your delegation details via: [Delegate] - [My Delegations]-[Delegation Rec], and then select one validator to continue delegation.
    2. Select the wallet you want to delegrate.
    3. You can select locked-up balance to delegate if there is, or select delegated freeze balance to delegate if there is.
    4. Enter the amount, and it must not be less than 10LAT/1ATP.
    5. Enter the correct password.
    6. You can delegate to the nodes you’ve delegated, no limit to the delegation times.

    Note
    1. Delegators delegates LAT/ATP to validtaors, when the delegated validators get profit, delegators will win the profits according to the delegation ratio set by validators.
    2. The wallet address connected to profit validators can’t be used to delegate.
    3. The delegated LAT/ATP will be valid at the next settlement interval.

    My Delegations#


    1. Click [My Delegation] to check your uncalmied reward, total reward and delegated amount.
    2. Select a specific wallet to check the details including total delegated amount, total rewards and unclaimed rewards. You can also delegate and withdraw your delegation.
    3. Click the [Claim] button to get all unclaimed rewards, and input your wallet. After that, you can see your rewards.

    Undelegation#


    1. Click You can withdraw your delegation via: [My Delegations]-[Delegation Rec]-[Withdraw].
    2. Enter the number,it should be greater than or equal to 10 LAT/1 ATP. Enter your password to proceed the process.

    Note
    1.When undelegate the delegation, the delegation will return to the original way during the hesitation period, and the delegation within the validity period will be returned to the delegation frozen account, which will be frozen for a certain period.
    2.When withdrawing all delegations, the delegation rewards will be claimed automatically.

    Freeze Details#


    There is a certain settlement period as a freezing period after Undelegate, and each settlement cycle is 10750 blocks.Delegation within the freeze period can be viewed on the Freeze Details.
    [Delegate node Details] Click [Delegated Freeze] to enter the Freeze details.

    Withdraw#


    After the freeze period ends, the user needs to manually perform the extraction operation,all delegations to be withdrawn will be withdrawn and returned to the user's wallet balance or locked account according to the source of the asset.
    1. [Freeze Details] Click the [Withdraw] button to enter the withdrawal;
    2. Click the [Withdraw] button to withdraw all the withdrawable delegations.

    Observed Wallet and Cold Wallet#

    Set the Observed Wallet and Cold Wallet#

    Preparation:

    1. Prepare two mobile phones and install the latest ATON.
    2. Make sure that one phone is never connected to the Internet. It is recommended to turn on the airplane mode and turn off WiFi to set it as a cold wallet device. The other one is connected to the network as an observed wallet device.

    1. Create a wallet as a cold wallet in offline environment, click [ Receive] to find the QR code.
    2. Click [...] at the upper right corner of the main interface, and then select [Import Wallet] -[Observe Wallet] with the mobile phone connected to the network, scan the wallet QR code or enter the wallet address on the mobile phone not connected to the Internet, and click [Finish]. Then the wallet is set successfully.

    Note
    1. Oberseved wallet: a wallet connected to network, and is used for observation only. If you need to conduct transactions,the observed wallet need to work with the cold wallet.
    2. Cold wallet:a wallet that is not connected to the Internet but has a private key, which needs to be kept in a safe place.

    Transaction with Cold Wallet#

    If you have set up observed wallets and cold wallets, you can initiate transfers, delegations, delegation withdrawals, etc. with the observed wallets, and have it worked with the cold wallets cooperate for sign. The following Below is an example.

    1. Observed wallet


    (1) Select an observed wallet, then move to the send page, enter the required trasfer details, and then click Finish.
    (2) Click the [Next] button, then you will find the QR code that would be scanned by the cold wallet.

    2. Cold wallet


    (1) Click the scan button at the upper right corner, or click the [Offline Signature] button of the specified wallet to scan the QR code displayed on the wallet page.
    (2) The page displays the detailed transaction information. If there is no problems with the transaction, you can click [OK, Sign] and enter the password.
    (3) After you can see the QR code of the signed transactions for the observed wallet to scan.

    3. Observed wallet


    (1) The offline signature is requied when you use observed wallet to send, delegate and withdraw.
    (2) Click [Already Scaned, Next], then you will arrive at the reading signature data page.
    (3) Click [Send] to send the transaction to the blockchain network.

    Note
    1. Jointly use observed wallet and cold wallet to do transactions.
    2. Please do not deposit assets to the observed wallet address that you cannot control.

    Others#

    Settings / Help and Feedback#


    1. Move to [Me] - [Settings], you can make
    - Network Settings: Select the network to be connected.
    - Reminder Threshold:Send notification when the amount of transfer exceeds the transaction threshold you set.
    - Resend Reminder:Send notification when repeated transaction occurred within 2 housrs.
    - Fingerprint / Face Unlocking: If you enable it, fingerprint or face unlock is required every time you launch the app.
    - Language: Chinese and English are available.
    2. Move to [Me] - [Support and feedback], You can find the user guide and Q &A. If you can’t find what you want, you can submit it and we will respond as soon as possible.

    Change Password#


    1. Move to [Me] - [Wallet Management] - [Change Password].
    2. Input the original password and click Confirm.
    3. Set new password and click Confirm.
    4. Click the [Confirm] button,then the wallet's password is successfully changed.

    Note
    1. Password is your credentials to use and manage the wallet. Servers of ATON does not store your password, make sure you keep it in mind.

    Reset Password#

    When you forget the password of a wallet, you could reimport the wallet using mnemonic/private key/keyStore and set the password again.

    Path for HD wallet: [Me] - [Wallet Management] - [HD Wallet Detail] - [HD Settings] - [Reimport Wallet]

    Path for Normal wallet: [Wallet] - [Wallet Icon] - [Reimport Wallet], or [Me] - [Wallet Management] - [Wallet Detail] - [Reimport Wallet]

    After successfully reimport a wallet, the old information of this wallet would be deleted.

    If you reimport a wallet by PrivateKey or KeyStore, the Mnemonic of this wallet would not be saved in ATON.

    Cold wallet signature chain ID#


    1. Observing the wallet and cold wallet signatures need to keep the chain ID consistent;
    2. ATON 1.1.5 and above are compatible with PlatON Mainnet's new chain ID:210425; the cold wallet has not been upgraded to ATON 1.1.5 and above, and the signature defaults to chain ID:100; if the hot wallet is changed to the latest chain ID:210425, Please upgrade the cold wallet and set a new chain ID at the same time to sign successfully;

    ATON 1.1.0 supports WalletConnect!#


    Support WalletConnect, you can easily complete the connection with the desktop DApp.

    WalletConnect is a service that supports connecting with desktop DApps through code scanning authorization. It is like an inter-city express train that narrows the distance between desktop applications and mobile wallets.

    ATON officially supports the WalletConnect standard [observation of wallets and cold wallets are not currently supported]. Not only can you realize the interaction between mobile DApps and ATON, you can also use ATON scan codes to authorize any desktop DApps that support this standard, and you don’t need to worry about asset security. The connection method is also very simple:
    1. The desktop DApp chooses to use WalletConnect to connect;
    2. Click [Scan] in the upper right corner of the ATON homepage, and select the wallet to complete the authorization;
    3. To confirm the operation, perform [Confirm] in ATON;

    Demo video:
    https://www.youtube.com/watch?v=hnHRR7D0Rak

    ATON’s WalletConnect Dapp demo on GitHub.
    https://github.com/PlatONnetwork/WalletConnect-Example

    HashKey DID#


    HashKey DID is a multi-chain decentralized identity data aggregator, powered by smart contract, NFT and privacy protection decentralised protocol, to provide identity services to Web3 users.
    HashKey Website: www.hashkey.id

    1.Use ATON to quickly register HashKey DID: Click the [HashKey DID Register] button below the wallet address on the ATON home page to register.


    2.Support input DID as the receiving address for transfer, for example, input the registered DID Name: abc123.key.

    - + \ No newline at end of file diff --git a/en/About_PlatON/index.html b/en/About_PlatON/index.html index f343c72ec..c94750b80 100644 --- a/en/About_PlatON/index.html +++ b/en/About_PlatON/index.html @@ -8,13 +8,13 @@ About PlatON | PlatON - + - + \ No newline at end of file diff --git a/en/Become_PlatON_Dev_Verification/index.html b/en/Become_PlatON_Dev_Verification/index.html index 813bd135d..bf244c6df 100644 --- a/en/Become_PlatON_Dev_Verification/index.html +++ b/en/Become_PlatON_Dev_Verification/index.html @@ -8,7 +8,7 @@ Run a dev node | PlatON - + @@ -40,7 +40,7 @@ } } }

    ...]

    If the printed information is empty, it means that the connection node failed. If there is any problem, you can contact the official customer service personnel.

    View the current block height#

    View the block height of the current node by executing the following command in the Platon console.

    platon.blockNumber
    • Execute this command several times, if the block height value increases continuously, then the connection is successful;

    • If it is a new node and the block height is always 0, it means that the node is in the synchronous block and there may be delay. You can use the command:

      platon.syncing
      • If false is printed, the node is not in a synchronous block state.

      • If the following message is printed, the node is in a synchronous block state;

        {  currentBlock: 1412416,  highestBlock: 1416699,  knownStates: 522,  pulledStates: 522,  startingBlock: 1408247}

    Exit console#

    Type Exit to exit the console.

    Upgrade to Validator Node#

    PlatON is a blockchain project that implements democratic governance. Verification nodes are jointly selected by all LAT holders to maintain and develop the PlatON network. The 201 nodes with the most votes will become candidate nodes, from which 43 verification nodes will be randomly selected using VRF to participate in the management of the entire PlatON network.

    This section describes how to operate as a validator node.

    Install PlatON MTool#

    Proceed as follows:

    Step1. Download PlatON MTool toolkit

    cd ~ && wget https://download.platon.network/platon/devnet/mtool/linux/1.1.1/platon_mtool.zip

    Step2. Extract the PlatON MTool toolkit

    (if ! command -v unzip;then sudo apt install unzip; fi;) && unzip platon_mtool.zip && cd platon_mtool

    Step3. Download script

    The script is downloaded to the platon_mtool directory, otherwise the script cannot find the path of the new version of mtool.

    wget https://download.platon.network/platon/scripts/mtool_install.sh

    Step4. Execute command

    chmod +x mtool_install.sh && ./mtool_install.sh
    • When the message Install platon mtool succeed. is displayed, PlatON MTool is successfully installed. If it is not successfully installed, please contact our official customer service to provide feedback on specific issues.

    Step5. Restart the session window

    After installation is complete, you need to restart the session window (do not restart the server, close the session window or SSH tool to reopen the window) for the newly added environment variables to take effect.

    Configure PlatON MTool#

    Generate wallet#

    To participate in the verification node to produce blocks, two wallets must be created. If you want to create a node using an existing wallet, rename the wallet file for the mortgaging account to staking.json, rename the wallet file for the income account to reward.json, and copy the wallet file to the $PLATON_MTOOLDIR/keystore directory to skip this step.

    • Staking wallet: The staking wallet is used to stake tokens. To become a candidate node, you must stake successfully. Run the following command to create a staking wallet:
    platon_mtool account new staking

    Enter the password once and confirm the password again to create a wallet file. After the creation is successful, a staking wallet file staking.json will be generated in the directory $PLATON_MTOOLDIR/keystore.

    • Reward wallet: It is used to collect block rewards and staking rewards. Staking rewards are uniformly distributed to verification nodes, which are distributed by the verification nodes themselves. Run the following command to create a reward wallet
    platon_mtool account new reward

    Enter the password once and confirm the password again to create the wallet file. After the creation is successful, the staking wallet file reward.json will be generated in the directory $PLATON_MTOOLDIR/keystore.

    Update config.properties#

    If you want to run mtool on the development network 2, change the chain ID in the config.properties file to 2206132;

    Configure verification node information#

    Download the script#
    cd $PLATON_MTOOLDIR && wget https://download.platon.network/platon/scripts/validator_conf.sh
    Run the script configuration#
    chmod +x validator_conf.sh && ./validator_conf.sh

    Note:

    • When the prompt shows "Please enter the platon node IP address:", please enter the PlatON node server ip address.
    • When the prompt shows "validator conf success", and when the validator_config.json content printed at the end is normal, it means that the script is executed successfully. If the script is not executed successfully, please contact our official customer service to feedback specific questions.
    Validator node information configuration file description#

    After the configuration of the validator node information is completed, the validator node information file validator_config.json will be generated in the validator subdirectory of the PlatON MTool installation directory. The file content is as follows:

    {    "nodePublicKey": "0abaf3219f454f3d07b6cbcf3c10b6b4ccf605202868e2043b6f5db12b745df0604ef01ef4cb523adc6d9e14b83a76dd09f862e3fe77205d8ac83df707969b47",    "blsPubKey": "82d740cbc0314ec558c5426f88fdad6f07a07f9846c6be4e40cd628b74b9f641ddad01e4c281a2c3693f8ff2a73a410297aff379ee0575127d51de99b97acc9a1b7bc8ca132ef6f0379a3ec9d76a603d623176e49e1c53e87fead36317895099",    "nodeAddress": "http://192.168.120.146",    "nodePort": "16789",    "nodeRpcPort": "6789"}

    Parameter description:

    • nodePublicKey: Node ID, which can be viewed in the nodeid file under the node data directory data
    • blsPubKey: BLS public key, which can be viewed in the blspub file under the node data directory data.
    • nodeAddress: If PlatON MTool and the node are on the same machine or in the same local area network, you can use the intranet IP, otherwise use the public IP whose format is: http://18.238.183.12.
    • nodePort: Node P2P port, default is 16789.
    • nodeRpcPort: rpc port, the default port is 6789.
    Custom PlatScan avatar#

    If users do not need to display their specified avatar on PlatScan, they can skip this step. Otherwise, the following operations are required:

    • Register a keybase account

      Users first need to register on the official website of keybase.io . If they have already registered, they can log on the official website of keybase.

    • Upload specified avatar

      Click the user avatar to upload the avatar.

    • Generate PGP key

      If the user has a PGP key, after a successful login, a series of 16-bit public keys will be displayed next to the user's avatar, such as: EB621920A48D0699; if the user does not already have a PGP key, click add a PGP key next to the user's avatar to generate.

    • Specify the externalId value

      When issuing the staking operation, specify the --external_id parameter to be the PGP key generated in the previous step.

    Note: After the user completes the staking operation, the avatar customized by the user can be displayed on PlatScan.

    Initiate a staking operation#

    If the consensus node deployment is complete and is catching up the blocknumber of Platscan, you can use PlatON MTool for staking operations. Please ensure that the balance of the staking account is sufficient before staking. The minimum threshold for staking is one hundred thousand LAT. If you want to access the development network, please send an email to support@latticex.foundation according to the format requirements. The email requirements are:

    Title: Platon Development Network Token ApplicationName:Contact Information:WeChat ID (or other instant messaging software) :Application amount:USES:Receipt account:Remark:

    Note:

    • Testing LAT has no value and is limited to experiencing test network features.

    • Please keep at least 1 LAT in the staking account, so that the transactions initiated by the subsequent node management have sufficient transaction fees, such as voting for upgrade proposals, and unsecured transactions.

    Excuting command

    platon_mtool staking --config $PLATON_MTOOLDIR/validator/validator_config.json --keystore $PLATON_MTOOLDIR/keystore/staking.json --autoamount 100000 --benefit_address xxx196278ns22j23awdfj9f2d4vz0pedld8a2fzwwj --delegated_reward_rate 5000 --node_name myNode --website www.mywebsite.com --details myNodeDescription --external_id 121412312

    Enter the password of the staking wallet and press Enter. If the following information is displayed, the staking is successful:

    operation finishedtransaction hash:0x89b964d27d0caf1d8bf268f721eb123c4af57aed36187bea90b262f4769eeb9bSUCCESS

    Parameter description:

    • config:node configuration file
    • keystore: staking wallet file
    • amount: staking amount, not less than 100000LAT-staking threshold, no more than 8 decimal places
    • restrictedamount: not less than 100000LAT - staking threshold, no more than 8 decimal points (staking using locked balance)
    • autoamount: Not less than 10000LAT-Priority to use the lock-up balance staking, if the lock-up balance is not enough for the staking deposit, then use free amount staking
    • benefit_address: benefit account to receive block-packing reward and staking reward
    • delegated_reward_rate:Delegated bonus ratio, type is integer range is [0,10000], unit: ten thousand percent, e.g. enter 5000, it means the bonus ratio is 50%
    • nodename:node name,30 bytes(beginning with a letter, including alphabet, number, space, , -, #)
    • website:node website, 30 bytes
    • details:node description, 280 bytes
    • external_id:node Icon ID of keybase.io, or identity authentication ID
    - + \ No newline at end of file diff --git a/en/Become_PlatON_Main_Verification/index.html b/en/Become_PlatON_Main_Verification/index.html index 6cac2bb37..c1745b1a0 100644 --- a/en/Become_PlatON_Main_Verification/index.html +++ b/en/Become_PlatON_Main_Verification/index.html @@ -8,12 +8,12 @@ Run a validator node | PlatON - +
    -

    Run a validator node

    This guide demonstrates how to install the PlatON Node software on Linux.

    System Requirements#

    • Server: Server and backup server running PlatON software (both have a firewall)
    • Memory: 16GB RAM
    • Local storage: 100GB system disk, 200GB data disk (can be expanded online)
    • Processor: 64-bit 4 cores (each core above 2.4 GHz)
    • Bandwidth: 5 MB/sec (can be expanded online)

    Installation Overview#

    It takes three or four steps to install a new node, which depends on the operating system used. The detailed procedures are list below.

    • Installing on Ubuntu (18.04)

    Note: Use the normal user to execute the following command.

    Installing on Ubuntu#

    Install and run NTP service#

    Open a terminal and run the following commands#
    sudo apt-get update &&sudo apt-get install -y gnupg2 curl software-properties-common ntp &&sudo systemctl enable ntp && sudo systemctl start ntp

    Notes:

    NTP service is used for time synchronization, incorrect system time will affect the normal operation of PlatON

    Validate the NTP time synchronization#
    ntpq -4c rv | grep leap_none

    Notes:

    Display associd=0 status=0615 leap_none, sync_ntp, 1 event, clock_sync, where leap_none is red, indicating that the NTP time synchronization is normal.

    Install PlatON#

    Ubuntu 18.04:

    sudo wget https://download.platon.network/platon/platon/1.4.4/platon -O /usr/bin/platonsudo wget https://download.platon.network/platon/platon/1.4.2/platonkey -O /usr/bin/platonkey

    Ubuntu 20.04:

    sudo wget https://download.platon.network/platon/platon/ubuntu20.04/1.4.4/platon -O /usr/bin/platonsudo wget https://download.platon.network/platon/platon/ubuntu20.04/1.4.2/platonkey -O /usr/bin/platonkey

    Ubuntu 22.04:

    sudo wget https://download.platon.network/platon/platon/ubuntu22.04/1.4.4/platon -O /usr/bin/platonsudo wget https://download.platon.network/platon/platon/ubuntu22.04/1.4.2/platonkey -O /usr/bin/platonkey
    sudo chmod +x /usr/bin/platon  /usr/bin/platonkeyplaton version

    After executing the commands above, platon and platonkey binary should be successfully installed in the /usr/bin directory on your system. You can execute corresponding commands in any directory.

    After you execute the platon version, please double check whether your Git Commit value is consistent with the following, if it is consistent, it means that it has been installed correctly:

    PlatON
    +

    Run a validator node

    This guide demonstrates how to install the PlatON Node software on Linux.

    System Requirements#

    • Server: Server and backup server running PlatON software (both have a firewall)
    • Memory: 16GB RAM
    • Local storage: 100GB system disk, 200GB data disk (can be expanded online)
    • Processor: 64-bit 4 cores (each core above 2.4 GHz)
    • Bandwidth: 5 MB/sec (can be expanded online)

    Installation Overview#

    It takes three or four steps to install a new node, which depends on the operating system used. The detailed procedures are list below.

    • Installing on Ubuntu (18.04)

    Note: Use the normal user to execute the following command.

    Installing on Ubuntu#

    Install and run NTP service#

    Open a terminal and run the following commands#
    sudo apt-get update &&sudo apt-get install -y gnupg2 curl software-properties-common ntp &&sudo systemctl enable ntp && sudo systemctl start ntp

    Notes:

    NTP service is used for time synchronization, incorrect system time will affect the normal operation of PlatON

    Validate the NTP time synchronization#
    ntpq -4c rv | grep leap_none

    Notes:

    Display associd=0 status=0615 leap_none, sync_ntp, 1 event, clock_sync, where leap_none is red, indicating that the NTP time synchronization is normal.

    Install PlatON#

    Ubuntu 18.04:

    sudo wget https://download.platon.network/platon/platon/1.4.4/platon -O /usr/bin/platonsudo wget https://download.platon.network/platon/platon/1.4.2/platonkey -O /usr/bin/platonkey

    Ubuntu 20.04:

    sudo wget https://download.platon.network/platon/platon/ubuntu20.04/1.4.4/platon -O /usr/bin/platonsudo wget https://download.platon.network/platon/platon/ubuntu20.04/1.4.2/platonkey -O /usr/bin/platonkey

    Ubuntu 22.04:

    sudo wget https://download.platon.network/platon/platon/ubuntu22.04/1.4.4/platon -O /usr/bin/platonsudo wget https://download.platon.network/platon/platon/ubuntu22.04/1.4.4/platonkey -O /usr/bin/platonkey
    sudo chmod +x /usr/bin/platon  /usr/bin/platonkeyplaton version

    After executing the commands above, platon and platonkey binary should be successfully installed in the /usr/bin directory on your system. You can execute corresponding commands in any directory.

    After you execute the platon version, please double check whether your Git Commit value is consistent with the following, if it is consistent, it means that it has been installed correctly:

    PlatON
    Version: 1.4.4-unstable
    Git Commit: af1168d0b62febf53913cb1ceebaa6413d3ba9b3
    Git Commit Date: 20230719
    @@ -47,7 +47,7 @@ } } }

    ...]

    If the printed information is empty, it means that the connection node failed. If there is any problem, you can contact the official customer service personnel.

    View the current block height#

    View the block height of the current node by executing the following command in the Platon console.

    platon.blockNumber
    • Execute this command several times, if the block height value increases continuously, then the connection is successful;

    • If it is a new node and the block height is always 0, it means that the node is in the synchronous block and there may be delay. You can use the command:

      platon.syncing
      • If false is printed, the node is not in a synchronous block state.

      • If the following message is printed, the node is in a synchronous block state;

        {  currentBlock: 1412416,  highestBlock: 1416699,  knownStates: 522,  pulledStates: 522,  startingBlock: 1408247}

    Exit console#

    Type Exit to exit the console.

    Upgrade to Validator Node#

    PlatON is a blockchain project that implements democratic governance. Verification nodes are jointly selected by all LAT holders to maintain and develop the PlatON network. The 201 nodes with the most votes will become candidate nodes, from which 43 verification nodes will be randomly selected using VRF to participate in the management of the entire PlatON network.

    This section describes how to operate as a validator node.

    Install PlatON MTool#

    Proceed as follows:

    Step1. Download PlatON MTool toolkit

    cd ~ && wget https://download.platon.network/platon/mtool/linux/1.1.1/platon_mtool.zip

    Step2. Extract the PlatON MTool toolkit

    (if ! command -v unzip;then sudo apt install unzip; fi;) && unzip platon_mtool.zip && cd platon_mtool

    Step3. Download script

    The script is downloaded to the platon_mtool directory, otherwise the script cannot find the path of the new version of mtool.

    wget https://download.platon.network/platon/scripts/mtool_install.sh

    Step4. Execute command

    chmod +x mtool_install.sh && ./mtool_install.sh
    • When the message Install platon mtool succeed. is displayed, PlatON MTool is successfully installed. If it is not successfully installed, please contact our official customer service to provide feedback on specific issues.

    Step5. Restart the session window

    After installation is complete, you need to restart the session window (do not restart the server, close the session window or SSH tool to reopen the window) for the newly added environment variables to take effect.

    Configure PlatON MTool#

    Generate wallet#

    To participate in the verification node to produce blocks, two wallets must be created. If you want to create a node using an existing wallet, rename the wallet file for the mortgaging account to staking.json, rename the wallet file for the income account to reward.json, and copy the wallet file to the $PLATON_MTOOLDIR/keystore directory to skip this step.

    • Staking wallet: The staking wallet is used to stake tokens. To become a candidate node, you must stake successfully. Run the following command to create a staking wallet:
    platon_mtool account new staking

    Enter the password once and confirm the password again to create a wallet file. After the creation is successful, a staking wallet file staking.json will be generated in the directory $PLATON_MTOOLDIR/keystore.

    • Reward wallet: It is used to collect block rewards and staking rewards. Staking rewards are uniformly distributed to verification nodes, which are distributed by the verification nodes themselves. Run the following command to create a reward wallet
    platon_mtool account new reward

    Enter the password once and confirm the password again to create the wallet file. After the creation is successful, the staking wallet file reward.json will be generated in the directory $PLATON_MTOOLDIR/keystore.

    Configure verification node information#

    Download the script#
    cd $PLATON_MTOOLDIR && wget https://download.platon.network/platon/scripts/validator_conf.sh
    Run the script configuration#
    chmod +x validator_conf.sh && ./validator_conf.sh

    Note:

    • When the prompt shows "Please enter the platon node IP address:", please enter the PlatON node server ip address.
    • When the prompt shows "validator conf success", and when the validator_config.json content printed at the end is normal, it means that the script is executed successfully. If the script is not executed successfully, please contact our official customer service to feedback specific questions.
    Validator node information configuration file description#

    After the configuration of the validator node information is completed, the validator node information file validator_config.json will be generated in the validator subdirectory of the PlatON MTool installation directory. The file content is as follows:

    {    "nodePublicKey": "0abaf3219f454f3d07b6cbcf3c10b6b4ccf605202868e2043b6f5db12b745df0604ef01ef4cb523adc6d9e14b83a76dd09f862e3fe77205d8ac83df707969b47",    "blsPubKey": "82d740cbc0314ec558c5426f88fdad6f07a07f9846c6be4e40cd628b74b9f641ddad01e4c281a2c3693f8ff2a73a410297aff379ee0575127d51de99b97acc9a1b7bc8ca132ef6f0379a3ec9d76a603d623176e49e1c53e87fead36317895099",    "nodeAddress": "http://192.168.120.146",    "nodePort": "16789",    "nodeRpcPort": "6789"}

    Parameter description:

    • nodePublicKey: Node ID, which can be viewed in the nodeid file under the node data directory data
    • blsPubKey: BLS public key, which can be viewed in the blspub file under the node data directory data.
    • nodeAddress: If PlatON MTool and the node are on the same machine or in the same local area network, you can use the intranet IP, otherwise use the public IP whose format is: http://18.238.183.12.
    • nodePort: Node P2P port, default is 16789.
    • nodeRpcPort: rpc port, the default port is 6789.
    Custom PlatScan avatar#

    If users do not need to display their specified avatar on PlatScan, they can skip this step. Otherwise, the following operations are required:

    • Register a keybase account

      Users first need to register on the official website of keybase.io . If they have already registered, they can log on the official website of keybase.

    • Upload specified avatar

      Click the user avatar to upload the avatar.

    • Generate PGP key

      If the user has a PGP key, after a successful login, a series of 16-bit public keys will be displayed next to the user's avatar, such as: EB621920A48D0699; if the user does not already have a PGP key, click add a PGP key next to the user's avatar to generate.

    • Specify the externalId value

      When issuing the staking operation, specify the --external_id parameter to be the PGP key generated in the previous step.

    Note: After the user completes the staking operation, the avatar customized by the user can be displayed on PlatScan.

    Initiate a staking operation#

    If the consensus node deployment is complete and is catching up the blocknumber of Platscan, you can use PlatON MTool for staking operations. Please ensure that the balance of the staking account is sufficient before staking. The minimum threshold for staking is one hundred thousand LAT.

    Note:

    • Please keep at least 1 LAT in the staking account, so that the transactions initiated by the subsequent node management have sufficient transaction fees, such as voting for upgrade proposals, and unsecured transactions.

    Excuting command

    platon_mtool staking --config $PLATON_MTOOLDIR/validator/validator_config.json --keystore $PLATON_MTOOLDIR/keystore/staking.json --autoamount 100000 --benefit_address xxx196278ns22j23awdfj9f2d4vz0pedld8a2fzwwj --delegated_reward_rate 5000 --node_name myNode --website www.mywebsite.com --details myNodeDescription --external_id 121412312

    Enter the password of the staking wallet and press Enter. If the following information is displayed, the staking is successful:

    operation finishedtransaction hash:0x89b964d27d0caf1d8bf268f721eb123c4af57aed36187bea90b262f4769eeb9bSUCCESS

    Parameter description:

    • config:node configuration file
    • keystore: staking wallet file
    • amount: staking amount, not less than 100000LAT-staking threshold, no more than 8 decimal places
    • restrictedamount: not less than 100000LAT - staking threshold, no more than 8 decimal points (staking using locked balance)
    • autoamount: Not less than 10000LAT-Priority to use the lock-up balance staking, if the lock-up balance is not enough for the staking deposit, then use free amount staking
    • benefit_address: benefit account to receive block-packing reward and staking reward
    • delegated_reward_rate:Delegated bonus ratio, type is integer range is [0,10000], unit: ten thousand percent, e.g. enter 5000, it means the bonus ratio is 50%
    • nodename:node name,30 bytes(beginning with a letter, including alphabet, number, space, , -, #)
    • website:node website, 30 bytes
    • details:node description, 280 bytes
    • external_id:node Icon ID of keybase.io, or identity authentication ID
    - + \ No newline at end of file diff --git a/en/Build_Private_Chain/index.html b/en/Build_Private_Chain/index.html index ab43e9b66..f82a81857 100644 --- a/en/Build_Private_Chain/index.html +++ b/en/Build_Private_Chain/index.html @@ -8,7 +8,7 @@ Private Network | PlatON - + @@ -16,7 +16,7 @@

    Private Network

    This document describes how to quickly deploy a private blockchain.

    • Before building the private chain, you need to compile the binary. You can refer to the Install PlatON document.

    • Take the private chain deployment under Ubuntu as an example, including single node and cluster deployment. The deployment procedures under Windows is similar to Ubuntu.

    If you can't easily connect to an external network, you can choose to build your own private network.PlatON supports single node mode and cluster mode to run private networks.Take the Ubuntu environment as an example and suppose the node data directory is ~/platon-node/data , which the users should modify accordingly:

    Standalone or Single Node Mode#

    • Generate nodekey and blskey files
    mkdir -p ~/platon-node/data && platonkey genkeypair | tee >(grep "PrivateKey" | awk '{print $2}' > ~/platon-node/data/nodekey) >(grep "PublicKey" | awk '{print $3}' > ~/platon-node/data/nodeid) && platonkey genblskeypair | tee >(grep "PrivateKey" | awk '{print $2}' > ~/platon-node/data/blskey) >(grep "PublicKey" | awk '{print $3}' > ~/platon-node/data/blspub)

    Note:

    • nodeid: node public key (ID) file, which stores the public key of the node and is used to identify the node
    • nodekey: node private key file which stores the node's private key and can not be public and need to do a backup.
    • blspub: node BLS public key file which stores the BLS public key of the node, and is used for fast verification of signatures in the consensus protocol.
    • blskey: node BLS private key file which stores the node's BLS private key, cannot be published and need to make a backup.
    • Generate wallet file
    mkdir -p ~/platon-node/data && platon --datadir ~/platon-node/data account new

    Your new account is locked with a password. Please give a password. Do not forget this password.

    Passphrase:

    Repeat passphrase:

    Address: {lat1q25u0zphmre6tz8nt3cuen0ekmas7qfzaalgh4}

    Note:

    The wallet file and password are very important for the generated account address. Losing the wallet file or forgetting the password will cause the token in the account to be lost. Please make a backup of the wallet file and remember the password.

    • Editing the genesis block configuration file platon.json

    Create the genesis block configuration file platon.json in the ~/platon-node directory, then copy the following genesis block configuration file template content to platon.json file, modify your-node-pubkey as the previously generated node public key (nodeid), your-node-blspubkey as node BLS public key (blspub), your-account-address as the wallet address:

    ……    "cbft": {    "initialNodes": [{        "node": "enode://your-node-pubkey@127.0.0.1:16789",        "blsPubKey": "your-node-blspubkey"    }],    ……    "alloc": {      "your-account-address": {            "balance": "999000000000000000000"      }    },……
    • Genesis block configuration file template
    {    "config": {        "chainId": 1021,        "eip155Block": 3,        "cbft": {            "initialNodes": [              {                    "node":"enode://4fcc251cf6bf3ea53a748971a223f5676225ee4380b65c7889a2b491e1551d45fe9fcc19c6af54dcf0d5323b5aa8ee1d919791695082bae1f86dd282dba4150f@127.0.0.1:16790",                    "blsPubKey":"d341a0c485c9ec00cecf7ea16323c547900f6a1bacb9daacb00c2b8bacee631f75d5d31b75814b7f1ae3a4e18b71c617bc2f230daa0c893746ed87b08b2df93ca4ddde2816b3ac410b9980bcc048521562a3b2d00e900fd777d3cf88ce678719"              }            ],            "amount": 10,            "period": 10000,            "validatorMode": "ppos"        },        "genesisVersion": 3328    },    "economicModel":{        "common":{            "maxEpochMinutes":4,            "maxConsensusVals":4,            "additionalCycleTime":28        },        "staking":{            "stakeThreshold": 100000000000000000000000,            "operatingThreshold": 10000000000000000000,            "maxValidators": 30,            "unStakeFreezeDuration": 2,            "rewardPerMaxChangeRange": 500,            "rewardPerChangeInterval": 10        },        "slashing":{           "slashFractionDuplicateSign": 100,           "duplicateSignReportReward": 50,           "maxEvidenceAge":1,           "slashBlocksReward":20,           "zeroProduceCumulativeTime":3,           "zeroProduceNumberThreshold":2,           "zeroProduceFreezeDuration":1        },         "gov": {            "versionProposalVoteDurationSeconds": 160,            "versionProposalSupportRate": 6670,            "textProposalVoteDurationSeconds": 160,            "textProposalVoteRate": 5000,            "textProposalSupportRate": 6670,                      "cancelProposalVoteRate": 5000,            "cancelProposalSupportRate": 6670,            "paramProposalVoteDurationSeconds": 160,            "paramProposalVoteRate": 5000,            "paramProposalSupportRate": 6670              },        "reward":{            "newBlockRate": 50,            "platonFoundationYear": 10,            "increaseIssuanceRatio": 250        },        "innerAcc":{            "platonFundAccount": "lat1q25u0zphmre6tz8nt3cuen0ekmas7qfzaalgh4",            "platonFundBalance": 0,            "cdfAccount": "lat10kvcm60zhmlsfmsjjdqggnsu6nccl5q2v6kqw2",            "cdfBalance": 331811981000000000000000000        }    },    "nonce": "0x0376e56dffd12ab53bb149bda4e0cbce2b6aabe4cccc0df0b5a39e12977a2fcd23",    "timestamp": "0x5bc94a8a",    "extraData": "0xd782070186706c61746f6e86676f312e3131856c696e757800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",    "gasLimit": "4712388",    "alloc": {        "lat1zqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqrdyjj2v": {            "balance": "200000000000000000000000000"        },        "lat1jvm3ljpeyrc6k9c7d6x0sq4dq9m42skueugvxy": {            "balance": "9718188019000000000000000000"        }    },    "number": "0x0",    "gasUsed": "0x0",    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"}
    • Initialize the genesis block
    cd ~/platon-node && platon --datadir ./data init platon.json

    Note:

    The Successfully genesis state prompt appears to indicate that the initialization of the genesis information is complete.

    • Start Node

      In general, the platon process is always in the foreground, so we cannot do anything else, and if we exit the terminal in the middle, the program will exit.Ubuntu can launch programs in nohup mode:

    cd ~/platon-node && nohup platon --identity "platon" --datadir ./data --port 16789 --rpcaddr 127.0.0.1 --rpcport 6789 --rpcapi "db,platon,net,web3,admin,personal" --rpc --nodiscover --nodekey ./data/nodekey --cbft.blskey ./data/blskey & > ./data/platon.log 2>&1 &

    When succeed in excuting the command of nohup, press enter again to ensure that the process does not exit because the terminal is closed by mistake.

    • Check the running status of the node
    platon attach http://localhost:6789 --exec platon.blockNumber

    Execute the above command several times. If the block height keeps growing, the single-node private chain deployment is successful.

    Cluster Deployment#

    PlatON cluster is a private chain with multiple nodes. Here we assume that you can already build a single node. And we will build a network of two nodes on one server.The deployment of more than two nodes is similar.U:

    • Each node instance has a separate data directory (--datadir)
    • Each instance runs on a different port, whether it is a p2p port or an rpc port (--port and --rpcport)
    • Nodes can be interconnected with each other
    • RPC server port is not occupied

    1.Create directory

    Create directories data0 and data1 under the platon-node directory as the data directories for the two nodes. Generate two coinbase accounts for each node.

    mkdir -p ~/platon-node/data0 ~/platon-node/data1

    2. Generate key pair

    Save the nodekey and blskey of the two nodes to 'data0' and 'data1' respectively.

    cd ~/platon-node/data0 && platonkey genkeypair | tee >(grep "PrivateKey" | awk '{print $2}' > ./nodekey) >(grep "PublicKey" | awk '{print $3}' > ./nodeid) && platonkey genblskeypair | tee >(grep "PrivateKey" | awk '{print $2}' > ./blskey) >(grep "PublicKey" | awk '{print $3}' > ./blspub)
     cd ~/platon-node/data1 && platonkey genkeypair | tee >(grep "PrivateKey" | awk '{print $2}' > ./nodekey) >(grep "PublicKey" | awk '{print $3}' > ./nodeid) && platonkey genblskeypair | tee >(grep "PrivateKey" | awk '{print $2}' > ./blskey) >(grep "PublicKey" | awk '{print $3}' > ./blspub)

    3. Editing genesis files

    Modify the genesis block configuration file platon.json.

    Add the node information of the two nodes to the initialNodes array, which is 2 because we are generating a two-node cluster environment.The platon.json file needs to be modified: please replace the contents of the following files 'node0-nodekey ', 'node1-nodekey', 'node0-blspubkey' and 'node1-blspubkey' with the node public key and node BLS public key generated in the previous step.Replace 'your account-address' with the wallet address.

    ……  "cbft": {  "initialNodes": [{        "node": "enode://node0-pubkey@127.0.0.1:16789",        "blsPubKey": "node0-blspubkey"    },{        "node": "enode://node1-pubkey@127.0.0.1:16790",        "blsPubKey": "node1-blspubkey"    }],    ……  "alloc": {    "your-account-address": {        "balance": "999000000000000000000"    },    "1000000000000000000000000000000000000003": {        "balance": "200000000000000000000000000"    }  },……

    4. Initialization and startup

    Initialize genesis block information for node 0 and node 1, respectively:

    platon --datadir ~/platon-node/data0 init platon.json && platon --datadir ~/platon-node/data1 init platon.json

    After successful initialization, start node 0 and node 1 in nohup mode:

    cd ~/platon-node && nohup platon --identity "platon0" --datadir ./data0 --port 16789 --rpcaddr 0.0.0.0 --rpcport 6789 --rpcapi "db,platon,net,web3,admin,personal" --rpc --nodiscover --nodekey ./data0/nodekey --cbft.blskey ./data0/blskey > ./data0/platon.log 2>&1 &
     cd ~/platon-node && nohup platon --identity "platon1" --datadir ./data1 --port 16790 --rpcaddr 0.0.0.0 --rpcport 6790 --rpcapi "db,platon,net,web3,admin,personal" --rpc --nodiscover --nodekey ./data1/nodekey --cbft.blskey ./data1/blskey  > ./data1/platon.log 2>&1 &

    5. Check

    Go to the platon console for any node as described above to see if the node is connected to its counterpart and to see if the cluster has started successfully by seeing if blockNumber continues to grow.

    platon attach http://localhost:6789 --exec platon.blockNumberplaton attach http://localhost:6790 --exec platon.blockNumber

    Do this multiple times and watch if the block height increases.

    - + \ No newline at end of file diff --git a/en/CTool_Manual/index.html b/en/CTool_Manual/index.html index 7d7aba26e..31a3c8ead 100644 --- a/en/CTool_Manual/index.html +++ b/en/CTool_Manual/index.html @@ -8,13 +8,13 @@ CTool tutorial | PlatON - +

    CTool tutorial

    CTool is an integrated tool kit for wallet/contract transactions on PlatON. It allows users to create wallets, transfer funds, and engage in contract transactions safely and conveniently on PlatON. This document introduces the operating environment of the contract tools and how they are used.

    To keep the wallet and private key safe and secure, users need to set up two operating environments:

    • An offline operating environment specifically used to generate regular/HD wallets and to store wallets and private keys, as well as offline signatures of transaction files, including batch operations for staking, transfers, locking, trading contracts, etc.
    • An online operating environment for sending PlatON offline-signed transactions, including batch operations for staking, transfers, locking, trading contracts, etc.

    More specifically, you will go through the process as below:

    1. Install the Offline CTool#

    1.1 Hardware Requirements#

    A computer running Windows 10 without any Internet connection (e.g. WiFi and network cable).

    A USB flash drive that contains CTool.exe (the CTool installation package).

    A USB flash drive used to store and copy data (from/to the offline device/the online device).

    1.2 Install CTool#

    For security concerns, the offline CTool should be installed on an offline device without any Internet connection.

    step1. Download the CTool installation package

    Download path: https://download.platon.network/platon/CTool/CTool.exe.

    step2. Copy CTool.exe to the offline device through a secure storage medium, such as a USB flash drive or hard drive.

    step3. Install CTool on the offline device

    Double-click CTool.exe to install CTool. The default installation directory is C:\CTool. We do not recommend changing this default setting. The popup window notice of “Completing the CTool Setup Wizard” indicates that CTool has been installed, and you can now click on Finish.

    1.3 Config Modification#

    To support the different chain-id of the two versions, we added new config files to adjust the chain-id, as well as the ip and rpc ports. Config file path: C:\CTool\bin\config\config.json. Config file template:

    {    "wallet_file_base_dir": "C:\CTool\keystore\",    "prikey_file_base_dir": "C:\CTool\priatekey\",    "validator_file_base_dir": "C:\CTool\validator\",    "unsigned_transaction_file_dir": "C:\CTool\unsigned_transaction\",    "signed_transaction_file_dir": "C:\CTool\signed_transaction\",    "transaction_result_dir": "C:\CTool\transaction_result\",    "rpc_url":"http://127.0.0.1:6789",    "chain_id": 210425,    "hrp_type": "lat"}

    Fields:

    • wallet_file_base_dir: the directory where regular/HD wallet files are generated;

    • prikey_file_base_dir: the directory where the private keys and QR codes of regular/HD wallets are generated;

    • validator_file_base_dir: the directory for staking node info and config files;

    • unsigned_transaction_file_dir: the directory where unsigned transactions are saved;

    • signed_transaction_file_dir: the directory where signed transaction files are saved;

    • transaction_result_dir: the directory where the results of sending and verifying transactions are saved;

    • rpc_url: the path for calling a node’s rpc interface;

    • chain_id: the ChainID of the current version used by the node (the ChainID of the PlatON mainnet: 210425);

    • hrp_type: the bech32 address format prefix;

      The above config file should be modified as appropriate.

    1.4 File Templates#

    After CTool is installed, you can find the config files relating to the generation of wallets and transactions under C:\CTool\template. Specifically:

    • wallet_file.xlsx, the wallet config file, includes the configuration for generating regular/HD wallets;

      Note:

      • As the wallet and private key files are stored under the Private Key Manager\Wallet Type\Account Usage path, the three fields cannot contain special characters, such as \;
    • transfer_file.xlsx is the transfer transaction config file;

    • restrict_file.xlsx is the locking transaction config file;

    Please modify the config files according to the template format.

    2. Install the Online CTool#

    Refer to the installation of the offline CTool for the specific methods and steps.

    3. Operating Steps#

    • Generate wallet

      For security concerns, we recommend generating wallets on the offline machine;

    • About transactions

      • Generating unsigned files and sending transactions are both operations that ought to be executed on the online device;
      • Transactions are signed on the offline device;

    3.1 Generate Wallet#

    Modify wallet_file.xlsx (the wallet config file) under C:\CTool\template in advance;

    3.1.1 Generate Regular Wallet#

    Execute the command:

    batch_generate_wallet -f C:\CTool\template\wallet_file.xlsx --empty_keystore

    -f: wallet config file path;

    --empty_keystore: the command will empty the files in the wallet file directory and wallet private key directory, which correspond to the directories of wallet_file_base_dir and prikey_file_base_dir, specified in [1.3 Config Modification](#1.3 修改config配). Please use the command as appropriate. The files are not emptied by default.

    After the command is executed, the regular wallet file and the regular wallet private key file will be generated under the configured directory; and the password file password_xxxx.txt corresponding to the wallet file is also generated. In particular, the password file format is $address:$password, in which $address represents the address, and $password corresponds to the plaintext. In addition, the plaintext is randomly generated, for instance:

    lat1jhsv560t2cx7m90fwsu66uhegjtm2w7049s6d9:DWkRAJU8

    3.1.2 Generate HD Wallet#

    Execute the command:

    batch_generate_wallet -f C:\CTool\template\wallet_file.xlsx -t hd

    -f: wallet config file path;

    -t: wallet type (HD indicates that a hierarchical deterministic wallet will be generated);

    After the command is executed, the HD wallet file and the HD wallet private key file will be generated under the configured directory;

    3.2 Batch Transfer#

    Modify transfer_file.xlsx (the transfer transaction config file) under C:\CTool\template in advance;

    • Generate the unsigned transfer transaction file

    Execute the command:

    batch_unsigned_transfer_tx -f C:\CTool\template\transfer_file.xlsx

    Note:

    • -f: the transfer transaction config file;

    After the command is executed, unsigned_transfer_transactions.csv (the unsigned transfer transaction file) will be generated under unsigned_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

    • Generate signed transfer transaction files

    Execute the command:

    batch_signed_transfer_tx -f C:\CTool\unsigned_transaction\unsigned_transfer_transactions.csv -k C:\CTool\keystore

    Note:

    -f: the unsigned transfer transaction file;

    -k: the path of the wallet file for transfer transactions; if the wallet is provided externally, you will need to name the wallet the address and then add the address and password of the wallet file to the current password file password.txt following the format $address:$password.

    After the command is executed, signed_transfer_transaction.csv (the signed transfer transaction file) will be generated under signed_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

    • Send batch transfer transactions

    Execute the command:

    batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_transfer_transaction.csv -t transfer --no-wait

    Note:

    -f: the signed transfer transaction file;

    -t: transaction type, including staking\transfer\restrict;

    -s: sleep time after sending each transaction (measured in milliseconds; default: 100 ms);

    --no-wait: the transaction hash will be directly returned, without waiting for the receipt; --wait: wait for the transaction receipt (it will take longer to send transactions by this means);

    Print information such as the transaction hash and the balance of the from/to address accounts before the transfer (unit: ATP). After all the transactions are sent, transfer_transaction_result.csv (the transaction result file) will be generated under transaction_result_dir, specified in [1.3 Config Modification](#1.3 修改config配).

    Verify transactions:

    • Use the generated result file transfer_transaction_result.csv to verify whether the transaction was successful:
    verify_transaction_result -f C:\CTool\template\transfer_file.xlsx -r C:\CTool\transaction_result\transfer_transaction_result.csv -t transfer

    After verification, check_transfer_result_XXXXXXXXXXX.csv (a test file) will be generated, which records information such as the balance of the from/to address accounts before and after the transfer (unit: ATP);

    Where err_transfer_result_XXXXXXXXXXX.csv is generated, the transaction is abnormal, and you will need to resend the transfer transaction using transfer_file_XXXXXXXXXXX.xlsx.

    3.3 Batch Staking Nodes#

    Modify staking_file.xlsx (the batch staking config file) under C:\CTool\template in advance;

    • Generate the unsigned batch staking file

    Execute the command:

    batch_unsigned_staking_tx -f C:\CTool\template\staking_file.xlsx

    Note:

    • -f: the node staking info file

    After the command is executed, unsigned_staking_transactions.csv (the unsigned staking transaction file) will be generated under unsigned_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

    • Generate the signed staking transaction file

    Execute the command:

    batch_signed_staking_tx -f C:\CTool\unsigned_transaction\unsigned_staking_transactions.csv -k C:\CTool\keystore

    Note:

    -f: the unsigned staking transaction file;

    -k: the path of the wallet file for staking addresses; if the wallet is provided externally, you will need to name the wallet the address and then add the address and password of the wallet file to the current password file password.txt following the format $address:$password.

    After the command is executed, signed_staking_transaction.csv (the signed staking transaction file) will be generated under signed_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

    • Send node staking transactions

    Execute the command:

    batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_staking_transaction.csv -t staking --no-wait

    Note:

    -f: Signed staking transaction file;

    -t: transaction type, including staking\transfer\restrict;

    -s: sleep time after sending each transaction (measured in milliseconds; default: 100 ms);

    --no-wait: the transaction hash will be directly returned, without waiting for the receipt; --wait: wait for the transaction receipt (it will take longer to send transactions by this means);

    Print information such as the transaction hash and the transaction type. After all the transactions are sent, staking_transaction_result.csv (the transaction result file) will be generated under transaction_result_dir, specified in [1.3 Config Modification](#1.3 修改config配).

    Check whether the transactions are on the chain:

    • To check whether all the transactions are on the chain, execute:
    batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_staking_transaction.csv -t staking --check
    • If not all transactions are on the chain, please wait!!! pops up, then not all the transactions are on the chain. In this case, please wait, and do not verify transactions (repeat the above command after a while);
    • If all transactions are on the chain. pops up, then all the transactions are on the chain, and you can verify the transactions to see whether they are successful;

    Verify transactions:

    • Use the generated result file staking_transaction_result.csv to verify whether the transaction was successful:
    verify_transaction_result -f C:\CTool\template\staking_file.xlsx -r C:\CTool\transaction_result\staking_transaction_result.csv -t staking

    After verification, check_staking_result_XXXXXXXXXXX.csv (a test file) will be generated, which records information such as the balance of the staking accounts (unit: LAT) and staking nodes before and after the transfer;

    Where err_staking_result_XXXXXXXXXXX.csv is generated, the transaction is abnormal, and you will need to resend the staking transaction using staking_file_XXXXXXXXXXX.xlsx.

    3.4 Batch Locking#

    • Generate the unsigned locking transaction file

    Execute the command:

    batch_unsigned_restrict_tx -f C:\CTool\template\restrict_file.xlsx

    Note:

    • -f: the batch locking config file

    After the command is executed, unsigned_restrict_transaction.csv (the unsigned locking transaction file) will be generated under unsigned_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

    • Generate the signed locking transaction file

    Execute the command:

    batch_signed_restrict_tx -f C:\CTool\unsigned_transaction\unsigned_restrict_transaction.csv -k C:\CTool\keystore

    Note:

    -f: the unsigned locking transaction file

    -k: the path of the wallet file for locking transactions; if the wallet is provided externally, you will need to name the wallet the address and then add the address and password of the wallet file to the current password file password.txt following the format $address:$password.

    After the command is executed, signed_restrict_transaction.csv (the signed locking transaction file) will be generated under signed_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

    • Send locking transactions

    Execute the command:

    batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_restrict_transaction.csv -t restrict --no-wait

    Note:

    -f: the signed locking transaction file;

    -t: transaction type, including staking\transfer\restrict;

    -s: sleep time after sending each transaction (measured in milliseconds; default: 100 ms);

    --no-wait: the transaction hash will be directly returned, without waiting for the receipt; --wait: wait for the transaction receipt (it will take longer to send transactions by this means);

    Print information such as the transaction hash and the transaction type. After all the transactions are sent, restrict_transaction_result.csv (the statistics file) will be generated.

    Check whether the transactions are on the chain:

    • To check whether all the transactions are on the chain, execute:
    batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_restrict_transaction.csv -t restrict --check
    • If not all transactions are on the chain, please wait!!! pops up, then not all the transactions are on the chain. In this case, please wait, and do not verify transactions (repeat the above command after a while);
    • If all transactions are on the chain. pops up, then all the transactions are on the chain, and you can verify the transactions to see whether they are successful;

    Verify transactions:

    • Use the generated result file restrict_transaction_result.csv to verify whether the transaction was successful:
    verify_transaction_result -f C:\CTool\template\restrict_file.xlsx -r C:\CTool\transaction_result\restrict_transaction_result.csv -t restrict

    After verification, check_restrict_result_XXXXXXXXXXX.csv (a test file) will be generated, which records information such as the free balance of the from account (unit: LAT) before and after the locking;

    Where err_restrict_result_XXXXXXXXXXX.csv is generated, the transaction is abnormal, and you will need to resend the locking transaction using restrict_file_XXXXXXXXXXX.xlsx.

    3.5 General Contract Transaction (Batch)#

    • Acquire the abi and bin files of the contract

    • Copy the abi and bin files to the device where CTool is installed;

    • Generate the config file template for contract transactions

      generate_erc20_file -a $abi_path -c contractName -n func_name -s $save_dir

      Parameters:

      -a: the path of the contract abi file;

      -c: the contract name; if not specified, the default name ERC20 will be used;

      -n: the function name; if not specified, the default name constructor will be used, which indicates contract deployment;

      -s: the directory where the file is saved; if not specified, the file will be saved in the current directory;

      After the command is executed, the config file {$contractName}_{$func_name}_file.xlsx will be generated under $save_dir, specified in [1.3 Config Modification](#1.3 修改config配).

      In particular, “from” indicates the address that initiates the contract transaction, “contract_address” represents the contract address, and param_xxx refers to the parameters of the function;

    • Edit the config file of contract transactions

      Edit {$contractName}_{$func_name}_file.xlsx according to specific needs;

    • Generate the unsigned contract transaction file

      Copy the edited config file of contract transactions to the online device where CTool is installed, and execute:

    batch_unsigned_erc20_tx -f {$contractName}_{$func_name}_file.xlsx -a $abi_path -b $bin_path -c $contractName -d $contract_address -n $func_name

    Parameters:

    -f: the path of the contract transaction file;

    -a: the path of the contract abi file;

    -b: the path of the contract bin file;

    -c: the contract name;

    -d: the erc2.0 contract address; if not specified, the address will be read from the contract_address field in the contract transaction file; when specifying the address, please change $contract_address to an authentic contract address; if contract deployment is required, then no address should be specified;

    -n: the function name; if not specified, the default name transfer will be used, which indicates contract transfer transaction; if contract deployment is required, then the name should be specified as constructor;

    After the command is executed, unsigned_{$contractName}_{$func_name}_transactions.csv (the unsigned contract transaction file) will be generated underunsigned_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

    • Sign contract transactions
    batch_signed_erc20_tx -f C:\CTool\unsigned_transaction\unsigned_{$contractName}_{$func_name}_transactions.csv -k C:\CTool\keystore

    Parameters:

    -f: the unsigned erc2.0 contract transaction file;

    -k: the path of the wallet file for transfer transactions; if the wallet is provided externally, you will need to name the wallet the address and then add the address and password of the wallet file to the current password file password.txt following the format $address:$password;

    After the command is executed, signed_{$contractName}_{$func_name}_transactions.csv (the unsigned contract transaction file) will be generated under signed_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

    • Send the contract transaction
    batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_{$contractName}_{$func_name}_transactions.csv -t erc20 --no-wait

    Parameters:

    -f: the signed contract transaction file;

    -t: transaction type, including staking\transfer\restrict\erc20;

    -s: sleep time after sending each transaction (measured in milliseconds; default: 100 ms);

    --no-wait: the transaction hash will be directly returned, without waiting for the receipt; --wait: wait for the transaction receipt (it will take longer to send transactions by this means). If contract deployment is required, then the result files will need to save the contract address, and this parameter will be needed;

    After the command is executed, {$contractName}_{$func_name}_transaction_result.csv (the signed contract transaction file) will be generated under transaction_result_dir, specified in [1.3 Config Modification](#1.3 修改config配).

    Check whether the transactions are on the chain:

    • To check whether all the transactions are on the chain, execute:
    batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_{$contractName}_{$func_name}_transactions.csv -t erc20 --check
    • If not all transactions are on the chain, please wait!!! pops up, then not all the transactions are on the chain. In this case, please wait, and do not verify transactions (repeat the above command after a while);
    • If all transactions are on the chain. pops up, then all the transactions are on the chain, and you can verify the transactions to see whether they are successful;

    • Verify contract transactions

    Use the generated result file {contractName}_{func_name}_transaction_result.csv to verify whether the transaction was successful:

    verify_transaction_result -f {$contractName}_{$func_name}_file.xlsx -r C:\CTool\transaction_result\{$contractName}_{$func_name}_transaction_result.csv -t erc20

    After verification, check_{$contractName}_{$func_name}_result_XXXXXXXXXXX.csv (a test file) will be generated, which records information such as the verification result of contract transfer transactions;

    Where err_{$contractName}_{$func_name}_result_XXXXXXXXXXX.csv is generated, the transaction is abnormal, and you will need to resend the contract transaction using {$contractName}_{$func_name}_file_XXXXXXXXXXX.xlsx.

    3.6 Batch NFT Transaction#

    3.6.1 Contract Deployment#

    • Generate the unsigned contract deployment file

      Copy the edited config file of contract deployment transactions C:\CTool\template\erc721_constructor_file.xlsx to the online device where CTool is installed, and execute:

    batch_unsigned_erc20_tx -f C:\CTool\template\erc721_constructor_file.xlsx -a C:\CTool\bin\contract\erc721.abi -b C:\CTool\bin\contract\erc721.bin -c ERC721 -n constructor

    Parameters:

    -f: the path of the contract transaction file;

    -a: the path of the NFT contract abi file;

    -b: the path of the NFT contract bin file;

    -c: the NFT contract name;

    -n: the NFT contract interface name; constructor refers to the contract constructor name and is used for contract deployment;

    After the command is executed, unsigned_ERC721_deploy_transactions.csv (the unsigned contract transaction file) will be generated under unsigned_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

    • Sign erc721 contract transactions
    batch_signed_erc20_tx -f C:\CTool\unsigned_transaction\unsigned_ERC721_deploy_transactions.csv -k C:\CTool\keystore

    Parameters:

    -f: the unsigned contract transaction file;

    -k: the path of the wallet file for transfer transactions; if the wallet is provided externally, you will need to name the wallet the address and then add the address and password of the wallet file to the current password file password.txt following the format $address:$password;

    After the command is executed, signed_ERC721_deploy_transactions.csv (the signed contract transaction file) will be generated under signed_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

    • Send contract transactions
    batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_ERC721_deploy_transactions.csv -t erc20 --no-wait

    Parameters:

    -f: the signed contract transaction file;

    -t: transaction type, including staking\transfer\restrict\erc20;

    s: sleep time after sending each transaction (measured in milliseconds; default: 100 ms); this parameter will become invalid when the specified -m is greater than 0;

    --no-wait: the transaction hash will be directly returned, without waiting for the receipt; --wait: wait for the transaction receipt (it will take longer to send transactions by this means). If contract deployment is required, then the result files will need to save the contract address, and this parameter will be needed;

    After the command is executed, ERC721_deploy_transaction_result.csv (the signed contract transaction file) will be generated under transaction_result_dir, specified in [1.3 Config Modification](#1.3 修改config配).

    Check whether the transactions are on the chain:

    • To check whether all the transactions are on the chain, execute:
    batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_ERC721_deploy_transactions.csv -t erc20 --check
    • If not all transactions are on the chain, please wait!!! pops up, then not all the transactions are on the chain. In this case, please wait, and do not verify transactions (repeat the above command after a while);
    • If all transactions are on the chain. pops up, then all the transactions are on the chain, and you can verify the transactions to see whether they are successful;
    • Verify contract transactions

    Use the generated result file ERC721_deploy_transaction_result.csv to verify whether the transaction was successful:

    verify_transaction_result -f C:\CTool\template\erc721_constructor_file.xlsx -r C:\CTool\transaction_result\ERC721_deploy_transaction_result.csv -t erc20

    After verification, check_ERC721_deploy_result_XXXXXXXXXXX.csv (a test file) will be generated, which records the verification result of the erc721 contract transaction;

    Where err_ERC721_deploy_result_XXXXXXXXXXX.csv is generated, the transaction is abnormal, and you will need to resend the erc721 contract transaction using ERC721_deploy_file_XXXXXXXXXXX.xlsx.

    3.6.2 Batch Minting#

    • Generate the unsigned batch minting transaction file

      Copy the edited config file of contract transfer transactions C:\CTool\template\erc721_mint_file.xlsx to the online device where CTool is installed, and execute:

    batch_unsigned_erc20_tx -f C:\CTool\template\erc721_mint_file.xlsx -a C:\CTool\bin\contract\erc721.abi -b C:\CTool\bin\contract\erc721.bin -c ERC721 -n mint -d $contract_address

    Parameters:

    -f: the path of the contract transaction file;

    -a: the path of the NFT contract abi file;

    -b: the path of the NFT contract bin file;

    -c: the NFT contract name;

    -n: the NFT contract interface name; constructor refers to the contract constructor name and is used for contract deployment;

    -d: the contract address; if not specified, the address will be read from the contract_address field in the contract transaction file; when specifying the address, please change $contract_address to an authentic contract address, which can be acquired from contract deployment;

    After the command is executed, unsigned_ERC721_mint_transactions.csv (the unsigned contract transaction file) will be generated under unsigned_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

    • Sign erc721 contract transactions
    batch_signed_erc20_tx -f C:\CTool\unsigned_transaction\unsigned_ERC721_mint_transactions.csv -k C:\CTool\keystore

    Parameters:

    -f: the unsigned contract transaction file;

    -k: the path of the wallet file for transfer transactions; if the wallet is provided externally, you will need to name the wallet the address and then add the address and password of the wallet file to the current password file password.txt following the format $address:$password;

    After the command is executed, signed_ERC721_mint_transactions.csv (the signed contract transaction file) will be generated under signed_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

    • Send erc721 contract transactions
    batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_ERC721_mint_transactions.csv -t erc20 --no-wait

    Parameters:

    -f: the signed contract transaction file;

    -t: transaction type; including staking/transfer/restrict/erc20;

    s: sleep time after sending each transaction (measured in milliseconds; default: 100 ms); this parameter will become invalid when the specified -m is greater than 0;

    --no-wait: the transaction hash will be directly returned, without waiting for the receipt; --wait: wait for the transaction receipt (it will take longer to send transactions by this means);

    After the command is executed, ERC721_mint_transaction_result.csv (the signed contract transaction file) will be generated under transaction_result_dir, specified in [1.3 Config Modification](#1.3 修改config配).

    Check whether the transactions are on the chain:

    • To check whether all the transactions are on the chain, execute:
    batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_ERC721_mint_transactions.csv -t erc20 --check
    • If not all transactions are on the chain, please wait!!! pops up, then not all the transactions are on the chain. In this case, please wait, and do not verify transactions (repeat the above command after a while);
    • If all transactions are on the chain. pops up, then all the transactions are on the chain, and you can verify the transactions to see whether they are successful;
    • Verify contract transactions

    Use the generated result file ERC721_mint_transaction_result.csv to verify whether the transaction was successful:

    verify_transaction_result -f C:\CTool\template\erc721_mint_file.xlsx -r C:\CTool\transaction_result\ERC721_mint_transaction_result.csv -t erc20

    After verification, check_ERC721_mint_result_XXXXXXXXXXX.csv (a test file) will be generated, which records the verification result of the contract minting transaction;

    Where err_ERC721_mint_result_XXXXXXXXXXX.csv is generated, the transaction is abnormal, and you will need to resend the erc721 contract transaction using ERC721_mint_file_XXXXXXXXXXX.xlsx.

    3.6.3 Batch NFT Transactions#

    • Edit the config file of erc721 contract transactions

      Edit C:\CTool\template\erc721_safeTransferFrom_file.xlsx according to specific needs;

      fromcontract_addressparam_fromparam_toparam_tokenId

      Fields:

      • from: the address for sending contract transactions, i.e. the minting address $param_from;
      • contract_address: the erc721 contract address;
      • param_from: the minting address;
      • param_to: the voting/recipient NFT wallet;
      • param_tokenId: the token ID;
    • Generate the unsigned erc721 contract transfer transaction file

      Copy the edited config file of contract transfer transactions C:\CTool\template\erc721_safeTransferFrom_file.xlsx to the online device where CTool is installed, and execute:

    batch_unsigned_erc20_tx -f C:\CTool\template\erc721_safeTransferFrom_file.xlsx -a  C:\CTool\bin\contract\erc721.abi -b C:\CTool\bin\contract\erc721.bin -c erc721 -d $contract_address -n safeTransferFrom 

    Parameters:

    -f: the path of the contract transaction file;

    -a: the path of the erc721 contract abi file;

    -b: the path of the erc721 contract bin file;

    -c: the erc721 contract name;

    -d: the erc721 contract address; if not specified, the address will be read from the contract_address field in the contract transaction file; when specifying the address, please change $contract_address to an authentic contract address;

    -n: the function name; if not specified, the default name transfer will be used, i.e. erc721 contract transfer transaction;

    After the command is executed, unsigned_erc721_safeTransferFrom_transactions.csv (the unsigned contract transaction file) will be generated under unsigned_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

    • Sign erc721 contract transactions
    batch_signed_erc20_tx -f C:\CTool\unsigned_transaction\unsigned_erc721_safeTransferFrom_transactions.csv -k C:\CTool\keystore

    Parameters:

    -f: the unsigned erc2.0 contract transaction file;

    -k: the path of the wallet file for transfer transactions; if the wallet is provided externally, you will need to name the wallet the address and then add the address and password of the wallet file to the current password file password.txt following the format $address:$password;

    After the command is executed, signed_erc721_safeTransferFrom_transactions.csv (the signed contract transaction file) will be generated under signed_transaction_file_dir, specified in [1.3 Config Modification](#1.3 修改config配).

    • Send erc721 contract transactions
    batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_erc721_safeTransferFrom_transactions.csv -t erc20 -n 1 -m 20 --no-wait

    Parameters:

    -f: the signed contract transaction file;

    -t: transaction type, including staking\transfer\restrict\erc20;

    -s: sleep time after sending each transaction (measured in milliseconds; default: 100 ms); this parameter will become invalid when the specified -m is greater than 0;

    -n: the minimum sleep time after sending each transaction (measured in minutes; 0 by default);

    -m: the maximum sleep time after sending each transaction (measured in minutes; 0 by default);

    --no-wait: the transaction hash will be directly returned, without waiting for the receipt; --wait: wait for the transaction receipt (it will take longer to send transactions by this means);

    After the command is executed, erc721_safeTransferFrom_transaction_result.csv (the signed contract transaction file) will be generated under transaction_result_dir, specified in [1.3 Config Modification](#1.3 修改config配).

    Check whether the transactions are on the chain:

    • To check whether all the transactions are on the chain, execute:
    batch_send_raw_transaction -f C:\CTool\signed_transaction\signed_erc721_safeTransferFrom_transactions.csv -t erc20 --check
    • If not all transactions are on the chain, please wait!!! pops up, then not all the transactions are on the chain. In this case, please wait, and do not verify transactions (repeat the above command after a while);
    • If all transactions are on the chain. pops up, then all the transactions are on the chain, and you can verify the transactions to see whether they are successful;
    • Verify contract transactions

    Use the generated result file erc721_safeTransferFrom_transaction_result.csv to verify whether the transaction was successful:

    verify_transaction_result -f C:\CTool\template\erc721_safeTransferFrom_file.xlsx -r C:\CTool\transaction_result\erc721_safeTransferFrom_transaction_result.csv -t erc20

    After verification, check_erc721_safeTransferFrom_result_XXXXXXXXXXX.csv (a test file) will be generated, which records the verification result of the erc721 contract transaction;

    Where err_erc721_safeTransferFrom_result_XXXXXXXXXXX.csv is generated, the transaction is abnormal, and you will need to resend the erc721 contract transaction using erc721_safeTransferFrom_file_XXXXXXXXXXX.xlsx.

    - + \ No newline at end of file diff --git a/en/Command_Line_Tools/index.html b/en/Command_Line_Tools/index.html index 58e623bd9..ebea4810a 100644 --- a/en/Command_Line_Tools/index.html +++ b/en/Command_Line_Tools/index.html @@ -8,7 +8,7 @@ Command line tools | PlatON - + @@ -17,7 +17,7 @@ Copyright 2019 The PlatON-Go Authors USAGE: platon [options] command [command options] [arguments...] VERSION: 1.4.4-unstable COMMANDS: account Manage accounts attach Start an interactive JavaScript environment (connect to node) console Start an interactive JavaScript environment copydb Create a local chain from a target chaindata folder dump Dump a specific block from storage dumpconfig Show configuration values export-preimages Export the preimage database into an RLP stream import-preimages Import the preimage database from an RLP stream init Bootstrap and initialize a new genesis block inspect Inspect the storage size for each type of data in the database js Execute the specified JavaScript files license Display license information removedb Remove blockchain and state databases show-deprecated-flags Show flags that have been deprecated version Print version numbers help, h Shows a list of commands or help for one command PLATON OPTIONS: --config value TOML configuration file --datadir "/home/platon/.platon" Data directory for the databases and keystore --datadir.ancient Data directory for ancient chain segments (default = inside chaindata) --keystore Directory for the keystore (default = inside the datadir) --nousb Disables monitoring for and managing USB hardware wallets --networkid value Network identifier (integer, 1=Frontier, 2=Morden (disused), 3=Ropsten, 4=Rinkeby) (default: 1) --main Mainnet network: pre-configured main network (default network) --testnet Testnet network: pre-configured test network --syncmode "full" Blockchain sync mode ("fast", "full", or "light") --identity value Custom node name --lightkdf Reduce key-derivation RAM & CPU usage at some expense of KDF strength DEVELOPER CHAIN OPTIONS: --dev.period value Block period to use in developer mode (0 = mine only if transaction pending) (default: 0) TRANSACTION POOL OPTIONS: --txpool.locals value Comma separated accounts to treat as locals (no flush, priority inclusion) --txpool.nolocals Disables price exemptions for locally submitted transactions --txpool.journal value Disk journal for local transaction to survive node restarts (default: "transactions.rlp") --txpool.rejournal value Time interval to regenerate the local transaction journal (default: 1h0m0s) --txpool.pricebump value Price bump percentage to replace an already existing transaction (default: 10) --txpool.accountslots value Minimum number of executable transaction slots guaranteed per account (default: 16) --txpool.globalslots value Maximum number of executable transaction slots for all accounts (default: 16384) --txpool.accountqueue value Maximum number of non-executable transaction slots permitted per account (default: 64) --txpool.globalqueue value Maximum number of non-executable transaction slots for all accounts (default: 4096) --txpool.globaltxcount value Maximum number of transactions for package (default: 3000) --txpool.lifetime value Maximum amount of time non-executable transaction are queued (default: 3h0m0s) --txpool.cacheSize value After receiving the specified number of transactions from the remote, move the transactions in the queen to pending (default: 0) PERFORMANCE TUNING OPTIONS: --cache value Megabytes of memory allocated to internal caching (default: 1024) --cache.database value Percentage of cache memory allowance to use for database io (default: 75) --cache.gc value Percentage of cache memory allowance to use for trie pruning (default = 25% full mode, 0% archive mode) (default: 25) --cache.triedb value Megabytes of memory allocated to triedb internal caching (default: 512) ACCOUNT OPTIONS: --unlock value Comma separated list of accounts to unlock --password value Password file to use for non-interactive password input --allow-insecure-unlock Allow insecure account unlocking when account-related RPCs are exposed by http API AND CONSOLE OPTIONS: --ipcdisable Disable the IPC-RPC server --ipcpath Filename for IPC socket/pipe within the datadir (explicit paths escape it) --http Enable the HTTP-RPC server --http.addr value HTTP-RPC server listening interface (default: "localhost") --http.port value HTTP-RPC server listening port (default: 6789) --http.api value API's offered over the HTTP-RPC interface --http.corsdomain value Comma separated list of domains from which to accept cross origin requests (browser enforced) --http.vhosts value Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: "localhost") --ws Enable the WS-RPC server --ws.addr value WS-RPC server listening interface (default: "localhost") --ws.port value WS-RPC server listening port (default: 6790) --ws.api value API's offered over the WS-RPC interface --ws.origins value Origins from which to accept websockets requests --graphql Enable GraphQL on the HTTP-RPC server. Note that GraphQL can only be started if an HTTP server is started as well. --graphql.corsdomain value Comma separated list of domains from which to accept cross origin requests (browser enforced) --graphql.vhosts value Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: "localhost") --rpc.gascap value Sets a cap on gas that can be used in platon_call/estimateGas (default: 0) --jspath loadScript JavaScript root path for loadScript (default: ".") --exec value Execute JavaScript statement --preload value Comma separated list of JavaScript files to preload into the console NETWORKING OPTIONS: --bootnodes value Comma separated enode URLs for P2P discovery bootstrap (set v4+v5 instead for light servers) --bootnodesv4 value Comma separated enode URLs for P2P v4 discovery bootstrap (light server, full nodes) --port value Network listening port (default: 16789) --maxpeers value Maximum number of network peers (network disabled if set to 0) (default: 60) --maxconsensuspeers value Maximum number of network consensus peers (network disabled if set to 0) (default: 40) --maxpendpeers value Maximum number of pending connection attempts (defaults used if set to 0) (default: 0) --nat value NAT port mapping mechanism (any|none|upnp|pmp|extip:<IP>) (default: "any") --nodiscover Disables the peer discovery mechanism (manual peer addition) --netrestrict value Restricts network communication to the given IP networks (CIDR masks) --nodekey value P2P node key file --nodekeyhex value P2P node key as hex (for testing) MINER OPTIONS: --miner.gasprice "1000000000" Minimum gas price for mining a transaction GAS PRICE ORACLE OPTIONS: --gpo.blocks value Number of recent blocks to check for gas prices (default: 20) --gpo.percentile value Suggested gas price is the given percentile of a set of recent transaction gas prices (default: 60) LOGGING AND DEBUGGING OPTIONS: --nocompaction Disables db compaction after import --verbosity value Logging verbosity: 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=detail (default: 3) --vmodule value Per-module verbosity: comma-separated list of <pattern>=<level> (e.g. eth/*=5,p2p=4) --backtrace value Request a stack trace at a specific logging statement (e.g. "block.go:271") --debug Prepends log messages with call-site location (file and line number) --pprof Enable the pprof HTTP server --pprof.addr value pprof HTTP server listening interface (default: "127.0.0.1") --pprof.port value pprof HTTP server listening port (default: 6060) --pprof.memprofilerate value Turn on memory profiling with the given rate (default: 524288) --pprof.blockprofilerate value Turn on block profiling with the given rate (default: 0) --pprof.cpuprofile value Write CPU profile to the given file --trace value Write execution trace to the given file --wasmlog value output wasm contract log to file METRICS AND STATS OPTIONS: --metrics Enable metrics collection and reporting --metrics.expensive Enable expensive metrics collection and reporting --metrics.influxdb Enable metrics export/push to an external InfluxDB database --metrics.influxdb.endpoint value InfluxDB API endpoint to report metrics to (default: "http://localhost:8086") --metrics.influxdb.database value InfluxDB database name to push reported metrics to (default: "alaya") --metrics.influxdb.username value Username to authorize access to the database (default: "test") --metrics.influxdb.password value Password to authorize access to the database (default: "test") --metrics.influxdb.tags value Comma-separated InfluxDB tags (key/values) attached to all measurements (default: "host=localhost") CBFT OPTIONS: --cbft.msg_queue_size value Message queue size (default: 1024) --cbft.wal.disabled Disable the Wal server --cbft.max_ping_latency value Maximum latency of ping (default: 2000) --cbft.blskey value BLS key file --cbft.blacklist_deadline value Blacklist effective time. uint:minute (default: "60") DB OPTIONS: --db.nogc Disables database garbage collection --db.gc_interval value Block interval for garbage collection (default: 86400) --db.gc_timeout value Maximum time for database garbage collection (default: 1m0s) --db.gc_mpt Enables database garbage collection MPT --db.gc_block value Number of cache block states, default 10 (default: 10) --db.validators_history Store the list of validators for each consensus round VM OPTIONS: --vm.wasm_type value The actual implementation type of the wasm instance (default: "wagon") --vm.timeout_duration value The VM execution timeout duration (uint: ms) (default: 0) ALIASED (deprecated) OPTIONS: --rpc Enable the HTTP-RPC server (deprecated, use --http) --rpcaddr value HTTP-RPC server listening interface (deprecated, use --http.addr) (default: "localhost") --rpcport value HTTP-RPC server listening port (deprecated, use --http.port) (default: 6789) --rpccorsdomain value Comma separated list of domains from which to accept cross origin requests (browser enforced) (deprecated, use --http.corsdomain) --rpcvhosts value Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (deprecated, use --http.vhosts) (default: "localhost") --rpcapi value API's offered over the HTTP-RPC interface (deprecated, use --http.api) --wsaddr value WS-RPC server listening interface (deprecated, use --ws.addr) (default: "localhost") --wsport value WS-RPC server listening port (deprecated, use --ws.port) (default: 6790) --wsorigins value Origins from which to accept websockets requests (deprecated, use --ws.origins) --wsapi value API's offered over the WS-RPC interface (deprecated, use --ws.api) --gpoblocks value Number of recent blocks to check for gas prices (deprecated, use --gpo.blocks) (default: 20) --gpopercentile value Suggested gas price is the given percentile of a set of recent transaction gas prices (deprecated, use --gpo.percentile) (default: 60) --pprofport value pprof HTTP server listening port (deprecated, use --pprof.port) (default: 6060) --pprofaddr value pprof HTTP server listening interface (deprecated, use --pprof.addr) (default: "127.0.0.1") --memprofilerate value Turn on memory profiling with the given rate (deprecated, use --pprof.memprofilerate) (default: 524288) --blockprofilerate value Turn on block profiling with the given rate (deprecated, use --pprof.blockprofilerate) (default: 0) --cpuprofile value Write CPU profile to the given file (deprecated, use --pprof.cpuprofile) MISC OPTIONS: --help, -h show help COPYRIGHT: Copyright 2019 The PlatON-Go Authors

    Common rpc commands#

    • Description
      • The rpc port is changed according to the actual startup command and the default is 6789

    admin#

    • View the data directory of the current node

      platon attach http://localhost:6789 -exec admin.datadir
    • View the ChainID of the current node

      platon attach http://localhost:6789 -exec admin.nodeInfo.protocols.platon.config.chainId
    • View the id of the current node

      platon attach http://localhost:6789 -exec admin.nodeInfo.id
    • View the blsPubKey of the current node

      platon attach http://localhost:6789 -exec admin.nodeInfo.blsPubKey
    • View the p2p port number of the current node

      platon attach http://localhost:6789 -exec admin.nodeInfo.ports.listener
    • View the connection information of peers of the current node

      platon attach http://localhost:6789 -exec admin.peers
    • View the genesis block hash of the current node

      platon attach http://localhost:6789 -exec admin.nodeInfo.protocols.platon.genesis
    • View the maximum number of blocks ($amount) of a single node in each consensus round of cbft consensus

      platon attach http://localhost:6789 -exec admin.nodeInfo.protocols.platon.config.cbft.amount
    • View the time window of block generation by a single node in each consensus round of cbft consensus ($period, unit: ms)

      platon attach http://localhost:6789 -exec admin.nodeInfo.protocols.platon.config.cbft.period

      Blocking time interval = period / 1000 / amount

    • Get the binary version number and signature information

      platon attach http://localhost:6789 -exec 'admin.getProgramVersion()'
    • Obtain zero- knowledge proof information (use the node's private key to prove whether the certificate issued by the interface is correct and used for node pledge)

      platon attach http://localhost:6789 -exec 'admin.getSchnorrNIZKProve()'
    • View the type of virtual machine used at the bottom (EVM / WASM)

      platon attach http://localhost:6789 -exec admin.nodeInfo.protocols.platon.config.interpreter

    platon#

    • View all wallet addresses under the current node

      platon attach http://localhost:6789 -exec platon.accounts
    • View the block height of the current node

      platon attach http://localhost:6789 -exec platon.blockNumber
    • Check the balance of the specified account ($account is the account address)

      platon attach http://localhost:6789 -exec 'platon.getBalance("$account")'
    • Query the number of transactions in the specified block ($blockNumber is the block height or block hash of the specified block)

      platon attach http://localhost:6789 -exec 'platon.getBlockTransactionCount($blockNumber)'
    • Query transaction information ($txHash is transaction hash)

      platon attach http://localhost:6789 -exec 'platon.getTransaction("$txHash")'
    • Query transaction receipt ($txHash is transaction hash)

      platon attach http://localhost:6789 -exec 'platon.getTransactionReceipt("$txHash")'
    • Query the number of transactions in the specified account (parameter $address is the account address, used to specify the nonce of the transaction when sending the transaction)

      platon attach http://localhost:6789 -exec 'platon.getTransactionCount("$address")'
    • Query the pending transaction of the current node

      platon attach http://localhost:6789 -exec platon.pendingTransactions
    • View the default gasPrice of the current node (unit: von)

      platon attach http://localhost:6789 -exec platon.gasPrice
    • Estimate the gas of the transaction (parameter $transaction is the transaction details, unit: von)

      platon attach http://localhost:6789 -exec 'platon.estimateGas($transaction)'

      For example:

      platon attach http://localhost:6789 -exec 'platon.estimateGas({from:"lax1fyeszufxwxk62p46djncj86rd553skpptsj8v6",to:"lax1zhllhqu72wz66cdwly8983xhla2sann75j2ec2",value:"0x10000000000000",data:"0x11",gas:"0x88888",gasprice:"0x333333",nonce:"11"})'
    • View the p2p protocol number of the underlying version of the current node

      platon attach http://localhost:6789 -exec 'web3.toDecimal(platon.protocolVersion)'
    • See if the current node is in sync

      platon attach http://localhost:6789 -exec platon.syncing
    • Get details of specified block

      platon attach http://localhost:6789 -exec 'platon.getBlock($blockNumber)'

    personal#

    • Generate wallet (parameter is wallet password)

      platon attach http://localhost:6789 -exec 'personal.newAccount("88888888")'
    • Import private key to generate wallet

      platon attach http://localhost:6789 -exec 'personal.importRawKey($privateKey, $password)'

      Parameters:

      • privateKey: private key, remove the leading 0x
      • password: wallet password

      Back to:

      • Wallet address

      For example:

      platon attach http://localhost:6789 -exec 'personal.importRawKey ("842d943dbb50a8d3fe63af2f82fda3d8f0ca817fe8d47e61698142bac7c24212", "88888888")'
    • View account address

      platon attach http://localhost:6789 -exec 'personal.listAccounts'
    • View local wallet information, including wallet address, wallet file path and wallet status

      platon attach http://localhost:6789 -exec 'personal.listWallets'
    • Lock account

      platon attach http://localhost:6789 -exec 'personal.lockAccount(platon.accounts[0])'
    • Unlock account

      platon attach http://localhost:6789 -exec 'personal.unlockAccount(platon.accounts[0], "88888888", 24*3600)'

      Parameters:

      • Account address
      • Wallet password
      • Unlock time in seconds
    • Send unsigned transactions

      platon attach http://localhost:6789 -exec 'personal.sendTransaction({from: platon.accounts[2], to: platon.accounts[0], value:web3.toVon("0.1","lat"), nonce: platon.getTransactionCount(platon.accounts[2])}, "88888888") '

    net#

    • View the networkid of the current node

      platon attach http://localhost:6789 -exec net.version
    • Check whether the p2p port of the current node is in the listening state

      platon attach http://localhost:6789 -exec net.listening
    • View the number of peer connections of the current node

      platon attach http://localhost:6789 -exec net.peerCount

    debug#

    • Query the economic model configuration parameters of the current node

      platon attach http://localhost:6789 -exec 'debug.economicConfig()'
    • Set log level

      platon attach http://localhost:6789 -exec 'debug.verbosity(4)'

      Log level description:

      0: CRIT

      1: ERROR

      2: WARN

      3: INFO

      4: DEBUG

      5: TRACE

    - + \ No newline at end of file diff --git a/en/DApp_integration_with_WalletConnect_for_ATON/index.html b/en/DApp_integration_with_WalletConnect_for_ATON/index.html index e95be13de..4e759a260 100644 --- a/en/DApp_integration_with_WalletConnect_for_ATON/index.html +++ b/en/DApp_integration_with_WalletConnect_for_ATON/index.html @@ -8,7 +8,7 @@ DApp integration with WalletConnect for ATON | PlatON - + @@ -35,7 +35,7 @@ // send transaction const result = await connector.sendTransaction(tx); console.log("connector.sendTransaction result txHash: ", result);};

    Display of transaction results

    Obtain txHash, which provides browser links and display of transaction details in the DApp

    // format displayed resultconst formattedResult = {  method: "eth_sendTransaction",  txHash: result,  from: address,  to: address,  value: "0 ETH",};
     // display resultthis.setState({  connector,  result: formattedResult || null,});

    Confirm Transaction

    Transaction Success@3x

    Conclusion#

    After the three steps are completed, users of your DApp will be able to connect with ATON in the DApp and send signature requests through sendTransaction provided by WalletConnect.

    Video Demo#

    - + \ No newline at end of file diff --git a/en/DApp_migrate/index.html b/en/DApp_migrate/index.html index e14a31a9d..e3775bdcd 100644 --- a/en/DApp_migrate/index.html +++ b/en/DApp_migrate/index.html @@ -8,13 +8,13 @@ DApp Quick Migration Tutorial | PlatON - +
    - + \ No newline at end of file diff --git a/en/EVM_Smart_Contract/index.html b/en/EVM_Smart_Contract/index.html index 2a4c158e5..e43ec2925 100644 --- a/en/EVM_Smart_Contract/index.html +++ b/en/EVM_Smart_Contract/index.html @@ -8,7 +8,7 @@ EVM Smart Contract | PlatON - + @@ -29,7 +29,7 @@ function writeMap(uint _map, uint _key, uint _value) public { array[_map][_key] = _value; } function readMap(uint _map, uint _key) public view returns (uint) { return array[_map][_key]; } function eraseMaps() public { delete array; }}

    Consider the example above and the following sequence of calls: allocate(10), writeMap(4, 128, 256). At this point, calling readMap(4, 128) returns 256. If we call eraseMaps, the length of state variable array is zeroed, but since its mapping elements cannot be zeroed, their information stays alive in the contract’s storage. After deleting array, calling allocate(5) allows us to access array[4] again, and calling readMap(4, 128) returns 256 even without another call to writeMap.

    If your mapping information must be deleted, consider using a library similar to iterable mapping, which allows you to traverse the keys and delete their values in the appropriate mapping.

    Permission Control Error#

    In smart contracts, contract developers usually set some permission for the contract owner, but if the developer negligently writes wrong function permissions, it may lead to serious consequences such as transfer of the owner.

    function initContract() public {    owner = msg.reader;}

    The above code function needs to be set onlyOwner.

    Reasonable permissions should be set for different functions in the contract.

    Address Initialization Problem#

    In EVM, all address-related initializations are given an initial value of 0.

    If an address variable is equal to 0, the variable may not be initialized or an unknown error may occur.

    If the developer initializes an address variable in the code but does not assign an initial value, or the user does not assign the address variable by mistake when initiating an operation, but this variable needs to be handled in the following code, it is possible Cause unnecessary security risks.

    For functions that involve addresses, it is recommended to add require (_to! = Address (0)) verification to effectively avoid unnecessary losses caused by user misoperations or unknown errors.

    Transaction Order Dependent#

    Since transactions are first stored in mempool in a short period of time, it is possible to know what action will take place before miners package them into blocks. This is troublesome for a decentralized market, because the transaction information of the token can be viewed, and the transaction order can be changed before it is packaged into a block. Avoiding this is difficult because it comes down to the specific contract itself.

    For example, in the market, it is best to implement batch auctions (this also prevents high frequency trading issues). Another method is using a pre-commit scheme.

    Minor Details#

    Types that do not occupy the full 32 bytes might contain “dirty higher order bits”. This is especially important if you access msg.data - it poses a malleability risk: You can craft transactions that call a function f(uint8 x) with a raw byte argument of 0xff000001 and with 0x00000001. Both are fed to the contract and both will look like the number 1 as far as x is concerned, but msg.data will be different, so if you use keccak256(msg.data) for anything, you will get different results.

    Security Recommendations#

    Take Warnings Seriously#

    If the compiler warns you about something, you should better change it. Even if you do not think that this particular warning has security implications, there might be another issue buried beneath it. Any compiler warning we issue can be silenced by slight changes to the code.

    Always use the latest version of the compiler to be notified about all recently introduced warnings.

    Restrict the Amount of Ether#

    Restrict the amount of Ether (or other tokens) that can be stored in a smart contract. If your source code, the compiler or the platform has a bug, these funds may be lost. If you want to limit your loss, limit the amount of Ether.

    Simple and Modular#

    Keep your contracts small and easily understandable. Single out unrelated functionality in other contracts or into libraries. General recommendations about source code quality of course apply: Limit the amount of local variables, the length of functions and so on. Document your functions so that others can see what your intention was and whether it is different than what the code does.

    Use the Checks-Effects-Interactions Pattern#

    Most functions will first perform some checks (who called the function, are the arguments in range, did they send enough Ether, does the person have tokens, etc.). These checks should be done first.

    As the second step, if all checks passed, effects to the state variables of the current contract should be made. Interaction with other contracts should be the very last step in any function.

    Early contracts delayed some effects and waited for external function calls to return in a non-error state. This is often a serious mistake because of the re-entrancy problem explained above.

    Note that, also, calls to known contracts might in turn cause calls to unknown contracts, so it is probably better to just always apply this pattern.

    Include a Fail-Safe Mode#

    While making your system fully decentralised will remove any intermediary, it might be a good idea, especially for new code, to include some kind of fail-safe mechanism:

    You can add a function in your smart contract that performs some self-checks like “Has any Ether leaked?”, “Is the sum of the tokens equal to the balance of the contract?” or similar things. Keep in mind that you cannot use too much gas for that, so help through off-chain computations might be needed there.

    If the self-check fails, the contract automatically switches into some kind of “failsafe” mode, which, for example, disables most of the features, hands over control to a fixed and trusted third party or just converts the contract into a simple “give me back my money” contract.

    Check Function Permissions Carefully#

    Reasonable permissions should be set for different functions in the contract.

    Check whether the functions in the contract use public and private keywords for visibility modification. Check whether the contract is correctly defined and uses modifiers to restrict access to key functions to avoid problems caused by unauthorized use.

    function initContract() public OnlyOwner {    owner = msg.reader;}

    Ask for Peer Review#

    The more people examine a piece of code, the more issues are found. Asking people to review your code also helps as a cross-check to find out whether your code is easy to understand - a very important criterion for good smart contracts.

    Other#

    1. More Security Recommendations
    2. Contract Best Practices

    Security Tools#

    1. Ethereum formal verification tool SMT checker .
    2. Formal verification tools: offline VS Code plugin,and Online version .
    3. Remix integrated security scan plugin: MythX

    Third Party Audit#

    You can find a professional third-party audit company for security audits, such as:slow mist


    - + \ No newline at end of file diff --git a/en/Economic_Model/index.html b/en/Economic_Model/index.html index 494607cb5..3b8ff01fd 100644 --- a/en/Economic_Model/index.html +++ b/en/Economic_Model/index.html @@ -8,7 +8,7 @@ Economic model | PlatON - + @@ -18,7 +18,7 @@ -System security maintenance -Client Support Services -Pledge locks liquidity costs

    Source of Incentive Fund#

    Based on the PoS consensus public chain, in order to promote the maintenance of distributed ledgers by miners, to ensure that there are enough tokens to carry future strong and rich distributed ecological applications, and to promote user pledge to provide chain security, the general incentive funds for PoS blockchains are From inflation.

    The sources of PlatON network incentives include the following:

    • Additional system

      Each additional issuance cycle is fixed at 80% (equivalent to 2% of the previous year's total issuance) transferred to the reward pool. Additional issues are the main source of incentive funds.

    • LatticeX Foundation subsidy

      In the first 10 years (additional period), in order to encourage and attract more nodes to join, the fund is subsidized to the reward pool by means of lock-up issuance, thereby increasing the profitability of the node in the first 10 years (additional period).

    • LatticeX Foundation validator revenue

      In order to maintain the stable operation of the main network, the LatticeX Foundation sponsored the pledge and maintained 7 validator nodes. The proceeds from the validator node sponsored by the LatticeX Foundation will all enter the reward pool as an incentive fund for community validator nodes.

    • Slash cuts fines

      The validator node was penalized by the system due to the low block generation rate, and the penalties were all entered into the reward pool for distribution in the next year's additional issuance cycle.

    Incentive rules#

    reward_distribution

    In PlatON, there are three types of incentive methods for the validator:

    • Block reward

      All validator nodes participating in consensus block production will receive block production rewards for the blocks produced. Block rewards are issued in real time based on the blocks that are produced. 50% of the reward pool is used for block rewards. The amount of block rewards for a single block is determined based on the balance of the reward pool at the beginning of each additional period, and the entire additional period remains unchanged. The reward for a single block in the $n$ additional period is as follows:

      $$B(n)=\frac{R_{v\times (n-1)}\times 50 \%}{v}$$

      among them,

      $R_{v\times (n-1)}$: The balance of the bonus pool at the beginning of the n-th year additional period (block $v\times (n-1)$).

      $v$ : The number of blocks in the system's additional period is a non-fixed parameter. The total number of blocks generated in one year is calculated based on the average interval of block generation.

    • Transaction Fees

      The validator node responsible for the production block can obtain the commission for all transactions in the corresponding block. Transaction fees are issued in real time with the block.

    • Staking reward

      All candidate validator nodes in each epoch can get Staking rewards as the return of the pledge lock. 50% of the reward pool is used for Staking rewards. Staking rewards in a single epoch are determined at the beginning of each additional period based on the balance of the reward pool at that time, and the entire additional period is unchanged. Staking rewards are evenly distributed to the candidate nodes at the time (including the validator node of the current consensus round) in the settlement block.

      Staking rewards for each epoch of the current issuance period:

      $$S(n)=\frac{c\times R_{v\times (n-1)}\times 50 \%}{v}$$

      On the settlement block, assuming that the number of candidate nodes in the current epoch is $m$, the Staking reward for each candidate node in the current epoch:

      $$I(n)=\frac{S(n)}{m}$$

      among them,

      $R_{v\times (n-1)}$: The balance of the reward pool at the beginning of the n-th additional period (block $v\times (n-1)$ ).

      $v$ : The number of blocks in the system's additional period is a non-fixed parameter. The total number of blocks generated in one year is calculated based on the average interval of block generation.

      $c$: Number of blocks in the system epoch, fixed at 10750 blocks

    Punishment mechanism#

    Unlike PoW public chains, PoS public chains generally do not rely on computing power to maintain system security. PoS public chains require participating nodes to pledge a certain amount of tokens as a guarantee. When a node behaves badly, the system will reduce the node's The pledged deposit is punished to increase the cost of evil, Lockup and regulate the behavior of nodes, and ensure the stability and security of the system. PlatON also introduced corresponding punishment mechanisms.

    Punished behavior#

    In PlatON, any node that attempts to fork the blockchain and stay offline for a long time may be penalized by Slash.

    • DuplicateVote\DuplicatePrepare

      Whether it is a soft fork or a hard fork, a collective decision needs to be made through voting. Any attempt by a node to attempt a fork privately will be punished by Slash.

      DuplicatePrepare, Refers to the situation where nodes in the same view have double blocks (or multiple blocks) at the same block height.

      DuplicateVote It means that in the same view, nodes have multiple signatures on the same block with different heights.

    • Long offline

      Nodes can't connect for a long time, can't produce blocks or verify signatures normally, nodes will be punished by Slash.

    PlatON's way of punishment#

    PlatON currently supports the following penalties:

    1. Deduct node own pledge

      A certain percentage or fixed amount of LAT is deducted from the node's own pledge (locked own pledge) as a penalty. After the deduction, if the node's remaining own pledge (including the locked and unlocked pledges in the hesitation period) does not meet the pledge threshold of the alternative validator candidate, the alternative validator candidate will immediately lose the qualification to participate in the validator and the system automatically revoke its pledge. The deduction rules are as follows:

      • Deduction of the node's own pledge deposit will only deduct the node's own pledge LAT which has been locked in the current epoch. Unlocked pledge LAT during the hesitation period will not participate in the deduction.

      • If a node pledges both the account balance and the locked balance of LAT, it will preferentially deduct the LAT pledged using the account balance, and then deduct the LAT of the locked balance pledge.

      • When deducting the LAT pledged from the account lock balance, the remaining unlocked amount of the account in the lock contract and the participating pledge amount are deducted correspondingly.

    2. Force exit alternative validator candidate

      Alternative validator candidate are passively withdrawn, they no longer participate in the election of alternative validators and validators, and are immediately revoked for pledges, withdrawing from the alternative validator candidate list. The LAT entrusted to this node is all invalidated and unlocked. The LAT entrusted to dismiss requires the user to apply for redemption by itself (too many principals, automatic return will greatly affect system performance). The node's remaining own pledge deposit will continue to be locked for 168 epochs and will automatically be returned to the node staking account.

      remove_from_candidate_validator_list
      • Nodes that are forced to withdraw do not participate in the allocation of Staking rewards for settlement blocks in this epoch.

      • When the pledge is revoked, the pledged LAT that is not locked in the hesitation period does not need to continue to lock for 168 epochs and will be returned immediately.

      • Upon cancellation of the pledge at the node, the principal is required to redeem the LAT that has been entrusted to node by oneself (see the section on entrusted redemption for details)..

      • A node that is forcibly withdrawn can only use the node ID to re-pledge after the lock-up period ends and the node pledged LAT returns.

    • When a node that is forcibly withdrawn uses the node ID to re-pledge, the previously entrusted LAT that has expired but has not been redeemed will not be credited to the re-pledged validator node (alternative node candidate).

    • When a forced withdrawal node participates in the voting of a proposal and the voting deadline of the proposal is greater than 168 settlement cycles, the unlocking block is postponed to the voting deadline block.

    • If the validator node that is punished and forced to withdraw is participating in the current consensus round, the validator node can continue to complete the block generation and validator work of this consensus round. If the node is punished after 410 blocks in the consensus round, if the next consensus round confirms that the validator node has the node, the node can continue to participate in the block generation and validator of the next consensus round.

    1. Restrict node qualification

      The node is temporarily disqualified as a verification node and locked for 56 settlement cycles. During the lock-up period, it is not eligible to become a verification node to participate in block production, and cannot participate in governance voting, and there is no staking reward.

    PlatON's punishment mechanism#

    DuplicatePrepare\DuplicateVote-Manual reporting and systematic penalties#

    In PlatON, DuplicateVote means signing the same block height and different hash in the same view, which is manifested in CBFT, namely DuplicateVote ViewChangeVote and DuplicateVote PrepareVote. DuplicatePrepare indicates that the block node has two different hash blocks for the same height in the same view. In essence, the block is also verified by the signature of the block, so the node DuplicateVote and DuplicatePrepare in PlatON are unified as DuplicateVote.

    The node has a DuplicateVote behavior. If it is found by any user, it can initiate a DuplicateVote report transaction, submit the type and evidence of the DuplicateVote (the evidence can be obtained through the query double-out, DuplicateVote evidence interface provided) to the system slashing contract, and slashing After the contract validator is confirmed to be true, the system will reduce 10‱ of the reported node's own pledge as a penalty, and at the same time, the reported node will forcibly withdraw from the alternative validator candidate and revoke the pledge. 50% of the fine is given to the whistleblower, and 50% is put into the reward pool for block production and staking rewards in the second year.

    • A DuplicateVote report has a validity period, and reports that are more than 27 epochs are invalid.

      report_validity_period
    • Reporting follows the principle of chronological order, and only the user who reports first will receive a penalty. Subsequent identical reports are invalid reports. Therefore, it is best to check whether you have been reported to have DuplicateVote before reporting.

    • A duplicateVote report only supports reporting of a duplicateVote behavior of a validating node. Multiple duplicateVote reports require multiple submissions.

    • In order to prevent misjudgment or artificially forged report evidence, the slashing contract follows the following validator rules:

      • Reporting whether the evidence is within the validity period or not is an invalid report.
      • Whether the signature of the report evidence is the signature of the validator node; otherwise, the report is invalid.
      • Whether the reported duplicatePrepare block is the block produced by the reported node, otherwise it is an invalid report.
      • Whether the reported duplicateVote voting block is the block responsible for validator by the reporting node, otherwise it is an invalid report.
      • Whether the reported duplicateVote block is a future block or not is an invalid report.
    Zero block-the system automatically judges and punishes#

    PlatON judges whether a node is online and whether the node's software, hardware, and network environment meets the requirements based on the level of block production. In the 410 block of each consensus round (430 blocks in one consensus round), the block rate of the last consensus round validator node is judged.

    low_block_rate_verification

    The validator node must meet the following two conditions and will be judged by the system as zero block:

    • A certain consensus cycle is selected as a verification node, no block is produced or all blocks produced have not been confirmed by other verification nodes
    • No blocks were produced in the following 20 consensus cycles (about 2 and a half hours)

    The node will be punished by the system after producing zero blocks, deducted the equivalent of 2500 blocks of block rewards, and restricted node qualifications. If the pledge deposit after deduction is less than 100,000 LAT, the candidate node candidate will be forced to withdraw.

    Transaction Fees#

    Every application running on PlatON consumes certain resources (including computing power, bandwidth, storage, data, etc.). In order to achieve fair and reasonable use of resources and avoid misuse of resources, the Gas mechanism of Ethereum is used to achieve reasonable scheduling and validity validator of resources.

    Gas fee mechanism#

    To prevent the exponential explosion and infinite loop of the code, PlatON uses the Gas mechanism of Ethereum to measure the resources (memory, CPU, bandwidth) consumed by each transaction execution. When submitting transactions, users can set GasPrice, which is the price of each Gas, in order to control the transaction fee for submitting transactions.

    Gas Expense Description#

    In addition to ordinary transfer transactions, PlatON also supports the following built-in contract transactions related to economics and governance. We adopt a custom fixed gas consumption according to the interface plus a customizable floating gas consumption based on input parameters.

    Transfer transaction#

    The transfer transaction is fixed at 21000Gas.

    Built-in transactions#

    Gas calculation rules for built-in transactions are:

    Built-in transaction gas consumption = transaction fixed gas consumption + transaction dynamic gas consumption rules + (number of non-zero value bytes in data * 68) + (number of zero value bytes in data * 4)
    • Staking transactions
    Interface nameTransaction fixed gas consumptionTrading dynamic gas consumption rules
    create staking59000N
    edit staking39000N
    increase staking47000N
    Revoke staking47000N
    Initiate a delegate43000N
    Underweight/Revoke deleagte35000N
    • Governance transactions

    To limit the malicious submission of text proposals, parameter proposals, upgrade proposals, and cancel proposals, increase the minimum GasPrice limit.

    Interface nameTransaction fixed gas consumptionTrading dynamic gas consumption rulesMinimum GasPrice(GVon)
    Submit text proposal350000N1500000
    Submit parameter proposal530000N2000000
    Submit upgrade proposal480000N2100000
    Cancel proposal530000N3000000
    Vote on proposal32000NN
    Version declaration33000NN
    • Slashing transactions
    Interface nameTransaction fixed gas consumptionTrading dynamic gas consumption rules
    Report duplicate signatures63000N
    • Lockup transactions
    Name of TradeTransaction fixed gas consumptionTrading dynamic gas consumption rules
    Create a Lockup plan68000Unlock times of this lockup×21000
    • Receive delgate income
    Name of TradeTransaction fixed gas consumptionTrading dynamic gas consumption rules
    Receive delegate award8000Number of delegated nodes(nodeid+stakingNum) x 1000 + Number of epoch without delegated reward x 100
    - + \ No newline at end of file diff --git a/en/Explorer_API/index.html b/en/Explorer_API/index.html index 41607dcd4..271517d39 100644 --- a/en/Explorer_API/index.html +++ b/en/Explorer_API/index.html @@ -8,7 +8,7 @@ Explorer API | PlatON - + @@ -18,7 +18,7 @@ body={'pageNo': 0, 'pageSize': 0, 'queryStatus': 'all'}

  • Address details

    • Use API: //platon-api/address/details

    • Detailed format of request:

      POST https://api.plateye.com/platon-api/address/details Content-Type: application/json body={'address': 'atp14zljtap2lvntcurr4v3rzysyt30t3ww3fnpdvw'}

  • FAQ#

    • Q: Why does it prompt that "Access-Control-Allow-Origin" is missing in the CORS header when the VUE project requests the interface?
      • A: It is caused by cross-domain requests. ProxyTable needs to be configured. If the request address starts with /api or /XXapi, target will be automatically added.
    • Q: Will there be plans for the gas station and DApp related interfaces in the future?
      • A: Our PlatEye project is in progress, and the gas station and DApp related interfaces will be launched successively.
    • Q: How to solve the slow website response due to too much data requested at one time?
      • A: Our back-end database applies a paging method. You can also set pageSize to query data in pages when using API, but remember to collaborate with the front-end display page.
    • Q: What project scenario is the API mainly used for?
      • A: It can be used to display the information of third-party wallets, such as the balance and transaction information of an address as well as on-chain data for analysis.
    - + \ No newline at end of file diff --git a/en/Go_SDK/index.html b/en/Go_SDK/index.html index 1ad1dba35..3795298d1 100644 --- a/en/Go_SDK/index.html +++ b/en/Go_SDK/index.html @@ -8,7 +8,7 @@ Go SDK | PlatON - + @@ -166,7 +166,7 @@ time.Sleep(time.Duration(10) * time.Second) result, err := instance.Items(nil, key) if err != nil { log.Fatal(err) } fmt.Println(string(result[:])) // kitty}

    to sum up#

    In this article, we demonstrated how to deploy the contract and call the view method and non-view method in the contract.

    - + \ No newline at end of file diff --git a/en/GraphQL_Server/index.html b/en/GraphQL_Server/index.html index b53cce726..88599ed05 100644 --- a/en/GraphQL_Server/index.html +++ b/en/GraphQL_Server/index.html @@ -8,14 +8,14 @@ GraphQL Server | PlatON - +

    GraphQL Server

    In addition to the JSON-RPC APIs, PlatON supports the GraphQL API as specified by EIP-1767. GraphQL lets you specify which fields of an objects you need as part of the query, eliminating the extra load on the client for filling in fields which are not needed. It also allows for combining several traditional JSON-RPC requests into one query which translates into less overhead and more performance.

    The GraphQL endpoint piggybacks on the HTTP transport used by JSON-RPC. Hence you'll have to enable and configure the relevant --http flags, and the --graphql flag itself:

    platon --http --graphql

    Now you can start querying against http://localhost:6789/graphql. To change the port, you'll need to provide --http.port, e.g.:

    platon --http --http.port 9545 --graphql

    Since PlatON provides support for EIP55 and bech32 dual address formats, if you want to use bech32 addresses in graphql, you need to add platon to the url, such as http://localhost:6789/platon/graphql, otherwise the default is EIP55 address format.

    GraphiQL#

    An easy way to get started right away and try out queries is the GraphiQL interface shipped with PlatON. To open it visit http://localhost:6789/graphql/ui. To see how this works let's read the sender, recipient and value of all transactions in block number 6000000. Try this out in GraphiQL:

    query txInfo {    block (number: 6000000) { transactions { hash from { address } to { address } value } }}

    GraphiQL also provides a way to explore the schema PlatON provides to help you formulate your queries, which you can see on the right sidebar. Under the title Root Types click on Query to see the high-level types and their fields.

    Since PlatON provides support for EIP55 and bech32 dual address formats, if you want to use bech32 addresses in GraphiQL, you need to add platon to the url, such as http://localhost:6789/graphql/ui, otherwise the default is EIP55 address format.

    Query#

    Reading out data from PlatON is the biggest use-case for GraphQL. However after trying out queries in the UI you may want to do it programmatically. You can consult the official docs to find bindings for your language. Or use your favorite tool for sending HTTP requests. For sake of completeness we briefly touch on two approaches here. First via cURL, and second via a JS script.

    Here's how you'd get the latest block's number via cURL. Note the use of a JSON object for the data section:

    curl -X POST http://localhost:6789/graphql -H "Content-Type: application/json" --data '{ "query": "query { block { number } }" }'{"data":{"block":{"number":6004069}}}

    Alternatively store the JSON-ified query in a file (let's call it block-num.query) and do:

    curl -X POST http://localhost:6789/graphql -H "Content-Type: application/json" --data '@block-num.query'

    Executing a simple query in JS looks like the following. Here we're using the lightweight library graphql-request to perform the request. Note the use of variables instead of hardcoding the block number in the query:

    const { request, gql } = require('graphql-request')
     const query = gql`    query blockInfo($number: Long) {        block (number: $number) { hash stateRoot }    }`request('http://localhost:6789/graphql', query, { number: '6004067' })    .then((res) => { console.log(res) })    .catch((err) => { console.log(err) })
    - + \ No newline at end of file diff --git a/en/Install_PlatON/index.html b/en/Install_PlatON/index.html index 36e12256f..3808f3fc4 100644 --- a/en/Install_PlatON/index.html +++ b/en/Install_PlatON/index.html @@ -8,13 +8,13 @@ Source Installation PlatON | PlatON - +

    Source Installation PlatON

    This document is intended for users with the ability to compile source code on the PlatON blockchain.

    • PlatON supports source code compilation and installation under Windows and Ubuntu.

    Windows source code compilation#

    Windows compilation environment requirements :

    • git: 2.19.1 and above
    • Go language development kit: go (1.16+)
    • mingw: mingw (V8.1.0)
    • cmake: 3.0 +

    You can install the above compilation environment yourself. Please make sure the above environment can run normally before compiling PlatON source code.

    You can also use Chocolatey to install the compilation environment (if you do not already have chocolatey, you can follow the instructions on https://chocolatey.org to install), start PowerShell as an administrator, and then execute the following command:

    Install git:

    choco install git

    Install golang:

    choco install golang

    Install mingw:

    choco install mingw

    Install cmake:

    choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System'

    Most softwares installed using the chocolatey package manager have a default installation path, and some software may have various paths, depending on the publisher of the software. Installing these packages will modify the Path environment variable. The final installation path can be viewed in the PATH. Some machine environments may not find the installation path of these tools in the PATH, and you need to add it manually at this time. After installation, please make sure the installed Go version is 1.16 (or higher).

    Note: The following commands need to be run in the Git-bash environment. In any directory, right-click and select Git Bash Here to bring up the Git Bash running window.

    • Get the source code

    Get the source code and put it in the GOPATH path, where master is the branch name, then switch to the actual branch:

    mkdir -p $GOPATH/src/github.com/PlatONnetworkcd $GOPATH/src/github.com/PlatONnetworkgit clone -b master https://github.com/PlatONnetwork/PlatON-Go.git --recursive
    • Add bls dependent library to environment variables
    echo 'export PATH=$PATH:"$GOPATH/src/github.com/PlatONnetwork/PlatON-Go/crypto/bls/bls_win/lib"' >> ~/.bashrcsource ~/.bashrc
    • Compile
    cd $GOPATH/src/github.com/PlatONnetwork/PlatON-Gogo run build/ci.go install ./cmd/platongo run build/ci.go install ./cmd/platonkey

    After compiling, platon, platonkey executable files will be generated in the PlatON-Go/build/bin directory. Copy these executable files to your working directory and run.

    Repeated compilation will overwrite the previously generated executable file.

    Note: It is recommended that the windows version be used for development testing only, and that the ubuntu version be used for the official production environment.

    Ubuntu source code compilation#

    step1. Ubuntu compilation environment requirements:

    • System version: Ubuntu 18.04 or higher
    • git: 2.19.1 or higher
    • Compilers: gcc (4.9.2+), g ++ (5.0+)
    • Go language development kit: go (1.16+)
    • cmake: 3.0 +

    step2. Get the PlatON source:

    git clone -b master https://github.com/PlatONnetwork/PlatON-Go.git --recursive

    step3. Install dependency library:

    install golang

    cd /usr/localsudo wget https://go.dev/dl/go1.18.7.linux-amd64.tar.gzsudo rm -rf /usr/local/go && tar -C /usr/local -xzf go1.18.7.linux-amd64.tar.gzsudo vim /etc/profile// Add a line at the endexport PATH=$PATH:/usr/local/go/binsource /etc/profile
    sudo apt update sudo apt install -y cmake llvm g++ libgmp-dev libssl-dev

    step4. compilation:

    cd PlatON-Go make all

    After compiling, a series of executable files such as platon, platonkey and so on will be generated in the ./build/bin directory.

    step5. Copy binary:

    sudo cp -f ./build/bin/platon /usr/bin/ sudo cp -f ./build/bin/platonkey /usr/bin/

    To this step, congratulations, the source code compilation completed!

    - + \ No newline at end of file diff --git a/en/JS_SDK/index.html b/en/JS_SDK/index.html index 32f6b0fb6..e494b3009 100644 --- a/en/JS_SDK/index.html +++ b/en/JS_SDK/index.html @@ -8,7 +8,7 @@ JS SDK | PlatON - + @@ -147,7 +147,7 @@ When parsing, ver needs to be converted into 4 bytes. Major version: second byte; minor version: third byte, patch version, fourth byte.

    Query The Cumulative Voteable Number Of Proposals#

    Query the cumulative voteable number of proposals through calling operation.

    Parameters:

    FieldTypeRemark
    funcTypeuint16(2bytes)Method type code(2105)
    proposalIDcommon.Hash(32bytes)Proposal ID
    blockHashcommon.Hash(32bytes)块 hash

    Returns:

    Array - []uint16: An array.

    FieldTypeRemark
    uint16Number of cumulative votes
    uint16Number of in favour votes
    uint16Number of negative votes
    uint16Number of Abstained votes

    Definition#

    ProposalType#

    TypeDefinitionDescription
    TextProposal0x01Text proposal
    VersionProposal0x02Upgrade proposal
    CancelProposal0x04Cancel proposal

    ProposalStatus#

    For text proposals, there are three states: 0x01, 0x02, 0x03; For the upgrade proposal, there are four states: 0x01, 0x03, 0x04, 0x05, 0x06. For cancellation proposals, there are three states: 0x01, 0x02, 0x03;

    TypeDefinitionDescription
    Voting0x01Voting
    Pass0x02Voted successfully
    Failed0x03Vote failed
    PreActive0x04(Upgrade Proposal) Pre-Effective
    Active0x05(Upgrade Proposal) Effective
    Canceled0x06(Upgrade proposal) cancelled

    VoteOption#

    TypeDefinitionDescription
    Yeas0x01agree
    Nays0x02Against
    AbstentionsOther valuesAbstain

    Proposal(TextProposal)#

    FieldTypeRemark
    ProposalIDcommon.Hash(32bytes)Proposal ID
    Proposercommon.NodeID(64bytes)Proposal Node ID
    ProposalTypebyteProposal type, 0x01: text proposal; 0x02: upgrade proposal; 0x03 parameter proposal; 0x04 cancel proposal.
    PIPIDstringProposal PIPID
    SubmitBlock8bytesSubmitted blockNumber
    EndVotingBlock8bytesBlockNumber of proposal voting ended, according to SubmitBlock

    Proposal(VersionProposal)#

    FieldTypeRemark
    ProposalIDcommon.Hash(32bytes)Proposal ID
    Proposercommon.NodeID(64bytes)Proposal Node ID
    ProposalTypebyteProposal type, 0x01: text proposal; 0x02: upgrade proposal; 0x03 parameter proposal; 0x04 cancel proposal.
    PIPIDstringProposal PIPID
    SubmitBlock8bytesSubmitted blockNumber
    EndVotingRounds8bytesNumber of voting consensus cycles
    EndVotingBlock8bytesThe block height at the end of proposal voting is calculated by the system according to SubmitBlock, EndVotingRounds
    ActiveBlock8bytesProposal effective block height, calculated by the system based on EndVotingBlock
    NewVersionuintupdated version

    Proposal CancelProposal#

    FieldTypeRemark
    ProposalIDcommon.Hash(32bytes)Proposal ID
    Proposercommon.NodeID(64bytes)Proposal Node ID
    ProposalTypebyteProposal type, 0x01: text proposal; 0x02: upgrade proposal; 0x03 parameter proposal; 0x04 cancel proposal.
    PIPIDstringProposal PIPID
    SubmitBlock8bytesSubmitted blockNumber
    EndVotingRounds8bytesNumber of voting consensus cycles
    EndVotingBlock8bytesThe block height at the end of proposal voting is calculated by the system according to SubmitBlock, EndVotingRounds
    TobeCanceledcommon.Hash(32bytes)ID of the promotion proposal to cancel

    Vote#

    FieldTypeRemark
    voter64bytesVote validator
    proposalIDcommon.Hash(32bytes)Proposal ID
    optionVoteOptionVoting options

    TallyResult#

    FieldTypeRemark
    proposalIDcommon.Hash(32bytes)Proposal ID
    yeasuint16(2bytes)Approve
    naysuint16(2bytes)Against
    abstentionsuint16(2bytes)Abstention
    accuVerifiersuint16(2bytes)Total number of validators who have qualified to vote during the entire voting period
    statusbytestatus
    canceledBycommon.Hash(32bytes)When status = 0x06, the ProposalID of the record that initiated the cancellation

    Exposure/Punishment Module#

    Report Double Sign#

    Report a double sign by sending a transaction.

    Parameters:

    FieldTypeRemark
    funcTypeuint16(2bytes)Method type code(3000)
    typuint8Stands for double sign type
    1:prepareBlock,2:prepareVote,3:viewChange
    datastringThe json value of a single evidence. The format is [RPC interface Evidences][evidences_interface]

    Query Whether Node Has Been Reported As Oversigned#

    Query whether a node has been reported as oversigned by sending a transaction.

    Parameters:

    FieldTypeRemark
    funcTypeuint16(2bytes)Method type code(3001)
    typuint32Stands for double sign type,
    1:prepareBlock,2:prepareVote,3:viewChange
    addr20bytesReporting node address
    blockNumberuint64Multi-Signed BlockNumber

    Returns:

    TypeRemark
    StringReported Transaction Hash

    Lockout Module#

    Create Hedging Plan#

    Create hedging plan by sending a transaction.

    Parameters:

    FieldTypeRemark
    account20bytesLock release to account
    plan[]RestrictingPlanplan is a list (array) of type RestrictingPlan. RestrictingPlan is defined as follows:
    type RestrictingPlan struct {
    Epoch uint64
    Amount: \ big.Int
    }
    Among them, Epoch : Represents a multiple of the settlement cycle. The product of the number of blocks per settlement cycle indicates the release of locked funds at the height of the target block. Epoch \
    The number of blocks per cycle must be at least greater than the highest irreversible block height.
    Amount: indicates the amount to be released on the target block.

    Get Lock Information#

    Get lock information by calling.

    Note: This interface supports the acquisition of historical data. The block height can be attached to the request. By default, the latest block data is queried.

    Parameters:

    FieldTypeRemark
    account20bytesThe account that was posted after the lockout was released

    Returns:

    Returns a json format string with the following fields:

    FieldTypeRemark
    balancestring(Hex)Amount of remaining locked positions
    pledgestring(Hex)Pledge / mortgage amount
    debtstring(Hex)Amount due for release
    plansbytesLocked entry information, json array:[{"blockNumber":"","amount":""},...,{"blockNumber":"","amount":""}]. among:
    blockNumber:*big.Int,Release blockNumber
    amount:\string(Hex string), Release amount

    Reward Interface#

    Withdraw Delegate Reward#

    Withdraw all currently available delegate rewards from the account and send the transaction.

    Parameters:

    FieldTypeRemark
    funcTypeuint16(2bytes)Method type code(5000)

    Returns:

    Note: The transaction results are stored in the logs.data of the transaction receipt. If the transaction is successful, rlp.Encode (byte {[] byte (status code 0), rlp.Encode (node income list)}). If the transaction is unsuccessful, it is consistent with the previous method.

    The returned node income list is an array

    FieldTypeRemark
    NodeIDdiscover.NodeID(64bytes)Node ID
    StakingNumuint64Node stake block Number
    Reward*big.IntReceived reward

    Query Delegate Reward#

    The query account did not withdraw the delegate reward at each node, and call query.

    Parameters:

    FieldTypeRemark
    funcTypeuint16(2bytes)Method type code(5100)
    address20bytesThe address of the account to be queried
    nodeIDs[]discover.NodeIDThe node to be queried, if it is empty, all nodes entrusted by the account are queried

    Returns:

    Is a []Reward array

    FieldTypeRemark
    nodeIDdiscover.NodeID(64bytes)Node ID
    stakingNumuint64Node stake block Number
    rewardstring(0x hex string)Did not withdraw the delegate reward

    Error Code Description#

    ErrorCodeRemark
    301000Wrong bls public key
    301001Wrong bls public key proof
    301002The Description length is wrong
    301003The program version sign is wrong
    301004The program version of the relates node's is too low
    301005DeclareVersion is failed on create staking
    301006The address must be the same as initiated staking
    301100Staking deposit too low
    301101This candidate is already exist
    301102This candidate is not exist
    301103This candidate status was invalided
    301104IncreaseStake von is too low
    301105Delegate deposit too low
    301106The account is not allowed to be used for delegating
    301107The candidate does not accept the delegation
    301108Withdrew delegation von is too low
    301109This delegation is not exist
    301110The von operation type is wrong
    301111The von of account is not enough
    301112The blockNumber is disordered
    301113The von of delegation is not enough
    301114Withdrew delegation von calculation is wrong
    301115The validator is not exist
    301116The fn params is wrong
    301117The slashing type is wrong
    301118Slashing amount is overflow
    301119Slashing candidate von calculate is wrong
    301200Getting verifierList is failed
    301201Getting validatorList is failed
    301202Getting candidateList is failed
    301203Getting related of delegate is failed
    301204Query candidate info failed
    301205Query delegate info failed

    English Translation Contributors @WillXing

    - + \ No newline at end of file diff --git a/en/Java_SDK/index.html b/en/Java_SDK/index.html index 98cc1843e..87ad27123 100644 --- a/en/Java_SDK/index.html +++ b/en/Java_SDK/index.html @@ -8,7 +8,7 @@ Java SDK | PlatON - + @@ -57,7 +57,7 @@ RawTransactionManager needs to specify the chain ID. Prevent transactions on one chain from being rebroadcasted to another chain:

    TransactionManager transactionManager = new RawTransactionManager(web3j, credentials, 100L);

    In addition to RawTransactionManager, the Java SDK also provides a client transaction manager ClientTransactionManager, which will hand over your transaction signing work to the PlatON client you are connecting to. In addition, there is a ReadonlyTransactionManager, which is used to query data from the smart contract only and not to trade with it.

    GasProvider#

    The handling fee of the contract is set through GasProvider, because the gas consumption of the contract is dynamic and related to the logic of the contract. It is recommended to use a larger value for the first deployment call, such as 999999. Later adjust according to the actual situation.

    BigInteger GAS_LIMIT = BigInteger.valueOf(999999);BigInteger GAS_PRICE = BigInteger.valueOf(1000000000L);
     GasProvider gasProvider  = new ContractGasProvider(GAS_PRICE, GAS_LIMIT);

    Invoking Transactions And Events#

    For all transactions methods, only the transaction receipt associated with the transaction is returned.

    TransactionReceipt transactionReceipt = contract.someMethod(<param1>, ...).send();

    With transaction receipts, you can extract indexed and non-indexed event parameters.

    List<SomeEventResponse> events = contract.getSomeEvents(transactionReceipt);

    Alternatively, you can use Observable filters to listen to events associated with smart contracts:

    contract.someEventObservable(startBlock, endBlock).subscribe(event -> ...);

    Call Constant Method#

    Constant methods only do queries without changing the state of the smart contract.

    Type result = contract.someMethod(<param1>, ...).send();
    - + \ No newline at end of file diff --git a/en/Join_Dev_Network/index.html b/en/Join_Dev_Network/index.html index dc0224922..0db26d70e 100644 --- a/en/Join_Dev_Network/index.html +++ b/en/Join_Dev_Network/index.html @@ -8,13 +8,13 @@ Dev Network | PlatON - +

    Dev Network

    This article will describe how to debug local applications by connecting to the PlatON DevNet(development Network).

    ChainId: 2206132

    openapi:

    https://devnet2openapi.platon.network/rpc or wss://devnet2openapi.platon.network/ws

    faucet:

    https://devnet2faucet.platon.network/faucet

    explorer:

    https://devnet2scan.platon.network

    How to access the dev network to debug local applications?#

    Step 1: Connect to the DevNet via RPC address#

    https://devnet2openapi.platon.network/rpc or wss://devnet2openapi.platon.network/ws

    Access method 1: Connect to the DevNet via the local PlatON node#

    on the ubuntu 18.04 server, download and install the PlatON binary with the following command:

    sudo wget https://download.platon.network/platon/platon/1.4.4/platon -P /usr/bin    

    Connect to the development network by.

    platon attach https://devnet2openapi.platon.network/rpc

    Access method 2: Connect to the PlatON DevNet through the SDKs#

    • Use the Java SDK to connect to the DevNet, for example, as follows.
    Web3j platonWeb3j = Web3j.build(new HttpService("https://devnet2openapi.platon.network/rpc"));
    • Use Python SDK to access the DevNet, the example is as follows.
    w3 = Web3(HTTPProvider("https://devnet2openapi.platon.network/rpc"))
    • Use JS SDK to access the DevNet, the example is as follows.
    var Web3 = require('web3');var web3 = new Web3('http://https://devnet2openapi.platon.network/rpc');
    • Using JSON RPC to access the DevNet, the example is as follows.
    curl -X POST -H 'content-type: application/json' --data '{"jsonrpc": "2.0", "method": "web3_clientVersion", "params":[], "id":67}' https://devnet2openapi.platon.network/rpc

    Not limited to the above language SDKs, you also have access through SDKs in other languages.

    Step 2: Apply for DevNet Test Token#

    Click faucet to receive the Test Token. If you have a large Test Token request, please send an email to support@latticex.foundation using the following format.

     Title: PlatON Development Network Token Request Your Name: Contact information: Wechart ID (or other instant messaging software) Amount: Use: Receiving addressA: Remarks:

    After successfully accessing the DevNet, you can send transactions after completing the test Token collection to start your test journey and can check the transactions in DevNet Browser.

    How to deploy a devnet node?#

    If you want to deploy a DevNet verification node, please refer to Run a dev node.

    - + \ No newline at end of file diff --git a/en/Json_Rpc/index.html b/en/Json_Rpc/index.html index 46a5bc195..fe5cddd02 100644 --- a/en/Json_Rpc/index.html +++ b/en/Json_Rpc/index.html @@ -8,7 +8,7 @@ JSON-RPC | PlatON - + @@ -65,7 +65,7 @@ //Result{ "id": 1, "jsonrpc": "2.0", "result": "0x62e05075829655752e146a129a044ad72e95ce33e48ff48118b697e15e7b41e4"}

    personal_ecRecover#

    Returns the address associated with the private key that was used to calculate the signature in personal_sign.

    Parameters#
    1. Data - The data which hash was signed.
    2. Data - Signed data.
    params: [  "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675",  "0xe7225f986f192f859a9bf84e34b2b7001dfa11aeb5c7164f81a2bee0d79943e2587be1faa11502eba0f803bb0ee071a082b6fe40fba025f3309263a1eef52c711c"]
    Returns#

    Address - Address of the signer of the message.

    Example#
    //Requestcurl --data '{"method":"personal_ecRecover","params":["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675","0xe7225f986f192f859a9bf84e34b2b7001dfa11aeb5c7164f81a2bee0d79943e2587be1faa11502eba0f803bb0ee071a082b6fe40fba025f3309263a1eef52c711c"],"id":1,"jsonrpc":"2.0","bech32":true}' -H "Content-Type: application/json" -X POST localhost:6789
     //Result{  "id": 1,  "jsonrpc": "2.0",  "result": "lat1kc8gm4sut5etaqzchw8tjuy8purjxv24msxq7q"}

    personal_importRawKey#

    Imports the given private key into the key store, encrypting it with the passphrase.

    Parameters#
    1. String - An unencrypted private key (hex string).
    2. String - The password of the account.
    Returns#

    String - The address of the account.

    Example#
    //Requestcurl --data '{"method":"personal_importRawKey","params":["cd3376bb711cb332ee3fb2ca04c6a8b9f70c316fcdf7a1f44ef4c7999483295e","password1234"],"id":1,"jsonrpc":"2.0","bech32":true}' -H "Content-Type: application/json" -X POST localhost:6789
     //Result"lat1kc8gm4sut5etaqzchw8tjuy8purjxv24msxq7q"

    personal_listAccounts#

    Lists all stored accounts.

    Parameters#

    no

    Returns#

    Array - A list of 20 byte account identifiers.

    Example#
    //Requestcurl --data '{"method":"personal_listAccounts","params":[],"id":1,"jsonrpc":"2.0","bech32":true}' -H "Content-Type: application/json" -X POST localhost:6789//Result{  "id": 1,  "jsonrpc": "2.0",  "result": [    "lat1kc8gm4sut5etaqzchw8tjuy8purjxv24msxq7q",    "lat1e2q84y8avn0w6as0hx9lpp5mgawydy6g4lups0"  ]}

    personal_listWallets#

    list all your accounts you’ve used before + 1 empty new one

    Parameters#

    no

    Returns#

    rawWalletArray - A list of raw wallets.

    Example#
    //Requestcurl --data '{"method":"personal_listWallets","params":[],"id":1,"jsonrpc":"2.0","bech32":true}' -H "Content-Type: application/json" -X POST localhost:6789//Result{  accounts: [{      address: "atp1v79he42uvxghmmajx4r2gxqrckl7l0r6w2pwk8",      url: "keycard://044d/m/44'/60'/0'/0/0"  }],  status: "Online",  url: "keycard://044def09"}

    personal_lockAccount#

    Locks the given account.

    Parameters#
    1. String - The account address.
    2. Function - (optional) Optional callback, returns an error object as first parameter and the result as second.
    Returns#

    Boolean - true if the account was successfully locked, otherwise false.

    Example#
    //Requestcurl --data '{"method":"personal_lockAccount","params":["lat1v79he42uvxghmmajx4r2gxqrckl7l0r6huhkfg"],"id":1,"jsonrpc":"2.0","bech32":true}' -H "Content-Type: application/json" -X POST localhost:6789//Result{  result: true}

    personal_newAccount#

    Creates new account.

    Note: it becomes the new current unlocked account. There can only be one unlocked account at a time.

    Parameters#
    1. String - Password for the new account.
    Returns#

    Address - 20 Bytes - The identifier of the new account.

    Example#
    //Requestcurl --data '{"method":"personal_newAccount","params":["abc123"],"id":1,"jsonrpc":"2.0","bech32":true}' -H "Content-Type: application/json" -X POST localhost:6789//Result{  "id": 1,  "jsonrpc": "2.0",  "result": "lat13upz04zc2wjsam753h20asjatvlay227nmyk6p"}

    personal_sign#

    Calculates an PlatON specific signature with: sign(keccak256("Ethereum Signed Message: " + len(message) + message))).

    Parameters#
    1. Data - The data to sign
    2. Address - 20 Bytes - The address of the account to sign with
    3. String - Passphrase to unlock the from account.
    Returns#

    Data - Signed data.

    Example#
    //Requestcurl --data '{"method":"personal_sign","params":[0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675","lat1kc8gm4sut5etaqzchw8tjuy8purjxv24msxq7q","hunter"],"id":1,"jsonrpc":"2.0","bech32":true}' -H "Content-Type: application/json" -X POST localhost:6789//Result{  "id": 1,  "jsonrpc": "2.0",  "result": "0xe7225f986f192f859a9bf84e34b2b7001dfa11aeb5c7164f81a2bee0d79943e2587be1faa11502eba0f803bb0ee071a082b6fe40fba025f3309263a1eef52c711c"}

    personal_signTransaction#

    Signs a transaction without dispatching it to the network. It can later be submitted using platon_sendRawTransaction. The account does not need to be unlocked to make this call, and will not be left unlocked after.

    Parameters#
    1. Object - Transaction object with optional condition field. see platon_sendRawTransaction.
    2. String - Passphrase to unlock the from account.
    Returns#

    Object - Signed transaction and its details:

    • raw: Data - The signed, RLP encoded transaction.
    • tx: Object - Transaction object.
    • from: Address - 20 Bytes - The address the transaction is send from.
    • to: Address - (optional) 20 Bytes - The address the transaction is directed to.
    • gas: Quantity - (optional) Integer of the gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions.
    • gasPrice: Quantity - (optional) Integer of the gas price used for each paid gas.
    • value: Quantity - (optional) Integer of the value sent with this transaction.
    • data: Data - (optional) 4 byte hash of the method signature followed by encoded parameters. For details see Ethereum Contract ABI.
    • nonce: Quantity - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.
    • condition: Object - (optional) Conditional submission of the transaction. Can be either an integer block number { block: 1 } or UTC timestamp (in seconds) { time: 1491290692 } or null.
    Example#
    //Requestcurl --data '{"method":"personal_signTransaction","params":[{"from":"lat1gp7h8k9ynm4ct5ev73j4qlwhr4g8zqxpunjvg7","to":"lat14984xa8uuhkmer32s6tuz5e3valxa0ct4z0qkm","data":"0x41cd5add4fd13aedd64521e363ea279923575ff39718065d38bd46f0e6632e8e","value":"0x186a0"},"hunter2"],"id":1,"jsonrpc":"2.0","bech32":true}' -H "Content-Type: application/json" -X POST localhost:6789//Result{  "id": 1,  "jsonrpc": "2.0",  "result": {    "raw": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675",    "tx": {      "hash": "0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b",      "nonce": "0x0",      "blockHash": "0xbeab0aa2411b7ab17f30a99d3cb9c6ef2fc5426d6ad6fd9e2a26a6aed1d1055b",      "blockNumber": "0x15df",      "transactionIndex": "0x1",      "from": "lat1gp7h8k9ynm4ct5ev73j4qlwhr4g8zqxpunjvg7",      "to": "lat1s5l58k9ynm4ct5ev73j4qlwhr4g8zqxpkhv75y",      "value": "0x7f110",      "gas": "0x7f110",      "gasPrice": "0x09184e72a000",      "input": "0x603880600c6000396000f300603880600c6000396000f3603880600c6000396000f360"    }  }}

    personal_unlockAccount#

    Decrypts the key with the given address from the key store.This method is disabled by default in the PlatON 1.1.1 version and above, and needs to be enabled by adding --allow-insecure-unlock to the startup parameters.

    The unencrypted key will be held in memory until the unlock duration expires. If the unlock duration defaults to 300 seconds. An explicit duration of zero seconds unlocks the key until geth exits.

    The account can be used with platon_sign and platon_sendTransaction while it is unlocked.

    Parameters#
    1. Address - 20 Bytes - The address of the account to unlock.
    2. String - Passphrase to unlock the account.
    3. Quantity - (default: 300) Integer or null - Duration in seconds how long the account should remain unlocked for.
    Returns#

    Boolean - whether the call was successful

    Example#
    //Requestcurl --data '{"method":"personal_unlockAccount","params":["lat13upz04zc2wjsam753h20asjatvlay227nmyk6p","hunter2",null],"id":1,"jsonrpc":"2.0","bech32":true}' -H "Content-Type: application/json" -X POST localhost:6789//Result{  "id": 1,  "jsonrpc": "2.0",  "result": true}

    miner_setGasPrice#

    Sets the minimal accepted gas price when mining transactions. Any transactions that are below this limit are excluded from the mining process.

    Parameters#
    1. Uint - number of gas.
    Returns#

    Boolean - whether the gas price was successfully set.

    Example#
    //Requestcurl --data '{"method":"miner_setGasPrice","params":[19999999],"id":1,"jsonrpc":"2.0","bech32":true}' -H "Content-Type: application/json" -X POST localhost:6789//Result{  "id": 1,  "jsonrpc": "2.0",  "result": true}

    txpool_status#

    The status property of txPool can be used to query information such as the number of transactions in the transaction pool waiting to be packaged into the next block.

    Parameters#

    none

    Returns#

    Object - The value of the status property is an object containing two fields, pending and Queued, each of which is an associative array.

    Example#
    //Requestcurl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","bech32":true,"method":"txpool_status","params":[],"id":1}' http://127.0.0.1:6789//Result{  "id": 1,  "jsonrpc": "2.0",  "result": {        "pending": "0x0",        "queued": "0x0"    }}

    txpool_content#

    The content property of txPool can be used to list pending and queued transactions currently in the pool.

    Parameters#

    none

    Returns#

    Object - The value is an object containing two fields: Pending and Queued, each of which is an associative array.

    Example#
    //Requestcurl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","bech32":true,"method":"txpool_content","params":[],"id":1}' http://127.0.0.1:6789//Result{  "id": 1,  "jsonrpc": "2.0",  "result": {        "pending": {            "lat1fx2pjucpzk3zm7fdyqez4yhxyqkrqlzhgpzcf7": {                806: [{                        blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",                        blockNumber: null,                        from: "lat1fx2pjucpzk3zm7fdyqez4yhxyqkrqlzhgpzcf7",                        gas: "0x5208",                        gasPrice: "0xba43b7400",                        hash: "0xaf953a2d01f55cfe080c0c94150a60105e8ac3d51153058a1f03dd239dd08586",                        input: "0x",                        nonce: "0x326",                        to: "lat1c7kuxvr4wdswy89p049spsk6ddwtqhjqcp4uef",                        transactionIndex: null,                        value: "0x19a99f0cf456000"                }]            }        },        "queued": {            "lat1h926hjvmfnhenwrx7tzr2mcwk2wq80dvzzeqjj": {                2: [{                    blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",                    blockNumber: null,                    from: "lat1h926hjvmfnhenwrx7tzr2mcwk2wq80dvzzeqjj",                    gas: "0x15f90",                    gasPrice: "0xba43b7400",                    hash: "0x3a3c0698552eec2455ed3190eac3996feccc806970a4a056106deaf6ceb1e5e3",                    input: "0x",                    nonce: "0x2",                    to: "lat1smxhhr3ufxnqv55agjtq3cjsng4rqx489p6d0m",                    transactionIndex: null,                    value: "0xebec21ee1da40000"                }],            }        }    }}

    txpool_inspect#

    The inspect property of TXPool lists the summary of transactions in the transaction pool that are currently waiting to be packaged into the next block.

    Parameters#

    none

    Returns#

    Object - The value of the Inspect property is an object containing two fields, pending and Queued, each of which is an associative array.

    Example#
    //Requestcurl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","bech32":true,"method":"txpool_inspect","params":[],"id":1}' http://127.0.0.1:6789//Result{    "jsonrpc": "2.0",    "id": 1,    "result": {        "pending": {            "lat1wv9jphl4gxj8jyazl63qvfzp4sq2zv82u0zl2n": {                "13975": "lat1d5cqy3j8462xrywh9h08jndpfky78rt82qapul: 1 von + 21000 gas × 1000000000 von",                "13976": "lat1qtyzgqm8n0vcv2cnmyvqnvzeures9ggr38yf9k: 1 von + 21000 gas × 1000000000 von",                "13977": "lat1j5zyyyztejn7d67f4vk3c0uydhgx8qu0quhj7e: 1 von + 21000 gas × 1000000000 von",                "13978": "lat1jvy3w9ps7t076w4pclhv9n9x3ng4zjxedhwdcj: 1 von + 21000 gas × 1000000000 von",                "13979": "lat1ft23z88sfdqaphp6u7lt5eaaha3x9tqpwq6geu: 1 von + 21000 gas × 1000000000 von"            },            "lat1z9ayvyxhtepectk92gd8rkfzuk48wq3pxyexrs": {                "13829": "lat1896fjn0fsun8xnpy58jcku9zpgdpzta07565v4: 1 von + 21000 gas × 1000000000 von",                "13830": "lat1e2aew0nh6dcung2mg0xuqtdp0fl5x9sm36jmvl: 1 von + 21000 gas × 1000000000 von",                "13831": "lat1kvyd32vqqwtrnw0687hvccjezm5jnl8a5lm5hf: 1 von + 21000 gas × 1000000000 von"            }        },        "queued": {            "lat1g62rmjcmd5v8ezyp0levzakp2t3g2x3qfjeeyy": {                "13813": "lat16z74lt8sj75mdw9lxpjpce22x9u6h5tslealgp: 1 von + 21000 gas × 1000000000 von",                "13814": "lat1hff2xwvh7p34rayy695xg48f78j7nmkwctgqld: 1 von + 21000 gas × 1000000000 von"            },            "lat14zgzfkz6sfh5sy3csvwsfcphg458kgdhhc3e5r": {                "14192": "lat1wyfjc62wp9axjcjg6jupeclnrklzhk2m58he44: 1 von + 21000 gas × 1000000000 von",                "14193": "lat1rz5dq9ea8ay6mj4chlzq9cn6qkvunad6ezynnn: 1 von + 21000 gas × 1000000000 von",                "14194": "lat1lvcl6w2nfhjhachqsncfe4nvafe5seykfj05vm: 1 von + 21000 gas × 1000000000 von"            }        }    }}

    debug_getWaitSlashingNodeList#

    Get all nodes with zero production blocks, and a list of nodes that have been observed because of zero production blocks.

    Parameters#

    no

    Returns#

    array - The node list of the zero production block, each structure contains three fields, NodeId: the node ID of the zero production block, Round: the number of consensus rounds in the first zero production during the observation period, CountBit: the zero production block Bitmap of the number of times (starting from Round, 1 means that no block is produced in this round).

    Example#
    // Requestcurl -X POST --data '{ "jsonrpc": "2.0", "method": "debug_getWaitSlashingNodeList", "params": [], "id": 74}'// Result{  "id": 74,  "jsonrpc": "2.0",  "result": "[{    "NodeId": "8e91f562c1798dc8c567a5c4a99a840eb86e43324b622fd0a4a8defdf873baf8f822313d7f35227fe15b6f4a2767dfb9ea7f7968d0a3a243e57b4d1090f6fc6c",    "Round": 1000,    "CountBit": 7  }]"}

    debug_getValidatorByBlockNumber#

    Get the list of validators of the specified consensus round, pass in any block height in a consensus round, the system will automatically calculate the consensus round to which the block height belongs and return the list of validators of that consensus round, or return the empty string if there is no data.

    Parameters#

    Uint64 - blockNumber

    Returns#

    array - Validator List, Address: address of node; NodeId:id of node;BlsPubKey:bls public key of node.

    Example#
    // Requestcurl -X POST --data '{ "jsonrpc": "2.0", "method": "debug_getValidatorByBlockNumber", "params": [1000], "id": 75}'// Result{  "jsonrpc": "2.0",  "id": 75,  "result": "[{    "Address": "0xc6a99e99978ac78333897e2117ec9747f010b827",    "NodeId": "2d016c3c2dd0ffb4c251940e255a90cd4541c553710c0b5b594595d1eaa660cb8109c1cd90ac864665852abffc7fd47343b03d0156d81501b838be7c4e354d6d",    "BlsPubKey": "21a9fc05c3b349e9a50f0966d5c338082f52e72639778d6ed5d11ce544efc2ba8b8f463d03eb4d02934937da603d0f109a08e5c4c82c835fc7f4209ad0d5c551853dd9fbfab08345346696e09124c19e0d08e01a4b5d841eea896fd3ae982995"  }]"}
    - + \ No newline at end of file diff --git a/en/Ledger-hardware-wallet/index.html b/en/Ledger-hardware-wallet/index.html index fa79e5ca3..7aeb1953d 100644 --- a/en/Ledger-hardware-wallet/index.html +++ b/en/Ledger-hardware-wallet/index.html @@ -8,13 +8,13 @@ Ledger hardware wallet | PlatON - +

    Ledger hardware wallet



    Recently, PlatON has initially integrated Ledger hardware wallet (currently in developer mode for the time being), and will subsequently provide hardware wallet services to a wide range of PlatON users.Ledger, one of the most popular hardware wallets on the market today, provides the highest level of security and reliability for PlatON’s network assets through a state-of-the-art security chip that holds private keys.
    Samurai, PlatON’s open-source web browser plug-in wallet, has completed support for the Lager hardware wallet, providing users with a more secure way to store and use their assets.
    - Authentication and authorization of transactions
    - Provide a cold storage option for creating wallets and storing private keys offline

    By using the Ledger hardware wallet to store private keys and sign transactions, the private keys will not come into contact with your software wallet, making the transaction signing process more secure and simple.
    Note: The ATON mobile wallet will also support the Ledger hardware wallet in the future, so stay tuned!

    This article will guide you through the process of configuring the Ledger hardware wallet and signing Samurai transactions using the Ledger Nano hardware wallet.Here are the details of the process.

    Prepare the environment for Ledger Hardware Wallets#

    Initialization and program installation#



    Ledger hardware wallets, Ledger Live Desktop, Samurai Wallet;

    [Ledger Nano S and Ledger Nano X are operated basically in the same way. Here we take Ledger Nano X as an example]

    Ledger hardware wallet initialization#



    [Operation instructions: press the black and white buttons respectively to switch between options. Press the black and white buttons at the same time to confirm]
    ① Set the PIN identification code: Long press the black button to start the Ledger hardware wallet, enter and confirm the PIN identification code setting, as shown in Figure 1.1.1;

    Figure1.1.1


    ② Between the two options, [Set up as new device] and [Restore from Recovery phrase], here we choose Restore from Recovery phrase (mnemonic phrase), as shown in Figure 1.1.2;

    Figure1.1.2

    ③ In the recovery phrase (mnemonic phrase), the PlatON network can generate multiple types of mnemonic phrases. To facilitate ATON HD Wallet to import mnemonic phrase, here we choose [12 words], as shown in Figure 1.1.3;

    Figure1.1.3


    Or we can choose 24 words to restore from the recovery phrase self-generated by Ledger. Enter the Ledger hardware wallet after creating/recovering the phrase, as shown in Figure 1.1.4;You need to install Ledger hardware wallet in Ledger Live Desktop.

    Figure1.1.4


    Note: Ledger and ATON mnemonics are not compatible with Samurai mnemonics, please use your wallet private key to import each other.

    Prepare the environment for Ledger Live Desktop#



    Download Ledger Live and install it locally; download link:
    https://www.ledger.com/ledger-live/download
    Steps of operation and installation are as shown in Figures 1.1.5 and 1.1.6.

    Figure1.1.5


    Figure1.1.6

    To prepare the environment for Samurai Wallet#



    ① Download and unpack Samurai Wallet from
    https://github.com/AlayaNetwork/Samurai/releases
    as shown in Figure 1.1.7;

    Figure1.1.7


    ② Open the Chrome browser, enter chrome://extensions/ in the address bar and press Enter to enter the page of Extensions. [Activate] developer mode, select [Load unpacked], import the directory where the Samurai plug-in wallet is unpacked, as shown in Figures 1.1.8.

    Figure1.1.8

    Install PlatON hardware Drivers (Method 1)#



    Use Ledger Live Desktop to add [PlatON] to the Ledger hardware wallet

    1) Open Ledger Live Desktop and select the corresponding Ledger hardware device, as shown in Figure 1.2.1. You need to set the PIN identification code for the first use, and the previously set options are directly synchronized to the application;

    Figure1.2.1


    2)To connect to the desktop program for pairing, you need to enter the PIN identification code, and authorize the pairing, as shown in Figure 1.2.2;

    Figure1.2.2


    3)Download and install the PlatON application in Ledger Live Desktop: Since the PlatON application has not been officially launched on Ledger Live, it is currently in a beta phase for professional enthusiasts/community members. So you need to manually activate the developer mode before you can search [PlatON]. Large transactions are not suggested in the current testing phase;
    ① Enter Ledger Live Desktop, and activate the developer mode in the settings, as shown in Figure 1.2.3;

    Figure1.2.3


    ② Then find and install [PlatON] in Manager, as shown in Figure 1.2.4. After that, we need Samurai/MetaMask;

    Figure1.2.4

    Install PlatON hardware Drivers (Method 2)#



    Adding the [PlatON] hardware driver to the Ledger Hardware Wallet — Use the Ledger live App pairing to add the [PlatON] app to the Ledger Hardware Wallet.

    1)Open the Ledger Live app and select the corresponding Ledger hardware device, as shown in Figure 1.3.1. You need to set the PIN identification code for the first use, and the previously set options are directly synchronized to the application;

    Figure1.3.1


    2)It is necessary to pair the Ledger hardware wallet with the Ledger Live app, as shown in Figure 1.3.1.1;

    Figure1.3.1.1


    You need to confirm the pairing on both your Ledger hardware wallet and the Ledger Live app, as shown in Figures 1.3.2, 1.3.3, and 1.3.4.;

    Figure1.3.2


    Figure1.3.3


    Figure1.3.4


    Pairing can be successful only after confirmation, as shown in Figure 1.3.5.;

    Figure1.3.5

    Before pairing, you need to make sure that the Ledger hardware wallet is unlocked and Bluetooth is turned on. Under normal circumstances, the Ledger hardware wallet remains unlocked, without the need of manual setting. Here is a precondition: the setting prescribed in [1.1] has been completed.

    3)In the Ledger Live app, add [PlatON] to the Ledger hardware wallet:
    Portfolio page: Tap [Settings] in the upper right corner, as shown in Figure 1.3.6. Select [Experimental Function], and activate [Developer mode], as shown in Figure 1.3.7;

    Figure1.3.6


    Figure1.3.7


    Manager page: Select your Ledger hardware wallet device, and open the application catalog, as shown in Figure 1.3.8. Find and download [PlatON], as shown in Figure 1.3.9. After that, we need Samurai/MetaMask;

    Figure1.3.8


    Figure1.3.9


    Use the Ledger hardware wallet signature to complete the transaction#


    [Samurai Wallet and MetaMask Wallet are operated basically in the same way. Here we take Samurai Wallet as an example]

    Select PlatON hardware driver application#



    Prerequisites: Prepare the environment stated in the above [1.]; then the Ledger hardware wallet needs to enter the PlatON application, till it reads [application is ready], as shown in Figure 2.1.1;

    Figure2.1.1


    Samurai pair and unlock Ledger hardware wallet#



    Create an account randomly with Samurai, enter the main page of Samurai Wallet, and select [Link Hardware Wallet] to pair, as shown in Figure 2.2.1; after the link is successfully paired, select the account to unlock the hardware wallet, as shown in Figure 2.2.2;

    Figure2.2.1


    Figure2.2.2


    Ledger hardware wallet completes signature transfer transaction#



    Now that Samurai reads and enters the hardware wallet page, you can send the transfer, as shown in Figure 2.3.1. The Ledger hardware wallet receives the signature and confirms it, as shown in Figures 2.3.2 and 2.3.3. After confirmation, the transfer is completed, as shown in Figure 2.3.4;

    Figure2.3.1


    Figure2.3.2


    Figure2.3.3


    Figure2.3.4


    Change PIN identification code and reset Ledger hardware wallet#

    Change the PIN identification code in the Ledger hardware wallet#



    Press and hold the black and white buttons at the same time for 3 seconds, select [Setting Manage device], as shown in Figure 3.1.1. Select [Security], as shown in Figure 3.1.2. Select [Change PIN] as shown in Figure 3.1.3. Finally, set a new PIN identification code.

    Figure3.1.1


    Figure3.1.2


    Figure3.1.3


    Reset Ledger hardware wallet#



    Press and hold the black and white buttons at the same time for 3 seconds, and select [Setting Manage device], as shown in Figure 3.1.1. Select [Security], as shown in Figure 3.1.2. Select [Reset device] as shown in Figure 3.2.1. To reset, select [Restore from Recovery phrase] (mnemonic phrase) as shown in Figure 1.1.2.

    Figure3.2.1


    Tip#



    When the Ledger hardware wallet enters the PlatON application, if it is [Pending] without displaying [application is ready], as shown in Figure 4.1.1, you need to unplug the USB and plug it in again or restart it to re-enter the application, until you see [application is ready], as shown in Figure 4.1.2.

    Figure4.1.1


    Figure4.1.2

    - + \ No newline at end of file diff --git a/en/MetaMask/index.html b/en/MetaMask/index.html index 81462492f..34e0b6ba9 100644 --- a/en/MetaMask/index.html +++ b/en/MetaMask/index.html @@ -8,13 +8,13 @@ MetaMask Configure PlatON/Alaya Network | PlatON - +

    MetaMask Configure PlatON/Alaya Network

    What is MetaMask#

    MetaMask is a wallet extension application embedded in the browser, which helps you interact with decentralized applications (dApps).

    MetaMask allows you to easily access the Ethereum network and add other public chains compatible with the EVM.

    Why PlatON|Alaya uses MetaMask#

    MetaMask, the most widely used browser plug-in wallet on the market, is well-received in the community.

    To lower the threshold for community users, PlatON | Alaya is compatible with the core tools of the Ethereum ecosystem, including MetaMask, after its upgrade to the Ethereum-compatible version.

    MetaMask makes operations such as transfer, signing, and contract interaction more convenient.

    Notices#

    1. The address generated via MetaMask starts with 0x, that is, one in the Ethereum format. To view the address in the PlatON|Alaya format, please check in PlatON|Alaya.

      PlatON MainNet:https://scan.platon.network/

      PlatON DevNet2: https://devnet2scan.platon.network/

      Alaya MainNet:https://scan.alaya.network/

      Alaya DevNet: https://devnetscan.alaya.network/

    2. Mnemonics of ATON and those of MetaMask are incompatible with each other as they are generated through different paths. Private keys are compatible.

    3. MetaMask cannot be called by WASM contracts, but EVM contracts only.

    4. Starting from PlatON version 1.3.0 (effective time 2022.11.9,For details see:https://forum.latticex.foundation/t/topic/6548 ), PlatON MainNet has been completely switched to ChainID: 210425, the original ChainID: 100 is no longer supported!

    This document will guide you through PlatON | Alaya network configuration using MetaMask.

    MetaMask installation and use#

    There are many detailed introductions about the installation and use of MetaMask on the Internet, hence no need of further elaboration.

    You may refer to:

    Installation, configuration and use of MetaMask

    How To Use MetaMask: Ethereum Wallet in your Browser

    After creating a wallet using MetaMask, you're advised to back up the private key of the wallet so that it can be imported into ATON for later use.

    Steps of backup:

    image-20220112183347293image-20220112183413762image-20220112183659326

    How to manually add PlatON network#

    PlatON MainNet#

    First, you need to install a MetaMask plugin on your Chrome browser.

    Then register the wallet and save your mnemonics and private key.

    Then click the drop-down menu in the upper right corner.

    image-20220112183808168

    Then scroll to the end and click "Add Network"

    image-20220112183837332image-20220112183901268

    Fill in the above information one by one. The configuration content is as follows:

    • PlatON ChainID:210425 Configuration Information ( Recommended )
    Network Name: PlatON MainNetworkNew RPC URL: https://openapi2.platon.network/rpcChain ID210425Currency SymbolLATBlock Explorer URL: https://scan.platon.network/
    • PlatON ChainID:100 Configuration information -- Disabled
    Network Name: PlatON MainNetworkNew RPC URL: https://openapi.platon.network/rpcChain ID100Currency SymbolLATBlock Explorer URL: https://scan.platon.network/

    Then click Save and wait for it to finish.

    Now, the PlatON MainNet has been successfully added to MetaMask.

    image-20220112184025579

    You can also transfer assets as usual.

    image-20220112184503864image-20220112184532084

    Done! It is worth mentioning that only Hex addresses are supported on the mainnet. In other words, you have a LAT Address and Hex Address in your ATON wallet, and the one that starts with 0x is your Hex address!

    PlatON DevNet#

    Similarly, you can add and configure the PlatON DevNet2 according to the following information:

    Network Name: PlatON Dev2 NetworkNew RPC URL: https://devnet2openapi.platon.network/rpc   OR wss://devnet2openapi.platon.network/wsChain ID2206132Currency SymbolLATBlock Explorer URL: https://devnet2scan.platon.network/

    After the settings are saved, it will automatically jump to PlatON DevNet, and the following will appear:

    image-20220112184723277

    Next, we can apply for test tokens on the PlatON DevNet faucet (https://devnet2faucet.platon.network/faucet) to test the transfer operation.

    image-20220112184859903

    First, we create the No.2 test wallet:

    image-20220112185037936

    After it is saved, we will see:

    image-20220112185056331

    Then we use the No. 1 test wallet to transfer 50 LAT to the No. 2 wallet:

    image-20220112185347872

    Click "Confirm"

    image-20220112185403356

    Transferring...

    image-20220112185439816

    Done! 50 LATs have been transferred through the testnet. We can also see a contract interaction below, which is the interaction with the showme application.

    image-20220112185459908

    Alaya MainNet#

    By the same token, let's fill in the following information to add the network to MetaMask.

    Network Name: Alaya MainNetworkNew RPC URL: https://openapi.alaya.network/rpcChain ID201018 Currency SymbolATPBlock Explorer URL: https://scan.alaya.network/

    Other available RPC nodes on the Alaya MainNet:

    https://rpc.alayascan.com (provided by itokenpool)

    Successfully added:

    image-20220112190053868

    Transfer succeeds as well.

    Alaya DevNet#

    Fill out the form with the following information in order:

    Network Name: Alaya Dev NetworkNew RPC URL: https://devnetopenapi.alaya.network/rpcChain ID201030Currency SymbolATPBlock Explorer URL: https://devnetscan.alaya.network/

    After the information is added, create a new Alaya test wallet, and then apply for test tokens on the Alaya DevNet faucet (https://faucet.alaya.network/faucet/) to test the transfer operation.

    image-20220112191841275

    After receiving the test ATP from the faucet, we can start testing transfer:

    Start transferring

    image-20220112192819523image-20220112192843056

    Transferring...

    image-20220112192856706

    Done. Now we can see 5 ATP has been received by the Alaya DevNet-2.

    image-20220112192930266

    Add a network using ChainList#

    First, open ChainList and click "Connect Wallet" to authorize the connection to MetaMask.

    e27a930f30709e719b147ac64dcaaacaf904b93a_2_690x338

    Then, enter PlatON in the input box to search,

    and we can see:

    9800bbe80cff52b23b102f36b0eae9e0c05a7bbd_2_690x338

    Next, click "Add tTo MetaMask" to add the network.

    0acc9a52bb0d63ed11f2fb9063a12e059c754298_2_690x338

    Then click switch network to jump to the PlatON DevNet!

    image-20220112193135951

    Now let's add the Alaya Dev Testnet to MetaMask in the same way.

    e67da043d7028ad99c9f1048a37b65d13a1f8ad9_2_690x338

    Similarly, click Approve and then switch network. The Alaya Dev Testnet has been added.

    A quick way to add MetaMask to Blockchain Explorer#

    Enter the PlatON or Alaya blockchain explorer, find [MORE] in the navigation menu, click [Add to Extension], and select the network to be configured:

    Blockchain explorer on the PlatON MainNet: https://scan.platon.network/add-to-extension

    Blockchain explorer on the PlatON DevNet: https://devnetscan.platon.network/add-to-extension

    Blockchain explorer on the Alaya MainNet: https://scan.alaya.network/add-to-extension

    Blockchain explorer on the Alaya DevNet: https://devnetscan.alaya.network/add-to-extension

    [Figure-4.1.1]

    Connect with MetaMask in the web browser#

    1) After entering the Add to Extension page in the blockchain explorer, click [Connect MetaMask].

    [Prerequisite: MetaMask needs to be installed in the explorer in advance]

    [Figure-4.1.2.1]

    2) Click [Next] in MetaMask, and then click [Connect] to establish communication with MetaMask.

    [Figure-4.1.2.2][Figure-4.1.2.3]

    Add network configuration to MetaMask#

    1) After the connection is successful, [Connect MetaMask] turns into [Add to MetaMask]. Click [Add to MetaMask].

    [Figure-4.1.3.1]

    2) Click [Approve] to add the network configuration to MetaMask.

    [Figure-4.1.3.2]

    3) The plug-in wallet will prompt you to switch to this network. Click [Switch Network] to switch the corresponding network for later use.

    [Figure-4.1.3.3]

    This tutorial is contributed by @LeQianQian @Dengxin46

    - + \ No newline at end of file diff --git a/en/NET_SDK/index.html b/en/NET_SDK/index.html index bb2969ff9..efa840889 100644 --- a/en/NET_SDK/index.html +++ b/en/NET_SDK/index.html @@ -8,13 +8,13 @@ PlatONet:.NET SDK for PlatON/Alaya networks | PlatON - +

    PlatONet:.NET SDK for PlatON/Alaya networks

    To be translated, feel free to submit contributions

    - + \ No newline at end of file diff --git a/en/Network_Description/index.html b/en/Network_Description/index.html index 43e3565a3..b4648b72e 100644 --- a/en/Network_Description/index.html +++ b/en/Network_Description/index.html @@ -8,13 +8,13 @@ Networks | PlatON - +

    Networks

    PlatON is a protocol, which means that multiple independent “networks” can be built based on it.

    You can use different PlatON networks depending on your purpose. PlatON mainnet and PlatON development network is currently available.

    Note: The generation of the wallet account does not depend on the network. The same account can be used in different networks. When using the same account in different networks, you need to pay attention to the security of funds on the mainnet!

    Mainnet#

    The PlatON mainnet is a public chain with real economic value operated by the LatticeX Foundation. Anyone can create a mainnet wallet account and can query or create transactions with it, or verify transactions in progress.

    If you want to connect to the mainnet as a validator, please refer to Becoming a mainnet validator.

    Development network#

    The PlatON development network shares the same features with the mainnet and may be ahead of the mainnet in terms of version. It can be used for testing before going online on the mainnet, and can also provide a development and testing environment for developers or validators.

    If you want to connect to the development network as a validator, please refer to Becoming a development network validator.

    Note: Since the development network is also a test ground, therefore, instability and network reset may occur!

    Development network faucet#

    If you need to use test LAT on the development network, you have to obtain it through the faucet at

    devnet1:Original Devnet1 (ChainID:210309) has been disabled, please change it to Devnet2 (ChainID:2206131) if needed.

    devnet2:https://devnet2faucet.platon.network/faucet/

    Note: LAT on the development network has no real value and is for testing only!

    Private network#

    PlatON private network is an independent network that is not connected to the mainnet or development network. You can test your application by deploying a private network locally, which can speed up your testing progress.

    For building a private test network, please refer to Deploying a Private Network .

    - + \ No newline at end of file diff --git a/en/OffLine_MTool_Manual/index.html b/en/OffLine_MTool_Manual/index.html index 55e2aaf9f..5b9fe670c 100644 --- a/en/OffLine_MTool_Manual/index.html +++ b/en/OffLine_MTool_Manual/index.html @@ -8,7 +8,7 @@ MTool offline tutorial | PlatON - + @@ -19,7 +19,7 @@ SUCCESS wallet created at: C:\platon_mtool\mtool\current\keystore\staking_observed.json

    View wallet list#

    • Command line
    platon_mtool account list

    Query balance according to wallet name#

    • Command line
    platon_mtool account balance $keystorename --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Variable description

    $keystorename: wallet file name, such as staking.json

    Check balance based on address#

    • Command line
    platon_mtool account balance -a $address --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameters

    a: wallet address

    Offline PlatON MTool transaction process#

    The main process of PlatON MTool offline signature method is: generate the file to be signed on the online machine, then sign the transaction on the offline machine, and finally send the signed transaction on the online machine. Taking the transfer transaction as an example, the steps are as follows. For the operation of generating the file to be signed for other transactions, refer to the [PlatON MTool Transaction Command Details] (# PlatON MTool Transaction Command Details) chapter.

    Generate transaction pending signature file#

    Execute on online machine:

    platon_mtool tx transfer --address $PLATON_MTOOLDIR/keystore/staking_observed.json --amount "1" --recipient $to_address --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter Description:

    address: Observation wallet path for sending transactions;

    amount: transfer amount, unit: LAT;

    recipient: recipient address;

    The following information is printed, indicating successful execution:

    Transfer unsigned raw: H4sIAAAAAAAAAGWOPW/DIBRF/8ubPfDhGsdrp0oZMmSrMiCMDUGADTiGRPnvoVGHSn3T1ZHuPe8Ba/j0ozwH7iIXSXt31DHB8P0Abv3masTo3zUgFNfua4SBIIxoBVPwFgbgKeM9pLweppERJTrGXH+n1KY+5Wtujckfy247JqF2NvdWnssiYagjM49HbXWVEvzWVHAKWsg/XzTgvPshtIHkf5UlxKL2tBVkCJnZnNWtm/dyn/qbiIdrNHFlysDzUjvaypi4Xepmh2jbMor6luLnC0n7ZKsMAQAAFile generated on: $PLATON_MTOOLDIR/transaction_details/transaction_detail_20191108114241.csv

    Among them, transaction_detail_20191108114241.csv is the file to be signed for the transfer transaction, which needs to be copied to the offline machine for signature;

    Signature transaction#

    Execute on the offline machine where the cold wallet is kept:

    platon_mtool offlinesign --filelocation $PLATON_MTOOLDIR/transaction_details/transaction_detail_20191108114241.csv

    Note: $PLATON_MTOOLDIR/transaction_details/transaction_detail_20191108114241.csv is the file to be signed generated in the previous step, modified to the actual file to be signed.

    Enter the corresponding cold wallet password and return the signed file. The content of the file is as follows:

     ┌────────┬───────┬────────┬────────┬────────┬──── ────┬────────┬───────┬──────┐│Type │From │To │Account │Amount │Fee │Nonce │Create │Chain ││ │ │ │Type │ │ │ │Time │Id │├────────┼────────┼────────┼────────┼────────┼──── ────┼────────┼───────┼───────┤│STAKING │0xa1548d│0x100000│FREE_AMO│5000000.│0.043210│0 │2019-10│100 ││ │d61010a7│00000000│UNT_TYPE│00000000│00000000│ │-11T13:│ ││ │42cd66fb│00000000│ │00000000│0000 │ │54:06.8│ ││ │86324ab3│00000000│ │00 │ │ │97 │ ││ │e2935586│00000000│ │ │ │ │ │ ││ │4a │02 │ │ │ │ │ │ │└────────┴────────┴────────┴────────┴────────┴──── ────┴────────┴───────┴──────┘Need load 1 wallets for address: [0xa1548dd61010a742cd66fb86324ab3e29355864a]
     operation finishedSUCCESSFile generated on transaction_signature/transaction_signature_20191108114625.csvtotal: 1, to be signed: 1success: 1, failure: 0

    Note: transaction_signature/transaction_signature_20191108114625.csv is the signed transaction file, copy the transaction signature file to the online machine;

    Send signed transaction#

    Send transaction in online machine:

    platon_mtool send_signedtx --filelocation $PLATON_MTOOLDIR/transaction_signature/transaction_signature_20191108114625.csv --config $PLATON_MTOOLDIR/validator/validator_config.json

    Note: transaction_signature_20191108114625.csv is the transaction signature file generated in the previous step, modified to the actual signature file.

    Enter yes to return the transaction result:

    Send Transaction? (yes|no)yestransaction 1 successtransaction hash: 0xf14f74386e6ef9027c48582d7faed3b50ab1ffdd047d6ba3afcf27791afb4e9bSUCCESStotal: 1success: 1, failure: 0

    Note: Prompt success and return transaction hash means that the signature transaction is sent successfully, otherwise the signature transaction fails.

    Detailed explanation of PlatON MTool trading commands#

    This chapter mainly describes the relevant commands for generating the csv format transaction to-be-signed file on the online machine. The generated csv file will be saved in the $PLATON_MTOOLDIR/transaction_details directory. For the complete transaction process of sending offline signatures, please refer to the [Offline PlatON MTool Transaction Process] (#Offline PlatON MTool Transaction Process) chapter.

    Ordinary transfer operations#

    • Command line
    platon_mtool tx transfer --address $PLATON_MTOOLDIR/keystore/staking_observed.json --amount "1" --recipient $to_address --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter Description

    address: Observation wallet path for sending transactions;

    amount: transfer amount, unit: LAT;

    recipient: recipient address;

    Create a new Lockup plans#

    Creating a new Lockup plan, node's LATs will be transferred to a specified precompiled contract. The LATs will be transferred to the specified account multiple times at specified intervals. Before creating a new Lockup plan, you need to create a Lockup plan description file in json format.

    • Lockup plan description file,retricting_plans.json
    {  "account":"lat12jn6835z96ez93flwezrwu4xpv8e4zathsyxdn",  "plans":[    {"epoch": 5000,"amount": 100},    {"epoch": 6000,"amount": 100},    {"epoch": 7000,"amount": 100}  ]}

    account:the specified account that will received LAT from the estricting plan.

    epoch:the number of epoch to wait for a transfer plan (Greater than or equal to 1)

    amount:the number of LAT to be transferred. Unit: LAT

    • command line
    platon_mtool create_restricting --config $PLATON_MTOOLDIR/validator/validator_config.json --address $PLATON_MTOOLDIR/keystore/staking_observed.json --file ./restricting_plans.json
    • Parameter Description

    config:node configuration file

    address: observation wallet file

    file: Lockup plan description file

    Initiate a pledge operation#

    If the consensus node deployment is complete and the blocks have been successfully synchronized, you can use PlatON MTool to pledge operations. After the pledge fund application is completed, ensure that the pledge account balance is sufficient, and replace the pledge deposit amount according to the user's situation. The minimum pledge threshold is 100,000 LAT.

    Note: Please keep enough LAT in the pledge account to prepare for the subsequent transactions managed by the initiating node to have sufficient transaction fees, such as voting for upgrade proposals, unstaking transactions and other transactions.

    • Command line
    platon_mtool staking --config $PLATON_MTOOLDIR/validator/validator_config.json --address $PLATON_MTOOLDIR/keystore/staking_observed.json --amount 100000 --benefit_address xxx196278ns22j23awdfj9f2d4vz0pedld8a2fzwwj --delegated_reward_rate 5000 --node_name myNode --website www.mywebsite.com --details myNodeDescription --external_id 121412312
    • Parameter Description

    config:node configuration file

    address: pledge observation wallet file

    amount: pledge amount, no less than 100000LAT-pledge threshold, no more than 8 decimal places (use free amount pledge)

    restricted amount: not less than 100000LAT-pledge threshold, no more than 8 decimal places (using locked balance pledge)

    autoamount: Not less than 100000LAT-Priority to use the lock-up balance staking, if the lock-up balance is not enough for the staking deposit, then use free amount staking

    benefit_address: benefit account to receive block-packing reward and staking reward

    delegated_reward_rate:Delegated bonus ratio, type is integer range is [0,10000], unit: ten thousand percent, e.g. enter 5000, it means the bonus ratio is 50%

    nodename:node name,30 bytes(beginning with a letter, including alphabet, number, space, , -, #)

    website:node website, 30 bytes

    details:node description, 280 bytes

    external_id:node Icon ID of keybase.io, or identity authentication ID

    Modify validator information operation#

    • Command line
    platon_mtool update_validator --config $PLATON_MTOOLDIR/validator/validator_config.json --address $PLATON_MTOOLDIR/keystore/staking_observed.json --node_name myNode --website www.mywebsite.com --external_id 121412312 --delegated_reward_rate 6000 --benefit_address lax1x0f9xwr9steccekttqvml0d26zgsxwdnhq3fkv --details "Modify the verifier information operation"
    • Parameter Description

    config:node configuration file

    address: pledge observation wallet file

    benefit_address[option]: benefit account to receive block-packing reward and staking reward

    delegated_reward_rate[option]:Delegated bonus ratio, type is integer range is [0,10000], unit: ten thousand percent, e.g. enter 5000, it means the bonus ratio is 50%

    nodenam[option]e:node name,30 bytes(beginning with a letter, including alphabet, number, space, , -, #)

    website[option]:node website, 30 bytes

    details[option]:node description, 280 bytes

    external_id[option]:node Icon ID of keybase.io, or identity authentication ID

    Unpledge operation#

    **It takes 168 settlement cycles to withdraw from the pledge, please be careful!**
    • Command line
    platon_mtool unstaking --address $PLATON_MTOOLDIR/keystore/staking_observed.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter Description

    None

    Increase pledge operation#

    • Command line
    platon_mtool increasestaking --amount 5000000 --address $PLATON_MTOOLDIR/keystore/staking_observed.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter Description

    amount: Use the account balance to increase the pledge amount (LAT), no less than 10 minimum increase value, no more than 8 decimal places

    restricted amount: Use the account lock balance to increase the pledge amount, no less than 10 pledge threshold, no more than 8 decimal places (use locked balance pledge)

    Submit text proposal operation#

    • Command line
    platon_mtool submit_textproposal --pid_id 100 --address $PLATON_MTOOLDIR/keystore/staking_observed.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter Description

    pid_id: GitHub ID

    Submit an upgrade proposal operation#

    • Command line
    platon_mtool submit_versionproposal --newversion 0.15.1 --end_voting_rounds 345 --pid_id 100 --address $PLATON_MTOOLDIR/keystore/staking_observed.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter Description

    newversion: target upgrade version, x.x.x, number plus punctuation

    end_voting_rounds: the number of voting consensus rounds, the number of voting consensus rounds N, must satisfy 0 <N <= 4838 (about 2 weeks)

    pid_id: GitHub ID

    Submit proposal cancellation#

    • Command line
    platon_mtool submit_cancelproposal --proposalid 0x444c3df404bc1ce4d869166623514b370046cd37cdfa6e932971bc2f98afd1a6 --end_voting_rounds 12 --pid_id 100 --address $PLATON_MTOOLDIR/keystore/staking_observed.json --config $PLATON_MTOOLDIR/validator/validator/validator
    • Parameter Description

    proposalid: proposal ID that needs to be cancelled, that is, the hash used to initiate the proposal transaction, 66 characters, alphanumeric

    end_voting_rounds: the number of voting consensus rounds, the number of voting consensus rounds N, must satisfy 0 <N <= 4838 (about 2 weeks)

    pid_id: GitHub ID

    Text proposal voting operation#

    • Command line
    platon_mtool vote_textproposal --proposalid 0x444c3df404bc1ce4d869166623514b370046cd37cdfa6e932971bc2f98afd1a6 --opinion yes --address $PLATON_MTOOLDIR/keystore/staking_observed.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter Description

    proposalid: text proposal ID, which is the hash used to initiate the proposal transaction, 66 characters, alphanumeric

    opinion: voting options, yes, no, abstain-choose one of three

    Upgrade proposal voting operation#

    • Command line
    platon_mtool vote_versionproposal --proposalid 0x444c3df404bc1ce4d869166623514b370046cd37cdfa6e932971bc2f98afd1a6 --address $PLATON_MTOOLDIR/keystore/staking_observed.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter Description

    proposalid: upgrade proposal ID, that is, the hash used to initiate the proposal transaction, 66 characters, alphanumeric

    Cancel proposal voting operation#

    • Command line
    platon_mtool vote_cancelproposal --proposalid 0x444c3df404bc1ce4d869166623514b370046cd37cdfa6e932971bc2f98afd1a6 --opinion yes --address $PLATON_MTOOLDIR/keystore/staking_observed.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter Description

    proposalid: cancel proposal ID, that is, the hash used to initiate the proposal transaction, 66 characters, alphanumeric composition

    opinion: voting options, yes, no, abstain-choose one of three

    Submit parameter proposal operation#

    • Command line
    platon_mtool submit_paramproposal --pid_id 200 --module $module --paramname $paramname --paramvalue $paramvalue --address $PLATON_MTOOLDIR/keystore/staking_observed.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter Description

    module: management module parameters

    paramname: management module parameter name, pay attention to letter case

    paramvalue: governance module parameter value

    pid_id: GitHub ID

    Parameter proposal voting operation#

    • Command line
    platon_mtool vote_paramproposal --proposalid 0x444c3df404bc1ce4d869166623514b370046cd37cdfa6e932971bc2f98afd1a6 --opinion yes --address $PLATON_MTOOLDIR/keystore/staking_observed.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter Description

    proposalid: cancel proposal ID, that is, the hash used to initiate the proposal transaction, 66 characters, alphanumeric

    opinion: voting options, yes, no, abstain-choose one of three

    Version statement operation#

    • Command line
    platon_mtool declare_version --address $PLATON_MTOOLDIR/keystore/staking_observed.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter Description

    None

    View help#

    • Command line
    platon_mtool -h
    • Parameter Description

    None

    - + \ No newline at end of file diff --git a/en/OnLine_MTool_Manual/index.html b/en/OnLine_MTool_Manual/index.html index eeba67531..58d9b5063 100644 --- a/en/OnLine_MTool_Manual/index.html +++ b/en/OnLine_MTool_Manual/index.html @@ -8,14 +8,14 @@ MTool online tutorial | PlatON - +

    MTool online tutorial

    Introductory#

    To facilitate node transfer, pledge, delegate, and governance operations, PlatON provides MTool to assist users:

    • PlatON MTool supports Ubuntu 18.04 and Windows 10. This document describes the installation and use of Windows and Ubuntu, respectively. Users can choose from their own resources.

    • PlatON MTool provides two signature methods for transactions such as pledge: online signature and offline signature.This document describes online signing operations. For offline signing operations, refer to the Offline PlatON MTool Manual

    Install PlatON MTool#

    In addition, this document introduces the operation of PlatON MTool under Windows and Ubuntu respectively. Users can choose according to their own resources.

    Install PlatON MTool under Windows#

    Preparation before installation#

    execute command:

    platon_mtool --version

    If the execution result shows error message, it indicates that the PlatON MTool has not been installed and you can skip the following instructions on how to uninstall the older version.

    If the execution result shows the version number, timestamp and other information, it indicates that PlatON MTool has been installed. If the PlatON MTool is an old version, you need to back up important information at this time, and then manually uninstall the old version. The instructions are as follows:

    Step1. Backup directory

    Back up the C:\platon_mtool\mtool\current\keystore and C:\platon_mtool\mtool\current\validator directories to other directories (do not back them up to C:\platon_mtool). After installing the new version, you need to copy the backup directory back to the C:\platon_mtool\mtool\current\ directory. (If the installation directory is a custom directory, the actual one shall prevail)

    Step2. Uninstall old version

    Double-click C:\platon_mtool\unins000.exe to uninstall all old versions of PlatON MTool and other business platon_mtool.

    Start installation#

    Step1. Download PlatON MTool installation package

    On the online machine, copy the link https://download.platon.network/platon/mtool/windows/1.1.1/platon_mtool.exe to the browser and download the PlatON MTool installation package.

    Step2. Install PlatON MTool

    Double-click platon_mtool.exe to install it. The default installation directory is C:\platon_mtool, and it is recommended not to change this installation directory. The pop-up interface displays the message Completing the mtool Setup Wizard, indicating that the installation was successful. Click Finish.

    Step3. Restart the terminal

    After installation is complete, you need to restart the terminal (do not restart the server, close the CMD window or PowerShell window and reopen the window) for the newly added environment variables to take effect.

    Install PlatON MTool under Ubuntu#

    Preparation before installation#

    Back up the ~/platon_mtool/keystore and ~/platon_mtool/validator directories to other directories (do not back them up to ~/platon_mtool). After installing the new version, you need to copy the backup directory back to the ~/platon_mtool/ directory. (If the installation directory is a custom directory, the actual one shall prevail)

    start installation#

    Proceed as follows:

    Step1. Download PlatON MTool toolkit

    wget https://download.platon.network/platon/mtool/linux/1.1.1/platon_mtool.zip

    Step2. Extract the PlatON MTool toolkit

    (if ! command -v unzip;then sudo apt install unzip; fi;) && unzip platon_mtool.zip && cd platon_mtool

    Step3. Download script

    The script is downloaded to the platon_mtool directory, otherwise the script cannot find the path of the new version of mtool.

    wget https://download.platon.network/platon/scripts/mtool_install.sh

    Step4. Execute command

    chmod +x mtool_install.sh && ./mtool_install.sh
    • When the message Install platon mtool succeed. is displayed, PlatON MTool is successfully installed. If it is not successfully installed, please contact our official customer service to provide feedback on specific issues.

    Step5. Restart the session window

    After installation is complete, you need to restart the session window (do not restart the server, close the session window or SSH tool to reopen the window) for the newly added environment variables to take effect.

    PlatON MTool Environment Variable Description#

    The environment variables of PlatON MTool directories under Windows and Ubuntu are different:

    • PlatON MTool directory
      • Windows: %PLATON_MTOOLDIR%
      • Ubuntu: $PLATON_MTOOLDIR

    Note:Users choose according to their installed system.

    PlatON MTool Command Details#

    Note: The follow-up command is the command format under Ubuntu. Under Windows, you need to modify $PLATON_MTOOLDIR to %PLATON_MTOOLDIR%.

    • Original Devnet1 (ChainID:210309) has been disabled, please change it to Devnet2 (ChainID:2206131) if needed.
    • If you are connecting to the Development 2 network, you need to modify the domainid of the config.properties configuration file in the PlatON MTool installation directory to 2206131.

    Create A Wallet#

    • Execute the command:
    platon_mtool account new staking
    • Parameter description

    staking: The name of the wallet to be created. Once the wallet is created successfully, a wallet file named staking.json will be generated in the directory $PLATON_MTOOLDIR/keystore, And print the following information:

    -name: staking-type: NORMAL-address: lat124xmsmd0uf5cvk7v3s36eytqezqsjfcxfw2lmr-public key: 0x9521cd81ba28d5d1c23bb7ddb7042d146375203d35000c0289178027abd4dc09bca30257739df166201e73497485242f41d5f50d46bc3c7e4385f81bde560db0Important write this Private Key in a safe place.It is the important way to recover your account if you ever forget your password.4630b6d86bc74bffd4ca8cfc18bceec562cb40fc5080c258452a04a69bc1ee07
     Important write this mnemonic phrase in a safe place.It is the important way to recover your account if you ever forget your password.worry jewel penalty jealous expect embark outer eternal verb rebuild rice kidney

    Wallet address format adjusted to Bech32, among them:

    lat124xmsmd0uf5cvk7v3s36eytqezqsjfcxfw2lmr: account address;

    4630b6d86bc74bffd4ca8cfc18bceec562cb40fc5080c258452a04a69bc1ee07 : the private key of the wallet;

    worry jewel penalty jealous expect embark outer eternal verb rebuild rice kidney: the mnemonic words.

    For security reasons, users need to back up the wallet private key or mnemonic words (both can be backed up, or one of them can be backed up). When the wallet is lost, it can be used for recovery. It is recommended that users back up mnemonic words or private keys to a secure storage medium, such as an offline machine.

    Recover wallet file#

    If the wallet file is lost, you can restore it with the backed up private key or mnemonic as follows:

    • Execute the command:

      Recovery via private key:

      platon_mtool account recover -k staking

      Prompt to enter the new wallet password and backup private key, as follows:

      Enter a passphrase to encrypt your key to disk:Repeat the passphrase:Enter your 64bit Private Key:4630b6d86bc74bffd4ca8cfc18bceec562cb40fc5080c258452a04a69bc1ee07

      or

      Recovery through mnemonics:

      platon_mtool account recover -m staking

      Prompt to enter a new wallet password and backup mnemonic words, as follows:

       Enter a passphrase to encrypt your key to disk: Repeat the passphrase: Enter your bip39 mnemonic: worry jewel penalty jealous expect embark outer eternal verb rebuild rice kidney
    • Parameter description

      staking:wallet name.

      After successful restoration, the wallet file staking.json will be generated under the directory $PLATON_MTOOLDIR/keystore.

    Ordinary transfer operation#

    • Command line
    platon_mtool tx transfer --keystore $PLATON_MTOOLDIR/keystore/staking.json --amount "1" --recipient $ to_address --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter Description

    keystore: path of the wallet sending the transaction

    amount: transfer amount, unit: LAT

    recipient: receiving address

    View wallet list#

    • Command line
    platon_mtool account list

    Query balance based on wallet name#

    • Command line
    platon_mtool account balance $keystorename --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter description

    $ keystorename: wallet file name,example:staking.json

    Query balance based on address#

    • Command line
    platon_mtool account balance -a $address --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter description

    a: wallet address

    Create a new Lockup plans#

    Creating a new Lockup plan, node's LATs will be transferred to a specified precompiled contract. The LATs will be transferred to the specified account multiple times at specified intervals. Before creating a new Lockup plan, you need to create a Lockup plan description file in json format.

    • Lockup plan description file,retricting_plans.json
    {  "account":"lat12jn6835z96ez93flwezrwu4xpv8e4zathsyxdn",  "plans":[    {"epoch": 5000,"amount": 100},    {"epoch": 6000,"amount": 100},    {"epoch": 7000,"amount": 100}  ]}

    account:the specified account that will received LAT from the estricting plan.

    epoch:the number of epoch to wait for a transfer plan (Greater than or equal to 1)

    amount:the number of LAT to be transferred. Unit: LAT

    • command line
    platon_mtool create_restricting --config $PLATON_MTOOLDIR/validator/validator_config.json --keystore $PLATON_MTOOLDIR/keystore/staking.json --file ./restricting_plans.json
    • Parameter Description

    config:node configuration file

    keytore: wallet file

    file: Lockup plan description file

    Initiate a staking operation#

    If the deployment of the consensus node is complete and the block has been synchronized successfully, you can use MTool for staking operations. After the staking fund application is completed, ensure that the balance of the staking account is sufficient, and replace the staking amount according to the user's situation. The minimum threshold for staking is one hundred thousand LAT.

    Note: Please keep enough LAT in the staking account, so that the transactions initiated by the subsequent node management have sufficient transaction fees, such as voting for upgrading proposals, and unsecured transactions.

    • Command line
    platon_mtool staking --config $PLATON_MTOOLDIR/validator/validator_config.json --keystore $PLATON_MTOOLDIR/keystore/staking.json --amount 100000 --benefit_address xxx196278ns22j23awdfj9f2d4vz0pedld8a2fzwwj --delegated_reward_rate 5000 --node_name myNode --website www.mywebsite.com --details myNodeDescription --external_id 121412312

    Prompt:please input keystore password:Enter the password of the staking wallet and press Enter. If the following information is displayed, the staking is successful:

    operation finishedtransaction hash:0x89b964d27d0caf1d8bf268f721eb123c4af57aed36187bea90b262f4769eeb9bSUCCESS
    • Parameters Description

    config:node configuration file

    keystore: staking wallet file

    amount: staking amount, not less than 100000LAT-staking threshold, no more than 8 decimal places

    restrictedamount: not less than 100000LAT-staking threshold, no more than 8 decimal points (staking using locked balance)

    autoamount: Not less than 100000LAT-Priority to use the lock-up balance staking, if the lock-up balance is not enough for the staking deposit, then use free amount staking

    benefit_address: benefit account to receive block-packing reward and staking reward

    delegated_reward_rate:Delegated bonus ratio, type is integer range is [0,10000], unit: ten thousand percent, e.g. enter 5000, it means the bonus ratio is 50%

    nodename:node name,30 bytes(beginning with a letter, including alphabet, number, space, , -, #)

    website:node website, 30 bytes

    details:node description, 280 bytes

    external_id:node Icon ID of keybase.io, or identity authentication ID

    Modify validator information operation#

    • Command line
    platon_mtool update_validator --config $PLATON_MTOOLDIR/validator/validator_config.json --keystore $PLATON_MTOOLDIR/keystore/staking.json --node_name myNode --website www.mywebsite.com --external_id 121412312 --delegated_reward_rate 6000 --benefit_address lax1x0f9xwr9steccekttqvml0d26zgsxwdnhq3fkv --details "Modify the verifier information operation"
    • Parameters Description

    config:node configuration file

    keystore: staking wallet file

    benefit_address[option]: benefit account to receive block-packing reward and staking reward

    delegated_reward_rate[option]:Delegated bonus ratio, type is integer range is [0,10000], unit: ten thousand percent, e.g. enter 5000, it means the bonus ratio is 50%

    nodenam[option]e:node name,30 bytes(beginning with a letter, including alphabet, number, space, , -, #)

    website[option]:node website, 30 bytes

    details[option]:node description, 280 bytes

    external_id[option]:node Icon ID of keybase.io, or identity authentication ID

    Decommissioning operation#

    It takes 168 settlement cycles to withdraw from the pledge, please be careful!

    • Command line
    platon_mtool unstaking --keystore $PLATON_MTOOLDIR/keystore/staking.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter Description

    None

    Increase staking operation#

    • Command line
    platon_mtool increasestaking --amount 5000000 --keystore $PLATON_MTOOLDIR/keystore/staking.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameters Description

    amount: Use the account balance to increase the staking amount (LAT), the minimum added value is not less than 10, and the decimal point does not exceed 8 digits

    restrictedamount: use the account balance to increase the amount of staking, not less than 10 staking threshold, the decimal point does not exceed 8

    Submit Text Proposal#

    • Command line
    platon_mtool submit_textproposal --pid_id 100 --keystore $PLATON_MTOOLDIR/keystore/staking.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter Description

    pid_id: GitHub ID

    Submit upgrade proposal operation#

    • Command line
    platon_mtool submit_versionproposal --newversion 0.15.1 --end_voting_rounds 345 --pid_id 100 --keystore $PLATON_MTOOLDIR/keystore/staking.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameters Description

    newversion: target upgrade version, x.x.x, number punctuation

    end_voting_rounds: the number of voting consensus rounds, the number of voting consensus rounds N, must satisfy 0 < N <= 4838 (about 2 weeks)

    pid_id: GitHub ID

    Submit Cancel Proposal#

    • Command line
    platon_mtool submit_cancelproposal --proposalid 0x444c3df404bc1ce4d869166623514b370046cd37cdfa6e932971bc2f98afd1a6 --end_voting_rounds 12 --pid_id 100 --keystore $PLATON_MTOOLDIR/keystore/staking.json --config $PLATON_MTOOLDIR_validator/validator
    • Parameters Description

    proposalid: the ID of the proposal that needs to be cancelled

    end_voting_rounds: the number of voting consensus rounds, the number of voting consensus rounds N, must satisfy 0 < N <= 4838 (about 2 weeks)

    pid_id: GitHub ID

    Text proposal voting operation#

    • Command line
    platon_mtool vote_textproposal --proposalid 0x444c3df404bc1ce4d869166623514b370046cd37cdfa6e932971bc2f98afd1a6 --opinion yes --keystore $PLATON_MTOOLDIR/keystore/staking.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameters Description

    proposalid: text proposal ID, that is, the hash of the proposal transaction, 66 characters, alphanumeric

    opinion: voting options, yes, no, abstain-choose one

    Upgrade proposal voting operation#

    • Command line
    platon_mtool vote_versionproposal --proposalid 0x444c3df404bc1ce4d869166623514b370046cd37cdfa6e932971bc2f98afd1a6 --keystore $PLATON_MTOOLDIR/keystore/staking.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter Description

    proposalid: upgrade proposal ID, that is, the hash of the proposed transaction, 66 characters, alphanumeric

    Cancel proposal voting#

    • Command line
    platon_mtool vote_cancelproposal --proposalid 0x444c3df404bc1ce4d869166623514b370046cd37cdfa6e932971bc2f98afd1a6 --opinion yes --keystore $PLATON_MTOOLDIR/keystore/staking.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameters Description

    proposalid: Cancel the proposal ID, that is, the hash of the proposed transaction, 66 characters, composed of alphanumeric characters

    opinion: voting options, yes, no, abstain-choose one

    Submit parameter proposal operation#

    • Command line
    platon_mtool submit_paramproposal --pid_id 200 --module $ module --paramname $ paramname --paramvalue $ paramvalue --keystore $PLATON_MTOOLDIR/keystore/staking.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameters Description

    module: governance module parameters

    paramname: the name of the governance module parameter, pay attention to the case of the letters

    paramvalue: Governance module parameter value

    pid_id: GitHub ID

    Parameter proposal voting operation#

    • Command line
    platon_mtool vote_paramproposal --proposalid 0x444c3df404bc1ce4d869166623514b370046cd37cdfa6e932971bc2f98afd1a6 --opinion yes --keystore $PLATON_MTOOLDIR/keystore/staking.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameters Description

    proposalid: Cancel the proposal ID, that is, the hash of the proposed transaction, 66 characters, composed of alphanumeric characters

    opinion: voting options, yes, no, abstain-choose one

    Version declaration operation#

    • Command line
    platon_mtool declare_version --keystore $PLATON_MTOOLDIR/keystore/staking.json --config $PLATON_MTOOLDIR/validator/validator_config.json
    • Parameter Description

    None

    View help#

    • Command line
    platon_mtool -h
    • Parameter Description

    None

    - + \ No newline at end of file diff --git a/en/PRC20_contract/index.html b/en/PRC20_contract/index.html index d2087c410..ce05a883f 100644 --- a/en/PRC20_contract/index.html +++ b/en/PRC20_contract/index.html @@ -8,7 +8,7 @@ PRC-20 | PlatON - + @@ -17,7 +17,7 @@ If a Smart Contract implements the following methods and events it can be called an PRC-20 Token Contract and, once deployed, it will be responsible to keep track of the created tokens on PlatON.

    contract PRC20 {
         //required    function totalSupply() constant returns (uint theTotalSupply);    function balanceOf(address _owner) constant returns (uint balance);    function transfer(address _to, uint _value) returns (bool success);    function transferFrom(address _from, address _to, uint _value) returns (bool success);    function approve(address _spender, uint _value) returns (bool success);    function allowance(address _owner, address _spender) constant returns (uint remaining);        //optional    function name() public view returns (string);    function symbol() public view returns (string);    function decimals() public view returns (uint8);        //events    event Transfer(address indexed _from, address indexed _to, uint _value);    event Approval(address indexed _owner, address indexed _spender, uint _value);}

    Required APIs#

    • totalSupply

    Returns the total token supply.

    • balanceOf

    Returns the account balance of another account with address _owner.

    • transfer

    Transfers _value amount of tokens to address _to, and MUST fire the Transfer event. The function SHOULD throw if the message caller's account balance does not have enough tokens to spend.

    Note Transfers of 0 values MUST be treated as normal transfers and fire the Transfer event.

    • approve

    Allows _spender to withdraw from your account multiple times, up to the _value amount. If this function is called again it overwrites the current allowance with _value..

    • transferFrom

    Transfers _value amount of tokens from address _from to address _to, and MUST fire the Transfer event.

    The transferFrom method is used for a withdraw workflow, allowing contracts to transfer tokens on your behalf. This can be used for example to allow a contract to transfer tokens on your behalf and/or to charge fees in sub-currencies. The function SHOULD throw unless the _from account has deliberately authorized the sender of the message via some mechanism.

    Note Transfers of 0 values MUST be treated as normal transfers and fire the Transfer event.

    • allowance

    Returns the amount which _spender is still allowed to withdraw from _owner.

    Optional APIs#

    • name

    Returns the name of the token - e.g. "MyToken".

    • symbol

    Returns the symbol of the token. E.g. "HAHA".

    • decimals

    Returns the number of decimals the token uses - e.g. 8, means to divide the token amount by 100000000 to get its user representation.

    Events#

    • Transfer

    MUST trigger when tokens are transferred, including zero value transfers.

    A token contract which creates new tokens SHOULD trigger a Transfer event with the _from address set to 0x0 when tokens are created.

    • Approval

    MUST trigger on any successful call to approve(address _spender, uint256 _value).

    Implementation#

    Refer OpenZeppelin implementation.

    View#

    It can be viewed via PlatON browser and also via ATON to view the PRC-20 contract transactions.

    Deploy#

    please refer to Solidity Contracts Getting Started Manual

    Invoking functions#

    Using python as an example:

    Installing Dependencies#

    Use the following command to install the PlatON python library,Python version 3.7.5+ is recommended:

    pip install client-sdk-python

    During the installation process, some dependency packages will require c++14 compilation, please download cppbuildtools after you see the relevant prompt, use the default value to install, and then re-execute the pip install command.

    Instantiation#

    from client_sdk_python import Web3, HTTPProvider
     rpc, chain_id, hrp = 'http://127.0.0.1:6789', 210425, 'lat'w3 = Web3(HTTPProvider(rpc), chain_id=chain_id, hrp_type=hrp)abi = []            # ABIprc20 = w3.eth.contract(address='contract address', abi=abi)# View all functions and events of the contractprint([func for func in prc20.functions])print([event for event in prc20.events])

    Query the total number of tokens issued#

    prc20.functions.totalSupply().call()

    Check the token balance of your account#

    prc20.functions.balanceOf('you address').call()

    Transfer#

    tx = {    'chainId': w3.chain_id,    'nonce': w3.eth.getTransactionCount('your address'),    'gas': 4012388,    'value': 0,    'gasPrice': 1000000000,}txn = prc20.functions.transfer(to='to address', value=1 * 10 ** 18).buildTransaction(tx)signed_txn = w3.eth.account.signTransaction(txn, private_key='your private key')tx_hash = w3.eth.sendRawTransaction(signed_txn.rawTransaction).hex()receipt = w3.eth.waitForTransactionReceipt(tx_hash)

    Get contract events#

    As an example of transfer transaction events, other events can be obtained in a similar way.

    events = prc20.events.Transfer().processReceipt(receipt)
    - + \ No newline at end of file diff --git a/en/PRC721_contract/index.html b/en/PRC721_contract/index.html index e7bb807c0..b45f84760 100644 --- a/en/PRC721_contract/index.html +++ b/en/PRC721_contract/index.html @@ -8,7 +8,7 @@ PRC-721 | PlatON - + @@ -19,7 +19,7 @@ rpc, chain_id, hrp = 'http://127.0.0.1:6789', 210425, 'lat'w3 = Web3(HTTPProvider(rpc), chain_id=chain_id, hrp_type=hrp)abi = [ { "inputs": [ { "internalType": "string", "name":"_name", "type": "string"} {"internalType": "string", "name":"_symbol", "type": "string"} ], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [ { "internalType": "address", "name": "_to", "type": "address" } {"internalType": "uint256", "name":"_tokenId", "type": "uint256"}, {"internalType": "uint256", "name":"_tokenId", "type": "uint256"}, {"internalType": "string", "name":"_uri", "type": "string"} ], "name": "mint", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{"internalType": "address", "name": "_owner", "type": "address"}], "name": "balanceOf", "outputs": [{"internalType": "uint256", "name": "", "type": "uint256"}], "stateMutability": "view", "type": "function" }, { "inputs": [{"internalType": "uint256", "name": "_tokenId", "type": "uint256"}], "name": "ownerOf", "outputs": [{"internalType": "address", "name": "_owner", "type": "address"}], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_from", "type": "address" } {"internalType": "address", "name":"_to", "type": "address"}, {"internalType": "address", "name":"_to", "type": "address"}, {"internalType": "address", "name":"_to", "type": "address"}, {"internalType": "uint256", "name":"_tokenId", "type": "uint256"}, {"internalType": "uint256", "name":"_tokenId", "type": "uint256"} ], "name": "safeTransferFrom", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "_from", "type": "address" } {"indexed": true, "internalType": "address", "name":"_to", "type": "address"}, "indexed": true, "internalType": "address", "name":"_to", "type": "address"}, {"indexed": true, "internalType": "uint256", "name":"_tokenId", "type": "uint256"} ], "name": "Transfer", "type": "event" },]prc721 = w3.eth.contract(address='contract address', abi=abi)# View all functions and events of the contractprint([func for func in prc721.functions])print([event for event in prc721.events])

    Query contract information#

    With balanceOf, ownerOf example, other query methods are similar to this.

    # Count the number of NFTs held by usersprc721.functions.balanceOf('your address').call()# Query the holder of NFTsprc721.functions.ownerOf('your token id').call()

    Sending contract transactions#

    Using the safeTransferFrom example, other transaction methods are similar to this.

    # Transfer ownership of NFT from one address to anothertx = {    'chainId': w3.chain_id,    'nonce': w3.eth.getTransactionCount('your address'),    'gas': 4012388,    'value': 0,    'gasPrice': 1000000000,}txn = prc721.functions.safeTransferFrom(_from='your address', _to='to address', _tokenId='your token id').buildTransaction(tx)signed_txn = w3.eth.account.signTransaction(txn, private_key='your private key')tx_hash = w3.eth.sendRawTransaction(signed_txn.rawTransaction).hex()receipt = w3.eth.waitForTransactionReceipt(tx_hash)

    Get contract events#

    Using the safeTransferFrom transaction event example, other event fetching methods are similar to this.

    events = prc721.events.Transfer().processReceipt(receiveipt)

    Upload Metadata to IPFS network#

    Metadata is the metadata of NFT tokens in order to display more detailed information about NFT assets, stored under the chain, generally the issuance of an NFT token will specify a URI path to the Metadata data of this token.

    1. Install IPFS#

    Refer to the IPFS installation instructions to install and start.

    2. Adding files to ipfs#

    Prepare an image, name it PlatON.jpeg, and upload it to the ipfs node

    $ ipfs add PlatON.jpegadd QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy PlatON.jpeg//QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy is the unique ID of the file, generated after adding it to ipfs

    If you open the link to the image in your browser and see the image, it means that the image was successfully downloaded: https://ipfs.io/ipfs/QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy?filename=PlatON.jpeg

    With the image link above, you can use it to construct the metadata for NFT.

    First, follow the instructions in the PRC-721 document metadata to create a json file named PlatON.json:

    {    "name": "PlatON.jpg",    "author": "PlatON",    "description": "use for prc721",    "image": "https://ipfs.io/ipfs/QmZtmD2qt6fJot32nabSP3CUjicnypEBz7bHVDhPQt9aAy?filename=PlatON.jpeg"}

    Upload to the ipfs node:

    $ ipfs add PlatON.jsonadded QmQXqTVCb1w7CmdsYxHWR1T1qyaCHHgWwiPmoZDcQL39Px PlatON.json

    Open the uri of the metadata file in your browser: https://ipfs.io/ipfs/QmQXqTVCb1w7CmdsYxHWR1T1qyaCHHgWwiPmoZDcQL39Px?filename=PlatON.json

    Above, the upload is complete.

    - + \ No newline at end of file diff --git a/en/Particle_Network_Integration_for_PlatON/index.html b/en/Particle_Network_Integration_for_PlatON/index.html index 0490cf2a9..9fcc31614 100644 --- a/en/Particle_Network_Integration_for_PlatON/index.html +++ b/en/Particle_Network_Integration_for_PlatON/index.html @@ -8,7 +8,7 @@ Integrating Particle Network within dApps on PlatON | PlatON - + @@ -37,7 +37,7 @@ notification.success({ message: txReceipt.transactionHash }) }; return ( <div className="App"> {!userInfo ? ( <div className="login-section"> <button className="sign-button" onClick={() => handleLogin('google')}>Sign in with Google</button> <button className="sign-button" onClick={() => handleLogin('twitter')}>Sign in with Twitter</button> </div> ) : ( <div className="profile-card"> <h2>{userInfo.name}</h2> <div className="balance-section"> <small>{balance} LAT</small> <button className="sign-message-button" onClick={executeTx}>Execute Transaction</button> <button className="disconnect-button" onClick={() => disconnect()}>Logout</button> </div> </div> )} </div> );}; export default App;

    Thus, Particle Network's Wallet-as-a-Service can be plugged in and used as you would any other standard wallet on PlatON, enabling social logins in just a few lines of code.

    Learn More#

    - + \ No newline at end of file diff --git a/en/PlaTrust-wallet-js-sdk-api/index.html b/en/PlaTrust-wallet-js-sdk-api/index.html index 35b883b7b..46d1656a8 100644 --- a/en/PlaTrust-wallet-js-sdk-api/index.html +++ b/en/PlaTrust-wallet-js-sdk-api/index.html @@ -8,7 +8,7 @@ PlaTrust Wallet js-sdk-API | PlatON - + @@ -16,7 +16,7 @@

    PlaTrust Wallet js-sdk-API

    1. Enumerations (enum)#

    1. Operation: Transaction call methods
    CALL: Cross-contract callDElEGATECALL: Cross-contract delegatecall
    1. SignatureMode: Signature composition modes
    guardians: Multi-signature must be wallet's guardian membersowner: Multi-signature must be wallet's owner memberssession: Single-signature under session mode without multi-signature

    2. Classes (class)#

    1. WalletLib: Wallet base library
    2. Bundler: Bundler RPC library
    3. Paymaster: Paymaster operation library
    4. UserOperation: Encapsulation of user operations structure
    5. Callbase: Base class for assembling wallet function calls in UserOperation
    6. ERC20: UserOperation entry for assembling ERC20 related function calls (Depends on Callbase class)
    7. ERC721: UserOperation entry for assembling ERC721 related function calls (Depends on Callbase class)
    8. ERC1155: UserOperation entry for assembling ERC1155 related function calls (Depends on Callbase class)
    9. LAT: UserOperation entry for assembling LAT transfer related function calls (Depends on Callbase class)

    3. Interfaces (interface)#

    1. ApproveToken: Encapsulation of ERC20 approve parameters
    2. ExecutionResult: Encapsulation of transaction normal execution results
    3. ValidationResult: Definition of the execution verification userOp result according to EIP-4337
    4. FailedOp: Exception information
    5. Result: Wrapper information for ExecutionResult, ValidationResult, and FailedOp
    6. StakeInfo: Staking information
    7. ReturnInfo: Gas and content returned when simulating a transaction
    8. EstimateUserOpGas: Estimation result of userOp gas
    9. ParsedTransaction: Encapsulation of transaction receipt
    10. UserOperationReceipt: Execution receipt information of userOp
    11. Logs: Encapsulation of transaction receipt logs

    4. Global Functions#

    1. encodeSignature: Encodes the signature information of userOp.
    encodeSignature(signatureMode, signature, validAfter?, validUntil?, aggregator?): string

    Input Parameters:

    Field NameTypeDescriptionRequired
    signatureModeBigNumberSignature mode, 0: owner; 1: guardians; 2: sessionY
    signaturestringHexadecimal signature informationY
    aggregatorstringAggregator address for aggregate signatures (optional)N
    validAfterBigNumberSignature's valid-after timestamp (optional)N
    validUntilBigNumberSignature's valid-until timestamp (optional)N

    Return Parameters:

    Field NameTypeDescription
    packedSignaturestringSignature information of userOp
    1. decodeSignature: Decodes the signature information of userOp.
    decodeSignature(packedSignature): Object

    Input Parameters:

    Field NameTypeDescriptionRequired
    packedSignaturestringSignature information of userOpY

    Return Parameters:

    | Field Name    | Type      | Description                                        || ------------- | --------- | -------------------------------------------------- || signatureMode | BigNumber | Signature mode, 0: owner; 1: guardians; 2: session || signature     | string    | Hexadecimal signature information                  || aggregator    | string    | Aggregator address for aggregate signatures        || validAfter    | BigNumber | Signature's valid-after timestamp                  || validUntil    | BigNumber | Signature's valid-until timestamp                  |
    1. packSignatureHash: Computes the signature information of a data hash.
    packSignatureHash(hash, signatureMode?, validAfter?, validUntil?, aggregator?): string

    Input Parameters:

    Field NameTypeDescriptionRequired
    hashstringData hash to be signedY
    signatureModeBigNumberSignature mode, 0: owner; 1: guardians; 2: sessionN
    aggregatorstringAggregator address for aggregate signatures (optional)N
    validAfterBigNumberSignature's valid-after timestamp (optional)N
    validUntilBigNumberSignature's valid-until timestamp (optional)N

    Return Parameters:

    Field NameTypeDescription
    _hashstringkeccak256(abi.encodePacked(hash,signatureMode,aggregator&validAfter&validUntil))
    1. recoverAddress: Resolves the signer's account address.
    recoverAddress(msg, signature): string

    Input Parameters:

    Field NameTypeDescriptionRequired
    msgstringData used for signingY
    signaturestringSignature informationY

    Return Parameters:

    Field NameTypeDescription
    -stringSigner's account address
    1. signMessage: Signs a message using a private key.
    signMessage(msg, privateKey): string

    Input Parameters:

    Field NameTypeDescriptionRequired
    msgstringMessage to be signedY
    privateKeystringPrivate keyY

    Return Parameters:

    Field NameTypeDescription
    -stringSignature

    5. WalletLib External Functions#

    1. Constructor
    new WalletLib(singletonFactory?)

    Input:

    Field NameTypeDescriptionRequired
    singletonFactorystringWallet factory contract addressNo

    Output:

    WalletLib

    1. singletonFactory Get the wallet's factory contract address
    singletonFactory(): string

    Input:

    None

    Output:

    Field NameTypeDescription
    -stringWallet factory contract address
    1. getInitCode Get the wallet's initCode
    getInitCode(walletFactory, walletLogic, initializer, salt): string

    Input:

    Field NameTypeDescriptionRequired
    walletFactorystringWallet factory contract addressYes
    walletLogicstringWallet logic contract addressYes
    initializerstringWallet initialization encoding (setUp function encoding)Yes
    saltstringSalt (controls create2-generated wallet address)Yes

    Output:

    Field NameTypeDescription
    -stringWallet's initCode
    1. getNonce Get the wallet's nonce value
    getNonce(walletAddress, etherProvider, defaultBlock?): Promise<number>

    Input:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet contract addressYes
    etherProviderethers.providers.BaseProviderethers.js provider (e.g., ethers.provider)Yes
    defaultBlockstringearliest, latest, pending, default: latestNo

    Output:

    Field NameTypeDescription
    -numberWallet's nonce value
    1. getPaymasterData Get the paymaster call information for assembling userOp
    getPaymasterData(payMasterAddress, token, maxCost): string

    Input:

    Field NameTypeDescriptionRequired
    payMasterAddressstringPaymaster addressYes
    tokenstringPaymaster's accepted token addressYes
    maxCostBigNumberMaximum costYes

    Output:

    Field NameTypeDescription
    -numberPaymaster call information
    1. getSetupCode Get the setup call encoding for the wallet instance
    getSetupCode(entryPoint, owners, threshold, to, data, fallbackHandler, lockPeriod): string

    Input:

    Field NameTypeDescriptionRequired
    entryPointstringEntryPoint contract addressYes
    ownersstring[]Multiple owners of the wallet, at least one is requiredYes
    thresholdBigNumberMultisig threshold of the wallet ownersYes
    tostring'to' parameter for the module call in the walletYes
    datastring'calldata' information for the module call in the wallet (in hexadecimal)Yes
    fallbackHandlerstringWallet's fallback handler contract addressYes
    lockPeriodBigNumberWallet's lock duration, [recommended to be 1 week] (unit: ms)Yes

    Output:

    Field NameTypeDescription
    -stringSetup call encoding
    1. getWalletCode Get the wallet's deployment encoding
    getWalletCode(walletLogicAddress, walletProxyConfig?): string

    Input:

    Field NameTypeDescriptionRequired
    walletLogicAddressstringWallet logic contract addressYes
    walletProxyConfigstructProxy configuration (including proxy's ABI and proxy's bytecode)No

    Output:

    Field NameTypeDescription
    -stringActual walletproxy encoding (includes the bytecode from walletProxyConfig)
    1. activateWalletOp Assemble userOp for deploying the wallet
    activateWalletOp(walletLogic, initializer, paymasterAndData, salt, walletFactory, maxFeePerGas, maxPriorityFeePerGas, callGasLimit, verificationGasLimit, preVerificationGas): UserOperation

    Input:

    Field NameTypeDescriptionRequired
    walletLogicstringWallet logic contract addressYes
    initializerstringInitialization function call encoding for the walletYes
    paymasterAndDatastringPaymaster call informationYes
    saltstringSalt (controls create2-generated wallet address)Yes
    walletFactorystringWallet factory contract addressYes
    maxFeePerGasnumberMaximum fee per gas (similar to EIP-1559 max_fee_per_gas)Yes
    maxPriorityFeePerGasnumberMaximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas)Yes
    callGasLimitnumberGas allocated for the main execution call (calculated locally, executing callData's gas)Yes
    verificationGasLimitnumberGas allocated for the verification step (used in functions validateUserOp()/validatePaymasterUserOp())Yes
    preVerificationGasnumberGas paid for compensating pre-verification execution and call data bundling (extra gas prepared to handle some routine logic gas consumption)Yes

    Output:

    Field NameTypeDescription
    -UserOperationAssembled userOp
    1. calculateWalletAddress Calculate the wallet address (create2-generated address)
    calculateWalletAddress(walletLogic, initializer, salt, walletFactory): string

    Input:

    Field NameTypeDescriptionRequired
    walletLogicstringWallet logic contract addressYes
    initializerstringInitialization function call encoding for the walletYes
    saltstringSalt (controls create2-generated wallet address)Yes
    walletFactorystringWallet factory contract addressYes

    Output:

    Field NameTypeDescription
    -stringWallet address
    1. addOwnerWithThresholdOp Add a wallet owner and update the multisig threshold
    addOwnerWithThresholdOp(walletAddress, etherProvider, owner, threshold, paymasterAndData, maxFeePerGas, maxPriorityFeePerGas, callGasLimit, verificationGasLimit, preVerificationGas): Promise<UserOperation>

    Input:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressYes
    etherProviderethers.providers.BaseProviderethers.js provider (e.g., ethers.provider)Yes
    ownerstringNew wallet ownerYes
    thresholdnumberWallet multisig thresholdYes
    paymasterAndDatastringPaymaster contract address and data sent to paymaster, currently, the implementation of paymaster is not clear, if we use our own paymaster, this value is not required, fixed to 0x0No
    maxFeePerGasnumberMaximum fee per gas (similar to EIP-1559 max_fee_per_gas)No
    maxPriorityFeePerGasnumberMaximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas)No
    callGasLimitnumberGas allocated for the main execution call (calculated locally, executing callData's gas)No
    verificationGasLimitnumberGas allocated for the verification step (used in functions validateUserOp()/validatePaymasterUserOp())No
    preVerificationGasnumberGas paid for compensating pre-verification execution and call data bundling (extra gas prepared to handle some routine logic gas consumption)No

    Output:

    Field NameTypeDescription
    -UserOperationAssembled userOp
    1. changeThresholdOp Update the multisig threshold
    changeThresholdOp(walletAddress, etherProvider, threshold, paymasterAndData, maxFeePerGas, maxPriorityFeePerGas, callGasLimit, verificationGasLimit, preVerificationGas): Promise<UserOperation>

    Input:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressYes
    etherProviderethers.providers.BaseProviderethers.js provider (e.g., ethers.provider)Yes
    thresholdnumberWallet multisig thresholdYes
    paymasterAndDatastringPaymaster contract address and data sent to paymaster, currently, the implementation of paymaster is not clear, if we use our own paymaster, this value is not required, fixed to 0x0No
    maxFeePerGasnumberMaximum fee per gas (similar to EIP-1559 max_fee_per_gas)No
    maxPriorityFeePerGasnumberMaximum priority fee per gas (similar to EIP-1559 max_priority_fee_per_gas)No
    callGasLimitnumberGas allocated for the main execution call (calculated locally, executing callData's gas)No
    verificationGasLimitnumberGas allocated for the verification step (used in functions validateUserOp()/validatePaymasterUserOp())No
    preVerificationGasnumberGas paid for compensating pre-verification execution and call data bundling (extra gas prepared to handle some routine logic gas consumption)No

    Output:

    Field NameTypeDescription
    -UserOperationAssembled userOp
    1. getThreshold - Get the threshold of the wallet's multisig.

    getThreshold(walletAddress, etherProvider): Promise

    markdown Copy code

    Input Parameters:

    FieldTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY

    Return Parameters:

    FieldTypeDescription
    -numberMultisig threshold
    1. swapOwnerOp - Replace an owner of a wallet.
    swapOwnerOp(walletAddress, etherProvider, prevOwner, oldOwner, newOwner, paymasterAndData, maxFeePerGas, maxPriorityFeePerGas, callGasLimit, verificationGasLimit, preVerificationGas): Promise<UserOperation>

    Input Parameters:

    FieldTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY
    prevOwnerstringPrevious owner of the owner to be replacedY
    oldOwnerstringOwner to be replacedY
    newOwnerstringNew ownerY
    paymasterAndDatastringPaymaster contract address and data to send to it (currently unclear implementation of paymaster, set to 0x0 if using our own paymaster)N
    maxFeePerGasnumberMaximum fee per gas for each type of gas (similar to EIP-1559 max_fee_per_gas)N
    maxPriorityFeePerGasnumberMaximum priority fee per gas for each type of gas (similar to EIP-1559 max_priority_fee_per_gas)N
    callGasLimitnumberGas allocated for main execution call (simulated locally, gas for executing callData)N
    verificationGasLimitnumberGas allocated for verification steps (used in functions validateUserOp()/validatePaymasterUserOp())N
    preVerificationGasnumberGas paid for compensating pre-verification execution and call data bundler (extra gas to handle regular gas consumption, e.g., in loops)N

    Return Parameters:

    FieldTypeDescription
    -UserOperationAssembled userOp
    1. removeOwnerOp - Remove an owner from the wallet.
    removeOwnerOp(walletAddress, etherProvider, prevOwner, owner, threshold, paymasterAndData, maxFeePerGas, maxPriorityFeePerGas, callGasLimit, verificationGasLimit, preVerificationGas): Promise<UserOperation>

    Input Parameters:

    FieldTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY
    prevOwnerstringPrevious owner of the owner to be removedY
    ownerstringOwner to be removedY
    thresholdnumberNew multisig threshold (if no update needed, provide the old value)Y
    paymasterAndDatastringPaymaster contract address and data to send to it (currently unclear implementation of paymaster, set to 0x0 if using our own paymaster)N
    maxFeePerGasnumberMaximum fee per gas for each type of gas (similar to EIP-1559 max_fee_per_gas)N
    maxPriorityFeePerGasnumberMaximum priority fee per gas for each type of gas (similar to EIP-1559 max_priority_fee_per_gas)N
    callGasLimitnumberGas allocated for main execution call (simulated locally, gas for executing callData)N
    verificationGasLimitnumberGas allocated for verification steps (used in functions validateUserOp()/validatePaymasterUserOp())N
    preVerificationGasnumberGas paid for compensating pre-verification execution and call data bundler (extra gas to handle regular gas consumption, e.g., in loops)N

    Return Parameters:

    FieldTypeDescription
    -UserOperationAssembled userOp
    1. getOwners - Get the list of owners of the wallet.
    getOwners(walletAddress, etherProvider): Promise<Array<string>>

    Input Parameters:

    FieldTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY

    Return Parameters:

    FieldTypeDescription
    -Array\<string>List of wallet owners
    1. isOwner - Check if an account is an owner of the wallet.
    isOwner(owner, walletAddress, etherProvider): Promise<boolean>

    Input Parameters:

    FieldTypeDescriptionRequired
    ownerstringAccount address to be checkedY
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY

    Return Parameters:

    FieldTypeDescription
    -booleanWhether it is a wallet owner
    1. startSessionOp - Start a multisig-free session.
    startSessionOp(walletAddress, etherProvider, sessionUser, duration, paymasterAndData, maxFeePerGas, maxPriorityFeePerGas, callGasLimit, verificationGasLimit, preVerificationGas): Promise<UserOperation>

    Input Parameters:

    FieldTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY
    sessionUserstringOwner of the wallet sessionY
    durationnumberValid duration of the wallet session (in ms)Y
    paymasterAndDatastringPaymaster contract address and data to send to it (currently unclear implementation of paymaster, set to 0x0 if using our own paymaster)N
    maxFeePerGasnumberMaximum fee per gas for each type of gas (similar to EIP-1559 max_fee_per_gas)N
    maxPriorityFeePerGasnumberMaximum priority fee per gas for each type of gas (similar to EIP-1559 max_priority_fee_per_gas)N
    callGasLimitnumberGas allocated for main execution call (simulated locally, gas for executing callData)N
    verificationGasLimitnumberGas allocated for verification steps (used in functions validateUserOp()/validatePaymasterUserOp())N
    preVerificationGasnumberGas paid for compensating pre-verification execution and call data bundler (extra gas to handle regular gas consumption, e.g., in loops)N

    Return Parameters:

    FieldTypeDescription
    -UserOperationAssembled userOp
    1. clearSessionOp - End a multisig-free session.
    clearSessionOp(walletAddress, etherProvider, paymasterAndData, maxFeePerGas, maxPriorityFeePerGas, callGasLimit, verificationGasLimit, preVerificationGas): Promise<UserOperation>

    Input Parameters:

    FieldTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY
    paymasterAndDatastringPaymaster contract address and data to send to it (currently unclear implementation of paymaster, set to 0x0 if using our own paymaster)N
    maxFeePerGasnumberMaximum fee per gas for each type of gas (similar to EIP-1559 max_fee_per_gas)N
    maxPriorityFeePerGasnumberMaximum priority fee per gas for each type of gas (similar to EIP-1559 max_priority_fee_per_gas)N
    callGasLimitnumberGas allocated for main execution call (simulated locally, gas for executing callData)N
    verificationGasLimitnumberGas allocated for verification steps (used in functions validateUserOp()/validatePaymasterUserOp())N
    preVerificationGasnumberGas paid for compensating pre-verification execution and call data bundler (extra gas to handle regular gas consumption, e.g., in loops)N

    Return Parameters:

    FieldTypeDescription
    -UserOperationAssembled userOp
    1. enableModuleOp - Enable a module.
    enableModuleOp(walletAddress, etherProvider, module, paymasterAndData, maxFeePerGas, maxPriorityFeePerGas, callGasLimit, verificationGasLimit, preVerificationGas): Promise<UserOperation>

    Input Parameters:

    FieldTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY
    modulestringModule addressY
    paymasterAndDatastringPaymaster contract address and data to send to it (currently unclear implementation of paymaster, set to 0x0 if using our own paymaster)N
    maxFeePerGasnumberMaximum fee per gas for each type of gas (similar to EIP-1559 max_fee_per_gas)N
    maxPriorityFeePerGasnumberMaximum priority fee per gas for each type of gas (similar to EIP-1559 max_priority_fee_per_gas)N
    callGasLimitnumberGas allocated for main execution call (simulated locally, gas for executing callData)N
    verificationGasLimitnumberGas allocated for verification steps (used in functions validateUserOp()/validatePaymasterUserOp())N
    preVerificationGasnumberGas paid for compensating pre-verification execution and call data bundler (extra gas to handle regular gas consumption, e.g., in loops)N

    Return Parameters:

    FieldTypeDescription
    -UserOperationAssembled userOp
    1. disableModuleOp - Disable a module.
    disableModuleOp(walletAddress, etherProvider, prevModule, module, paymasterAndData, maxFeePerGas, maxPriorityFeePerGas, callGasLimit, verificationGasLimit, preVerificationGas): Promise<UserOperation>

    Input Parameters:

    FieldTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY
    prevModulestringPrevious module address to be disabledY
    modulestringModule address to be disabledY
    paymasterAndDatastringPaymaster contract address and data to send to it (currently unclear implementation of paymaster, set to 0x0 if using our own paymaster)N
    maxFeePerGasnumberMaximum fee per gas for each type of gas (similar to EIP-1559 max_fee_per_gas)N
    maxPriorityFeePerGasnumberMaximum priority fee per gas for each type of gas (similar to EIP-1559 max_priority_fee_per_gas)N
    callGasLimitnumberGas allocated for main execution call (simulated locally, gas for executing callData)N
    verificationGasLimitnumberGas allocated for verification steps (used in functions validateUserOp()/validatePaymasterUserOp())N
    preVerificationGasnumberGas paid for compensating pre-verification execution and call data bundler (extra gas to handle regular gas consumption, e.g., in loops)N

    Return Parameters:

    FieldTypeDescription
    -UserOperationAssembled userOp
    1. isEnabledModule - Check if an address is a valid module.
    isEnabledModule(module, walletAddress, etherProvider): Promise<boolean>

    Input Parameters:

    FieldTypeDescriptionRequired
    modulestringModule addressY
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY

    Return Parameters:

    FieldTypeDescription
    -booleanWhether it is a valid module
    1. isEnabledModules - Check a group of addresses for valid modules.
    isEnabledModules(modules, walletAddress, etherProvider): Promise<boolean>

    Input Parameters:

    FieldTypeDescriptionRequired
    modulesstring[]A group of module addressesY
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY

    Return Parameters:

    FieldTypeDescription
    -booleanWhether all are valid modules
    1. getModulesPaginated Paginated retrieval of an array of modules
    getModulesPaginated(start: string, pageSize: number, walletAddress: string, etherProvider: ethers.providers.BaseProvider): Promise<any[]>

    Input Parameter:

    Field NameTypeDescriptionRequired
    startstringStarting address of the paginationY
    pageSizenumberPage sizeY
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderEthers.js provider, e.g., ethers.providerY

    Return Parameter:

    Field NameTypeDescription
    -any[]Array of modules returned, and the address of the next page of modules (The first element is the list of modules, and the second element is the address of the next page)
    1. lockWalletOp Lock the wallet
    lockWalletOp(walletAddress: string, etherProvider: ethers.providers.BaseProvider, paymasterAndData: string, maxFeePerGas: number, maxPriorityFeePerGas: number, callGasLimit: number, verificationGasLimit: number, preVerificationGas: number): Promise<UserOperation>

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderEthers.js provider, e.g., ethers.providerY
    paymasterAndDatastringPaymaster contract address and data sent to paymaster (The current implementation of paymaster is not yet clear. If we use our own paymaster, this value is not required and can be fixed to 0x0.)N
    maxFeePerGasnumberMaximum fee per unit of gas, similar to EIP-1559 max_fee_per_gasN
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, similar to EIP1559 max_priority_fee_per_gasN
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)N
    verificationGasLimitnumberGas allocated for the verification step (used in functions validateUserOp() and validatePaymasterUserOp())N
    preVerificationGasnumberGas paid for compensating the pre-verification execution and call data bundler (additional gas reserved to deal with some regular gas consumption, such as loops)N

    Return Parameter:

    Field NameTypeDescription
    -UserOperationAssembled UserOperation
    1. unlockWalletOp Unlock the wallet
    unlockWalletOp(walletAddress: string, etherProvider: ethers.providers.BaseProvider, paymasterAndData: string, maxFeePerGas: number, maxPriorityFeePerGas: number, callGasLimit: number, verificationGasLimit: number, preVerificationGas: number): Promise<UserOperation>

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderEthers.js provider, e.g., ethers.providerY
    paymasterAndDatastringPaymaster contract address and data sent to paymaster (The current implementation of paymaster is not yet clear. If we use our own paymaster, this value is not required and can be fixed to 0x0.)N
    maxFeePerGasnumberMaximum fee per unit of gas, similar to EIP-1559 max_fee_per_gasN
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, similar to EIP1559 max_priority_fee_per_gasN
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)N
    verificationGasLimitnumberGas allocated for the verification step (used in functions validateUserOp() and validatePaymasterUserOp())N
    preVerificationGasnumberGas paid for compensating the pre-verification execution and call data bundler (additional gas reserved to deal with some regular gas consumption, such as loops)N

    Return Parameter:

    Field NameTypeDescription
    -UserOperationAssembled UserOperation
    1. isLocked Verify if the wallet is locked
    isLocked(walletAddress: string, etherProvider: ethers.providers.BaseProvider): Promise<boolean>

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderEthers.js provider, e.g., ethers.providerY

    Return Parameter:

    Field NameTypeDescription
    -booleanWhether the wallet is locked or not (true: locked; false: not locked)
    1. getLock Retrieve the lock duration of the wallet

    getLock(walletAddress: string, etherProvider: ethers.providers.BaseProvider): Promise Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderEthers.js provider, e.g., ethers.providerY

    Return Parameter:

    Field NameTypeDescription
    -numberLock duration of the wallet (in ms)
    1. setFallbackHandlerOp Set the wallet's fallback handler for additional functionalities
    setFallbackHandlerOp(walletAddress: string, etherProvider: ethers.providers.BaseProvider, handler: string, paymasterAndData: string, maxFeePerGas: number, maxPriorityFeePerGas: number, callGasLimit: number, verificationGasLimit: number, preVerificationGas: number): Promise<UserOperation>

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderEthers.js provider, e.g., ethers.providerY
    handlerstringWallet extension contract addressY
    paymasterAndDatastringPaymaster contract address and data sent to paymaster (The current implementation of paymaster is not yet clear. If we use our own paymaster, this value is not required and can be fixed to 0x0.)N
    maxFeePerGasnumberMaximum fee per unit of gas, similar to EIP-1559 max_fee_per_gasN
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, similar to EIP1559 max_priority_fee_per_gasN
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)N
    verificationGasLimitnumberGas allocated for the verification step (used in functions validateUserOp() and validatePaymasterUserOp())N
    preVerificationGasnumberGas paid for compensating the pre-verification execution and call data bundler (additional gas reserved to deal with some regular gas consumption, such as loops)N

    Return Parameter:

    Field NameTypeDescription
    -UserOperationAssembled UserOperation
    1. getEntryPoint Retrieve the EntryPoint address of the wallet
    getEntryPoint(walletAddress: string, etherProvider: ethers.providers.BaseProvider): Promise<string>

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderEthers.js provider, e.g., ethers.providerY

    Return Parameter:

    Field NameTypeDescription
    -stringEntryPoint address
    1. withdrawDepositOp Withdraw the wallet's own pledge to the amount advanced to the EntryPoint
    withdrawDepositOp(walletAddress: string, etherProvider: ethers.providers.BaseProvider, withdrawAddress: string, amount: number, paymasterAndData: string, maxFeePerGas: number, maxPriorityFeePerGas: number, callGasLimit: number, verificationGasLimit: number, preVerificationGas: number): Promise<UserOperation>

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderEthers.js provider, e.g., ethers.providerY
    withdrawAddressstringWithdraw addressY
    amountnumberAmount of the pledge to be withdrawnY
    paymasterAndDatastringPaymaster contract address and data sent to paymaster (The current implementation of paymaster is not yet clear. If we use our own paymaster, this value is not required and can be fixed to 0x0.)N
    maxFeePerGasnumberMaximum fee per unit of gas, similar to EIP-1559 max_fee_per_gasN
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, similar to EIP1559 max_priority_fee_per_gasN
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)N
    verificationGasLimitnumberGas allocated for the verification step (used in functions validateUserOp() and validatePaymasterUserOp())N
    preVerificationGasnumberGas paid for compensating the pre-verification execution and call data bundler (additional gas reserved to deal with some regular gas consumption, such as loops)N

    Return Parameter:

    Field NameTypeDescription
    -UserOperationAssembled UserOperation
    1. addDeposit Pledge the wallet's own deposit to the EntryPoint
    addDeposit(walletAddress: string, signer: ethers.Wallet, value: string): Promise<any>

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    signerethers.WalletEthers.js WalletY
    valuestringThe amount of the pledgeY

    Return Parameter:

    None

    1. getDeposit Query the balance of the wallet's own deposit
    getDeposit(walletAddress: string, etherProvider: ethers.providers.BaseProvider): Promise<number>

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet proxy contract addressY
    etherProviderethers.providers.BaseProviderEthers.js provider, e.g., ethers.providerY

    Return Parameter:

    Field NameTypeDescription
    -numberBalance of the wallet's own deposit

    6. Bundler External Functions#

    1. Constructor
    new Bundler(entryPoint: string, etherProvider: ethers.providers.BaseProvider, bundlerApiURL: string, timeout?: ApiTimeOut)

    Input Parameters:

    NameTypeDescriptionRequired
    entryPointstringAddress of the entryPoint contractY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY
    bundlerApiURLstringURL of the bundlerY
    timeoutApiTimeOutTimeout options: web3ApiRequestTimeout, web3ApiResponseTimeout, bundlerApiRequestTimeout, bundlerApiResponseTimeoutN

    Return Parameters:

    NameTypeDescription
    -BundlerBundler object
    1. platon_chainId (EIP-4337 specification) - Returns the EIP-155 chain ID
    platon_chainId(timeout?: number): Promise<string>

    Input Parameters:

    NameTypeDescriptionRequired
    timeoutnumberTimeoutN

    Return Parameters:

    NameTypeDescription
    -stringChain ID
    1. platon_estimateUserOperationGas (EIP-4337 specification) - Estimates gas for UserOperation
    platon_estimateUserOperationGas(userOp: UserOperation, timeout?: number): Promise<EstimateUserOpGas>

    Input Parameters:

    NameTypeDescriptionRequired
    userOpUserOperationUserOperation objectY
    timeoutnumberTimeoutN

    Return Parameters:

    NameTypeDescription
    -EstimateUserOpGasGas estimation result
    1. platon_getUserOperationByHash (EIP-4337 specification) - Returns a UserOperation based on the hash returned by eth_sendUserOperation
    platon_getUserOperationByHash(userOpHash: string, timeout?: number): Promise<null | UserOperationReceipt>

    Input Parameters:

    NameTypeDescriptionRequired
    userOpHashstringUserOp's hashY
    timeoutnumberTimeoutN

    Return Parameters:

    NameTypeDescription
    -UserOperationReceiptEIP-4337 specification-defined response
    1. platon_getUserOperationReceipt (EIP-4337 specification) - Returns a UserOperation receipt based on the hash returned by eth_sendUserOperation
    platon_getUserOperationReceipt(userOpHash: string, timeout?: number): Promise<null | UserOperationReceipt>

    Input Parameters:

    NameTypeDescriptionRequired
    userOpHashstringUserOp's hashY
    timeoutnumberTimeoutN

    Return Parameters:

    NameTypeDescription
    -UserOperationReceiptEIP-4337 specification-defined response
    1. platon_sendUserOperation (EIP-4337 specification) - Submits a UserOperation object to the bundler's User Operation pool
    platon_sendUserOperation(userOp: UserOperation, timeout?: number): Promise<string>

    Input Parameters:

    NameTypeDescriptionRequired
    userOpUserOperationUserOperation informationY
    timeoutnumberTimeoutN

    Return Parameters:

    NameTypeDescription
    -stringEIP-4337 userOpHash
    1. platon_supportedEntryPoints (EIP-4337 specification) - Returns an array of entryPoint contract addresses supported by the bundler
    platon_supportedEntryPoints(timeout?: number): Promise<string[]>

    Input Parameters:

    NameTypeDescriptionRequired
    timeoutnumberTimeoutN

    Return Parameters:

    NameTypeDescription
    -string[]Array of entryPoint contract addresses
    1. sendUserOperation Submits a UserOperation object to the bundler's User Operation pool and appends a listener
    sendUserOperation(userOp: UserOperation, timeout?: number, receiptTimeout?: number, receiptInterval?: number): EventEmitter

    Input Parameters:

    NameTypeDescriptionRequired
    userOpUserOperationUserOperation informationY
    timeoutnumberTimeout for bundler requestN
    receiptTimeoutnumberTimeout for listenerN
    receiptIntervalnumberListener intervalN

    Return Parameters:

    NameTypeDescription
    -EventEmitterJS event listener
    1. simulateHandleOp Simulates the execution of a userOp
    simulateHandleOp(op: UserOperation, target?: string, targetCallData?: string): Promise<Result>

    Input Parameters:

    NameTypeDescriptionRequired
    opUserOperationUserOperation informationY
    targetstringTarget address if non-zero, indicating a call to be made after the userOp simulation. If called, targetSuccess and TargetResult are set to the return value of the callN
    targetCallDatastringCallData to be passed to the target addressN

    Return Parameters:

    NameTypeDescription
    -ResultExecution result
    1. simulateValidation Simulates the validation of a userOp
    simulateValidation(op: UserOperation): Promise<Result>

    Input Parameters:

    NameTypeDescriptionRequired
    opUserOperationUserOperation informationY

    Return Parameters:

    NameTypeDescription
    -ResultExecution result

    7. Paymaster External Functions#

    1. Constructor
    new Paymaster(payMasterAddress: string, wallet: ethers.Wallet)

    Input Parameters:

    NameTypeDescriptionRequired
    payMasterAddressstringPaymaster addressY
    walletethers.Walletethers.js wallet instance (owner of the paymaster)Y

    Return Parameters:

    NameTypeDescription
    -PaymasterPaymaster object
    1. addSupportedToken Add supported token category
    addSupportedToken(token: string, priceOracle: string): Promise<any>

    Input Parameters:

    NameTypeDescriptionRequired
    tokenstringToken addressY
    priceOraclestringToken's price oracle addressY

    Return Parameters:

    NameTypeDescription
    -transaction receiptTransaction receipt
    1. removeSupportedToken Remove supported token category
    removeSupportedToken(token: string): Promise<any>

    Input Parameters:

    NameTypeDescriptionRequired
    tokenstringToken addressY

    Return Parameters:

    NameTypeDescription
    -transaction receiptTransaction receipt
    1. paymasterSupportedToken Check supported token category
    paymasterSupportedToken(tokens: string[]): Promise<string[]>

    Input Parameters:

    NameTypeDescriptionRequired
    tokensstring[]Token addressesY

    Return Parameters:

    NameTypeDescription
    -string[]Token addresses
    1. entryPoint Get the entrypoint contract address of the paymaster
    entryPoint(): Promise<any>

    Input Parameters:

    NameTypeDescriptionRequired
    --None-

    Return Parameters:

    NameTypeDescription
    -addressEntrypoint address
    1. addStake Add stake
    addStake(extraUnstakeDelaySec: number, value: string): Promise<any>

    Input Parameters:

    NameTypeDescriptionRequired
    extraUnstakeDelaySecnumberDelay in seconds for unstakingY
    valuestringHex value of the staking amount (in lat)Y

    Return Parameters:

    NameTypeDescription
    -transaction receiptTransaction receipt
    1. deposit Add deposit amount
    deposit(value: string): Promise<any>

    Input Parameters:

    NameTypeDescriptionRequired
    valuestringHex value of the deposit amount (in lat)Y

    Return Parameters:

    NameTypeDescription
    -transaction receiptTransaction receipt
    1. unlockStake Unlock stake
    unlockStake(): Promise<any>

    Input Parameters:

    NameTypeDescriptionRequired
    --None-

    Return Parameters:

    NameTypeDescription
    -transaction receiptTransaction receipt
    1. withdrawStake Withdraw stake amount
    withdrawStake(withdrawAddress: string): Promise<any>

    Input Parameters:

    NameTypeDescriptionRequired
    withdrawAddressstringAccount address to receive the withdrawn stakeY

    Return Parameters:

    NameTypeDescription
    -transaction receiptTransaction receipt
    1. withdrawTo Withdraw deposit amount
    withdrawTo(withdrawAddress: string, amount: string): Promise<any>

    Input Parameters:

    NameTypeDescriptionRequired
    withdrawAddressstringAccount address to receive the withdrawn depositY
    amountstringHex value of the withdrawn deposit amount (in lat)Y

    Return Parameters:

    NameTypeDescription
    -transaction receiptTransaction receipt
    1. withdrawToken Withdraw compensated tokens
    withdrawToken(token: string, to: string, amount: string): Promise<any>

    Input Parameters:

    NameTypeDescriptionRequired
    tokenstringToken address to be withdrawnY
    tostringAccount address to receive the withdrawn tokensY
    amountstringAmount of tokens to be withdrawn (in lat)Y

    Return Parameters:

    NameTypeDescription
    -transaction receiptTransaction receipt
    1. getDeposit Get remaining deposit balance
    getDeposit(): Promise<any>

    Input Parameters:

    NameTypeDescriptionRequired
    --None-

    Return Parameters:

    NameTypeDescription
    -numberDeposit balance
    1. getExchangePrice Get token price information
    getExchangePrice(token: string, fetchTokenDecimals?: boolean): Promise<{ decimals: number; price: BigNumber; tokenDecimals: undefined | number }>

    Input Parameters:

    NameTypeDescriptionRequired
    tokenstringToken addressY
    fetchTokenDecimalsbooleanWhether to fetch token decimalsN

    Return Parameters:

    NameTypeDescription
    priceBigNumberToken price
    decimalsnumberToken price decimals
    tokenDecimalsnumberToken decimals

    8. UserOperation External Functions#

    1. Constructor
    new UserOperation(sender?, nonce?, initCode?, callData?, callGasLimit?, maxFeePerGas?, maxPriorityFeePerGas?, paymasterAndData?, verificationGasLimit?, preVerificationGas?, signature?)

    Return Parameters:

    Field NameTypeDescriptionRequired
    senderstringWallet address that performs the operation (the address of the wallet contract, but the sender's EOA address during the first deployment)N
    noncenumberAnti-replay parameter set in the wallet, also used as salt for the initial creation of the walletN
    initCodestringAll wallet creation in this design is deployed by the predefined wallet template contract (EIP-1167), so this field is emptyN
    callDatastringData passed by the sender to the main execution call (opcode converted by the wallet from the user's request)N
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)N
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)N
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)N
    paymasterAndDatastringPaymaster contract address and data sent to the paymaster, the implementation of the paymaster is not clear yet, and if we use our own paymaster, this value is not needed, set to 0x0N
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())N
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)N
    signaturestringSignatures of multiple Owners, multiple Owners sign the UserOperationN

    Return Parameter:

    UserOperation

    1. addSupportedToken Serialize UserOperation
    Serialized(): void

    Input Parameter:

    None

    Return Parameter:

    None

    1. callDataCost Calculate the call cost
    callDataCost(): number

    Input Parameter:

    None

    Return Parameter:

    Field NameTypeDescription
    -BigNumberCall cost
    1. getStruct Get the serialized UserOperation
    getStruct(): SerializedUserOperation

    Input Parameter:

    None

    Return Parameter:

    Field NameTypeDescription
    senderstringWallet address that performs the operation (the address of the wallet contract, but the sender's EOA address during the first deployment)
    noncenumberAnti-replay parameter set in the wallet, also used as salt for the initial creation of the wallet
    initCodestringAll wallet creation in this design is deployed by the predefined wallet template contract (EIP-1167), so this field is empty
    callDatastringData passed by the sender to the main execution call (opcode converted by the wallet from the user's request)
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)
    paymasterAndDatastringPaymaster contract address and data sent to the paymaster, the implementation of the paymaster is not clear yet, and if we use our own paymaster, this value is not needed, set to 0x0
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)
    signaturestringSignatures of multiple Owners, multiple Owners sign the UserOperation
    1. getUserOpHash Get UserOperation Hash
    getUserOpHash(entryPointAddress, chainId): string

    Input Parameter:

    Field NameTypeDescriptionRequired
    entryPointAddressstringEntrypoint contract addressY
    chainIdnumberChain IDY

    Return Parameter:

    Field NameTypeDescription
    -stringUserOperation hash value
    1. getUserOpHashFromContract Get UserOperation Hash
    getUserOpHashFromContract(entryPointAddress, etherProvider, defaultBlock?): Promise<string>

    Input Parameter:

    Field NameTypeDescriptionRequired
    entryPointAddressstringEntrypoint contract addressY
    etherProviderethers.providers.BaseProviderethers.js provider, e.g., ethers.providerY
    defaultBlockstring'earliest', 'latest', 'pending', default: 'latest'N

    Return Parameter:

    Field NameTypeDescription
    -stringUserOperation hash value
    1. packUserOp Assemble EIP-712 information of UserOperation
    packUserOp(forSignature?): string

    Input Parameter:

    Field NameTypeDescriptionRequired
    forSignaturebooleanWhether it is for computing the EIP-712 information for signature value, true: does not include the signature value; false: includes the signature valueN

    Return Parameter:

    Field NameTypeDescription
    -stringEIP-712 information of UserOperation
    1. signWithSignature Fill in the value of the 'signature' field of UserOperation based on the signature, signature mode, validity period start time, and validity period end time
    signWithSignature(signature, signatureMode?, validAfter?, validUntil?): void

    Input Parameter:

    Field NameTypeDescriptionRequired
    signaturestringSignature messageY
    signatureModeSignatureModeSignature mode, 0: owner; 1: guardians; 2: sessionN
    validAfternumberValidity period start timeN
    validUntilnumberValidity period end timeN

    Return Parameter:

    None

    1. toJSON Convert UserOperation to JSON format information
    toJSON(): string

    Input Parameter:

    None

    Return Parameter:

    Field NameTypeDescription
    -stringJSON format information of UserOperation
    1. toTuple Convert UserOperation to tuple format information
    toTuple(): string

    Input Parameter:

    None

    Return Parameter:

    Field NameTypeDescription
    -stringTuple format information of UserOperation
    1. fromJSON Convert JSON format information to UserOperation
    fromJSON(json): UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    jsonstringJSON format information of UserOperationY

    Return Parameter:

    Field NameTypeDescription
    -UserOperationUserOperation information
    1. fromObject Convert object format information to UserOperation
    fromObject(obj): UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    objobjectObject format information of UserOperationY

    Return Parameter:

    Field NameTypeDescription
    -UserOperationUserOperation information

    9. Callbase External Functions#

    1. createOp Create UserOperation for calling the wallet (executeFromModule)
    createOp(        walletAddress: string,        nonce: NumberLike,        paymasterAndData: string,        maxFeePerGas: NumberLike,        maxPriorityFeePerGas: NumberLike,        callGasLimit: NumberLike,        verificationGasLimit: NumberLike,        preVerificationGas: NumberLike,        data: string,    ) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet address that performs the operation (the address of the wallet contract, but the sender's EOA address during the first deployment)Y
    noncenumberAnti-replay parameter set in the wallet, also used as salt for the initial creation of the walletY
    paymasterAndDatastringPaymaster contract address and data sent to the paymaster, the implementation of the paymaster is not clear yet, and if we use our own paymaster, this value is not needed, set to 0x0Y
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    datastringParameter for calling the wallet contract's executeFromModule (i.e., the encoded call for other wallet functions)Y

    Return Parameter:

    UserOperation

    1. createOpByBatch Create UserOperation for calling the wallet (executeBatchFromModule)
    createOpByBatch(        walletAddress: string,        nonce: NumberLike,        paymasterAndData: string,        maxFeePerGas: NumberLike,        maxPriorityFeePerGas: NumberLike,        callGasLimit: NumberLike,        verificationGasLimit: NumberLike,        preVerificationGas: NumberLike,        datas: string[],    ) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet address that performs the operation (the address of the wallet contract, but the sender's EOA address during the first deployment)Y
    noncenumberAnti-replay parameter set in the wallet, also used as salt for the initial creation of the walletY
    paymasterAndDatastringPaymaster contract address and data sent to the paymaster, the implementation of the paymaster is not clear yet, and if we use our own paymaster, this value is not needed, set to 0x0Y
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    datasstring[]Parameters for calling the wallet contract's executeBatchFromModule (i.e., the encoded calls for other wallet functions)Y

    Return Parameter:

    UserOperation

    10. ERC20 External Functions#

    1. Constructor
    new ERC20()

    Input Parameter:

    None

    Return Parameter:

    ERC20

    1. approve Create UserOperation for calling the 'approve' function of ERC20
    approve(walletAddress: string, nonce: NumberLike, paymasterAddress: string,            maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, callGasLimit: NumberLike,            verificationGasLimit: NumberLike, preVerificationGas: NumberLike, _token: string, _spender: string, _value: string) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    _tokenstringERC20 token address to operate onY
    _spenderstringThe _spender parameter for 'approve'Y
    _valuestringThe _value parameter for 'approve'Y

    Return Parameter:

    UserOperation

    1. transferFrom Create UserOperation for calling the 'transferFrom' function of ERC20
    transferFrom(walletAddress: string, nonce: NumberLike, paymasterAddress: string,                 maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, callGasLimit: NumberLike,                 verificationGasLimit: NumberLike, preVerificationGas: NumberLike, _token: string, _from: string, _to: string, _value: string) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    _tokenstringERC20 token address to operate onY
    _fromstringThe _from parameter for 'transferFrom'Y
    _tostringThe _to parameter for 'transferFrom'Y
    _valuestringThe _value parameter for 'transferFrom'Y

    Return Parameter:

    UserOperation

    1. transfer Create UserOperation for calling the 'transfer' function of ERC20
    transfer(walletAddress: string, nonce: NumberLike, paymasterAddress: string,             maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, callGasLimit: NumberLike,             verificationGasLimit: NumberLike, preVerificationGas: NumberLike, _token: string, _to: string, _value: string) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    _tokenstringERC20 token address to operate onY
    _tostringThe _to parameter for 'transfer'Y
    _valuestringThe _value parameter for 'transfer'Y

    Return Parameter:

    UserOperation

    11. ERC721 External Functions#

    1. Constructor
    new ERC721();

    Input Parameter:

    None

    Return Parameter:

    ERC721

    1. approve Create UserOperation for calling the 'approve' function of ERC721
    approve(walletAddress: string, nonce: NumberLike, paymasterAddress: string,        maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, callGasLimit: NumberLike,        verificationGasLimit: NumberLike, preVerificationGas: NumberLike, _token: string, _spender: string, _tokenId: string) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    _tokenstringERC20 token address to operate onY
    _spenderstringThe _spender parameter for 'approve'Y
    _tokenIdstringThe _tokenId parameter for 'approve'Y

    Return Parameter:

    UserOperation

    1. transferFrom Create UserOperation for calling the 'transferFrom' function of ERC721
    transferFrom(walletAddress: string, nonce: NumberLike, paymasterAddress: string,             maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, callGasLimit: NumberLike,             verificationGasLimit: NumberLike, preVerificationGas: NumberLike, _token: string, _from: string, _to: string, _tokenId: string) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    _tokenstringERC20 token address to operate onY
    _fromstringThe _from parameter for 'transferFrom'Y
    _tostringThe _to parameter for 'transferFrom'Y
    _tokenIdstringThe _tokenId parameter for 'transferFrom'Y

    Return Parameter:

    UserOperation

    1. transfer Create UserOperation for calling the 'transfer' function of ERC721
    transfer(walletAddress: string, nonce: NumberLike, paymasterAddress: string,         maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, callGasLimit: NumberLike,         verificationGasLimit: NumberLike, preVerificationGas: NumberLike, _token: string, _to: string, _tokenId: string) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    _tokenstringERC20 token address to operate onY
    _tostringThe _to parameter for 'transfer'Y
    _tokenIdstringThe _tokenId parameter for 'transfer'Y

    Return Parameter:

    UserOperation

    1. safeTransferFrom Create UserOperation for calling the 'safeTransferFrom' function of ERC721
    safeTransferFrom(walletAddress: string, nonce: NumberLike, paymasterAddress: string,                 maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, callGasLimit: NumberLike,                 verificationGasLimit: NumberLike, preVerificationGas: NumberLike, _token: string, _from: string, _to: string, _tokenId: string) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    _tokenstringERC20 token address to operate onY
    _fromstringThe _from parameter for 'safeTransferFrom'Y
    _tostringThe _to parameter for 'safeTransferFrom'Y
    _tokenIdstringThe _tokenId parameter for 'safeTransferFrom'Y

    Return Parameter:

    UserOperation

    1. setApprovalForAll Create UserOperation for calling the 'setApprovalForAll' function of ERC721
    setApprovalForAll(walletAddress: string, nonce: NumberLike, paymasterAddress: string,                  maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, callGasLimit: NumberLike,                  verificationGasLimit: NumberLike, preVerificationGas: NumberLike, _token: string, _operator: string, _approved: boolean) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    _tokenstringERC20 token address to operate onY
    _operatorstringThe _operator parameter for 'setApprovalForAll'Y
    _approvedbooleanThe _approved parameter for 'setApprovalForAll'Y

    Return Parameter:

    UserOperation

    12. ERC1155 External Functions#

    1. Constructor
    new ERC1155();

    Input Parameter:

    None

    Return Parameter:

    ERC1155

    1. safeTransferFrom Create UserOperation for calling the 'safeTransferFrom' function of ERC1155
    safeTransferFrom(walletAddress: string, nonce: NumberLike, paymasterAddress: string,                 maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, callGasLimit: NumberLike,                 verificationGasLimit: NumberLike, preVerificationGas: NumberLike, _token: string, _from: string, _to: string, _id: string, _value: string, _data: string)  : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    _tokenstringERC20 token address to operate onY
    _fromstringThe _from parameter for 'safeTransferFrom'Y
    _tostringThe _to parameter for 'safeTransferFrom'Y
    _idstringThe _id parameter for 'safeTransferFrom'Y
    _valuestringThe _value parameter for 'safeTransferFrom'Y
    _datastringThe _data parameter for 'safeTransferFrom'Y

    Return Parameter:

    UserOperation

    1. safeBatchTransferFrom Create UserOperation for calling the 'safeBatchTransferFrom' function of ERC1155
    safeBatchTransferFrom(walletAddress: string, nonce: NumberLike, paymasterAddress: string,                      maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, callGasLimit: NumberLike,                      verificationGasLimit: NumberLike, preVerificationGas: NumberLike, _token: string, _from: string, _to: string, _ids: string, _values: string, _data: string) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    _tokenstringERC20 token address to operate onY
    _fromstringThe _from parameter for 'safeBatchTransferFrom'Y
    _tostringThe _to parameter for 'safeBatchTransferFrom'Y
    _idsstringThe _ids parameter for 'safeBatchTransferFrom'Y
    _valuesstringThe _values parameter for 'safeBatchTransferFrom'Y
    _datastringThe _data parameter for 'safeBatchTransferFrom'Y

    Return Parameter:

    UserOperation

    1. setApprovalForAll Create UserOperation for calling the 'setApprovalForAll' function of ERC1155
    setApprovalForAll(walletAddress: string, nonce: NumberLike, paymasterAddress: string,                  maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, callGasLimit: NumberLike,                  verificationGasLimit: NumberLike, preVerificationGas: NumberLike, _token: string, _operator: string, _approved: boolean) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    callGasLimitnumberGas allocated for the main execution call (calculated locally, the gas for executing callData)Y
    verificationGasLimitnumberGas allocated for the verification step (gas used in functions validateUserOp()/validatePaymasterUserOp())Y
    preVerificationGasnumberGas paid to the bundler for compensation pre-verification execution and call data (additional gas prepared to deal with some common gas consumption, such as loops, etc.)Y
    _tokenstringERC20 token address to operate onY
    _operatorstringThe _operator parameter for 'setApprovalForAll'Y
    _approvedstringThe _approved parameter for 'setApprovalForAll'Y

    Return Parameter:

    UserOperation

    13. LAT External Functions#

    1. Constructor
    new LAT();

    Input Parameter:

    None

    Return Parameter:

    LAT

    1. transfer Create UserOperation for calling the 'transfer' function of LAT
    transfer(walletAddress: string,        nonce: NumberLike, paymasterAddress: string,        maxFeePerGas: NumberLike, maxPriorityFeePerGas: NumberLike, to: string, value: string) : UserOperation

    Input Parameter:

    Field NameTypeDescriptionRequired
    walletAddressstringWallet addressY
    noncenumberWallet nonceY
    paymasterAddressstringPaymaster addressY
    maxFeePerGasnumberMaximum fee per unit of gas, i.e., gas price (similar to EIP-1559 max_fee_per_gas)Y
    maxPriorityFeePerGasnumberMaximum priority fee per unit of gas, i.e., the fee allocated to miners in EIP-1559 (similar to EIP-1559 max_priority_fee_per_gas)Y
    tostringRecipient's LAT account addressY
    valuestringAmount of LAT to transferY

    Return Parameter:

    UserOperation

    - + \ No newline at end of file diff --git a/en/PlaTrust-wallet-js-sdk/index.html b/en/PlaTrust-wallet-js-sdk/index.html index 86481f847..aa47cbdb1 100644 --- a/en/PlaTrust-wallet-js-sdk/index.html +++ b/en/PlaTrust-wallet-js-sdk/index.html @@ -8,7 +8,7 @@ PlaTrust Wallet js-sdk | PlatON - + @@ -21,7 +21,7 @@ const bundlerEvent = bundler.sendUserOperation(activateOp); bundlerEvent.on('error', (err: any) => { console.log(err); }); bundlerEvent.on('send', (userOpHash: string) => { console.log('send: ' + userOpHash); }); bundlerEvent.on('receipt', (receipt: IUserOpReceipt) => { console.log('receipt: ' + JSON.stringify(receipt)); }); bundlerEvent.on('timeout', () => { console.log('timeout'); });} main();

    PlatON Testnet Configuration#

    TestnetURL: 'https://devnet2openapi2.platon.network/rpc'bundleURL: 'https://testbundler.platon.network'
     walletLogic: '0x3b682b956E65b5F5b8150f75F2235f156A8F4b7B'walletFactory: '0x97429FFFdE9223C92Cb00F66D8352B0642f70FA4' // wallet proxy factory contract addressrelayerManagerAddr: '0xD7998fC16185cC619b0918028D9BBc77A844a880'
    - + \ No newline at end of file diff --git a/en/PlaTrust_Wallet/index.html b/en/PlaTrust_Wallet/index.html index 34f3aaab0..07028ebd5 100644 --- a/en/PlaTrust_Wallet/index.html +++ b/en/PlaTrust_Wallet/index.html @@ -8,13 +8,13 @@ PlaTrust Wallet | PlatON - +

    PlaTrust Wallet

    Preface#

    Web3 is undoubtedly one of the hottest technology topics in recent years. The key to entering the Web3 world is a private key. However, for many users who are still using Web2, accustomed to logging in with account names and passwords, the concept of a private key can be a hurdle that prevents them from entering Web3. The long string of hexadecimal characters or random mnemonic phrases can be overwhelming. Another problem introduced by private keys is that losing the private key means losing access to assets in Web3, making secure storage of private keys a major concern. Additionally, as the ecosystem of public blockchains expands and more dapps emerge, gas fees have become higher, making it difficult for regular users to participate in Web3 activities due to the high transaction costs. Is there a wallet that allows users to access Web3 without the need to record private keys or mnemonic phrases (seedless) and without incurring huge transaction fees (gasless)? The answer lies in delegating the tasks to others. However, delegating ownership to others can lead to trust issues concerning one's assets in the Web3 world. In this scenario, a multi-signature contract wallet based on EIP-4337 perfectly addresses the pain points mentioned above.

    Main use cases include:

    1. Companies and contracts can safely hold their funds and require the consent of a majority of owners to transfer funds. This way, no single owner can run away with the funds.
    2. Companies can execute sensitive transactions with the consensus of the majority of owners.
    3. Individuals can use multisig to have redundant keys. One feature of multisig is that if you lose one key, you can recover the wallet with the remaining two keys.

    What is PlaTrust Wallet#

    PlaTrust Wallet is a multi-signature contract wallet that follows the EIP-4337 specification. It lowers the barriers for Web2 users to enter Web3 and offers the following main features:

    1. Threshold-based Multisig: Manage assets in a multi-signature form based on the specified threshold.
    2. Session without Multi-Signature: Enable exemption from multi-signature operation within a specific time window to provide convenience for user wallet transactions.
    3. Wallet Lock: Allows wallet locking when owners suspect their account (device) has been compromised (lost, stolen, etc.).
    4. Custom Modules: Support user-defined modules that can be added to the wallet to introduce custom extensions.
    5. Wallet Recovery: Recover the wallet's ownership by replacing the lost private key with a new one through multi-signature initiated by other owners.
    6. Custom Role Control: Users can define different role information to control asset operation permissions in the wallet.
    7. Gasless: Users can operate the wallet without paying native tokens as gas fees.
    8. Wallet Upgrade: Upgrade the wallet to the latest version when new features or significant vulnerabilities arise.
    9. Account Whitelist: Set up a whitelist of accounts, allowing certain accounts to execute cross-account operations or transfers without considering trust issues.
    10. Censorship Resistance: Users have full control over their accounts without relying on any third-party services.
    11. Multi-chain Support: Compatible with all EVM-compatible public blockchains, ensuring the same wallet address across different EVM-compatible chains.

    Feature Overview#

    1. Threshold-based Multisig#

    Explanation#

    PlaTrust Wallet is a multi-signature contract wallet based on the EIP-4337 specification. It supports multiple owners and provides various wallet operations based on a multisig threshold. The concept of multisig is illustrated as follows:

    For each wallet operation (especially asset management), it must be signed by at least the threshold number of owners. Only when the required number of owner signatures is collected, the wallet operation can be successfully executed.

    Functions and Use Cases#

    1. Maximizing Asset Protection when a Private Key is Lost: By holding multiple private keys, users can significantly reduce the risk of asset loss due to the loss or theft of a single private key. Even if one of the private keys is compromised, the funds will still be secure.
    2. Preventing Erroneous Transactions with Multiple Verifications: When a user initiates a transaction, other private key holders can prevent the execution of erroneous transactions by refusing to sign them. The more people involved in the verification process, the lower the possibility of erroneous transactions.
    3. Facilitating Collective Decision Making and Arbitration: When many co-signers jointly maintain the keys, fund control becomes more secure and organized. In this format, only unanimous decisions can be formed and executed, effectively implementing good decisions.
    4. Diversifying the Risk of Theft: By distributing keys across different geographical locations and multiple devices, users create a secure environment. Hackers will be unable to crack multiple distributed keys, thus keeping encrypted assets secure in the hands of users.

    2. Session without Multi-Signature#

    Explanation#

    In certain scenarios, multisig introduces inconvenience for operations. Every time a wallet operation is performed, it requires signatures from the threshold number of owners to be effective. If a user wishes to perform numerous transactions within a specific time window and seeks to exempt from multisig and obtain permission from other owners, this can be achieved by creating a session without Multi-Signature. A session defines a temporary session key held by a specific owner, and as long as the session key is valid, the owner holding the session can use it to bypass multisig and execute any wallet call. The duration of the session is defined by the owner when creating it, and the session key will automatically expire at the end of the session.

    Starting a session requires the number of signatures that satisfy the multisig threshold. The wallet's owners can close a session at any time before its expiration.

    Functions and Use Cases#

    1. Providing Convenience for Operations within a Specific Time Window: During the valid time window, the holder of the session can operate the wallet without requiring other owners to participate in multisig.
    2. Uniqueness: Only one session can exist in the wallet at a given time window, and the session can only be held by the designated owner, with other owners not enjoying exemption from multisig calls.
    3. Expiration: Sessions have a specific time window of validity, and the session key will automatically expire after the validity period.
    4. Interruptible: During the session's validity period, the holder of the session can close the session without multisig, or other owners can close the session through multisig.

    3. Wallet Lock#

    Explanation#

    The wallet supports a lock feature, which allows owners to initiate a locking period when they suspect that their account (device) has been compromised (lost, stolen, etc.). During the wallet's locked period, only specific restricted operations, such as the unlock process, are allowed. All other operations (changing owners, changing multisig threshold, asset transfers, etc.) will be blocked.

    To unlock the wallet before the security period ends, the owner needs to initiate a multisig unlock to trigger the wallet's unlocking.

    Functions and Use Cases#

    1. Protecting Asset Security: When there is a suspicion of security issues with the wallet, it can be locked to prevent potential asset transfers.
    2. Limiting Wallet Operations: When the wallet is under attack, it can be locked to restrict wallet calls.

    4. Custom Modules#

    Explanation#

    In PlaTrust Wallet, users can extend custom functional components to the wallet. By deploying custom module contracts and enabling them in the wallet through the "enable module" function, users can activate custom functional components for the wallet. Users can call functions from custom components and ultimately execute calls from the modules to the wallet using the executeFromModule function. It is important to note that each wallet contract instance will set the EIP-4337 entry contract RelayerManager as the default module during creation, and RelayerManager cannot be removed.

    Functions and Use Cases#

    1. Scalability: Users can append custom functional components to their wallets, facilitating diverse extensions for the wallet.
    2. Plug-and-play: Apart from the built-in EIP-4337 entry contract RelayerManager, other custom modules can be freely enabled and disabled.

    5. Wallet Recovery#

    Explanation#

    Ultimately, a contract wallet still requires an externally owned account (EOA) to perform operations. If the private key of the controlling contract owner is not properly saved, it can lead to a loss of the private key. When the control contract's owner's private key is lost, the user loses control of the wallet. To prevent this situation, the wallet includes a wallet recovery function. When an owner's private key is lost, the user can initiate the wallet recovery function to replace the old private key with a new one and regain control of the wallet. Changing to a new private key requires multisig from other owners in the wallet, and the number of signatures must meet the multisig threshold.

    Functions and Use Cases#

    1. Preventing Users from Losing Access to the Wallet due to Lost Owner Private Keys.

    6. Custom Role Control#

    Explanation#

    In many business scenarios, it is necessary to finely segment the functionality of a wallet based on different permissions, such as what admin users can do, what manager users can do, etc. Fine-grained functional permission has the advantage that different roles can perform different functions, ensuring each role fulfills its own responsibilities. In PlaTrust Wallet, users can add various custom roles and permissions, and specify the functions that can be called by each permission role, achieving fine-grained functional permission control.

    Functions and Use Cases#

    1. Support for Fine-Grained Permission Control.
    2. Convenient for Managing and Extending Permissions.

    7. Gasless#

    Explanation#

    PlaTrust Wallet is a multi-signature contract wallet based on EIP-4337, and the EIP-4337 standard natively supports "meta transactions." When owners of the wallet perform wallet-related functions, they assemble and sign what is called the "User Operation" message, then pass the User Operation to the relevant "Bundler" service for assembling and submitting the User Operation as a blockchain transaction. For wallet owners, they only need to sign the User Operation message with their corresponding owner private keys, without sending actual blockchain transactions. Hence, they do not need to pay any gas fees. For the Bundler service, upon receiving the User Operation and collecting the required multisig signatures, it assembles the User Operation and multisig signatures into a blockchain transaction and submits it to the chain, thereby incurring gas fees. The gas fees advanced by the Bundler are either covered by the tokens held by the wallet itself or filled in by the paymaster. Therefore, for wallet users (owners), PlaTrust Wallet exhibits gasless characteristics.

    Functions and Use Cases#

    1. Allows users to continue using the wallet without being affected by gas fees when gas fees are becoming increasingly high.
    2. Promotes fair extraction of MEV (Miner Extractable Value) and encourages the community to join the construction of layer 2 solutions, especially for operators maintaining the bundler.
    3. Reduces barriers for Web2 users to use wallets.

    8. Wallet Upgrade#

    Explanation#

    The contract wallet itself is a smart contract written by humans, and code written by humans can potentially have vulnerabilities. Once the smart contract is deployed to the chain, it becomes transparent to all users and cannot be easily modified or revoked. Thus, when encountering significant security vulnerabilities or malicious attacks, an upgrade is necessary to fix the flaws. For users, the on-chain address of the wallet remains the same, but the functions have been switched to the logic after the upgrade.

    Functions and Use Cases#

    1. Flexibility in Functionality Changes.
    2. Ability to Fix Security Vulnerabilities.

    9. Account Whitelist#

    Explanation#

    The whitelist of the wallet is designed to facilitate business usage and provide convenience for users based on a certain level of trust. The whitelist is further divided into dapp whitelist and account whitelist. Contracts addresses added to the dapp whitelist can be directly called with trust. Similarly, account whitelist addresses can directly perform transfer operations.

    Functions and Use Cases#

    1. Increased Convenience.
    2. Based on Trust Premise.

    10. Censorship Resistance#

    Users can directly connect the functionality of the wallet to their own applications through the SDK, without relying on any third parties, and can directly use their own wallets.

    11. Multi-chain Support#

    The wallet is deployed using the create2 opcode, which allows for the creation of the same contract address (also called a "counterfactual address") based on the same input parameters. This has the advantage that the wallet address can be known before the wallet contract is actually deployed on various EVM-compatible blockchains, allowing early funding of the wallet. Additionally, in many cross-chain projects, having the same contract address on multiple different blockchains facilitates wallet account management across different chains.

    Reference#

    1. https://eips.ethereum.org/EIPS/eip-4337
    - + \ No newline at end of file diff --git a/en/PlatEye/index.html b/en/PlatEye/index.html index a2546bd15..f665a3647 100644 --- a/en/PlatEye/index.html +++ b/en/PlatEye/index.html @@ -8,13 +8,13 @@ PlatEye | PlatON - +

    PlatEye

    PlatEye is a professional blockchain explorer for PlatON and Alaya networks. Based on the professional in-depth analysis of on-chain data, it provides the community with massive data and versatile data analysis and query functions. Through PlatEye, you can query information such as blocks, transactions, account addresses, nodes, large account addresses, and large transactions.

    Access to PlatON blockchain:https://www.plateye.com

    Major Technique#

    PlatEye employs Apache Flink, a high-throughput, low-latency distributed streaming data processing framework, for statistics on the latest data. Data that need to be retrieved, e.g. transactions and contracts, are processed and stored in the Elastic Search cluster. Data can be queried and retrieved within milliseconds using the MySql database. The front-end uses the Vue.js framework, while the back-end uses Java, separate from each other in development. The CDN uses Cloudflare. The information on the chain is accessed through the node rpc. Meanwhile, the client needs to be modified to obtain the transactions in the current transaction pool, which is used to work out the relationship between the time the transactions are packaged in the transaction pool and the gas.

    Function Description#

    Home page#

    • The home page of the explorer displays the latest information on the current ATP. The latest block and the list of the lastest transactions are displayed in scroll bars.
    • There is a block/address/transaction search bar where you can query block/address/transaction information through the query function provided by the explorer.

    Query#

    You can query specific information about a block, address, and transaction by entering the block height, address or transaction hash value respectively.

    Address holding ranking#

    PlatEye Browser provides a function to view the ranking of address positions. Addresses can be ranked by total amount, liquidity amount, locked position amount, and total pledged amount. Click on an address to jump to the address details page to see the details of that address.

    Transaction list and transaction details view#

    A list showing all transactions and you can view the detailed information of a given transaction.

    On-chain information monitoring#

    You can view the transaction list and detailed information, monitor large transactions, check lock-up balance and lock-up plans, etc.

    Ranking of nodes and node details#

    You can view the node list. The details page provides the relevant data of the node with a snapshot available for download.

    Token list and transactions#

    You can view the list of PRC20 and PRC721 tokens, with details of the token name, holder and corresponding contract, as well as the list of transactions corresponding to the token.

    Functions under Development#

    Gas station#

    For the statistics of gas consumed and the estimation of gas required for transactions.

    Smart contract module#

    To display smart contracts deployed on the Alaya network, open-source code, contract interface data, etc.

    DApp#

    To display DApps in the current ecosystem and submit a DApp.

    - + \ No newline at end of file diff --git a/en/PlatON_BlockChain_Browser/index.html b/en/PlatON_BlockChain_Browser/index.html index e02ca95c3..5b7822ec2 100644 --- a/en/PlatON_BlockChain_Browser/index.html +++ b/en/PlatON_BlockChain_Browser/index.html @@ -8,13 +8,13 @@ PlatScan | PlatON - +

    PlatScan

    Block explorers are your portal to PlatON's data. You can use them to see real-time data on blocks, transactions, validators, accounts, and other on-chain activity.

    • PlatScan -- PlatON blockchain explorer and analysis platform, available in English and Chinese.

    Data#

    Blockchain is designed to be transparent, anyone can verify the data of blocks. The block explorers provides interface to access these data and visualize them.

    Here's a summary of the types of data you can get from a block explorer:

    Blocks#

    Every 1 to 2 seconds, a new block produced in PlatON network, newly generated data will continuously add to the block explorer. The block contains many important data, including:

    • Block height: The id of the block and the length of the blockchain when the current block creates. (block as a unit)
    • Timestamp: The time of the block creation.
    • Transactions:Transaction numbers contained in this block.
    • Block hash: Encrypted hash of the block head, it is the unique identifier of the block.
    • Parent hash: The previous block's hash
    • Producer: The name of the validator node that produced this block.
    • Block reward: The amount of the LAT that rewarded to the validator node which produced this block.

    Transactions#

    The block explorer provides transaction data accurate and in detail, it's very helpful for track transaction progress and checks the detail of the transaction. The transaction data including:

    • TxHash: A hash generated when the transaction is submitted.
    • Status: An indication of whether the transaction is pending, failed or successful.
    • Block Height: The height of the block in which the transaction has been included.
    • Timestamp: The time this transaction included in a block, it's also the time this transaction gets confirmed.
    • From: The address of the account that submitted the transaction.
    • To: The address of the recipient or smart contract that the transaction interacts with.
    • Amount: A total number of LAT being transferred.
    • Transaction fee: The amount paid to the validator to process the transaction (calculated by gas price*gas used)

    Accounts#

    There's a lot of data that you can access about an account. This is why it's often recommended to use multiple accounts so that your assets and value can't be easily tracked. There are also some solutions being developed to make transactions and account activity more private. But here's the data that's available for accounts:

    • Address: The public address you can use to send funds to.
    • Balance: The amount of available LAT associated with the account.
    • Locked-up balance: The amount of unavailable LAT associated with the account.
    • Stakes/Delegations: The amount of staked/delegated LAT associated with the account.
    • Unclaimed Reward: The amount of reward can be claimed by the account from the delegation in which the account participated.
    • Unredeemed delegation: The amount of LAT need to be redeemed when the delegation relationship dissolved.
    • Transactions: A list of all the transactions where this account was either the sender or the recipient.
    • PRC20 Tokens: The information of the PRC20 tokens associated with the account.
    • Delegations: The records of delegations associated with the account.
    • Reward details: The records of the rewards claimed by the account.

    Tokens#

    Tokens are a type of contract, compared to other contracts, token has value and can be traded:

    • Total supply: The number of tokens in circulation.
    • Contract address: The address of the token that was deployed to mainnet.
    • Decimals: PRC20 tokens are divisible and have decimal places.
    • Transfers: The number of times the token has been transferred between accounts.
    • Holders: The number of addresses that hold the token.

    PlatScan token list only display verified token, to get the token verified, please contact: support@platon.network.

    Network#

    By data provide by block explorer, you can intuitive understanding the network status and the status of network economy base on PPOS mechanism.

    • Total transactions: The number of transactions since PlatON network was created.
    • TPS: The number of transactions processable within a second.
    • Circulation: The amount of tradable LAT currently circulate in the network.
    • Total supply – Number of LAT in circulation – new LAT is created with the creation of every block and every epoch complete.
    • Total stakes: The amount of LAT staked by nodes participating validation in the network.
    • Addresses: The number of addresses with transactions history in PlatON network.
    • Ongoing proposal: The ongoing governance proposal in PlatON network.

    Validators#

    Validator take responsibility to create and validate the block, more information about validator refer to this page Introduction of PlatON validator.

    • Total stakes: The amount of LAT staked by validator and delegators.
    • Total delegated: The amount of delegated LAT received by the validator.
    • Delegators: The number of addresses delegating LAT to the validator.
    • Validator annualized yield: Estimated annualized yield base on most recent 4 epochs. (calculated by validator income/validator staking cost * annual epochs count * 100%)
    • Delegated annualized yield: Estimated annualized yield base on most recent 4 epochs. (calculated by delegation income distributed by validator/cost of the delegation received by validator * annual epochs count * 100%)
    • Status: The status of the validator
      • Active: The top 201 nodes can participate in validators election, they also called alternative validator.
      • Candidate: Candidate nodes that can not participate in validators election.
      • Verifying: Node chosen to become the validator of the consensus round, participating block verifying.
      • Producing: Node chosen to become the validator of the consensus round, participating block producing.

    Contributors#

    PlatON blockchain explorer#

    • PlatScan -- PlatON blockchain explorer and analysis platform, support English and Chinese.

    Know of a community resource that helped you? Edit this page and add it!

    - + \ No newline at end of file diff --git a/en/PlatON_Dev_Faucet/index.html b/en/PlatON_Dev_Faucet/index.html index 9c53a6ecb..df6dc9717 100644 --- a/en/PlatON_Dev_Faucet/index.html +++ b/en/PlatON_Dev_Faucet/index.html @@ -8,13 +8,13 @@ DevNetwork Faucet | PlatON - +

    DevNetwork Faucet

    1. Usages of DevNetwork Faucet and Test Coin

    We set a faucet on DevNetwork to satisfy the requirements from developer. From faucet you can get the test coins for free. Then use the test coins to test the developing software(s) without loss of real tokens.

    Note:

    The test coins are worthless in real world. They can be used only when you really need to test your software(s) on DevNetwork.

    1. Link of faucet, how to apply for test coins and the rules of application.

    Link to apply for test coins on DevNetwork of PlatON: https://faucet.platon.network/faucet/。

    Note:

    Applying amount of test coins of an e-mail address is limited up to 200 everyday.

    1. The way to apply for huge amount test coins

    If you need to receive large amount of test LAT, please send an email to support@latticex.foundation according to the format requirements. The email requirements are:

    Title: PlatON Develop Network Token ApplicationName:Contact Information:WeChat ID (or other instant messaging software) :Application amount:USES:Receipt account:Remark:
    - + \ No newline at end of file diff --git a/en/PlatON_Governance_Solution/index.html b/en/PlatON_Governance_Solution/index.html index 6cd7c4825..ebd3f0a20 100644 --- a/en/PlatON_Governance_Solution/index.html +++ b/en/PlatON_Governance_Solution/index.html @@ -8,7 +8,7 @@ Governance mechanism | PlatON - + @@ -20,7 +20,7 @@ Non-referendum proposals are ordinary proposals that are produced by validator votes. The types of proposals can be divided into the following types:
    • Text proposals: Text proposals can be used for decisions that need not be implemented.
    • Software upgrade proposal: used to initiate an upgrade vote on the chain to achieve the purpose of smooth upgrade.
    • Parameter modification proposal: used to modify manageable parameters such as system parameters.
    • Account proposal: used to freeze or unfreeze accounts (including contracts).
    • Incentive proposal: Used to allocate the balance of the governance fund account.
    • Cancel Proposal: Used to cancel the software upgrade proposal that is being voted on the chain.

    Governance process#

    governace-flow

    1) Initiate Proposal

    Referendum proposals can be initiated by anyone, and non-referendum proposals are initiated by validators. Each proposal should have a corresponding text description, which is stored in the PIP repository on github and managed by the core developer, similar to EIP.

    To control spam proposals, the initiation of all types of proposals requires a proposal fee as the cost of the proposal. For the referendum proposal, a token is required to be pledged as the deposit of the proposal. Other holders can also attach the proposal by increasing the deposit of the proposal to increase the chance of the proposal entering the voting period. The proposal deposit is returned to the original account when the proposal enters the voting period.

    2) Proposal Screening

    • Referendum Proposal: Since the referendum proposal is not the norm, multiple referendum proposals can be initiated on the chain at the same time. These proposals will be sorted according to the highest margin, and the proposal with the highest margin will be selected each month to enter the voting stage .

    • Non-referendum proposal: The successful launch of the proposal will enter the voting period, and multiple proposals can be voted in parallel.

    3) Vote for Proposal

    • Referendum proposal

      The core equity vote of the referendum proposal. Voting will last two weeks and there are three voting options: "Yes", "No" and "Abstain". Only tokens participating in the pledge and delegation can vote. The voting form adopts the model of "validator's vote + personal voting coverage". That is: the verifier's voting weight is the sum of its own pledged tokens and the number of accepted commissioned tokens. If the client and the validator have different opinions, the client can vote on its own, and its voting weight is the number of commissions. The voting options will be overwritten. All votes will be locked until the end of the vote.

      In order to alleviate the problem of voting centralization caused by the majority of tokens being controlled by a few nodes, the number of validators participating in the voting should be sufficient. If the majority of validators disagree or do not participate in the voting, the proposal will still not pass.

    • Non-referendum proposal

      The core of voting on non-referendum proposals is validator voting. Any node that is elected as a validator within the voting period of the proposal can vote. The voting cycle is generally two weeks, and the voting cycle of a software upgrade proposal can be determined by the proposal initiator according to the situation. The voting method adopts a system of one person and one vote for validators. After voting, the validator's own pledged tokens will be locked until the end of voting. In addition to software upgrade proposals, there are three voting options for other types of voting: "Yes", "No", and "Abstain". In order to simplify the voting process, there are no explicit options for the software upgrade proposal. Each validator can indicate his or her voting position by whether to upgrade the local node.

    4) Voting results calculation

    • Referendum Proposal: There are three dimensions for calculating the results of referendum proposals:
      • Validator support rate: the ratio of the number of validators who vote for support to the total number of validators who can vote;
      • Token support rate: the ratio of the number of tokens supported to the total number of tokens participating in the vote;
      • Token participation rate: The ratio of the total number of tokens participating in the voting to the total number of tokens in circulation.

    When both: validator support rate> P%, Token support rate> Q%, and Token participation rate> K%, the proposal is approved, otherwise the proposal is not approved.

    • Non-referendum proposal: There are two calculation dimensions for non-referendum proposals:

      • Verifier support rate: the ratio of the number of validators who vote for support to the total number of validators who can vote;
    • Validator participation rate: the ratio of the number of voting validators to the total number of voteable validators;

    When both: Validator support rate> M% and validator participation rate> N%, the proposal is voted through, otherwise the proposal fails to vote.

    Note: In the software upgrade proposal, the default validator participation rate is 100%.

    TypeParticipation RateSupport ratio
    Text proposal>50%>=66.7%
    Cancel proposal>50%>=66.7%
    Parameter proposal>50%>=66.7%
    Upgrade proposal=100%>=66.7%

    Upgrade mechanism#

    Overall mechanism#

    The upgrade mechanism is a guarantee that the network can continue to iterate and improve. For different situations that may occur during the operation of the blockchain system, we should provide targeted upgrade methods, mainly in the following four cases:

    • Optimized upgrade: This type of upgrade is a function optimization of the current chain version. Each node can decide whether to upgrade according to the situation, whether or not the upgrade does not affect the consensus.

    • Vote for upgrades: This category of upgrades adds new features or fixes to patches that affect the consensus mechanism. This upgrade needs to initiate a software upgrade proposal on the chain, and decide whether to implement the upgrade based on the voting results, and complete the smooth upgrade without interrupting the network. The focus will be explained later.

    • Repair and upgrade: When a node cannot participate in consensus normally due to a low version or an abnormal transaction, the validator can restore the participation in the network consensus by installing a new version of the software.

    • Snapshot upgrade: When the blockchain system encounters a major anomaly, which prevents the entire chain from producing blocks properly, a snapshot can be generated based on the previous normal network state, and then the network can be restored based on the snapshot.

    Below we will focus on the on-chain voting upgrade mechanism.

    On-chain voting upgrade#

    The upgrade package corresponding to the software upgrade proposal is provided by the developer. The upgrade package must be compatible with the current chain version, and validators can participate in voting after upgrading the local node.

    Initiate Upgrade Proposal#

    The upgrade proposal can only be initiated by a validator. When it is initiated, a fee higher than the ordinary transaction fee must be paid. The following parameters need to be provided in the parameters of the software upgrade proposal:

    • The version number of the upgrade target. The version number consists of three digits, such as 1.2.0. The first two digits of the version number of the upgrade target must be greater than the first two digits of the current chain version number.

    • The ID of the file that github describes the upgrade information, which is PIP-ID. The ID must be unique.

    • Number of consensus rounds for voting on the upgrade proposal. This parameter will be used to calculate the voting cutoff block height, that is, the 230th block cutoff vote of the Nth consensus round starts at the current consensus round.

    There can only be one software upgrade proposal in the chain, that is, when there is already a software upgrade proposal in the voting or under implementation on the chain, another software upgrade proposal cannot be initiated. If you encounter a special reason or emergency at this time and need to initiate a new software upgrade proposal immediately, you can initiate a cancellation proposal to cancel the software upgrade proposal.

    Cancellation proposal description: Cancellation proposal can be initiated only when there is an upgrade proposal being voted on the chain. The following parameters are required to cancel a proposed transaction.

    • Canceled upgrade proposal transaction hash

    • GitHub's description file ID of the upgrade information, that is, PIP-ID. The ID must be unique.

    • Cancel consensus round of proposal voting. The vote cutoff block height calculated by this parameter cannot exceed the vote cutoff block height of the cancelled upgrade proposal.

    Vote on Upgrade Proposal#

    After the software upgrade proposal is successfully launched, it enters the voting phase. Only validators can participate in the voting, that is, the voting transaction can only be initiated by the node's pledged account. Before voting, the local node must be upgraded to count votes by one person and one vote.

    We did not set voting options for "support", "oppose", and "abstain" in the voting transaction for the software upgrade proposal, but expressed our position through node behavior, as follows:

    • Supporters: After the local node version is updated to the version in the proposal upgrade, a vote on the upgrade proposal is initiated;

    • Neutral: You can choose to upgrade the node, but do not vote, and initiate a version statement transaction to declare that this node has been upgraded, so that you can participate in consensus normally whether the proposal is passed or not; -Opponents: No need to upgrade local nodes, no voting required.

    The following parameters are required to upgrade the proposal voting transaction:

    • Hash to initiate proposal transactions

    • The actual version number of the node. This version number needs to be the same as the version number of the upgrade target in the voting in order to vote successfully.

    • Node signature. The signature is the node private key's signature on the node version number.

    Although the node has been upgraded during the voting period, the logic currently running is still the logic of the old version. Wait until the implementation is complete before switching to the new version of the logic.

    Statistics on voting results of upgrade proposals#
    upgrade-statistics

    The voting result of the upgrade proposal is highly counted at the voting deadline block. If the voting situation in the voting cycle is as shown above:

    • The total number of validators in the settlement cycle 1: $ P_1 $, the number of validator-initiated upgrade votes is $ M_1 $

    • The total number of validators in the settlement cycle 2: $ P_2 $, the number of validator-initiated upgrade votes is $ M_2 $

    • The total number of validators in the settlement period N: $ P_n $, and the number of validator-initiated upgrade votes is $ M_n $

    Then the final support rate: $SR=\frac{100%\times \sum_{i=1}^{n}M_i}{\sum_{i=1}^{n}P_i-P_1\cap P_2 \cap ... \cap P_n}$

    If $SR \geq 66.7%$, the proposal is voted through and the implementation phase is entered.

    Upgrade Proposal Implementation#

    Due to the randomness of VRF selection of candidate nodes and in order not to affect consensus, we need to ensure that the verification nodes in a consensus round are all upgraded nodes when implementing the upgrade.

    Therefore, when the proposal voting deadline is high, the proposal's approval rate reaches 66.7%, then the upgrade will be implemented in the first block of the next consensus round, and no non-upgraded nodes will no longer be selected to participate in the consensus. In the current settlement cycle, the eliminated non-upgraded nodes will just not be selected by VRF to participate in consensus, but still enjoy the pledged benefits of the current settlement cycle.

    Release Statement#

    As there may be data incompatibility between different versions, in order to avoid consensus failure due to version issues, the node version on the chain should be controlled, so we introduced a version declaration. A node initiates a version statement to indicate that its node version is consistent with the target version number in the current chain version or software upgrade proposal vote, so that it can have the opportunity to participate in consensus normally before and after the upgrade.

    Only candidate nodes and validator nodes can initiate version declarations. Newly added nodes need to be candidates before they can launch a version statement. The conditions for each stage version declaration are as follows:

    version-declare

    When the node version and the version on the chain are inconsistent (the first two digits of the version number are different), the node will not be selected to participate in the consensus, even if the pledge is high, at this time, the node can declare that its node is consistent with the chain version by initiating a version declaration transaction. In order to participate in consensus in the subsequent settlement cycle. When there is a voting software upgrade proposal on the chain, a version statement consistent with the upgrade version can be issued. The version statement does not represent a vote. After the upgrade proposal is voted through, the node that has the same version number as the upgrade destination is declared without voting. Can participate in consensus normally.

    Quick Upgrade#

    Initiating an upgrade vote on the chain is a serious matter. In theory, there should be no possibility of revoking the proposal. All the results should be submitted to the verifier to vote. However, we only allow one software upgrade proposal to be voted on the chain, so when an emergency situation needs to be upgraded quickly, if there are unprocessed proposals on the chain, it will directly affect the emergency processing speed. From this we introduce the cancellation proposal, which is initiated by the validator. The voting cycle can be determined by itself, but it must be within the voting cycle of the cancelled proposal. By initiating the cancellation proposal and the quick response of each node, the software upgrade proposal that is being voted on can be cancelled in a short time, thereby implementing the emergency plan quickly. Cancellation proposals can only be initiated when there is an upgrade proposal being voted on the chain. Cancellation proposals must be implemented once they are initiated, so we encourage the use of cancellation proposals only in emergencies.

    The following parameters are required to cancel a proposed transaction:

    • Canceled upgrade proposal transaction hash

    • The ID of the file that github describes the upgrade information, which is PIP-ID. The ID must be unique.

    • Number of consensus rounds to cancel proposal voting. The vote cutoff block height calculated by this parameter cannot exceed the vote cutoff block height of the cancelled upgrade proposal.

    Governance parameters#

    Alternative nodes can modify some system parameters by initiating a parameter governance proposal. To avoid problems caused by the cross-implementation of parameter proposals and upgrade proposals, when there are voting upgrade proposals or parameter proposals on the chain, it is not allowed to initiate new parameter modification proposals. The parameter proposal voting cycle is two weeks. As of now, the governance parameters we support are as follows:

    • staking module
    Keydescriptionrange
    stakeThresholdThe minimum number of staking tokens to become alternative node candidates[10w,1000w] LAT
    operatingThresholdMinimum number of tokens for each delegation and redemption by the client[10, 10000] LAT
    maxValidatorsNumber of alternative nodes[43, 10000]
    unStakeFreezeDurationVerify the number of settlement cycles when the node exits and the pledged money is frozen(maxEvidenceAge,336] Epoch
    rewardPerMaxChangeRange"Reward Rate of Commitment" The maximum range of rewards that can be adjusted per revision (‱)[1,2000]
    rewardPerChangeIntervalThe "Delegate Rewards Ratio" allows you to change the number of settlement cycles that need to wait again[2, 28]
    • slashing module
    Keydescriptionrange
    slashBlocksRewardWhen the block generation rate is 0, the number of blocks rewarded by the reduced block[0, 50000) blocks
    slashFractionDuplicateSignProportion of penalty node own staking when dual signing behavior was reported(‱)(0,10000]
    duplicateSignReportRewardWhistleblower reward ratio(%)(0, 80]
    maxEvidenceAgeNumber of valid settlement cycles for evidence reported by dual signing(0, unStakeFreezeDuration)
    zeroProduceCumulativeTimeThe number of continuous consensus rounds of zero block out, and the number of zero block out is accumulated within this time[zeroProduceNumberThreshold , 50]
    zeroProduceNumberThresholdZero block times penalty threshold[1,zeroProduceCumulativeTime]
    ZeroProduceFreezeDurationNode zero block penalty is locked time[1, unStakeFreezeDuration)
    • block module
    Keydescriptionrange
    MaxBlockGasLimitBlock GasLimit dynamically adjusts the maximum Gas limit that can be reached[9424776, 300000000] gas
    • reward
    Keydescriptionrange
    increaseIssuanceRatioPercentage of annual increase in Platon Network LAT issuance (‱)[0, 2000]
    • restricting
    Keydescriptionrange
    minimumReleaseThe minimum value of the release amount in the release cycle of the lockup plan[100, 10000000]

    Reward and punishment mechanism#

    When designing a governance mechanism, a good system is needed to encourage more interested and capable professionals to participate in governance, and at the same time punish malicious acts such as occupying network resources.

    Reward#

    • Proposal rewards: Proposal rewards are automatically distributed to the proposal launch account after the proposal has been voted through;

    • Voting rewards: After voting, the tokens need to be locked until the voting of the proposal ends, so the voting reward is proportional to the length of the voting lock time and will be distributed to each voting account at the end of the voting of the proposal

    • Developer rewards: Developer rewards need to initiate proposals on the chain and decide whether to release them based on the voting results;

    • Vulnerability bounty: After confirming the existence of the loophole, a proposal must be launched on the chain and the voting result will be used to decide whether to release it.

    Punishment#

    If the dishonest node achieves the upgrade by disguising the version, when the chain upgrade is successful, the validator is selected to participate in the consensus, and the block generation rate will be low because the block cannot be consensus, which will result in system punishment. You can directly disqualify the node.

    Governance Fund#

    The governance fund comes from the foundation, and a fixed percentage of funds are transferred from the foundation's account to the governance account each year, and the balance of the governance account is allocated by way of voting on proposals for incentives and salary distribution. When the proposal is voted through, it will be automatically issued through multiple signatures.

    - + \ No newline at end of file diff --git a/en/PlatON_Overall_Solution/index.html b/en/PlatON_Overall_Solution/index.html index a1fdafae1..e41a325ca 100644 --- a/en/PlatON_Overall_Solution/index.html +++ b/en/PlatON_Overall_Solution/index.html @@ -8,7 +8,7 @@ Architecture | PlatON - + @@ -21,7 +21,7 @@ Responsible for production and verify blocks, validator nodes are randomly selected through PPoS + VRF, and run the CBFT protocol for consensus.

    Decentralized Application#

    To deploy DAPP applications (including blockchain), the following servers need to be deployed in the intranet environment:

    • Full node This node must connect to mainnet or testnet of PlatON. The P2P port of the node can be exposed to the internet, but the RPC port is not recommended to be exposed to the internet.

    • DAPP server The DAPP server is connected to the local full-node RPC port, monitor transactions, events, and blocks on the chain. At the same time, the DAPP server is also connected to the original business system of the enterprise.

    Validator pool#

    The validator pool deploys multiple validator nodes, and it is recommended to connect to the internet through a public front-end full node. For specific security deployment solution, see validator deployment.

    Operations platform#

    The Operations platform synchronizes all blocks, transactions, and events through a full node and perform monitoring.

    PlatScan Block Browser#

    The PlatScan block browser synchronizes all blocks, transactions, and events through a full node, and displays data such as blocks and transactions. The PlatScan block browser requires the following servers to be deployed:

    • Full node: RPC port allows only data processing server access
    • Data processing server
    • Database server
    • WEB server
    • Push server

    ATON wallet server#

    ATON is a mobile wallet which implements key management, signing transactions forwarded to the chain through the ATON server. The data including transaction, block, validator on the chain are synchronized by the ATON server through the full node and pushed to the mobile client. ATON wallet server needs to deploy the following servers:

    • Full node: RPC port allows only data processing server access
    • Data processing server
    • Database server
    • WEB server
    • Push server

    Validator Deployment#

    node_deployment

    Appropriate measures should be taken to ensure the security of validator for running stably:

    • RPC ports of full node and validator node are closed.
    • The validator node is not exposed on the Internet and communicates through non-validator full nodes.
    • Each validtor node should have at least 2 public full nodes and 2 non-public full nodes. The IPs of the public full nodes can be exposed on the Internet. The IPs of the non-public full nodes are only exposed to other reliable validator nodes and are not exposed on the Internet to avoid DDoS attacks.
    • Prevent network-wide scanning to locate highly-defensive servers. Modify the port 9876 (the same as RPC 8888) to ports 80, 443, or 22. This can effectively increase the cost of attacker positioning.

    Core Modules#

    P2P Network#

    The basic implementation of PlatON network is a decentralized structured topology completely based on RELOAD (Resource Location And Discovery) protocol and the Kademlia protocol [Kademlia]. The overall PlatON network structure is shown as follows.

    p2p_protocal_stack

    Link Layer#

    The Link Layer ensures the secure transfer of data. A variety of transmission protocols are employed to prevent eavesdropping, tampering and spoofing; to provide secure and authenticated connections; and to verify the source of messages and ensure the integrity of the data.

    Transport Layer Security (TLS) and Datagram Transport Layer Security (DTLS) are implemented on this layer.

    Forwarding and Connection Management#

    The Forwarding and Connection Management layer stores and implements the Routing Table by providing packet forwarding services between nodes. It also handles establishing new links between nodes, setting up connections for overlay links across NATs using ICE.

    Topology Plug-in#

    RELOAD is a P2P network framework that supports the development of different topology algorithms for implementing a fully-distributed non-structured topological or fully-distributed structured topological network.

    The Topology Plug-in is responsible for implementing the specific overlay algorithm being used. It uses the Message Transport component to send and receive overlay management messages, the Storage component to manage data replication, and the forwarding and connection management layer to control hop-by-hop message forwarding.

    The Topology Plug-in allows RELOAD to support a variety of overlay algorithms. PlatON implements a DHT based on Kademlia algorithm.

    Data Storage#

    The Data Storage Layer is responsible for processing messages relating to the storage and retrieval of data. It talks directly to the Topology Plug-in to manage data replication and migration, and it talks to the Message Transport component to send and receive messages.

    The base RELOAD protocol currently defines three data models: single value, array and dictionary.

    Message Transport#

    The Message Transport layer is responsible for handling end-to-end reliability.

    PlatON uses RELOAD as the basis for developing a Regional Flooding algorithm that broadcasts messages quickly throughout the entire network.

    Application Layer#

    The communication and storage capabilities of the RELOAD base layer are used to provide service discovery and scaling as well as routing, computing, data, storage and blockchain services based on service discovery.

    Service Discovery#

    PlatON uses ReDiR (Recursive Distributed Rendezvous) [RFC7374] to implement the service discovery mechanism. ReDiR can support tens of thousands of service provider nodes and service query nodes.

    ReDiR Tree#

    ReDiR uses a tree structure to implement the P2P service discovery mechanism. At the same time, the storage capacity of the RELOAD overlay network is used to save the data. Each type of service is stored as a ReDiR tree, and the tree nodes save the information of the service providing nodes. When a node requests to find a specified service provider, a limited number of searches in the ReDiR tree can find the service provider node that best matches the requesting node.

    Each tree node in the ReDiR tree contains a dictionary of entries of peers providing a particular service. Each tree node in the ReDiR tree also belongs to some level in the tree. The root node of the ReDiR tree is located at level 0. The child nodes of the root nodes are located at level 1 of the ReDiR tree. The child nodes of the tree nodes at level 1 are located at level 2, and so forth.

    The number of nodes in each layer of the ReDiR tree depends on the branching factor b. Each layer can hold up to $b^{level}$ nodes. Each node is uniquely identified by $(level, j)$, where $level$ is the node location.The number of layers, $j$ means that the node is the $j$ node in the corresponding layer. In each layer, $b^{level}$ tree nodes divide the $level$ layer into $b^{level}$ KEY spaces.

    All services providers are mapped into corresponding key space. A tree node is responsible for the storage of each key space. Tree node contains key space

    $(2^{BitsInKEY}b^{-level}(j+\frac{b'}{b}), 2^{BitsInKEY}b^{-level}(j+\frac{b'+1}{b}))$

    for $0 ≤ b′ < b$, and the resource ID stored in the tree node $ (level, j) $ is $ID = hash(service, level, j)$.

    Service Registration#

    A node $n$ with key $k$ use the following procedure to register as a service provider in the RELOAD Overlay Instance:

    • Step 1: Starting at some level $ l = l_{start}$. This is generally 2.

    • Step 2: Node $n$ sends a RELOAD Fetch request to fetch the contents of the tree node responsible for key space $I(l, k)$.and obtains the list of service nodes that the tree node stores.

    • Step 3: Node $n$ sends a RELOAD Store request add its entry to the dictionary stored in the tree node responsible for key space $I(l, k)$.

    • Step 4: If node n’s key is the lowest or highest key stored in the tree node responsible for key space, node $n$ MUST reduce the current level by one, repeating steps 2 and 3 above. Node $n$ continue in this way until it reaches either the root of the tree or a level at which k is not the lowest or highest key in the key space.

    In the same way, node $n$ also performs a downward walk from level $l = l_{start}$ recursively until the following condition is satisfied:node $n$ is the only service provider in the tree node responsible for key space $I(l, k)$.

    Service Refresh#

    All state in the ReDiR tree is soft. Therefore, a service provider needs to periodically repeat the registration process to refresh its Resource Record. If a record expires, it must be dropped from the dictionary by the peer storing the tree node.

    Service Lookup#

    A service lookup is similar to service registration. It also starts from an initial layer $l = l_{start}$. At each step gets the list of service nodes in the current KEY space $I(l, k)$, and it is processed as follows:

    • Step 1: If there is no service provider stored in the tree node associated with, then service provider corresponding to KEY($k$) must occur in a larger range of the keyspace, so we decrease the number of layers by 1 and repeat the query, or fail if $level$ is equal to 0.

    • Step 2: If $k$ is sandwiched between two client entries in, then the service provider must lie somewhere in a sub-space of . We set and repeat.

    • Step 3: Otherwise, the returned result must be the service provider closest to key($k$) and the lookup is done.

    Account Model#

    Compared with the account model, UTXO does not support smart contracts, and many DAG projects are actively exploring smart contracts, but there is no mature and stable solution. Therefore, PlatON chooses mature and stable account models that support smart contracts. In PlatON, each account has a state associated with it and a 20-byte address. There are two types of accounts:

    • Ordinary account

      Controlled by the private key, users can generate it through the wallet client or the command line. In PlatON, ordinary accounts can create transactions and use private keys to sign transactions.

    • Contract account

      There is no private key, it is controlled by code, and the contract account address is generated when the contract is deployed. Unlike ordinary accounts, contract accounts cannot initiate new transactions on their own. Whenever a contract account receives a message, the code inside the contract is activated, allowing it to read and write to internal storage, and send other messages or create a contract.

    Data Storage#

    In the original bitcoin blockchain, only ordinary transfer transactions need to be stored. Bitcoin is based on the UTXO model, which means that all the information stored on the chain is UTXO except for block-related information (hash, nonce, etc.) Smart contracts are generally supported in the blockchain 2.0 public chain represented by Ethereum. The content stored in the contract can be arbitrary. In addition to account-related information (such as tokens), users can also send text and pictures , videos, and so on.

    In some chains (such as Ethereum), in order to ensure data integrity, some state data (or historical data) is usually stored on the chain. These data are only useful in the corresponding block (height), and there is no other height. It is useful. The advantage of doing this is that at any time, I can trace what the full picture of the ledger looks like at a certain height in history, but the disadvantages are also obvious: the cost of storage is high. Therefore, there is a public chain storage solution similar to EOS. In addition to storing only the latest status data, EOS also uses the star file system to share the pressure on storage.

    PlatON believes that on-chain storage requires full consideration of costs. Only valuable information that requires consensus among all ledgers should be stored on the public ledger. Valuable information includes: blocks, transactions, and account data. For some information in the economic model, such as the validator list of the current consensus round, the candidate list, and the current block rate of each node, it is only necessary to store the latest data.

    PlatON's storage is divided into account data storage (statedb) and snapshot storage (snapshotdb).

    Account data storage (statedb)#

    PlatON's account data storage references Ethereum's MPT tree storage model, as shown below:

    MPT_tree_storage_model

    In PlatON, all account-related state information is stored and retrieved through StateDB. To support fast data query and block rollback operations, StateDB uses the MPT structure as its underlying storage method. All nodes in the MPT will eventually be stored in the disk database as key-value.

    statedb

    The top layer is StateDB. StateDB is responsible for making the most preliminary records of the data. The next layer is the Trie layer. Trie is responsible for structuring all data and subsequent operations such as rollback of storage queries. There are two types of Trie, State Trie and Storage Trie. The former is a status tree that records basic information such as the balance nonce of all accounts. The latter is used to record various contract storage data. There is only one state tree and many storage trees, because each contract has its own storage tree. Trie is TrieDB. TrieDB stores the order of the nodes in Trie in memory. TrieDB's main function is to act as a cache layer before finally inserting data into the hard disk. The last link in the entire structure is the database leveldb on the final hard disk.

    Snapshot Data Storage (snapshotdb)#

    Considering storage cost and read performance, part of the data in PlatON only retains the final state, which is stored and retrieved through snapshotdb. The data in snapshotdb will be finally stored in the disk database in the form of key-value.

    snapshotdb

    among them:

    • unRecognizedBlockData: An unconfirmed data set. Each DB write request updates the data set.
    • RecognizedBlockData: Confirmed block data. BlockData will become RecognizedBlockData after Flush. RecognizedBlockData has a corresponding relationship with block hash and number. There can be multiple RecognizedBlockData for the same block height. After committing, delete the same block height and the following other RecognizedBlockData.
    • CommitedBlockData: Block data waiting for Compaction, there is only one path (block association).
    • WAL: log file, write log before all data is recorded. Store k, v, hash data, hash = hash (k + v + hash)
    • current: is used to store the height of the current highest commit block and the highest merge block (base) block

    Consensus mechanism#

    The scalability trilemma posits that blockchains in which every node processes every computation and in which every node comes to consensus about the order of those computations can have two of three properties: safety, scalability, and decentralization of block production.

    • The decentralization of block production can be quantified as the number of block producers.
    • Scalability can be quantified as the number of transactions per unit of time that the system can process.
    • Safety can be quantified as the cost of mounting a Byzantine attack that affects liveness or transaction ordering.

    As a trade-off, PlatON uses a BFT-Style PoS mechanism.

    consensus_mechanism

    PlatON consensus runs in three stages:

    • Phase 1: The Election of Alternative Validators;

    In PlatON, every LAT holder can participate in PPoS.

    For an LAT holder who wants to become a validator, he/she must stakes more than a pre-specified minimum number of LATs to first become an alternative validator candidate. One staked LAT means one vote, which must be voted for himself and no one else. In other words, alternative validator candidates aren’t allowed to vote for each other.

    Other LAT holders who want to participate in the election of alternative validators must stake LATs too. The number of LATs locked against them must be greater than or equal to 10 LATs. They can vote for any alternative validator candidates they choose.

    After all the votes are cast, alternative validator candidates are ranked according to how many votes they received. A pre-specified number of candidates receiving the most votes become alternative validators. The LATs staked by alternative validators and their supporters remain staked until the end of a pre-specified lock-up period. For other candidates and their supporters, their staked LATs can be un-staked immediately after the election. They won’t participate in current round of PPoS anymore and won’t get any compensation, either.

    • Phase 2: The Selection of Validators by the VRF

    The VRF is used to select a pre-specified number of validators within all the alternative validators. The details of the VRF are very complicated. But it is equivalent to the following experiment.

    Firstly, imagine every vote received by each alternative validator as a ball. Mark different alternative validators by different colors, and mix all the balls together. Secondly, randomly draw a ball from the pool, record its color, and put it back. Repeat this step for many times. Thirdly, count the color distribution of the balls drawn from the pool. Those alternative validators corresponding to the colors with the most occurrences become validators.

    It can be proved that the more votes an alternative validator receives, the more likely it will be selected by the VRF as a validator. However, the VRF introduces a considerable level of randomness. The validators selected may not correspond to the alternative validators with the most votes.

    • Phase 3: Validators Run CBFT

      In CBFT, every validator is assigned a time window, during which it produces a pre-specified number of blocks consecutively. All the validators then run CBFT to reach consensus on the candidate blocks.

      After receiving block reward and staking reward, validators and alternative validators share their income with supporters according to agreements between them. Validators’ income also includes transaction fees.

    Smart contract#

    From a technical perspective, PlatON is essentially a decentralized FaaS (Functions as a Service) platform. Accordingly, smart contracts can be considered as functions on FaaS. Smart contracts in PlatON fall into three categories.

    smart_contract

    Solidity Contract#

    Solidity contract Supports development using solidity language, compiled into evm bytecode for execution. The transactions that trigger the solidity contract are packaged by validators, and nodes across the network repeatedly perform verification. The status of solidity contracts is kept in the statedb.

    WASM Contract#

    Wasm contract Supports high-level language development, compiled into WASM bytecode for execution. The transactions that trigger the Wasm contract are packaged by validators, and nodes across the network repeatedly perform verification. The status of the Wasm contract is kept in the statedb.

    WASM Virtual Machine#

    PlatON uses wagon as the PlatON virtual machine. As a PlatON virtual machine, it needs to be transformed. To implement external functions on the chain and how GAS is calculated.

    Toolchain#

    PlatON first supports C ++ as a smart contract writing language, and gradually provides mainstream high-level development languages ​​such as Rust and Go. The following tool chains are provided for C ++:

    • platon-cpp: C ++ compiler, responsible for generating WASM object code and ABI files.
    WASM contract execution process#
    wasm_compile_pub_tx
    GAS Billing for WASM Contracts#

    The execution of the WASM contract is performed in accordance with the called WASM instruction for GAS billing. Different WASM instructions have different GAS. The GAS value of the specific WASM instruction is supplemented later.

    Privacy Contract#

    Privacy contract scheme#

    The privacy contract also supports high-level language development, which is compiled into llvm ir intermediate language for execution. The input data of the privacy contract is stored locally in the data node, and the data node is secretly shared to multiple random computing nodes. The computing node performs privacy computations in a secure multi-party computing manner off-chain, and submits the computation results to the chain.

    privacy_contract
    Privacy contract execution process#
    privacy_contract_flow

    VC Contract#

    The development and release of a verifiable contract is no different from a Wasm contract, and it is eventually compiled into a WASM implementation. The state transition of the verifiable contract is performed asynchronously by the computing nodes off-chain. After the computation is completed, new states and state transition certificates are submitted to the chain. The nodes on the entire network can quickly verify the correctness and update the new state to the public ledger. Verifiable contracts can support complex and heavy computation logic without affecting the performance of the entire chain.

    Verifiable contract scheme#

    PlatON's verifiable solution is temporarily based on the zk-SNARK algorithm, and it is gradually replaced with a more optimized algorithm in the future.

    verifiable_contract
    • vc-contract template: The user compiles a vc contract according to the provided template, and can enter any computation model. It mainly implements three interfaces:
      • compute (): compute request
      • real_compute (): Generate computation results and proofs
      • set_result (): verify computation result and proof
    • vclang: compile the vc contract written by the user to generate an executable file supported by WASM vm. Contract developers do not need to care about the specific use of libsnark api, they only need to write their own computation model code.
    • vcc-reslover: built-in interface layer to support access to libcsnark in WASM virtual machine, calling libcsnark interface in c-go mode
    • libcsnark: encapsulates the libsnark api, libsnark implemented by c ++ can be accessed by the c interface
    • vc_pool: responsible for vc's transaction processing, distributing vc computation tasks, and uploading the computation results and proofs to the chain
    Verifiable contract execution process#
    verifiable_contract_flow
    • After the contract is compiled, pk and vk have been generated. After deployment to the PlatON network, pk and vk are stored on the chain and cannot be tampered with, which can facilitate node access

    • When the vc compute transaction is executed, a vc task is created, taskid is composed of the nonce of tx, and taskid is the key to store the input parameter x

    • After the compute transaction is written into the block, it will trigger the vc_pool to resolve the transaction event, so as to decide whether to add the task to the vc_pool queue

    • After the block is confirmed, real_compute can be executed. Because it is off-chain computation, no transaction fees will be incurred. The process of real_compute is to first generate s (witness) according to the gadget sequence operation that was previously compiled and generated. Once s is calculated, you can calculate the proof based on pk

    • set_result (proof, result) is to upload the computation result and proof to the chain. This process is mainly verify (vk, proof, input). Once the verification is passed, the transaction initiator can get the computation reward. The verification time of zk-SNARK is relatively short compared to the stage of generating proof, but it is also related to the length of the input parameter. Therefore, it is necessary to pay attention to limit the length of the input parameter to prevent the gas cost of the transaction from being too high and increase the cost of the verifier.

    Incentive model#

    Users who need computing outsourcing need to mortgage the appropriate fees to the contract account first, and each computing node can compete for the computing task by itself (the order-changing model will be changed to the random ordering model later). Once the computation is successful, the result and proof are generated, and set_result is initiated. For a transaction request, the computing node needs to pay the miner fee for the transaction first. The node receives the request and executes set_result. Once the proof and result parameters carried in the transaction are verified, the transaction requester successfully calculates the result and the contract account will be mortgaged. Fees are transferred to the requester's account, failure will not be rewarded.

    - + \ No newline at end of file diff --git a/en/PlatON_Overview_DevGuide/index.html b/en/PlatON_Overview_DevGuide/index.html index e6709d0fe..794aac4b3 100644 --- a/en/PlatON_Overview_DevGuide/index.html +++ b/en/PlatON_Overview_DevGuide/index.html @@ -8,13 +8,13 @@ Development guide | PlatON - +

    Development guide

    PlatON is compatible with EVM and WASM virtual machines, so it can support contract development in more high-level languages, lowering the learning threshold for contracts while improving performance in processing contract transactions.This significantly lowers the learning curve for writing contracts, while improving performance for processing contract transactions. The documentation in this section helps developers quickly write, deploy, and debug contracts on the PlatON network, and develop various Dapp applications based on contracts.

    What is Dapp?#

    Dapp (Decentralized Application) is a decentralized application built on the blockchain.

    How to develop a Dapp?#

    From the developer's point of view, a Dapp application is essentially a process of interacting with a contract. You can call the contract directly through the web side, or you can interact with the contract through SDKs. The whole development process is roughly divided into three major processes: development environment preparation, contract development, front-end and back-end development.

    Development environment preparation#

    • Private Network-Build a private node or network locally, which can help you quickly develop and debug local applications.
    • Dev Network-Access to dev network can help you test your code in a more open environment.
    • Main_Network-When you are done testing on the private and development networks, you can seamlessly migrate to the PlatON main network and start using the application seamlessly.

    Contract Development#

    PlatON supports dual virtual machines, Wasm and EVM, so developers can choose their contract development language based on their area of expertise.

    Solidity Contract Development#

    • Getting Started with Development - You can learn how to deploy, compile, publish, and invoke contracts on the PlatON network
    • Best Practices - How to set reasonable fees, how to avoid deducting fees for failed transactions, and other contract writing specifications
    • Development Costs-Introduce the cost of fees for Slolidity contract deployment calls on PlatON and the comparison analysis with Ether fees.
    • Security Guide-Introduces how to improve the security of contracts
    • Contract Migration-In addition to writing your own contracts, you can also migrate contracts from Ether or other public chains that support Solidity contracts to PlatON network
    • System contract call-How to call system contract in Solidity contract

    WASM Contract Development#

    WASM contract currently only supports C++ language development, but you are welcome to continue to extend the contract in other major languages.

    • Getting Started-Introducing how to compile and publish calls to Wasm contracts on PlatON
    • Development Costs-Introduce the cost of Wasm contract deployment invocation on PlatON and the comparison analysis with Ether contract fees
    • Best Practices-Introduction to how to set reasonable fees, how to avoid deducting fees for failed transactions, and other contract writing specifications
    • Wasm API

    Front-end or back-end development#

    If you want to interact directly with the contract through the web front-end, please refer to the following documentation.

    • Samurai API - provides support for web wallet development
    • JS SDK-How to use JS to interact with contracts or PlatON network

    If you want to interact with a contract or PlatON network by writing backend code, the following SDKs in different languages can help.

    How to publish PRC Token?#

    Since PlatON inherits the EVM virtual machine, theoretically it can be compatible with all the Tokens of the Ethernet standard protocol, currently the commonly used Token protocols are PRC-20 and PRC-721.

    - + \ No newline at end of file diff --git a/en/PlatON_Solution/index.html b/en/PlatON_Solution/index.html index 940cb49e5..73abc03d5 100644 --- a/en/PlatON_Solution/index.html +++ b/en/PlatON_Solution/index.html @@ -8,7 +8,7 @@ PlatON Consensus Solution | PlatON - + @@ -31,7 +31,7 @@

    B synchronizes the blocks produced based on A8 and A9 to other nodes at the same time. If other nodes receive all new blocks at the same time:

    ABCD
    D7(QC) commitD7(QC)commitD7(QC)commitD7(QC)commit
    A8(QC)lockA8(QC)lockA8(QC)lockA8(QC)lock
    A9(QC) B9:A8A9(QC) B9:A8A9(QC) B9:A8A9(QC) B9:A8
    B10:A8 B10:A9B10:A8 B10:A9B10:A8 B10:A9B10:A8 B10:A9
    B11:A9B11:A9B11:A9B11:A9

    After consensus, there are three possible outcomes:

    • B8:A8 reaches QC

      ABCD
      D7(QC) commitD7(QC)commitD7(QC)commitD7(QC)commit
      A8(QC)lockA8(QC)lockA8(QC)lockA8(QC)lock
      A9(QC) B9:A8(QC)A9(QC) B9:A8(QC)A9(QC) B9:A8(QC)A9(QC) B9:A8(QC)
      B10:A8 B10:A9B10:A8 B10:A9B10:A8 B10:A9B10:A8 B10:A9
      B11:A9B11:A9B11:A9B11:A9

      At 9th height, the blocks A9 and B9: A8 only reached QC, and are not finalized, so the chain is not forked. When it is C's turn, C can produce new blocks based on A9 or B9: A8.

    • B10:A9 reaches QC

      ABCD
      D7(QC) commitD7(QC)commitD7(QC)commitD7(QC)commit
      A8(QC)commitA8(QC)commitA8(QC)commitA8(QC)commit
      A9(QC)lock B9:A8A9(QC)lock B9:A8A9(QC)lock B9:A8A9(QC)lock B9:A8
      B10:A8 B10:A9(QC)B10:A8 B10:A9(QC)B10:A8 B10:A9(QC)B10:A8 B10:A9(QC)
      B11:A9B11:A9B11:A9B11:A9

      When B10:A9 reaches QC, A9 is be locked, and A8 is commited. All nodes are in the same state, the chain is not forked. When it is C's turn, C can produce new blocks based on B10: A9.

    • B9:A8 and B10:A9 have not reached QC It may be caused by D network abnormality or D host downtime. At this point, the view-change is triggered. If B is a Byzantine node, B may or may not send a ViewChange message.

      1. B does not send ViewChange message
      ABCD
      ViewChange<A9>ViewChange<A8>ViewChange<A9>nil

      In this case, C will produce blocks based on A9.

      1. B does send ViewChange message
      ABCD
      ViewChange<9>nilViewChange<9>nil

      The ViewChange cannot reaches QC. And the view can only switch to C normally after D failure recovers.

    Review and Summary#

    This article discusses the current common BFT-type consensus algorithms, and proposes a CBFT protocol that can be more suitable for the public network environment. It can greatly improve the speed of block confirmation and satisfy the blockchain on the premise of meeting safety and liveness. There is a growing need for consensus speed.

    References#

    [1] M. J. Fischer, N. A. Lynch, and M. S. Paterson, "Impossibility of distributed consensus with one faulty process," J. ACM , 1985.

    [2] L. Lamport, R. Shostak, and M. Pease. The Byzantine Generals Problem. ACM Transactions on Programming Languages and Systems, 4 (3), 1982.

    [3] M. Castro and B. Liskov. Practical byzantine fault tolerance. In OSDI, 1999.

    [4] E. Kokoris-Kogias, P. Jovanovic, N. Gailly, I. Khoffi, L. Gasser, and B. Ford, “Enhancing Bitcoin Security and Performance with Strong Consistency via Collective Signing,” 2016.

    [5] TEAM T Z. Zilliqa TechnicalWhitepaper [J]. Zilliqa, 2017: 1–8.

    [6] Guy Golan Gueta, Ittai Abraham, Shelly Grossman, Dahlia Malkhi, Benny Pinkas, Michael K. Reiter, Dragos-Adrian Seredinschi, Orr Tamir, Alin Tomescu, "a Scalable and Decentralized Trust Infrastructure", 2018.

    [7] C. Unchained, “Tendermint Explained — Bringing BFT-based PoS to the Public Blockchain Domain.” [Online]. Available: https://blog.cosmos.network/tendermint-explained-bringing-bft-based-pos-to-the-public-blockchain-domain-f22e274a0fdb.

    [8] M. Yin, D. Malkhi, M. K. Reiterand, G. G. Gueta, and I. Abraham, “HotStuff: BFT consensus in the lens of blockchain,” 2019.

    [9] “EOS.IO Technical White Paper v2.” [Online]. Available: https://github.com/EOSIO/Documentation/blob/master/TechnicalWhitePaper.md.

    [10] Dan Boneh, Manu Drijvers, Gregory Neven. "BLS Multi-Signatures With Public-Key Aggregation", 2018.

    - + \ No newline at end of file diff --git a/en/PlatON_Validation_Introduce/index.html b/en/PlatON_Validation_Introduce/index.html index 906b8e70a..1c9600517 100644 --- a/en/PlatON_Validation_Introduce/index.html +++ b/en/PlatON_Validation_Introduce/index.html @@ -8,7 +8,7 @@ Intro to validator | PlatON - + @@ -16,7 +16,7 @@

    Intro to validator

    What is a validator?#

    PlatON is a blockchain project that implements democratic governance. Validators are jointly selected by all LAT holders to maintain and develop the PlatON network. The 201 nodes with the most votes will become alternative nodes, from which 43 validators will be randomly selected by VRF to participate in the management of the entire PlatON network. The responsibilities of a validator are:

    • Maintaining PlatON nodes and network
    • Production and validating the blocks
    • Proposal voting and decision-making

    Basic requirements to become a validator#

    Minimum staking requirements#

    Minimum staking of 100,000 LAT is required and additional staking can be made, but all staking can only be canceled at once. If the actual staking is lower than the minimum staking due to penalties or other reasons., the node will automatically be removed from the list of alternative node candidates.

    Recommended configurations#

    • Server: Server or backup server running PlatON software (firewall required)
    • Memory: 16GB RAM
    • Local storage: 100GB system disk, 200GB data disk (online scalable)
    • Processor: 64-Bit 4 core (each core 2.4 GHz or higher)
    • Bandwidth: 5 MB/s (online scalable)

    Software requirements#

    • Linux: Ubuntu 18.04 or higher
    • Clock synchronization: NTP
    • User tools: Node management tools (mtool or other open sources/ self-developed tools)

    Operation requirements#

    • Network monitoring and real-time support
    • 99.9% uptime
    • Cross-regional failure recovery and data backup
    • Safety and security measures
    • Support software upgrade

    How to be a validator?#

    Firstly, make sure you have a balance of 100,000 LAT in your staking account, locked or unlocked. Secondly, you have to own a server with recommended configurations mentioned above. When you meet the above two conditions, staking can be made Become a mainnet validator.

    Please refer to Role Description for node-related terms and role descriptions.

    What rewards will I get for being a validator?#

    Source of reward#

    The source of reward consists of two parts:

    • Offerings: Each year, 2.5% of the total of the previous year is offered in increments, and 80% of the offerings (which is 2% of the total) enter the reward pool
    • Foundation subsidy: Equivalent to 3% of the total initial allocation. Allocated in the first 10 years. Keep the node reward pool the same every year

    Node Rewards#

    Node reward consists of three parts:

    • Block generation reward: For each block produced, the validator will receive a fixed amount of LAT as a reward. 1/2 of the total annual node reward pool is used as block generation reward, which is distributed evenly based on the number of blocks per year (about 28,688,727).
    • Transaction Fee: The fees for packaging transactions are all charged by validators who package the blocks.
    • Staking reward: 1/2 of the total node reward pool is used as Staking reward, which is distributed evenly based on the number of Staking epochs per year (about 2668). Each staking epoch is (10,750 blocks, around 3 hours). Upon completion, the reward is distributed evenly to all alternative nodes.

    Delegator reward#

    Staking rewards are issued to validators and alternative nodes, which will distribute them to the relevant delegators according to the set dividend proportion.

    What acts will be punished#

    Zero block generation penalty#

    • A consensus round is selected as a validator, and if no blocks are produced or all blocks produced are not confirmed by other validators, it is determined that there are zero blocks generated;

    • Zero blocks were generated in a consensus round. If no blocks are produced in the following 20 consensus rounds (about 2 hours and a half), there will be a penalty equivalent to the block generation rewards of 2500 blocks, and the node qualification will be restricted. If the staking is less than 100,000 LAT after the penalty, the status as an alternative node candidate will be revoked.

    • A consensus round is selected as a validator, and if no blocks are produced or all blocks produced are not confirmed by other validators, it is determined that there are zero blocks generated;

    • If a node generates zero blocks in a consensus round and does not produce blocks for the next 20 consensus rounds (about 2 hours and a half), it will receive the penalty, which is a deduction of LAT equivalent to the block generation rewards of 2500 blocks,

    Dual signing#

    • Producing or signing multiple blocks in the same block height is deem as dual signing;
    • Except for the revocation of nodes, a dual signing requires a deduction of 10‰ of its staking;
    • Anyone can report a dual signing, and after the current validator verifies and reaches consensus, the reported person will be recognized as a violation and punished. 50% of the penalty is given to the informer and 50% is placed in the reward pool for the next year's block generation and Staking rewards.

    Restrict the status for nodes: Temporary disqualification of the nodes, locking 56 epochs, during which period one cannot be a validator and cannot participate in block generation, and there will be no Staking rewards. Revocation of nodes: The staking is forcibly unsecured and the violator would be kicked out from the list of alternative node candidates. The staking LAT is returned to the original staking account after 168 Epochs, and cannot be re-staked as a new node during the pledge freeze period, and the original delegation relationship is abolished after re-staking. Deduct Staking LAT: Deduct LAT from the staking of the node and place the amount into the reward pool for block generation and staking rewards in the second year. If the staking is less than 100,000 LAT after the penalty, the node would be revoked.

    How to participate in the governance#

    In PlatON, governance is done through on-chain proposal voting with the following types of proposals:

    • Text proposal: Decisions that could be implemented without code can be initiated with a text proposal.

    • Upgrade proposal: Used for initiating version upgrade voting on the chain for smooth upgrade purposes.

    • Parameter proposal: Used for modifying the governable parameters such as system parameters.

    • Cancel proposal: Used for canceling a software upgrade or parameter modification proposal which is being voted on the chain.

    - + \ No newline at end of file diff --git a/en/PlatON_system_contract/index.html b/en/PlatON_system_contract/index.html index e5186f155..3210f2034 100644 --- a/en/PlatON_system_contract/index.html +++ b/en/PlatON_system_contract/index.html @@ -8,13 +8,13 @@ System contracts | PlatON - +

    System contracts

    After the chain is started, some contracts have been built in the system. The addresses of these contracts have been fixed and the functions have been implemented. Some of the contracts are the realization of economic models, and various contract interfaces are provided to interact with the client.

    Staking contract#

    contract address:lat1zqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzsjx8h7

    PlatON's network based on the PoS mechanism relies on a set of verifiers to keep it running properly. Validators participate in consensus blocking among nodes and receive blocking and staking revenue. To become a verifier, one needs to staking at least 100,000 LAT to the Staking contract and have a running node.

    Delegates are those LAT holders who cannot or do not want to become a verifier. They can delegate LAT to the verifier and receive the proceeds. The LAT delegated by the principal to the verifier is only transferred to the Staking contract, not transferring their own LAT to the verifier, and the principal holds the ownership of the delegated LAT from the beginning to the end. If it is already a validator, it will not be able to become a principal again.

    The interaction between the validator and the delegator is mainly done through the Staking contract. The Staking contract has the following functions:

    • Staking nodes become validators
    • Modify validator information
    • Remove the pledge and exit the validator list
    • Query verifier information and other operations
    • Delegated validator
    • Reduced holdings entrusted
    • Query Staking information

    Contract interface#

    1. Create verification node

      This interface is used to make a node an authentication node by staking LAT to the Staking contract. Before staking, you need your own node to access the network and make sure that the node private key and bls private key are stored safely. When staking, you have to fill in the node information, the revenue account for receiving the block reward and the pledge reward, the reward share for the principal (the more the share, the more likely to attract more users to the principal), the amount of LAT you want to pledge (there is a threshold of 100,000 LAT for the pledge, if it is lower than that amount, the pledge will fail), and other information. If the pledge is successful, the pledge is transferred from the balance of the user account/locked contract account to the Staking contract and the node will participate in the election to become a block-out node in the next epoch. The total weight of the verifier is equal to the total amount of LAT pledged by itself plus the total amount of LAT delegated, and the higher the total weight the higher the probability of being elected as consensus.

      Interface parameters reference Java SDK: create validation node.

    1. Modify verification node information

      This interface is mainly used to modify the validator's income account, delegated share ratio, node information, etc. The interval for each modification of the share ratio must be greater than 10 consensus periods, and the magnitude of each modification cannot be greater than 5%.

      Interface parameters reference Java SDK: Modify verification node information.

    2. Increase the node Staking amount

      This interface is used to increase the node Staking amount and increase the node weight. The minimum amount of each increase is 10LAT. The validator’s new weight will take effect in the next epoch.

      Interface parameters reference Java SDK: Increase the node Staking amount.

    3. Release staking

      This interface is mainly used to exit the verification node. The user cannot reduce the staking and can only exit the staking completely. When a staking is released, the staking is unlocked according to the following rules.

      • The release of staking is in the same epoch as the staking/addition, and the related staking will be returned to the user's staking account from the Staking contract in real time.

      • If the release of the staking is not in the same epoch as the staking/addition, the staking will be locked for 168 cycles and then returned from the Staking Contract to the user's account at the time of the staking.

      After initiating a release of staking, the node will not be selected as a validator to participate in consensus.

      Interface parameters reference Java SDK: Release staking.

    1. Query the validator list of the current epoch

      This interface is used to query the validator information of the current epoch. At the end of each epoch, the list of validators for the next epoch will be updated based on the total weight of all candidate validators.

      Interface parameters reference Java SDK: Query the validator list of the current epoch.

    1. Query the list of validators in the consensus round

      This interface is used to query the list of verifiers that have been selected out of blocks for the current consensus cycle. Each consensus round is 430 blocks, and at 410 blocks will generate a list of verifiers from the verifier queue of the current Epoch that can participate in the next consensus round to get out the blocks.

      Interface parameters reference Java SDK: Query the list of validators in the consensus round.

    2. Query the list of candidate information

      This interface is used to query the list of all candidate verifier information. Any node that has successfully pledged is a candidate verifier.

      Interface parameters reference Java SDK: Query the list of candidate information.

    3. Query the validator entrusted by the delegator

      This interface is used to query which validators have been delegated by the specified delegator.

      Interface parameters reference Java SDK: Query the validator entrusted by the delegator.

    1. Query the staking information of a node

      This interface is used to query the staking information of the node.

      Interface parameters reference Java SDK: Query the staking information of a node.

    2. delegation

      This interface is used to delegate or incrementally delegate a verifier node. Users who have already pledged a node will not be able to delegate it. The user can delegate LAT to the verifier at any time with a minimum amount of 10 LAT per delegation. After a successful delegation, the LAT delegated by the delegator to the candidate verifier is transferred to the Staking contract. The new weight of the verifier will take effect in the next Epoch. When the verifier is selected to participate in the consensus, it will share the block-out and Staking rewards with the principal.

      Interface parameters reference Java SDK: delegation.

    1. Decrease/revoke delegation

      This interface is used to reduce or revoke the delegation operation. The delegator can reduce or revoke the delegation at any time. The minimum amount of the delegation for each reduction is 10 LAT. After the operation is completed, the LAT will be locked in the Staking contract for 56 settlement cycles. If it is less than 10LAT, the delegate's delegation will be revoked. The income obtained by the validator in the current cycle will be distributed to the delegator according to the delegated amount after the reduction.

      Interface parameters reference Java SDK: Decrease/revoke delegation.

    2. Receive the commission of unlocking

      This interface is used to receive the commission gold that is in the unlocking period.

    3. Query delegation

      This interface is used to query the user's delegation information.

      Interface parameters reference Java SDK: Query delegation.

    4. Inquiry account is at the commission amount of the lock -up and unlocking period

      The interface is used to query the commission amount of the account is in the lock -up and unlocking period.

    5. Query average time of packed blocks

      This interface is used to query the average time of packed blocks.

      Interface parameters reference Java SDK: Query average time of packed blocks.

    1. Query the block reward of the epoch

      This interface is used to query the block reward of the current epoch.

      Interface parameters reference Java SDK: Query the block reward of the epoc.

    1. Query the staking reward of the epoch

      This interface is used to query the staking reward of the current epoch.

      Interface parameters reference Java SDK: Query the staking reward of the epoch.

    Governance contract#

    contract address:lat1zqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq93t3hkm

    The on-chain governance method adopted by PlatON enables it to develop in accordance with the requirements of LAT holders. The goal of governance is to ensure that majority ownership can always control the network. Any governance modification plan discussed in the community can be initiated by a validator on the chain and voted for a referendum.

    • Text proposal can be used to vote on content discussed in certain communities. The process includes the voting stage, where the vote is passed and the vote fails.
    • Version proposal can be used to upgrade the version of the chain. The process includes the voting stage, voting failure, pre-validation, validation, and cancellation.
    • Cancel Proposal can be used to cancel previously initiated proposals. The process includes the voting stage, where the vote is passed and the vote fails.
    • Parameter proposal can be used to change some manageable parameters and optimize the ecology of the chain. The process includes the voting stage, where the vote is passed and the vote fails.

    Contract interface#

    1. Create a text proposal

      This interface is used to issue a text proposal. After the text proposal is issued, validators can vote for/against/abstain from the proposal. The voting deadline is about 2 weeks, and the proposal is passed when the voting rate is greater than 50% and the support rate among those who voted is greater than 66.7%.

      Interface parameters reference Java SDK: Create a text proposal.

    1. Create an version proposal

      This interface is used to initiate an version proposal. Proposals can only be initiated by validators. After the proposal is passed, the on-chain version will be upgraded. The validator’s vote is regarded as a support vote. After the voting deadline has passed, when the support rate is greater than 66.7%, the proposal enters the pre-validation stage and will come into effect in the next Epoch.

      Interface parameters reference Java SDK: Create an version proposal.

    1. Create an parameter proposal

      This interface is used to initiate parameter proposals. The parameter proposal is used to change some manageable parameters on the chain. The validator can vote for/again/abstaining votes. The voting deadline is about 2 weeks. When the voter turnout rate is greater than 50% and the voter approval rate is greater than 66.7%, the proposal is passed.

      Interface parameters reference Java SDK: Create an parameter proposal.

    1. Create an cancellation proposal

      This interface is used to initiate a cancellation proposal. Canceling a proposal can cancel the previously initiated text, parameters, and upgrade proposal. The voting deadline must be greater than the voting deadline of the cancelled proposal. After the voting deadline, when the voting rate is greater than 50

      Interface parameters reference Java SDK: Create an cancellation proposal.

    1. Vote

      This interface is used to vote on proposals in progress. Only yes votes can be voted for the version upgrade proposal, and the node needs to be upgraded to the new version before voting.

      Interface parameters reference Java SDK: Vote.

    2. DeclareVersion

      This interface is used to initiate version declarations. When the PlatON network is upgraded to a new version through an upgrade proposal, all verification nodes that have not voted need to upgrade their nodes to the latest version simultaneously, and update their version status in the network through a version statement, otherwise they will not be selected for consensus.

      Interface parameters reference Java SDK: Declare Version.

    1. Query proposal

      This interface is used to query the specified proposal.

      Interface parameters reference Java SDK: Query proposal.

    1. Query proposal status

      This interface is used to query the current status of the proposal

      Interface parameters reference Java SDK: Query proposal status.

    1. Query the list of proposals

      This interface is used to query the list of proposals that are in voting and have ended.

      Interface parameters reference Java SDK: Query the list of proposals.

    2. Query chain version

      This interface is used to query the current effective version of the chain.

      Interface parameters reference Java SDK: Query chain version.

    3. Query governance parameter values

      This interface is used to query the governance parameter value of the current block height

      Interface parameters reference Python SDK: Query governance parameter values.

    4. Query the cumulative number of votes available for a proposal

      This interface is used to query the cumulative number of votes available for a proposal.

      Interface parameters reference Python SDK: Query the cumulative number of votes available for a proposal.

    5. Query the list of governance parameters

      This interface is used to query all management parameters of a certain module.

      Interface parameters reference Python SDK: Query the list of governance parameters.

    Slashing contract#

    contract address:lat1zqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqyva9ztf

    The slashing contract is mainly for system security to monitor the behavior of each node, Penalties will be imposed on violating nodes that violate system security, the contract has the following two major functions:

    • Slashing nodes that can't produce blocks

      According to system rules, each consensus round will have a batch of nodes responsible for producing the blocks of that round, the number of blocks to be produced is fixed for each consensus round, each node is assigned a time window and the number of blocks that need to be produced, generate blocks in turn to complete the block production of the entire consensus round. When a node does not produce a block within the specified time window, will switch to the next node to continue producing blocks, this cycle continues until the number of blocks required to complete the consensus round. The entire consensus round is completed and a new batch of nodes starts the next consensus round.

      If a node has not produced a block in the entire consensus round, then the zero block behavior of the node will be recorded. The Punish conditions are:start recording when the node generates zero blocks for the first time, count the production of blocks in each consensus round in the next period of time, if during this period the node participates in the consensus round again and produces a block, then the previous zero block records will be cleared and exempted from penalties, otherwise, the node will be punished when the statistical time is up, Impose a fine (amount of fine = current block reward*n) and state lock (automatically unlock after a period of lock and return to the normal state. During the lock-up period, the node has no rewards and cannot perform any actions, including modifying information, revoking staking, participating in block production, and accepting delegation).

    • Slashing double-production or double-signed nodes

      Under normal circumstances, a node will only generate one block at the same block height or only sign one of the blocks for different blocks of the same block height, otherwise it is a violation of the rules and will be punished, when this happens to a node, the evidence of violation will be recorded locally by the received node, users can use the RPC to call the platon_evidences interface to obtain evidence of violations, then send the evidence to the chain in the form of a transaction, the system will judge the evidence, if the evidence is true, the node will be punished.

    Contract interface#

    1. Report double sign/double production

      This interface is used to report the double-signature or double-production behavior of a node, the user sends the evidence to the penalty contract in the form of a transaction, After the system verifies that the evidence is true, the node will be fined and the staking will be forcibly released (disqualification of validators and alternative nodes), Part of the fine (default:50%) will be awarded to the reporter as a reward and transferred to the account immediately (transferred to the account that initiated the reporting transaction).

      Interface parameters reference Java SDK: Report double sign/double production.

    1. Check whether the evidence has been reported

      This interface is used to check whether the evidence to be reported has been used before initiating a report (already reported), after the user obtains the evidence by calling the RPC interface, he can first call the interface to check whether the evidence has been reported to avoid repeated reporting. Because the reporting interface requires a lot of cost, and regardless of whether the evidence has been reported (used) or not, the cost of the transaction will still be spent. So this interface can provide pre-check, all input parameters of this interface are parsed from the evidence list returned by the RPC interface platon_evidences.

      Interface parameters reference Java SDK: Check whether the evidence has been reported.

    Lockup contract#

    contract address:lat1zqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqp7pn3ep

    This contract can be used to lock the asset to restrict its circulation within a certain period of time, it can control the total asset circulation within a certain period of time or other lock-in requirements of external personnel, When the lock-up period of the asset ends, the asset will be automatically transferred to the receiving account (the receiving account after unlocking entered when the lock plan was initiated), after the locked asset is transferred to the lock-up contract, the ownership of the asset will belong to the unlocked receiving account, the asset cannot be used for trading during the lock-up period, although it belongs to the receiving account, the funds are stored in the lock-up contract and the account balance cannot be queried, the asset can only be obtained by querying the lock-up record in the lock-up contract. The contract will release the assets to the designated unlock recipient according to the release rules specified by the person who initiated the lock, the release rule can be customized to unlock all at a certain point in time and transfer to the recipient's account, it can also be defined as splitting an asset into N shares and releasing them in M phases, setting the release time of each phase to release one part until all the locked assets are released after the M period, and each time the asset is released, the asset arrives in time. The user account can be used freely.

    Assets in the locked period cannot be transferred due to restrictions, in order to compensate users for the loss of asset liquidity and benefits, this asset can be used for staking nodes and delegation nodes to revitalize funds to obtain income and offset the value dilution caused by inflation. However, when the asset is used for staking or entrusted use, the asset will not be transferred to the recipient's account after the lock-up period has expired. Instead, the asset will be transferred to the recipient's account when the user releases the staking or the delegation, the release rules of the lockup contract will be handled differently according to the use of the asset. If the funds used for staking and delegation only use part of the assets in the locked position, then when the release period is reached, it will only be released from the funds that have never been misappropriated. If the released amount is not enough, it will not be released currently but wait for the user Only release when the misappropriated funds are cancelled.

    Contract interface#

    1. Create a lockup plan

      This interface is used to create an asset lock, transfer the specified amount from the initiator's account to the lock-up contract, and transfer it to the specified recipient account when the specified time is reached.

      Interface parameters reference Java SDK: Create a lockup plan.

    2. Query the lock-up plan

      This interface is used to query the lock-up plan under the specified account, and the specified account is the recipient's account after unlocking.

      Interface parameters reference Java SDK: Query the lock-up plan.

    DelegationReward contract#

    contract address:lat1zqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxlcypcy

    The contract is mainly used to deal with the business related to delegate income. When each user delegates a node, a delegation record will be generated, each delegation record will get dividends from the delegated node, the dividend amount is calculated from the node's income according to the dividend ratio set by the node to the delegator, the total dividends allocated will be divided equally according to the total delegations of the nodes, Each delegated unit will get a certain income, so the income that a single delegation can obtain is directly proportional to the delegated volume.

    In this process, at the end of each epoch, the system will automatically calculate the dividend rewards of each candidate node to all its delegators, all dividend rewards will be immediately transferred to this contract for temporary storage, that is, the income obtained by each principal is first stored in this contract, it is necessary to wait for the user to initiate a transaction for receiving revenue. At this time, the system will calculate how much delegation revenue this user has in this contract and immediately transfer it to the user's account.

    Contract interface#

    1. Receive delegated rewards

      This interface is used to extract delegated rewards that the user has not yet claimed, when a single user entrusts multiple nodes to generate multiple delegations, the interface can only process the rewards for 20 delegations at a time, the rest must be re-initiated to receive the operation (the rules for receiving 20 delegated rewards are sorted according to the number of Epochs that have not been claimed for each delegation, the more the number of unclaimed cycles, the priority to receive the delegated awards), if the number of delegated rewards waiting to be collected is less than 20, then directly collect all of them.

      Interface parameters reference Java SDK: Receive delegated rewards.

    1. Query delegation reward

      This interface can be used to query all pending delegation income details of the interface initiator, you can also specify to query a certain delegation or multiple delegations, the return result will be a sorted list of income details, the sorting rule is to sort in reverse order according to the number of unclaimed Epochs for each delegation (the return data will not be sorted if there are less than 20 delegated rewards to be received)。

      Interface parameters reference Java SDK: Query delegation reward.

    random number contract#

    contract address:lat1xqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpe9fgva

    This contract is mainly used to generate multiple random numbers. The parameter is the number of random numbers to be generated. It supports the generation of up to 500 random numbers. The return value is a []byte array, and every 32 bits is a random number.

    If only one random number is generated, it is obtained by the XOR of the random number of the current block and the transaction hash. If multiple random numbers need to be generated, the first random number is obtained by the XOR of the random number of the current block and the transaction hash. The random number is obtained by XORing the random number of the previous block in turn with the first random number.

    The random number generation principle of the block: After the PlatON node packs the block, it will use VRF to generate a random number and proof for the block, and store it in the Nonce field of the block. The random number seed is the random number of the previous block. number.

    - + \ No newline at end of file diff --git a/en/PlatON_system_contract_api/index.html b/en/PlatON_system_contract_api/index.html index 5af59da8d..82036b5e3 100644 --- a/en/PlatON_system_contract_api/index.html +++ b/en/PlatON_system_contract_api/index.html @@ -8,7 +8,7 @@ System contract api | PlatON - + @@ -32,7 +32,7 @@ EIP55 address:0x1000000000000000000000000000000000000001

    1. CreateRestrictingPlan: Create a lock plan plan

    parameter:

    parametertypedescribemust
    funcTypeuint16(2bytes)Representing method type code(4000)Y
    account20bytesLocklet release to the account accountY
    plan[] RestrictingPLANPlan is a list of restrictingplan types (arrays), and restrictingplan is defined as follows: Type RestrictingPlan Struct {EPOCH UINT64 AMOUCT: BIG.INT} where EPOCH: Indicates the multiple of the settlement cycle, more than 0, EPOCH is 1 represented in the transaction The settlement cycle releases the lock bin. The product of the number of pieces per settlement period is represented in the target block height to release the locked funds. The number of EPOCHs is at least greater than the highest irreversible zone height. Amount: Indicates the amount to be released to the target block.Y
    1. GetRestrictingInfo: Get the lock information

    Note: This interface supports acquisition history data, which can be attached with a high block when requested, and the data of the latest block is queried by default.

    parameter:

    parametertypedescribemust
    funcTypeuint16(2bytes)Representing method type code(4100)Y
    account20bytesLocklet release to the account accountY

    return value:

    Returns the parameter to the JSON format string of the following fields

    nametypedescribeWill it be empty?
    balancestring(0x hexadecimal string)Total lock bin balance - released amountN
    pledgestring(0x hexadecimal string)Pledge / mortgageY, 默认为 0
    debtstring(0x hexadecimal string)DepositY, 默认为 0
    plansbytesLock-locking information, JSON array:[{"blockNumber":"","amount":""},...,{"blockNumber":"","amount":""}]。Among them: blocknumber: BIG.INT, release block height amount:\string(0x hexadecimal string), Release the amountN

    Reward contract interface parameter description#

    The contract address of the reward associated interface is:

    Main network:lat1zqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqxlcypcy
    EIP55 address:0x1000000000000000000000000000000000000006

    1. withdrawDelegateReward: Extract all of the currently extracted delegation rewards

    parameter:

    parametertypedescribemust
    funcTypeuint16(2bytes)Representing method type code(5000)Y

    return value:

    Note: The trading results are stored in logs.data in the transaction receipt, such as transaction success, storage rlp.encode ([] byte {[] Byte (status code 0), rlp.encode (Node Receals list)}) If the transaction is unsuccessful, it is consistent with the previous manner.storage rlp.encode ([] byte {[] Byte (status code 0), rlp.encode (Node Receals list)}) If the transaction is unsuccessful, it is consistent with the previous manner.

    Node Reception List As an array, receive up to 20 nodes at a time at least one time.

    parametertypedescribeis nil
    NodeIDdiscover.NodeID(64bytes)Node IDN
    StakingNumuint64The decoration block of the node is highN
    Reward*big.IntReceiving incomeN
    1. getDelegateReward: The query account has not extracted a reward in each node.

    parameter:

    parametertypedescribemust
    funcTypeuint16(2bytes)Representing method type code(5100)Y
    address20bytesTo check the address of your accountY
    nodeIDs[]discover.NodeIDTo query the nodes, if you are empty, check all the nodes entrusted by your account.(Sort by returning all nodes, press DelegateEPoch ascending, the same time is arranged in the fast row results)N

    return value:

    Is a [] Reward array

    nametypedescribe
    nodeIDdiscover.NodeID(64bytes)Node ID
    stakingNumuint64The decoration block of the node is high
    rewardstring(0x hexadecimal string)Unpaged entrusted revenue

    PPOS RPC Interface Description#

    Query double out, double visa according to interface#

    • Method name:platon_evidences
    • parameter:without
    • return value:
    parametertypedescribe
    jsonrpcstringRPC version number
    idintID serial number
    resultstringEvidence string

    Result is evidence string, including 3 evidence types, named: DuplicatePrepare, DuPlicateViewChange Each type contains multiple evidence, so it is an array structure and needs attention when parsing

    duplicatePrepare

    nametypedescribe
    prepareAepochuint64Connectic wheel EPOCH value
    viewNumberuint64Consensus wheel View value
    blockHashstringBlock Hash
    blockNumberuint64Block Number
    blockIndexuint32Index value of blocks in a round of VIEW
    blockDatastringBlock RLP encoding value
    validateNodeindexuint32Verify the index value in a round of EPOCH
    nodeIdstringVerifier NodeID
    blsPubKeyobjectVerifier BLS public key
    signaturebyte[]Message signature
    prepareBepochuint64Connectic wheel EPOCH value
    viewNumberuint64Consensus wheel View value
    blockHashstringBlock Hash
    blockNumberuint64Block Number
    blockIndexuint32Index value of blocks in a round of VIEW
    blockDatastringBlock RLP encoding value
    validateNodeindexuint32Verify the index value in a round of EPOCH
    nodeIdstringVerifier NodeID
    blsPubKeyobjectVerifier BLS public key
    signaturebyte[]Message signature

    duplicateVote

    nametypedescribe
    voteAepochuint64Connectic wheel EPOCH value
    viewNumberuint64Consensus wheel View value
    blockHashstringBlock Hash
    blockNumberuint64Block Number
    blockIndexuint32Index value of blocks in a round of VIEW
    validateNodeindexuint32Verify the index value in a round of EPOCH
    nodeIdstringVerifier NodeID
    blsPubKeyobjectVerifier BLS public key
    signaturebyte[]Message signature
    voteBepochuint64Connectic wheel EPOCH value
    viewNumberuint64Consensus wheel View value
    blockHashstringBlock Hash
    blockNumberuint64Block Number
    blockIndexuint32Index value of blocks in a round of VIEW
    validateNodeindexuint32Verify the index value in a round of EPOCH
    nodeIdstringVerifier NodeID
    blsPubKeyobjectVerifier BLS public key
    signaturebyte[]Message signature

    duplicateViewchange

    nametypedescribe
    viewAepochuint64Connectic wheel EPOCH value
    viewNumberuint64Consensus wheel View value
    blockHashstringBlock Hash
    blockNumberuint64Block Number
    validateNodeindexuint32Verify the index value in a round of EPOCH
    nodeIdstringVerifier NodeID
    blsPubKeyobjectVerifier BLS public key
    blockEpochuint32EPOCH value generated by blocks
    blockViewuint32VIEW value generated by blocks
    signaturebyte[]Message signature
    viewBepochuint64Connectic wheel EPOCH value
    viewNumberuint64Consensus wheel View value
    blockHashstringBlock Hash
    blockNumberuint64Block Number
    validateNodeindexuint32Verify the index value in a round of EPOCH
    nodeIdstringVerifier NodeID
    blsPubKeyobjectVerifier BLS public key
    blockEpochuint32EPOCH value generated by blocks
    blockViewuint32VIEW value generated by blocks
    signaturebyte[]Message signature

    Query block aggregate signature interface#

    • Method name:platon_getPrepareQC
    • parameter:blockNumber (must)
    • return value:
    parametertypedescribe
    jsonrpcstringRPC version number
    idintID serial number
    resultstringAggregate signature structure

    QuorumCert

    nametypedescribe
    epochuint64Connectic wheel EPOCH value
    viewNumberuint64Consensus wheel View value
    blockHashstringBlock Hash
    blockNumberuint64Block Number
    blockIndexuint32Index value of blocks in a round of VIEW
    signaturestringAggregate signature string
    validatorSetstringVerifier index collection

    Query code versions and signatures#

    • Method name:admin_getProgramVersion
    • parameter:none
    • return value:
    parameterTypes ofdescribeWill it be empty?
    jsonrpcstringRPC version numberN
    idintID serial numberN
    resultstringStringN

    Result is a JSON string, contains two fields of Version and SIGN

    Query BLS certification#

    • Method name:admin_getSchnorrNIZKProve
    • parameter:none
    • return value:none
    parameterTypes ofdescribeWill it be empty?
    jsonrpcstringRPC version numberN
    idintID serial numberN
    resultstringBLS proofN

    Open database garbage collection#

    • Method name: debug_disableDBGC
    • parameter: none
    • return value: none

    Turn off database garbage collection#

    • Method name: debug_enableDBGC
    • parameter: none
    • return value: none
    - + \ No newline at end of file diff --git a/en/PlatON_wallet_plugin/index.html b/en/PlatON_wallet_plugin/index.html index 488babc5b..f2c725c54 100644 --- a/en/PlatON_wallet_plugin/index.html +++ b/en/PlatON_wallet_plugin/index.html @@ -8,13 +8,13 @@ PlatON-Wallet - Operation_Manual | PlatON - +

    PlatON Wallet Plugin

    What is PlatON Wallet Plugin#

    The PlatON Wallet plugin integrates basic wallet functions, cross-chain, fiat channels, Swap and other functions. In the future, it will realize more functions such as cross-currency exchange, transaction authentication based on confidential payment, prepaid card sales, virtual VISA cards, etc.

    The PlatON Wallet plugin is compatible with various decentralized wallets. After integrating the PlatON Wallet plugin, the project party can enable its users to easily conduct cross-chain recharge, fiat purchase and other operations.

    In order to meet the various integration needs of the project parties, we will provide SDKs for a series of languages and frameworks, so that application developers can quickly complete integration according to different business scenarios.

    How to integrate#

    • PlatON wallet plugin SDK: Provides complete wallet functions and pages. Through simple one-point integration, you can quickly use all the functions in the wallet.

    We will also provide more integration methods to meet the integration needs of applications in different scenarios.

    How to use#

    Note: Since the PlatON Wallet plugin itself does not generate account addresses and relies on third-party wallets with accounts, such as Metamask, etc., all transactions will be completed through third-party wallets.

    1. Connect Wallet

    After the application integrates the PlatON Wallet plugin, the PlatON wallet will also synchronize and connect to Metamask after the application connects to Metamask. After connecting to Metamask, the PlatON Wallet plugin will display the asset status of the account on the PlatON network.

    connect

    2. Send and Receive

    The wallet plugin supports sending and receiving Tokens on the PlatON network.

    send-receive

    3. Recharge

    Currently there are two ways to recharge assets on the PlatON network:

    • Method 1: Transfer assets from other networks to the PlatON network through cross-chain bridges
    • Method 2: Purchase assets on the PlatON network by paying in fiat currency through integration with Alchemy Pay and FaTPay. We will support more convenient recharge methods in the future.
    • Method 3: Deposit through Interchain Transfer. After depositing assets to the specified address, the asset deposit on the PlatON network can be completed.
    deposit

    4. Withdraw

    Currently we have two ways to withdraw assets from PlatON:

    • Method 1: Withdraw PlatON network assets to other networks through cross-chain bridges.
    • Method 2: Purchase shopping cards through txnhub.io
    withdraw

    5. More Functions

    We will subsequently support more networks, more cross-chain of currencies, Swap between different currencies, transaction authentication based on confidential payment, virtual VISA cards and more functions.

    - + \ No newline at end of file diff --git a/en/PlatON_wallet_plugin_sdk/index.html b/en/PlatON_wallet_plugin_sdk/index.html index bc99bf93f..3c474ba28 100644 --- a/en/PlatON_wallet_plugin_sdk/index.html +++ b/en/PlatON_wallet_plugin_sdk/index.html @@ -8,7 +8,7 @@ PlatON-Wallet-Plugin-SDK - Access Manual | PlatON - + @@ -25,7 +25,7 @@ // Show Platon-Wallet.walletSDK.show(); // Destroy Platon-WalletwalletSDK.destroy();

    When the project is rendered for the server (e.g. using next.js, etc.), use the following import method:

    let walletSDK = null
     import('@platonnetwork/platon-wallet-sdk').then(module => {  walletSDK = new module.default({ env: 'PROD' })})

    Token Contract#

    PlatON Testnet#

    namesymboladdress
    Tether USDUSDT0x1e6E4b48F6F57Aa7cefd8239e8515694D110386B
    USD CoinUSDC0x229b68722bF16CCc7186Dc8760b3D8C5980fe609

    PlatON Mainnet#

    namesymboladdress
    Tether USDUSDT0xeac734fb7581D8eB2CE4949B0896FC4E76769509
    USD CoinUSDC0xdA396A3C7FC762643f658B47228CD51De6cE936d
    - + \ No newline at end of file diff --git a/en/Python_SDK/index.html b/en/Python_SDK/index.html index 07036897e..8d7e35b05 100644 --- a/en/Python_SDK/index.html +++ b/en/Python_SDK/index.html @@ -8,7 +8,7 @@ Python SDK | PlatON - + @@ -62,7 +62,7 @@ The number of voting consensus rounds. Refer to the instructions for submitting the upgrade proposal. At the same time, the value of this parameter in this interface. cannot be greater than the value in the corresponding upgrade proposal.

  • tobe_canceled_proposal_id: Upgrade proposal ID to be cancelled.

  • pri_key: Private key for transaction.

  • transaction_cfg: Transaction basic configuration.

    type:     dictexample:    cfg = {         "gas":100000000,         "gasPrice":2000000000000,         "nonce":1,     }
  • Calling method

    pip.vote(verifier, proposal_id, option, program_version, version_sign, pri_key, transaction_cfg=None)

    Parameter Description

    • verifier: The certified submitting the proposal.

    • proposal_id: Proposal ID.

    • option: Voting option.

    • program_version: Node code version, obtained by rpc getProgramVersion interface.

    • version_sign: Code version signature, obtained by rpc getProgramVersion interface.

    • pri_key: Private key for transaction.

    • transaction_cfg: Transaction basic configuration.

      type:     dictexample:    cfg = {         "gas":100000000,         "gasPrice":2000000000000,         "nonce":1,     }
    Version Statement#

    Calling method

    pip.declareVersion(active_node, program_version, version_sign, pri_key, transaction_cfg=None)

    Parameter Description

    • active_node: The declared node can only be a verifier/candidate.

    • program_version: The declared version, obtained by rpc's getProgramVersion interface.

    • version_sign: The signed version signature, obtained by rpc's getProgramVersion interface.

    • pri_key: Private key for transaction.

    • transaction_cfg: Transaction basic configuration.

      type:     dictexample:    cfg = {         "gas":100000000,         "gasPrice":2000000000000,         "nonce":1,     }
    Query proposal#

    Calling method

    pip.getProposal(proposal_id, from_address=None)

    Parameter Description

    • proposal_id: proposal id.
    • from_address: Used to call the rpc call method.
    Query proposal results#

    Calling method

    pip.getTallyResult(proposal_id, from_address=None)

    Parameter Description

    • proposal_id: proposal id.
    • from_address: Used to call the rpc call method.
    Query the cumulative number of votes available for a proposal#

    Calling method

    pip.getAccuVerifiersCount(proposal_id, block_hash, from_address=None)

    Parameter Description

    • proposal_id: proposal id.
    • block_hash: block hash.
    • from_address: Used to call the rpc call method.
    Query the list of proposals#

    Calling method

    pip.listProposal(from_address=None)

    Parameter Description

    • from_address: Used to call the rpc call method.
    Query the effective version of the node's chain#

    Calling method

    pip.getActiveVersion(from_address=None)

    Parameter Description

    • from_address: Used to call the rpc call method.
    Query the governance parameter value of the current block height#

    Calling method

    pip.getGovernParamValue(module, name, from_address=None)

    Parameter Description

    • module: Parameter module.
    • name: parameter name.
    • from_address:Used to call the rpc call method.
    Query the governance parameter list#

    Calling method

    pip.listGovernParam(self, module=None, from_address=None)

    Parameter Description

    • module:Parameter module.
    • from_address: Used to call the rpc call method.
    - + \ No newline at end of file diff --git a/en/Samurai_API/index.html b/en/Samurai_API/index.html index 7c432236c..97b3db85f 100644 --- a/en/Samurai_API/index.html +++ b/en/Samurai_API/index.html @@ -8,7 +8,7 @@ Samurai API | PlatON - + @@ -59,7 +59,7 @@ **Parameter** `WatchAssetParams` - The metadata of the asset to be observed. ```javascriptinterface WatchAssetParams { type: 'ERC20'; // In the future, other standards will be supported options: { address: string; // The address of the token contract 'symbol': string; // A ticker symbol or shorthand, up to 5 characters decimals: number; // The number of token decimals image: string; // A string url of the token logo }; }

    Return value

    boolean - If the token has been added, it returns true; otherwise it returns false.

    Description

    In Samurai, users track token requests. Boolean indicates whether the token has been successfully added.

    Most PlatON/Alaya wallets support certain token sets, usually obtained from a centrally planned token registry. wallet_watchAsset enables web3 application developers to require their users to track the tokens in their wallets at runtime. Once added, the token cannot be distinguished from the tokens added through traditional methods (such as centralized registration).

    Example

    platon.request({  method: 'wallet_watchAsset',  params: {    type: 'PRC20',    options: {      address: 'lat1alad2dlvkxvcyz02ag5vtxs9c678mvc5adr3vm',      symbol: 'FOO',      decimals: 18,      image: 'https://foo.io/token-image.svg',    },  },  });.then((success) => {  if (success) {    console.log('FOO successfully added to wallet!')  } else {    throw new Error('Something went wrong.')  }}).catch(console.error)

    Example#

    The following example demonstrates how to initiate common and contract transaction operations on the web console to evoke Samurai for transaction processing.

    After opening Samurai and importing the account, open a new page. Right-click -> check -> console to enter the debug mode (the following command lines are executed in the console). Samurai will inject platon and web3a objects when opening the page, so they can be used directly in the console.

    Ordinary Transaction#

    • Request the authorization of the Samurai user, run the following command to evoke the Samurai interface, and select the corresponding account to agree to authorize the page connection permissions
    > platon.request({ method: 'platon_requestAccounts' });Promise {<pending>}> platon.selectedAddress"lat1mm09yjr8vwr2g78gselj03w2eks7atq2t4y83p"
    • To initiate an ATP transfer transaction, running the following command will evoke Samurai to process the transaction, and you can perform operations such as re-edit.
    > web3a.platon.sendTransaction({from: platon.selectedAddress,to: "lat1dt2wx0xjkd2je8ev4t3ysmte6n90kc9gzndwuv", value: 1e16}, function(err, transactionHash) {if (err) { console.log(err); } else {console.log(transactionHash);}});

    DApp Development Integration#

    On the DApp development page, since Samurai will inject a platon object when opening the page, the object can be directly called through javascript to complete the corresponding operation during development. For the introduction and use of web3a objects, see js-sdk document.

    The following example shows the corresponding javascript script that is called after clicking a page button to initiate a transfer.

    var Web3A = require('web3');var web3platon = new Web3A(platon)contract = new web3platon.platon.Contract(abi, address);toAccount = "lat1dt2wx0xjkd2je8ev4t3ysmte6n90kc9gzndwuv";transferBalance = 1000000000000000;contract.methods.transfer(toAccount,transferBalance)  .send({from:platon.selectedAddress, gas:4712388})  .then (function(receipt){    console.log("receipt: ", receipt);  }).catch(function(err) {    console.log('err: ', err);  })
    - + \ No newline at end of file diff --git a/en/Samurai_user_manual/index.html b/en/Samurai_user_manual/index.html index 6463c6a9f..463fe9b22 100644 --- a/en/Samurai_user_manual/index.html +++ b/en/Samurai_user_manual/index.html @@ -8,13 +8,13 @@ Samurai | PlatON - +

    Samurai

    Samurai is an open source browser plug-in wallet tool that supports the Alaya and PlatON networks, supporting wallet creation, sending and receiving ATP and LAT, and allowing web DApps to interact with the Alaya and PlatON networks.

    Samurai only generates wallet keys on your device, so only you can access your wallet account and data. You therefore need to keep your wallet key (private key, mnemonic) and wallet password safe. Samurai currently only supports Chrome.

    Note#

    Samurai is a browser plug-in wallet modified based on MetaMask's open source code version 8.0.10, which is mainly adapted to the Alaya network and PlatON network. Due to some bugs in the official MetaMask itself. Please pay attention when using Samurai:

    • Do not click the edit button to edit transaction related information on the transaction confirmation page.
    • On the transaction confirmation page, please make sure that the receiving address is correct before clicking the confirm button.

    Installation#

    • Download Samurai plug-in package from Release address.
    • Unzip Samurai plug-in package.
    • Open chrome browser,input chrome://extensions/ in the address bar and Enter,enter the management page of chrome extension program.
    chrome://extensions/
    • Open the switch of developer mode, select to load the unzipped extension program, import the unzipped catalogue of the 2nd step.

    Initial Use#

    1. Click the Samurai icon on the right side of browser address bar, when you use it for the first time, there will be a prompt as shown below:
    1. Click “Get Started”,there is two options - Create wallet and iImport wallet.
    • Import wallet:

    Click “import wallet”,enter the guide page, click “I agree” and enter the next step. Then input the Seed phrase and password of this wallet, and click “import”->Once all steps is completed, you can enter the mainpage.

    Note: The current Samurai mnemonic phrase generation path has problems, and the import of mnemonic phrases generated by external wallet applications is not supported. It is recommended to import it through the private key after the initial creation.

    • Create wallet:

    Click “create wallet”, enter the boot page, click “I agree” and enter the next step. Then input the password of new wallet, and click “create”.

    Go to the mnemonic backup page, click "CLICK HERE TO REVEAL SECRET WORDS" to show the mnemonic words of the new account (mnemonic words need to be prevented from being seen by others, Samurai uses the password you provided to encrypt this information locally and will never send it to the server), click “Reminder me later” to go directly to the Samurai mainpage of the new account(Skip not recommended).

    Click “ext step”, re-input the mnemonic words with the right sequence, click “confirm”->Once all steps is completed, you can enter the mainpage.

    Transaction Operation#

    Send LAT#

    • In the PlatON main network, click "send" on the mainpage, and you can see the Add Recipient page.
    • Enter or select the address for transfer between my accounts, and go to the transaction form page.
    • The transaction form must fill in the number of transaction LAT, and the system will give you the default transaction fee. You can also make appropriate adjustments to this value. After completing the form, click “next” to enter the page to be confirmed, which will show the total number of LAT spent (including the handling fee).
    • Click “Confirm” to complete the sending of LAT, and you can view the transaction status in the Activity on the mainpage.

    Add and send Token#

    Add Token#

    • Enter the mainpage, click Assets -> Add Token.
    • Pop-up the “Add Tokens” page, add the existed Token Contract Address of connected network, Samurai will automatically to get token’s symbol and exact decimal point, click “Next” when you completed all the steps.
    • Enter the confirm page of Add Tokens, there will show the balance of this token under this account, click “Add Tokens”to add successfully.
    • After the account is successfully added, go to the token display screen, which displays the balance of tokens, or you can click “send” to enter the token transfer page. At the same time, the asset list of the mainpage will display the token assets.

    Token Transfer#

    • You can click "send" in the account token display page to initiate the token transfer, or you can click "send" of the corresponding token in the asset list inof the mainpage.
    • Enter the add recipient page, enter or select the address for transfer between my accounts as you would for sending LAT, and enter the transaction form page.
    • The transaction form must enter the number of tokens for the transaction. Click “Next” to enter the transaction confirmation page.
    • Click “Confirm” to complete the sending of tokens, you can view the transaction status in the transaction list on the mainpage.

    Create and manage an account#

    Create Account#

    • Click on the wallet avatar at the top right of the Samurai homepage and click on Create Account in the drop down menu that appears.
    • Go to create account form page, enter account name (example below is wallet 2), click create button.
    • Successful creation will bring you to the mainpage of the newly created wallet, click on the wallet avatar at the top right to see a list of all wallet accounts.

    Import Account#

    • Click on the wallet avatar at the top right of the Samurai page and in the drop down menu that appears click on import account.
    • enter import account form page, you can choose two import modes (private key/keystore json file), choose private key mode, paste private key into the form, then click import button.
    • Choose import keystore file mode, select JSON file type, click select file, select keystore file from local directory, then enter keystore file passphrase, finally click import button.
    • If the import is successful you will enter the main page of the newly imported wallet, click on the wallet avatar at the top right to see a list of all wallet accounts.

    Network Management#

    By default, Samurai connects to the PlatON network, or it can connect to other networks.

    Choose networks#

    Samurai have added PlatON Main Network, PlatON dev network, PlatON Network, PlatON dev Network as default, you can choose a network to connect. Click “Networks” and choose a network from the four networks to connect.

    Add Custom Network#

    • Click “Networks”-> Custom RPC.

    • Enter the new network configuration page, and click “Save” after configuring the form.

    • Samurai will try to connect to the node, and if the node fails to connect, it will pop up a corresponding dialog prompt.

    • If the connection is successful, a network list option will be added to the network list.

    Switch language#

    • Click on the wallet avatar at the top right of the Samurai homepage and click on Settings in the drop down menu that appears.
    • Go to main settings page, then click General -> Go to Current Language drop down box to select (multiple languages supported).
    - + \ No newline at end of file diff --git a/en/Secure_Multi_Party_Computation/index.html b/en/Secure_Multi_Party_Computation/index.html index 4c63ee294..df74f677d 100644 --- a/en/Secure_Multi_Party_Computation/index.html +++ b/en/Secure_Multi_Party_Computation/index.html @@ -8,7 +8,7 @@ Secure Multi Party Computation | PlatON - + @@ -19,7 +19,7 @@ Now that Alice uses two input labels to encrypt the output label gate by gate. Taking the first row in the first table as the example, Alice takes $A0$ and $B_0$ as the input to double AES encrypt output label $E_0$, and obtains $AES{A0}(AES{B_0}(E_0))$. All left gates in this circuit are processed the same way as the first one, after finishing processing all gates, it will get the garbled table as shown in Figure 6 and obtain the garbled circuit $\widetilde{C}$ eventually.

    Figure 6: encryting output label with input labels

    3. Sending Alice's label according to her input#

    After generating the garbled circuit, Alice needs to encrypt her original input $s$. At first, she transforms $s$ into the boolean value corresponding to the input of $C$, then replaces each bit of the boolean value with $A_0$ and $A_1$ according to the input of $\widetilde{C}$. It will obtain the whole labels after replacing every bit. Afterward, Alice sends these labels and $\widetilde{C}$ to Bob together.

    Let Alice's original input is $s=s_0s_1=10$, she sends labels $A_1$ and $B_0$to Bob according her input.

    4. Receiving Bob's label according to his input#

    Now that Bob has both garbled circuit $\widetilde{C}$ and Alice's label, in order to decrypt $\widetilde{C}$, he still need the labels corresponding to his input. As the encryption process demonstrated before, Alice knows Bob's input labels but has no idea about his original input. Bob knows his own original input but has no idea about his input label. Bob achieve it by using 1-out-of-2 OT with Alice bit by bit according to her original input, where Alice is the sender, Bob is the receiver, Bob inputs 0 or 1 according to his actual input. Afterward, he obtains his whole input label according to his input while Bob learns no additional information and Alice is not able to know Bob's original input.

    Let Bob's original input is $t=t_0t_1=01$, after executing OT with Alice, he obtains $C_0$ and $D_1$ according his input. Then he is able to decrypt the garbled circuit by using both parties' input labels.

    5. Evaluating the garbled circuit#

    Bob now has already received the input labels corresponding to his original input, labels he owns are $A_1$, $B_0$, $C_0$ and $D_1$. Then he decrypts the garbled circuit gate by gate and delivers the output of each decrypted gate as the input to decrypt the next gate. After evaluating the garbled circuit, Bob obtains output label as shown in Figure 7.

    As for the first garbled table, Bob takes $A_1$ and $B_0$ as decryption key to get $E_0$; As for the second garbled table, he takes $A_1$ and $B_0$ as decryption key to get $F_1$; As for the third garbled table, Bob takes $C_0$ and $D_1$ as decryption key to get $G_1$; As for the fourth garbled table, Bob takes $F_1$ and $G_1$ as decryption key to get $H_0$; At last, he takes $E_0$ and $H_0$ as decryption key decrypt the last garbled table, and obtain the final output label $I_0$. Since Bob knows its corresponding relationship with 0/1, he is able to get the computing result and send it to Alice. So both of them have the final output result.

    Figure 7: decrypting gate by gate to obtain the output label

    Paradigm of Secure Two-party Computation#

    Figure 8: paradigm of secure two-party computation

    \ Figure 8 demonstrates an ordinary paradigm of secure two-party computation. The workflow is shown below.

    1. One of these two parties codes application algorithm by some common high-level programming languages, such as C++, Java, Python, etc. (depending on the MPC framework used)
    2. The Application algorithm will be compiled into the boolean circuit (consisting of AND, XOR and NOT gates) saved in a file by MPC Circuit Compiler.
    3. These two computing participants pre-process their own original input and transform them into the data format as the input of the boolean circuit.
    4. Both of them execute the boolean circuit by the installed MPC software and make the MPC computation.
    5. When MPC computation is done, both of them obtain the correct output result. Most importantly, it can be guaranteed that no more than the original input would be leaked.

    Paradigm of MPC in PlatON#

    MPC is one of the most important technologies used in PlatON, and secret contracts are implemented with MPC in PlatON, which can protect the privacy of original data belonging to each computing participant.

    Figure 9 demonstrates the computing architecture of Secure Two-party Computation in PlatON.

    Figure 9: Architecture of Secure Two-party Computation in PlatON

    \ Programming of secret contracts in PlatON is compatible with high-level programming languages. Instead of being compiled into redundant boolean circuit file, secret contracts will be compiled into more efficient LLVM IRs. And then LLVM IRs will be deployed onto PlatON network to be executed by JIT in MPC-VM on computing nodes. Input data of secret contracts are kept by data nodes in local, while computing nodes do MPC computation off-chain, and publish the output result onchain.

    Future plans#

    PlatON will optimize the current implemented MPC architecture in order to extend it to more innovational and efficient MPC protocols. PlatON will improve it in the following several ways.

    • combining with homomorphic encryption (HE) to decrease the communication complexity fo MPC.
    • implementing three-party computation and more to satisfy more complex practical application scenarios.
    - + \ No newline at end of file diff --git a/en/Solidity_Contract_Best_Practice/index.html b/en/Solidity_Contract_Best_Practice/index.html index 7e9eda900..a98282767 100644 --- a/en/Solidity_Contract_Best_Practice/index.html +++ b/en/Solidity_Contract_Best_Practice/index.html @@ -8,13 +8,13 @@ Best practices | PlatON - +

    Best practices

    Best Practice#

    Introduction#

    This guide introduces users with some key points that need to be paid attention in the development of smart contracts, mainly in the practice of actual development. Users can use this guide to quickly understand how to set a reasonable fee for a transaction, how to avoid losing the fee due to transaction failure, and how to encode a more standardized smart contract.

    Reasonable Cost Setting#

    When you need to deploy a contract on the main network of PlatON, you need to set a reasonable fee limit. The fee limit refers to the upper limit of the energy consumption cost of smart contract deployment/execution in PlatON. This restriction is mainly accomplished through Gas. Gas is the fuel value of the PlatON network world, which determines the normal operation of the PlatON network ecosystem. Gas is usually used to measure how much "work" is required to perform certain actions, and these workloads are the amount of fees that need to be paid to the PlatON network in order to perform the action. In a simple understanding, Gas is the commission for network miners, and is paid by LAT. Any transaction, contract execution, and data storage on the network need to use Gas.

    PlatON is similar to Ethereum's blockchain system. It uses LAT for payment and maintenance networks. One LAT is divided into:mLAT/uLAT/gVON/mVON/kVON/VON, and VON is the smallest unit.

    Gas consists of two parts: GasLimit and GasPrice. GasLimit is the maximum Gas consumption (minimum 21,000) that a user is willing to pay to perform an operation or confirm a transaction. GasPrice is the unit price of each Gas.

    When a user sends a transaction, GasLimit and GasPrice are set. GasLimit * GasPrice is the user's transaction cost, and the cost is rewarded to the miner as a commission.

    The higher the GasPrice of the transaction, the higher the execution priority of the transaction and the greater the transaction cost. After each transaction is completed, the remaining unused Gas will be returned to the sender's address account. It is important to note that if the execution of the transaction fails due to the GasLimit is too low, the Gas will not be returned to the user's address at this time, and the user still needs to pay the energy cost for the failed transaction. Therefore, regardless of whether the transaction is executed successfully, the transaction sender needs to pay a certain calculation fee to the miner.

    In the PlatON network, the maximum gas limit is 4,700,000 and the minimum is 22,000. Too low or too high will cause transaction failure. When deploying large contracts or calling complex functions in contracts, you can increase the gas limit, for example: 1,000,000. If it is a normal transfer, set it to the lowest value. The specific value needs to be estimated according to the size and complexity of the contract. Before the contract is released, the interface platon_estimateGas can be called for approximate estimation to avoid failure due to insufficient Gas. Click to view JSON-RPC reference documentation.

    LAT Unit Conversion

    UnitVON ValueVON
    VON11 VON
    kVON1e3 VON1,000
    mVON1e6 VON1,000,000
    gVON1e9 VON1,000,000,000
    LAT1e18 VON1,000,000,000,000,000,000
    mLAT1e24 VON1,000,000,000,000,000,000,000,000
    gLAT1e27 VON1,000,000,000,000,000,000,000,000,000

    Avoid Timeouts#

    Sending transactions on the PlatON network does not have the concept of timeout, but it will eventually stop according to the set gas limit value. If the limit value is lower than the consumption required for contract deployment, the transaction execution fails and the corresponding processing fee will be deducted. The fee setting cannot be infinite, because in the network, the block itself has a maximum GasLimit value. When the GasLimit of the transaction exceeds this value, the transaction will not be accepted.

    If the call function of a published contract is called (a call is a stateless operation in the contract logic), there is a 5s timeout limit. If the contract logic is not executed within 5s, a timeout will occur and the virtual machine will forcely exit , causing the query to fail.

    To avoid contract-related transaction failures, try breaking large contracts into smaller pieces and referencing each other as needed. To avoid infinite loops, be aware of common pitfalls and recursive calls.

    Punishment For Illegal Operations#

    If the smart contract is not compiled by a standard valid compiler, or the instruction code is changed at will, the opcode will be invalid. This type of contract not only fails to be deployed and executed successfully, but also generates a full amount (GasLimit * GasPrice) penalty. The transaction fee for the current transaction will be deducted. This is a very strong penalty. If the operator does not pay attention to this point and keep retrying, then the cost will be higher and the cost will be heavier.

    In general, invalid opcodes have the following conditions:

    1. Manually changed the instruction code for the normally compiled contract;
    2. The contract compiler version is not consistent with the contract version supported by the network lock;

    When operating a contract in the PlatON network. First, you must confirm the smart contract version supported by the current network, and then select the compiler of the corresponding version pair.

    The normal operation is to use the latest Truffle/PlatON-CDT officially provided by PlatON to compile/deploy/execute the contract. At the same time, before switching to the main network, it must be validated on the test network.

    Coding Standards#

    Naming Rules#

    Basic Rules:

    • Use complete descriptive information that accurately describes variables, fields, classes, interfaces, etc.
    • Use mixed case (except special characters) to improve the readability of the name.
    • Use terminology within the blockchain industry.
    • Use as few abbreviations as possible. If you must use them, it is recommended to use public abbreviations and custom abbreviations.
    • Avoid using names that are similar or just distinguish between upper and lower case.
    • The directory uses lowercase uniformly, without special symbols.
    • For smart contracts, the file name is consistent with the contract name.
    • The naming suggestion is to use the hump name uniformly.

    Document Format For Smart Contracts#

    File Layout Rules:

    • Generally more than 1000 lines of program code is difficult to read, try to avoid the situation that the number of lines of code in a file is too long. Each contract document should contain only a single contract class or contract interface.

    Order Of Files:

    • Notes on files: All contract source files have a note at the beginning, which lists the copyright statement, file name, function description, and creation and modification records of the file.
    • File/Package reference: In the contract source file, the first non-comment line is the compiler version, followed by the reference statement.
    • Remarks for class or interface: Comments should be made before class and interface definitions, including descriptions of classes and interfaces, latest modifiers, version numbers, reference links, etc.
    • The order of member variables: first the public level, then the protection level, and finally the private level.
    • Functions: Functions within a contract should be grouped by module, not by scope or access permissions.

    Suggestions#

    • In the smart contract, to get the value of the state variable modified by the public, there is no need to write a function of get.
    • In a smart contract, if an anonymous function modified by payable is added to the contract, the contract address can accept LAT transfers.

    - + \ No newline at end of file diff --git a/en/Solidity_Contract_Dev_Costs/index.html b/en/Solidity_Contract_Dev_Costs/index.html index 5387c0920..c2824e4cc 100644 --- a/en/Solidity_Contract_Dev_Costs/index.html +++ b/en/Solidity_Contract_Dev_Costs/index.html @@ -8,14 +8,14 @@ Development costs | PlatON - +

    Development costs

    Introduction#

    In a blockchain system, developing smart contracts based on any public chain system involves the development cost of resource expenditure. For example, deploying/calling smart contracts on the network, performing energy conversion, pledge/delegation and other operations all require a certain cost. Different blockchain network development costs are different. The cost of developing smart contracts on the PlatON network is similar to that of developing on Ethereum. This manual will analyze and compare in an intuitive format, allowing users to have a clearer understanding of development costs.

    Summary#

    This article will use a table to compare different development costs of small, medium and large contracts, and compare PlatON with Ethereum. In terms of contracts, a simple SET/GET function contract is used as a small test contract. The medium-sized contract example will use an open source(eth-tweet) contract The large contract is a smart contract that complies with the PRC20 standard.

    Data Overview#

    Simple Storage Contract

    PlatformContract LevelSizeGasUsedGasPriceAmountRemark
    PlatONSmall-sized0.3 kb769535,000,000,000 VON384765 gVON0.000384765 LAT
    EthereumSmall-sized0.3 kb1271735,000,000,000 wei635865 Gwei0.000635865 ETH

    eth-tweet Contract

    PlatformContract LevelSizeGasUsedGasPriceAmountRemark
    PlatONMedium-sized2.08 kb2570655,000,000,000 VON1285325 gVON0.001285325 LAT
    EthereumMedium-sized2.08 kb6213855,000,000,000 wei3106925 Gwei0.003106925 ETH

    PRC20 Token Contract

    PlatformContract LevelSizeGasUsedGasPriceAmountRemark
    PlatONLarge-sized4.45 kb5528235,000,000,000 VON2764115 gVON0.002764115 LAT
    EthereumLarge-sized4.45 kb12821715,000,000,000 wei6410855 Gwei0.006410855 ETH

    Small-sized Contract#

    Simple Storage Contract#

    Sample Code

    pragma solidity ^0.4.12;
     contract SimpleTest {        uint public age;     function setAge(uint _input) public {        age = _input;    }     function getAge() public constant returns (uint) {        return age;    }}

    ByteCode

    608060405234801561001057600080fd5b50610117806100206000396000f3006080604052600436106053576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063262a9dff146058578063967e6e65146080578063d5dcf1271460a8575b600080fd5b348015606357600080fd5b50606a60d2565b6040518082815260200191505060405180910390f35b348015608b57600080fd5b50609260d8565b6040518082815260200191505060405180910390f35b34801560b357600080fd5b5060d06004803603810190808035906020019092919050505060e1565b005b60005481565b60008054905090565b80600081905550505600a165627a7a7230582079e51340567895e1097e1c9115e778c3d982b8e71b6997c57f1ba497c56c8b3b0029

    ByteSize:311 byte => 0.3 kb

    Cost#

    PlatON

    • GasUsed: 76953
    • GasPrice: 5,000,000,000 (5 gVON)
    • Costs: 384765 gVON(0.000384765 LAT

    Ethereum

    • GasUsed: 127173
    • GasPrice: 5,000,000,000 (5 Gwei)
    • Costs: 635865 Gwei(0.000635865 ETH

    Medium-sized Contract#

    Eth-Tweet#

    Sample Code

    Click to view code

    ByteCode

    6060604052341561000f57600080fd5b5b600060018190555033600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b5b6107e88061006a6000396000f3006060604052361561008c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630c4f65bd146100915780633e450fff146100e65780635c3e426c146100fb578063ae978f0814610134578063b6db75a0146101d1578063c3ad5ecb146101fe578063ca7dc5b1146102a2578063fb46d4c5146102cb575b600080fd5b341561009c57600080fd5b6100a461033c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100f157600080fd5b6100f9610367565b005b341561010657600080fd5b610132600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506103b2565b005b341561013f57600080fd5b610147610411565b6040518080602001848152602001838152602001828103825285818151815260200191508051906020019080838360005b838110156101945780820151818401525b602081019050610178565b50505050905090810190601f1680156101c15780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b34156101dc57600080fd5b6101e46104f7565b604051808215151515815260200191505060405180910390f35b341561020957600080fd5b61021f6004808035906020019091905050610550565b6040518080602001838152602001828103825284818151815260200191508051906020019080838360005b838110156102665780820151818401525b60208101905061024a565b50505050905090810190601f1680156102935780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b34156102ad57600080fd5b6102b5610628565b6040518082815260200191505060405180910390f35b34156102d657600080fd5b610326600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610633565b6040518082815260200191505060405180910390f35b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505b90565b61036f6104f7565b156103af57600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b5b565b6103ba6104f7565b1561040d578073ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050505b5b50565b610419610703565b600080600080600180540381526020019081526020016000206001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104c95780601f1061049e576101008083540402835291602001916104c9565b820191906000526020600020905b8154815290600101906020018083116104ac57829003601f168201915b505050505092506000806001805403815260200190815260200160002060000154915060015490505b909192565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161490505b90565b610558610703565b60008060008481526020019081526020016000206001018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106035780601f106105d857610100808354040283529160200191610603565b820191906000526020600020905b8154815290600101906020018083116105e657829003601f168201915b505050505091506000808481526020019081526020016000206000015490505b915091565b600060015490505b90565b600061063d6104f7565b151561066b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90506106fd565b60a08251111561069d577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe90506106fc565b4260008060015481526020019081526020016000206000018190555081600080600154815260200190815260200160002060010190805190602001906106e4929190610717565b50600160008154809291906001019190505550600090505b5b5b919050565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061075857805160ff1916838001178555610786565b82800160010185558215610786579182015b8281111561078557825182559160200191906001019061076a565b5b5090506107939190610797565b5090565b6107b991905b808211156107b557600081600090555060010161079d565b5090565b905600a165627a7a7230582004bd291e77dd5f2bfd4822ec9590d7da613bf3ef8cb6270dc7d553fa687ab1780029

    ByteSize: 2130.5 byte => 2.08 kb

    Cost#

    PlatON

    • GasUsed: 257065
    • GasPrice: 5,000,000,000 (5 gVON)
    • Costs: 1285325 gVON(0.001285325 LAT

    Ethereum

    • GasUsed: 621385
    • GasPrice: 5,000,000,000 (5 Gwei)
    • Costs: 3106925 Gwei(0.003106925 ETH

    Large-sized Contract#

    PRC20 Token Contract#

    Sample Code

    Click to view code

    ByteCode

    6060604052604060405190810160405280600481526020017f56302e3100000000000000000000000000000000000000000000000000000000815250600690805190602001906200005292919062000139565b5034156200005c57fe5b604051620011cd380380620011cd833981016040528080519060200190919080518201919060200180519060200190919080518201919050505b83600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550836000819055508260039080519060200190620000f992919062000139565b5081600460006101000a81548160ff021916908360ff16021790555080600590805190602001906200012d92919062000139565b505b50505050620001e8565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200017c57805160ff1916838001178555620001ad565b82800160010185558215620001ad579182015b82811115620001ac5782518255916020019190600101906200018f565b5b509050620001bc9190620001c0565b5090565b620001e591905b80821115620001e1576000816000905550600101620001c7565b5090565b90565b610fd580620001f86000396000f300606060405236156100ad576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100c3578063095ea7b31461015c57806318160ddd146101b357806323b872dd146101d9578063313ce5671461024f57806354fd4d501461027b57806370a082311461031457806395d89b411461035e578063a9059cbb146103f7578063cae9ca511461044e578063dd62ed3e146104e8575b34156100b557fe5b6100c15b60006000fd5b565b005b34156100cb57fe5b6100d3610551565b6040518080602001828103825283818151815260200191508051906020019080838360008314610122575b805182526020831115610122576020820191506020810190506020830392506100fe565b505050905090810190601f16801561014e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561016457fe5b610199600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506105ef565b604051808215151515815260200191505060405180910390f35b34156101bb57fe5b6101c36106e2565b6040518082815260200191505060405180910390f35b34156101e157fe5b610235600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106e8565b604051808215151515815260200191505060405180910390f35b341561025757fe5b61025f610969565b604051808260ff1660ff16815260200191505060405180910390f35b341561028357fe5b61028b61097c565b60405180806020018281038252838181518152602001915080519060200190808383600083146102da575b8051825260208311156102da576020820191506020810190506020830392506102b6565b505050905090810190601f1680156103065780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561031c57fe5b610348600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a1a565b6040518082815260200191505060405180910390f35b341561036657fe5b61036e610a64565b60405180806020018281038252838181518152602001915080519060200190808383600083146103bd575b8051825260208311156103bd57602082019150602081019050602083039250610399565b505050905090810190601f1680156103e95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103ff57fe5b610434600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b02565b604051808215151515815260200191505060405180910390f35b341561045657fe5b6104ce600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610c70565b604051808215151515815260200191505060405180910390f35b34156104f057fe5b61053b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610f21565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105e75780601f106105bc576101008083540402835291602001916105e7565b820191906000526020600020905b8154815290600101906020018083116105ca57829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190505b92915050565b60005481565b600081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156107b5575081600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156107c15750600082115b156109585781600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555081600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610962565b60009050610962565b5b9392505050565b600460009054906101000a900460ff1681565b60068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a125780601f106109e757610100808354040283529160200191610a12565b820191906000526020600020905b8154815290600101906020018083116109f557829003601f168201915b505050505081565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610afa5780601f10610acf57610100808354040283529160200191610afa565b820191906000526020600020905b815481529060010190602001808311610add57829003601f168201915b505050505081565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610b535750600082115b15610c605781600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a360019050610c6a565b60009050610c6a565b5b92915050565b600082600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a38373ffffffffffffffffffffffffffffffffffffffff1660405180807f72656365697665417070726f76616c28616464726573732c75696e743235362c81526020017f616464726573732c627974657329000000000000000000000000000000000000815250602e01905060405180910390207c01000000000000000000000000000000000000000000000000000000009004338530866040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001828051906020019080838360008314610ec0575b805182526020831115610ec057602082019150602081019050602083039250610e9c565b505050905090810190601f168015610eec5780820380516001836020036101000a031916815260200191505b5094505050505060006040518083038160008761646e5a03f1925050501515610f155760006000fd5b600190505b9392505050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490505b929150505600a165627a7a723058200cefa2ee536584300e6123cee2abeafcf9ab9388caf67ee95580f02e5587008d0029

    ByteSize: 4557.5 byte => 4.45 kb

    Cost#

    PlatON

    • GasUsed: 552823
    • GasPrice: 5,000,000,000 (5 gVON)
    • Costs: 2764115 gVON(0.002764115 LAT

    Ethereum

    • GasUsed: 1282171
    • GasPrice: 5,000,000,000 (5 Gwei)
    • Costs: 6410855 Gwei(0.006410855 ETH

    - + \ No newline at end of file diff --git a/en/Solidity_Contract_Migrate/index.html b/en/Solidity_Contract_Migrate/index.html index 30b6910fa..c55a4ea38 100644 --- a/en/Solidity_Contract_Migrate/index.html +++ b/en/Solidity_Contract_Migrate/index.html @@ -8,7 +8,7 @@ Migration tutorial | PlatON - + @@ -33,7 +33,7 @@ /** * Destroy tokens from other account * * Remove `_value` tokens from the system irreversibly on behalf of `_from`. * * @param _from the address of the sender * @param _value the amount of money to burn */ function burnFrom(address _from, uint256 _value) public returns (bool success) { require(balanceOf[_from] >= _value); // Check if the targeted balance is enough require(_value <= allowance[_from][msg.sender]); // Check allowance balanceOf[_from] -= _value; // Subtract from the targeted balance allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance totalSupply -= _value; // Update totalSupply emit Burn(_from, _value); return true; }}

    Operation Procedure#

    Step1. Create new directory for example project

    mkdir example && cd example

    After the command is executed,project directory structure is as follows:

    Step2. Init project

    platon-truffle init

    After the command is executed,project directory structure is as follows:

    • contracts/: solidity contract directory

    • migrations/: depoly file directory

    • test/: test script directory

    • truffle-config.js: platon-truffle config

    Step3. Move ERC200513Token contract compiled in to example/contracts

    ls contracts/
    • ERC200513Token.sol
    • PlatON's smart contract unit is LAT, VON. To migrate the Ethereum smart contract to PlatON,please change the Ethereum denomination to PlatON denomination.also note the ether /LAT market rate(for this contract, we assume the market exchange rate1:1,uint256 public totalSupply = 10000000000000000000 ether; change to uint256 public totalSupply = 10000000000000000000 LAT;)
    • PlatON's smart contract block.timestamp is current block timestamp as milliseconds since unix epoch, and Ethereum smart contract is seconds.

    Step4. Modify the compilation version number and chain-dependent configuration in truffle-config.js

    module.exports = {  networks: {     development: {      host: "10.1.1.6",     // chain address      port: 8806,            // chain rpc port      network_id: "*",       // Any network (default: none)      from: "lat1wxadw8yzr6qxdw5yl3f2surp6ue6f03e07kcqc", // the wallet address of deployment contract       gas: 999999,      gasPrice: 50000000004,              },  },
       compilers: {    solc: {       version: "0.5.13",    // the version number used in compiling the contract is the same as the contract definition       docker: false,        // Use "0.5.1" you've installed locally with docker    }  }}

    Step5. Compile contract

    platon-truffle compile

    The following is the output of the successful compilation:

    Compiling your contracts...Compiling ./contracts/ERC200513Token.solCompiling ./contracts/Migrations.sol  compilation warnings encountered:
     Warning: This is a pre-release compiler version, please do not use it in production.Artifacts written to /home/guest/example/build/contractsCompiled successfully using:   solc: 0.5.13-develop.2020.1.2+commit.9ff23752.mod.Emscripten.clang

    Step6. Create deploy script

    cd migrations && touch 2_initial_ERC200513Token.js

    Deploy script 2_initial_ERC200513Token.js content is as follows:

    const ERC200513Token = artifacts.require("ERC200513Token"); //contract class namemodule.exports = function(deployer) {  deployer.deploy(ERC200513Token,100,'PLA','PLAT'); //ERC200513Token abstract and constructor params};  

    Step7. Deploy contract

    platon-truffle migrate

    After deploying successfully, you will see log info as follows:

    Compiling your contracts...Everything is up to date, there is nothing to compile.2_initial_ERC200513Token.js   Deploying 'ERC200513Token'     transaction hash:    0xa1770aecf4cffb0e75a172e06e75a9e9cb2d36bf89291b57d504e8c054985e99     Blocks: 0            Seconds: 0     contract address:    lat1uetshtp4tp6l067tl02e4x435py9ajrfdhsrd4//new contract address     block number:        265657     block timestamp:     1581742216965     account:             lat1wxadw8yzr6qxdw5yl3f2surp6ue6f03e07kcqc     balance:             90000000.826385379994114416     gas used:            638876     gas price:           50.000000004 gVON     value sent:          0 LAT     total cost:          0.031943800002555504 LAT     Saving migration to chain.     Saving artifacts     Total cost:     0.031943800002555504 LATSummary Total deployments:   2 Final cost:          0.037844150003027532 LAT

    - + \ No newline at end of file diff --git a/en/Solidity_Contract_Security_Dev_Guide/index.html b/en/Solidity_Contract_Security_Dev_Guide/index.html index 910b15128..ae0d40964 100644 --- a/en/Solidity_Contract_Security_Dev_Guide/index.html +++ b/en/Solidity_Contract_Security_Dev_Guide/index.html @@ -8,7 +8,7 @@ Contract security | PlatON - + @@ -29,7 +29,7 @@ function writeMap(uint _map, uint _key, uint _value) public { array[_map][_key] = _value; } function readMap(uint _map, uint _key) public view returns (uint) { return array[_map][_key]; } function eraseMaps() public { delete array; }}

    Consider the example above and the following sequence of calls: allocate(10), writeMap(4, 128, 256). At this point, calling readMap(4, 128) returns 256. If we call eraseMaps, the length of state variable array is zeroed, but since its mapping elements cannot be zeroed, their information stays alive in the contract’s storage. After deleting array, calling allocate(5) allows us to access array[4] again, and calling readMap(4, 128) returns 256 even without another call to writeMap.

    If your mapping information must be deleted, consider using a library similar to iterable mapping, which allows you to traverse the keys and delete their values in the appropriate mapping.

    Permission Control Error#

    In smart contracts, contract developers usually set some permission for the contract owner, but if the developer negligently writes wrong function permissions, it may lead to serious consequences such as transfer of the owner.

    function initContract() public {    owner = msg.reader;}

    The above code function needs to be set onlyOwner.

    Reasonable permissions should be set for different functions in the contract.

    Address Initialization Problem#

    In EVM, all address-related initializations are given an initial value of 0.

    If an address variable is equal to 0, the variable may not be initialized or an unknown error may occur.

    If the developer initializes an address variable in the code but does not assign an initial value, or the user does not assign the address variable by mistake when initiating an operation, but this variable needs to be handled in the following code, it is possible Cause unnecessary security risks.

    For functions that involve addresses, it is recommended to add require (_to! = Address (0)) verification to effectively avoid unnecessary losses caused by user misoperations or unknown errors.

    Transaction Order Dependent#

    Since transactions are first stored in mempool in a short period of time, it is possible to know what action will take place before miners package them into blocks. This is troublesome for a decentralized market, because the transaction information of the token can be viewed, and the transaction order can be changed before it is packaged into a block. Avoiding this is difficult because it comes down to the specific contract itself.

    For example, in the market, it is best to implement batch auctions (this also prevents high frequency trading issues). Another method is using a pre-commit scheme.

    Minor Details#

    Types that do not occupy the full 32 bytes might contain “dirty higher order bits”. This is especially important if you access msg.data - it poses a malleability risk: You can craft transactions that call a function f(uint8 x) with a raw byte argument of 0xff000001 and with 0x00000001. Both are fed to the contract and both will look like the number 1 as far as x is concerned, but msg.data will be different, so if you use keccak256(msg.data) for anything, you will get different results.

    Security Recommendations#

    Take Warnings Seriously#

    If the compiler warns you about something, you should better change it. Even if you do not think that this particular warning has security implications, there might be another issue buried beneath it. Any compiler warning we issue can be silenced by slight changes to the code.

    Always use the latest version of the compiler to be notified about all recently introduced warnings.

    Restrict the Amount of Ether#

    Restrict the amount of Ether (or other tokens) that can be stored in a smart contract. If your source code, the compiler or the platform has a bug, these funds may be lost. If you want to limit your loss, limit the amount of Ether.

    Simple and Modular#

    Keep your contracts small and easily understandable. Single out unrelated functionality in other contracts or into libraries. General recommendations about source code quality of course apply: Limit the amount of local variables, the length of functions and so on. Document your functions so that others can see what your intention was and whether it is different than what the code does.

    Use the Checks-Effects-Interactions Pattern#

    Most functions will first perform some checks (who called the function, are the arguments in range, did they send enough Ether, does the person have tokens, etc.). These checks should be done first.

    As the second step, if all checks passed, effects to the state variables of the current contract should be made. Interaction with other contracts should be the very last step in any function.

    Early contracts delayed some effects and waited for external function calls to return in a non-error state. This is often a serious mistake because of the re-entrancy problem explained above.

    Note that, also, calls to known contracts might in turn cause calls to unknown contracts, so it is probably better to just always apply this pattern.

    Include a Fail-Safe Mode#

    While making your system fully decentralised will remove any intermediary, it might be a good idea, especially for new code, to include some kind of fail-safe mechanism:

    You can add a function in your smart contract that performs some self-checks like “Has any Ether leaked?”, “Is the sum of the tokens equal to the balance of the contract?” or similar things. Keep in mind that you cannot use too much gas for that, so help through off-chain computations might be needed there.

    If the self-check fails, the contract automatically switches into some kind of “failsafe” mode, which, for example, disables most of the features, hands over control to a fixed and trusted third party or just converts the contract into a simple “give me back my money” contract.

    Check Function Permissions Carefully#

    Reasonable permissions should be set for different functions in the contract.

    Check whether the functions in the contract use public and private keywords for visibility modification. Check whether the contract is correctly defined and uses modifiers to restrict access to key functions to avoid problems caused by unauthorized use.

    function initContract() public OnlyOwner {    owner = msg.reader;}

    Ask for Peer Review#

    The more people examine a piece of code, the more issues are found. Asking people to review your code also helps as a cross-check to find out whether your code is easy to understand - a very important criterion for good smart contracts.

    Other#

    1. More Security Recommendations
    2. Contract Best Practices

    Security Tools#

    1. Ethereum formal verification tool SMT checker .
    2. Formal verification tools: offline VS Code plugin,and Online version .
    3. Remix integrated security scan plugin: MythX

    Third Party Audit#

    You can find a professional third-party audit company for security audits, such as:slow mist


    - + \ No newline at end of file diff --git a/en/Solidity_Dev_Manual/index.html b/en/Solidity_Dev_Manual/index.html index 3c8f464c6..dd671e20b 100644 --- a/en/Solidity_Dev_Manual/index.html +++ b/en/Solidity_Dev_Manual/index.html @@ -8,7 +8,7 @@ Getting started | PlatON - + @@ -52,7 +52,7 @@ //Give all donations from the contract to the beneficiary beneficiaryAddress.transfer(amountRaised); emit FundTransfer(beneficiaryAddress, amountRaised, false); } }}

    Compile Crowdfunding Contract

    Step1. Create new directory for Crowdfunding project

    mkdir myCrowdFunding && cd myCrowdFunding

    The following commands are performed in the myCrowdFunding directory without special instructions.

    Step2. Init project

    platon-truffle init

    After the command is executed, project directory structure is as follows:

    • contracts/: solidity contract directory
    • migrations/: depoly file directory
    • test/: test script directory
    • truffle-config.js: platon-truffle config

    Step3. Move crowdfunding contract compiled in to myCrowdFunding/contracts/

    ls myCrowdFunding/contracts/

    Files in the directory: crowdFunding.sol.

    Step4. Fix compile version same as the version setted in truffle-config.js

    vim truffle-config.js

    Truffle-config.js content is as follows:

    compilers: {     solc: {        version: "0.5.17",    //same as the version declared in CrowdFunding.sol    }}

    Step5. Compile contract

    platon-truffle compile

    After the command is executed, project directory structure is as follows:

    • build/: solidity contract directory after compiled
    • build/contracts/CrowdFunding.json: the compiled file corresponding with CrowdFunding.sol

    Deploly crowdfunding Contract

    Step1. Create deploy script

    cd migrations/ && touch 2_initial_CrowdFunding.js

    Deploy script 2_initial_crowdFunding.js,content is as follows:

    const CrowdFunding = artifacts.require("CrowdFunding"); //deployment contract class namemodule.exports = function(deployer) {      deployer.deploy(CrowdFunding);};

    Step2. Setting config information for blockchain in truffle-config.js

    vim truffle-config.js

    Set blockchain network info

    networks: {    development: {       host: "10.1.1.6",     // blockchain server address       port: 8806,            // server port       network_id: "*",       // Any network (default: none)       from: "lat1wxadw8yzr6qxdw5yl3f2surp6ue6f03e07kcqc", //the accout address of deploying contract       gas: 999999,       gasPrice: 50000000004,    },}

    Step3. Deploy contract

    platon-truffle migrate

    After deploying successfully, you will see log info as follows:

    Compiling your contracts... Everything is up to date, there is nothing to compile. 3_initial_CrowdFunding.js     Deploying 'CrowdFunding'     transaction hash:    0x3a6419cd4169d7cfb430a1fc5632239ac4a01845827f20df9b3229a334c5488b     Blocks: 0            Seconds: 0     contract address:    lat1qtgycm7jkrq8csa2rgef6enlru0u02g8u82kpt //contract address     block number:        280532     block timestamp:     1581751224032     account:             lat1wxadw8yzr6qxdw5yl3f2surp6ue6f03e07kcqc     balance:             90000000.806077629992489796     gas used:            379154     gas price:           50.000000004 gVON     value sent:          0 LAT     total cost:          0.018957700001516616 LAT      Saving migration to chain.     Saving artifacts     Total cost:     0.018957700001516616 LAT

    Crowdfounding Query:

    Step1. Enter the platon-truffle console

    platon-truffle console

    You can execute command in platon-truffle console

    Step2. Create contract object

    var abi = [...]; //ABI of CrowdFunding contract,can get from build/contracts/CrowdFunding.jsonvar contractAddr = 'lat1qtgycm7jkrq8csa2rgef6enlru0u02g8u82kpt'; //CrowdFundsing contract addressvar crowdFunding = new web3.platon.Contract(abi,contractAddr);

    Step3. Query the amount raised

    crowdFunding.methods.amountRaised().call(null,function(error,result){console.log("result:" + result);}); //query the amount raised

    Step4. Crowdfunder judge the success of crowdfunding

    crowdFunding.methods.safeWithdrawal().send({from:'lat1wxadw8yzr6qxdw5yl3f2surp6ue6f03e07kcqc'}).on('data', function(event){ console.log(event);}).on('error', console.error); 

    Call contract command description:

    • crowdFunding is the contract object we built earlier
    • methods fixed syntax specifying that methods in the contract will be obtained
    • safeWithdrawal is a method in our crowdfunding contract to recover funds
    • from caller's wallet address
    • on listen for contract processing result events, and output error logs for failures

    FAQ#

    About Compile#

    1. How many commands in platon-truffle?

      Refer to platon-truffle develop guide Reference here.

    2. Why contract syntax cannot be verified?

      Solidity 0.4.x has a great different with 0.5.x, detail info refer to Reference here.

    3. Why truffle doesn't compile?

      Confirm the contract version same as the version specified in the truffle-config.js. Contract syntax be writed in a wrong way.

    4. Why the contract can not be deployed by truffle migrate?

      Confrim the blockchain network info be configured correctly. Confirm the account address be configured correctly.

    5. Deploying a contract with a parameter constructor using the command truffle migrate failed.

      For example, A.sol

      Constructor(uint256 a, string memory b, string memory c) public {}

      2_initial_A.js configured as follow:

      const A = artifacts.require("A");  module.exports = function(deployer) {        deployer.deploy(A,100,'PLA','PLAT');//pass the corresponding construction parameters};
    - + \ No newline at end of file diff --git a/en/Solidity_Inner_Contract/index.html b/en/Solidity_Inner_Contract/index.html index 3ef28fa41..d57dc01b4 100644 --- a/en/Solidity_Inner_Contract/index.html +++ b/en/Solidity_Inner_Contract/index.html @@ -8,7 +8,7 @@ Call Inner Contract | PlatON - + @@ -22,7 +22,7 @@ function assemblyCallppos(bytes memory data,address addr) public { uint256 len = data.length; uint retsize; bytes memory resval; assembly { if iszero(call(gas, addr, 0, add(data, 0x20), len, 0, 0)) { invalid() } retsize := returndatasize() } resval = new bytes(retsize); assembly { returndatacopy(add(resval, 0x20), 0, returndatasize()) } returnValue = resval; } function getReturnValue() public view returns(bytes memory ){ return returnValue; } }

    Note: The RLP codes are required for the parameters of the system contract, so it is recommended to complete it under the chain.

    - + \ No newline at end of file diff --git a/en/Third_Party_Walle/index.html b/en/Third_Party_Walle/index.html index 71f37e059..fea3e56cf 100644 --- a/en/Third_Party_Walle/index.html +++ b/en/Third_Party_Walle/index.html @@ -8,13 +8,13 @@ Third-party wallets | PlatON - +

    Third-party wallets

    As the wallet specific for PlatON and Alaya, ATON does not support multi-chain and functions are relatively simple. Therefore, we hope the community can provide more third-party wallets with rich features and user-friendly experience that support PlatON and Alaya network.

    Following are third party wallets maintain and support by the community which able to transfer and store LAT on PlatON network, please research the security of them yourself before use, we listing the following information only for the convenience of downloading, it does not mean we responsible for the security of the wallet.

    • COBO Wallet-Cobo - Cobo wallet is a professional digital currency management wallet, it supports cloud wallet and HD wallet, it can store digital currencies of 40+ public chain including PlatON.

    • Math Plug-in Wallet - Math plug-in wallet supports PlatON main network and dev network, not only can support asset management, but also can be used as a development tool, and is also the Dapp application portal.

    • HashKey Me Wallet - HashKey Me wallet is a decentralized identity wallet that uses MPC, threshold signature and other technologies to provide users with a simple and secure experience of using a senseless private key, and currently supports a number of mainstream public chain digital assets including PlatON.

    - + \ No newline at end of file diff --git a/en/Verifiable_Computation/index.html b/en/Verifiable_Computation/index.html index 57d151692..c1b4daa10 100644 --- a/en/Verifiable_Computation/index.html +++ b/en/Verifiable_Computation/index.html @@ -8,7 +8,7 @@ Verifiable Computation | PlatON - + @@ -19,7 +19,7 @@ The processes of compling verifiable contract are:

    1. The vc compiler compiles the contract coded by users to IRs, and then converted to SSA, finally, it would be transformed into ggs, which is the gadget representation supported by libcsnark.
    2. Combines gss and keygenTemp.cpp to generate keygen.
    3. The vclang generates $pk$ and $vk$ (CRS construction) by keygen. This process performs a large number of elliptic curve multiplication operations, and after finishing generating $pk$ and $vk$, both of them would be serialized into the contract template, where $pk$ is used to generate trusted parameters, and $vk$ is the trusted parameter for verification.
    4. The vclang serializes $pk$ and $vk$ into vccTemp.cpp to generate vcc.cpp.
    5. The vclang compiles vcc.cpp to obtain vcc.wasm.

    How it works#

    vc-work

    Figure 4: The workflow of verifiable contract

    \ Here is the workflow of verifiable contract:

    1. After finishing compiling the contract, $pk$ and $vk$ would be obtained and would be deployed onto PlatON for storge to make them accessible to other nodes, and from being tampered.
    2. When executes the vc compute transaction, a vc task would be created, which is combined with nonce of the transaction and the input parameter x corresponding its key taskid.
    3. Once the compute transaction succeed being confirmed, the transaction parsing event would be invoked by the vc pool to check whether this task could be added to the vc pool or not.
    4. Waiting for 20 blocks confirmation, it starts to execute real_compute, which is off-chain computation making it no fee cost. The processes of real_compute are two steps. Firstly, computing the witness $s$ according to the obtained gadget sequence in the previous compilation. Secondly, with the additional pk got in step 1, the computing node can generate the final proof, which is a sequence of proofs combined with $\pi_A$, $\pi_B$, $\pi_C$, etc.
    5. The result and proof are deployed onto PlatON by Set_result(proof,result), which is mainly executing verify (vk,proof,input). Once validated, the transaction initiator would be rewarded for its computing contribution. The verify time of zkSNARK is relatively short compared to the time of proof generation, but it is also related to the length of the input parameter, so it is necessary to pay attention to limiting the length of the input parameter, preventing the gas cost of the transaction from being too high, and increasing the cost of the verifier.

    The incentive mechanism of verifiable contract#

    Users who have the requirement to outsource their computation need to mortgage the appropriate fees to the contract. Each node in the PlatON network can compete for the computing task. Once the computing node succeeds in finishing the computing task and obtain the result and the corresponding proof, the set_result transaction request would be initiated after that the computing node finished paying the miner fee. As the verifying node receives this request, the set_result would be executed in the meantime, and the proof and result parameters encapsulated in the transaction would be validated their legitimacy. If yes, it could be considered that the computing node obtains the correct result. Meanwhile, the mortgage fee would be transferred to the requester's account as the incentive, and no incentive would be offered if fails.

    Analysis to the VC solution#

    Performance analysis#

    computing stageoperationusercomputing node
    keygen constructionexponentialO(m+n)0
    real_computeexponential0O(m)
    set_resulthyperbolic matching operation, exponentialO(1),O(n)0

    where $m$ is the degree of polynomials $A$,$B$ and $C$, $n$ is the length of input parameter.

    1. keygen construction: homomorphic hiding the sampled value to generate trusted parameters. Since $m$ is a large number commonly, and it is an exponential operation, then it would take a relatively long time. As this process is done after compiling the contract, it would not affect the performance of contract executing.
    2. real_compute: $O(m)$ times of exponential operations are required to generate the witness and proof. And this can be distributed to third parties for fast computation.
    3. set_result: According to the specific input, the verify process generate parts of the proof, requiring $O(n)$ times of operations, and then take the fixed hyperbolic matching operation to make the verification. Since this process is done on-chain, it needs to be optimized to assure it at an acceptable computing cost.

    Comparison of different VC technologies#

    time(Setup)key len(Setup)time(Proving)memory(Proving)time(Verifying)proof len(Verifying)
    zkSNARK~28min~18GB~18min~216GB<10ms230B
    zkSNARK(Zcash-Sprout)~27hr(6 player)~900MB~37s~1.5GB<10ms~300B
    zkSNARK(Zcash-Sapling)months-MPC<800MB~7s~40MB<10ms~200B
    zkSTARK<0.1s16B6min131GB~0.1s~1.2MB
    Bulletproof2min~1MB~3s~1.5KB
    ZKBoo()~33ms~MBs~38ms~200KB
    Ligero()~140ms~MBs~60ms~34KB

    Future plans#

    PlatON will implement more optimized VC algorithm, it would be optimized in the following several ways:

    1. Cutting the ZK property off from SNARK to improve its efficiency, decreases the proof generation and verification time.
    2. Implementing privacy-preserving computing combining with MPC and HE.
    3. Considering adopting more optimized elliptic curves to increase the speed of encryption on ECC.
    4. Optimizing the verification process, including pre-processing the hyperbolic matching operation and presetting intermediate values to keep it from the repeated computation.
    5. Adopting some algorithms like MPC to guarantee security during the process of Setup.

    Reference#

    [1]. https://vitalik.ca/

    - + \ No newline at end of file diff --git a/en/WASM_Contract_1/index.html b/en/WASM_Contract_1/index.html index 68f4200a7..d58063bfa 100644 --- a/en/WASM_Contract_1/index.html +++ b/en/WASM_Contract_1/index.html @@ -8,13 +8,13 @@ PlatON WASM contract (1) - Introduction | PlatON - +
    - + \ No newline at end of file diff --git a/en/WASM_Contract_2/index.html b/en/WASM_Contract_2/index.html index 1ab12c289..16724af6c 100644 --- a/en/WASM_Contract_2/index.html +++ b/en/WASM_Contract_2/index.html @@ -8,13 +8,13 @@ PlatON WASM contract (2) - Cross contracts Interaction | PlatON - +

    PlatON WASM contract (2) - Cross contracts Interaction

    EN is under construction#

    - + \ No newline at end of file diff --git a/en/WASM_Contract_3/index.html b/en/WASM_Contract_3/index.html index 02c389c4b..a6ec99f9c 100644 --- a/en/WASM_Contract_3/index.html +++ b/en/WASM_Contract_3/index.html @@ -8,13 +8,13 @@ PlatON WASM contract (3) - Contract Event | PlatON - +
    - + \ No newline at end of file diff --git a/en/WASM_Contract_4/index.html b/en/WASM_Contract_4/index.html index 5cce781d0..427680b9d 100644 --- a/en/WASM_Contract_4/index.html +++ b/en/WASM_Contract_4/index.html @@ -8,13 +8,13 @@ PlatON WASM contract (4) - Parameters | PlatON - +

    PlatON WASM contract (4) - Parameters

    EN is under construction#

    - + \ No newline at end of file diff --git a/en/WASM_Contract_5/index.html b/en/WASM_Contract_5/index.html index 9cf05c91e..30b1be375 100644 --- a/en/WASM_Contract_5/index.html +++ b/en/WASM_Contract_5/index.html @@ -8,13 +8,13 @@ PlatON WASM contract (5) - Proxy | PlatON - +
    - + \ No newline at end of file diff --git a/en/WASM_Contract_6/index.html b/en/WASM_Contract_6/index.html index d02fea8eb..e8a251d21 100644 --- a/en/WASM_Contract_6/index.html +++ b/en/WASM_Contract_6/index.html @@ -8,13 +8,13 @@ PlatON WASM contract (6) - Proxy Event | PlatON - +

    PlatON WASM contract (6) - Proxy Event

    EN is under construction#

    - + \ No newline at end of file diff --git a/en/WASM_Contract_7/index.html b/en/WASM_Contract_7/index.html index aff74c214..f1ec3e42c 100644 --- a/en/WASM_Contract_7/index.html +++ b/en/WASM_Contract_7/index.html @@ -8,13 +8,13 @@ PlatON WASM contract (7) - General Proxy | PlatON - +

    PlatON WASM contract (7) - General Proxy

    EN is under construction#

    - + \ No newline at end of file diff --git a/en/WASM_Contract_8/index.html b/en/WASM_Contract_8/index.html index 8ecf6cf0b..d0f5cb49e 100644 --- a/en/WASM_Contract_8/index.html +++ b/en/WASM_Contract_8/index.html @@ -8,13 +8,13 @@ PlatON WASM contract (8) - Build-in Type | PlatON - +
    - + \ No newline at end of file diff --git a/en/WASM_Contract_9/index.html b/en/WASM_Contract_9/index.html index a94abbff8..ed00ecc20 100644 --- a/en/WASM_Contract_9/index.html +++ b/en/WASM_Contract_9/index.html @@ -8,13 +8,13 @@ PlatON WASM contract (9) - Build-in Type Performance Test | PlatON - +

    PlatON WASM contract (9) - Build-in Type Performance Test

    - + \ No newline at end of file diff --git a/en/WASM_Smart_Contract/index.html b/en/WASM_Smart_Contract/index.html index 89bfc824a..d4fc912f7 100644 --- a/en/WASM_Smart_Contract/index.html +++ b/en/WASM_Smart_Contract/index.html @@ -8,13 +8,13 @@ WASM Smart Contract | PlatON - +

    WASM Smart Contract

    WebAssembly (wasm for short) is a binary instruction set designed for stacked virtual machines. Wasm was designed to be a compile target for platforms such as C / C ++ / Rust, and was originally designed to solve JavaScript performance issues. Wasm is a web standard being led by the W3C and supported by browser vendors such as Google, Microsoft, and Mozilla.

    This tutorial is mainly to guide users to create a WASM smart contract using wasm language on PlatON.

    It is mainly explained from the following aspects:

    - + \ No newline at end of file diff --git a/en/Wasm_Contract_API/index.html b/en/Wasm_Contract_API/index.html index 5e3bc3884..19bb80343 100644 --- a/en/Wasm_Contract_API/index.html +++ b/en/Wasm_Contract_API/index.html @@ -8,7 +8,7 @@ Wasm API | PlatON - + @@ -107,7 +107,7 @@ Modify data based on iterator, but cannot modify all index-related fields .

    • Parameters
      • position: position of iterator
      • constructor: lambda function that updates the target object
    • Example:
    struct Member {std::string name;uint8_t age;uint8_t sex;uint64_t $seq_;std::string Name() const { return name; }uint8_t Age() const { return age; }PLATON_SERIALIZE(Member, (name)(age)(sex))};MultiIndex<"table"_n, Member,  IndexedBy<"index"_n, IndexMemberFun<Member, std::string, &Member::Name,                                    IndexType::UniqueIndex>>,IndexedBy<"index2"_n, IndexMemberFun<Member, uint8_t, &Member::Age,                                      IndexType::NormalIndex>>>member_table;member_table.modify(r.first, [&](auto &m) { m.sex = 15; });

    contract api#

    platon_destroy()#

    bool platon::platon_destroy ( const Address & addr)

    Destory contract.

    • Parameters
      • addr: Address of the contract
    • Returns
      • true if destroy successfully, false otherwise

    platon_migrate_contract()#

    template<typename value_type , typename gas_type >bool platon::platon_migrate_contract ( Address & addr,const bytes & init_args,value_type  value,gas_type  gas)

    Migrate contract.

    • Parameters
      • addr: The address of new contract
      • init_args: The input arguments
      • value: Transfer amount
      • gas: Pay amount of gas for this transaction
    • Returns
      • true if migration successfully, false otherwise

    cross_call_args()#

    template<typename... Args>bytes platon::cross_call_args ( const std::string & method,const Args &...  args)  

    Construct the Parameters of the call across contracts.

    • Parameters
      • method: The method name of the invoked contract
      • args: The Parameters corresponding to the contract method
    • Returns
      • Parameter byte array

    platon_call()#

    template <typename value_type, typename gas_type, typename... Args>inline bool platon_call(const Address &addr, const value_type &value,const gas_type &gas, const std::string &method,const Args &... args)

    Cross-contract call without return value.

    • Parameters

      • addr:The contract address to be invoked
      • value:The amount transferred to the contract
      • gas:The called contract method estimates the gas consumed
      • method:The method name of the invoked contract
      • args:The Parameters corresponding to the contract method
    • Returns

      • Call success or failure
    • Example:

      auto address_pair =make_address("lax10jc0t4ndqarj4q6ujl3g3ycmufgc77epxg02lt");bool result = platon_call(address_pair.first, uint32_t(100), uint32_t(100), "add", 1,2,3);if(!result){  platon_throw("cross call fail");}

    platon_call_with_return_value()#

    template <typename return_type, typename value_type, typename gas_type, typename... Args>inline auto platon_call_with_return_value(const Address &addr,const value_type &value,const gas_type &gas,const std::string &method,const Args &... args)

    Cross-contract call with return value.

    • Parameters

      • addr:The contract address to be invoked
      • value:The amount transferred to the contract
      • gas:The called contract method estimates the gas consumed
      • method:The method name of the invoked contract
      • args:The Parameters corresponding to the contract method
    • Returns

    • Return value and call success or failure

    • Example:

      auto address_pair =make_address("lax10jc0t4ndqarj4q6ujl3g3ycmufgc77epxg02lt"); auto result = platon_call_with_return_value<int>(address_pair.first, uint32_t(100), uint32_t(100), "add", 1,2,3);if(!result.second){ platon_throw("cross call fail");}

    platon_delegate_call()#

    template <typename gas_type, typename... Args>inline bool platon_delegate_call(const Address &addr, const gas_type &gas,const std::string &method,const Args &... args) 

    Cross-contract proxy call without return value.

    • Parameters

      • addr:The contract address to be invoked
      • gas:The called contract method estimates the gas consumed
      • method:The method name of the invoked contract
      • args:The Parameters corresponding to the contract method
    • Returns

      • Call success or failure
    • Example:

       auto address_pair =make_address("lax10jc0t4ndqarj4q6ujl3g3ycmufgc77epxg02lt"); bool result = platon_delegate_call(address_pair.first, uint32_t(100), uint32_t(100), "add", 1,2,3); if(!result){   platon_throw("cross call fail"); }

    platon_delegate_call_with_return_value()#

    template <typename return_type, typename gas_type, typename... Args>inline auto platon_delegate_call_with_return_value(const Address &addr,const gas_type &gas,const std::string &method,const Args &... args) 

    Cross-contract proxy call with return value.

    • Parameters

      • addr:The contract address to be invoked
      • gas:The called contract method estimates the gas consumed
      • method:The method name of the invoked contract
      • args:The Parameters corresponding to the contract method
    • Returns

      • Return value and call success or failure
    • Example:

      auto address_pair = make_address("lax10jc0t4ndqarj4q6ujl3g3ycmufgc77epxg02lt"); auto result = platon_delegate_call_with_return_value<int>(address_pair.first, uint32_t(100), "add", 1,2,3);if(!result.secnod){  platon_throw("cross call fail");}

    get_call_output()#

    template<typename T >void platon::get_call_output ( T & t)

    Gets the return value of calling contract methods across contracts.

    • Template Parameters
      • T: The output value type
    • Parameters
      • t: The value returned by the contract method

    platon_event#

    void platon_event(const uint8_t *topic, size_t topic_len, const uint8_t *args,                  size_t args_len);

    Post event to VM

    • Parameters
      • topic: The topic of event
      • topic_len: The length of topic
      • args: The arguments
      • args_len: The length of arguments

    exception api#

    platon_panic#

    void platon_panic(void);

    Terminate transaction, deduct all gas given by transaction

    platon_revert#

    void platon_revert(void);

    Terminate the transaction and deduct the gas consumed

    other api#

    platon_sha3()#

    h256 platon::platon_sha3 ( const bytes & data )

    Sh3 algorithm.

    • Parameters
      • data: Binary data
    • Returns
      • The Hash of the data

    - + \ No newline at end of file diff --git a/en/Wasm_Contract_Best_Practice/index.html b/en/Wasm_Contract_Best_Practice/index.html index b9d81a058..f2d2a2fcc 100644 --- a/en/Wasm_Contract_Best_Practice/index.html +++ b/en/Wasm_Contract_Best_Practice/index.html @@ -8,7 +8,7 @@ Best practices | PlatON - + @@ -70,7 +70,7 @@ containers and iterators can simplify code. For example:

    std::map<std::string, std::string> my_map;for (auto it = my_map.begin(); it != my_map.end(); it++) {    // ignore}
    Reference Arguments#

    Suggest using reference arguments as function parameters. Reference parameters can reduce unnecessary replication and reduce unnecessary memory allocation. For us WASM virtual machines, memory allocation is an expensive operation.

    Containers#

    The C ++ standard library provides some commonly used containers (map, vector, list, etc.), and you should carefully read the corresponding interface documentation when using it. It is important to note that the operator[] oper ator of map, according to the interface documentation, when the key does not exist, the insert action will be performed. For contract development, when using StorageType to store the map, do not useoperator []to determine whether the key exists, but usefind () .


    - + \ No newline at end of file diff --git a/en/Wasm_Contract_Dev_Costs/index.html b/en/Wasm_Contract_Dev_Costs/index.html index da83cdabb..353c6c3a8 100644 --- a/en/Wasm_Contract_Dev_Costs/index.html +++ b/en/Wasm_Contract_Dev_Costs/index.html @@ -8,7 +8,7 @@ Development Costs | PlatON - + @@ -47,7 +47,7 @@ CONST std::string getSymbol(){ return symbol.self(); } CONST uint64_t getTotalSupply(){ return totalSupply.self(); } // Approves and then calls the receiving contract. ACTION bool approveAndCall(Address _spender, uint64_t _value, const bytes& _extraData) { Address sender = platon_caller(); allowed.self()[sender][_spender] = _value; PLATON_EMIT_EVENT2(Approval, sender, _spender, _value); // call the receiveApproval function on the contract you want to be notified. This // crafts the function signature manually so one doesn't have to include a contract // in here just for this. // define: receiveApproval(Address _from, uint64_t _value, Address _tokenContract, bytes& _extraDaa) // it is assumed that when does this that the call should succeed. return true; }}; PLATON_DISPATCH(LATToken,(init)(balanceOf)(transfer)(transferFrom)(approve)(allowance)(getName)(getDecimals)(getSymbol)(getTotalSupply)(approveAndCall))

    ByteCode

    Click to view bincode

    ByteSize: 36764 byte => 35.9 kb


    Costs#

    PlatON-EVM

    • GasUsed: 552823
    • GasPrice: 5,000,000,000 (5 gVON)
    • Costs: 2764115 gVON(0.002764115 LAT

    Ethereum

    • GasUsed: 1282171
    • GasPrice: 5,000,000,000 (5 Gwei)
    • Costs: 6410855 Gwei(0.006410855 ETH

    PlatON-WASM

    • GasUsed: 486274
    • GasPrice: 5,000,000,000 (5 gVON)
    • Costs: 2431370 gVON(0.00243137 LAT

    - + \ No newline at end of file diff --git a/en/Wasm_Dev_Manual/index.html b/en/Wasm_Dev_Manual/index.html index fd872bf26..80583fa71 100644 --- a/en/Wasm_Dev_Manual/index.html +++ b/en/Wasm_Dev_Manual/index.html @@ -8,7 +8,7 @@ Getting started | PlatON - + @@ -39,7 +39,7 @@ supported?

    The following C ++ standard library types are supported:

    • std::string
    • std::vector
    • std::map
    • std::list
    • std::array
    • std::set
    • std::pair
    • std::tuple
  • How do custom types support RLP serialization/deserialization?

    • Macro PLATON_SERIALIZE for common types
       struct Base {   int a;   std::string b;
        PLATON_SERIALIZE(Base, (a)(b));   };
    • The derived class uses the macro PLATON_SERIALIZE_DERIVED, and the base class also uses the macro PLATON_SERIALIZE
    struct Derived : public Base {  int c;  int d;
       PLATON_SERIALIZE_DERIVED(Derived, Base, (c)(d));};
  • - + \ No newline at end of file diff --git a/en/Wasm_Operation_Principle/index.html b/en/Wasm_Operation_Principle/index.html index 9acd1ed88..a1216144b 100644 --- a/en/Wasm_Operation_Principle/index.html +++ b/en/Wasm_Operation_Principle/index.html @@ -8,13 +8,13 @@ WebAssembly(Wasm) | PlatON - +

    WebAssembly(Wasm)

    Preface#

    WASM (WebAssembly) is not a language, but a new bytecode format, a brand-new underlying binary grammar, and instruction code compiled by the compiler. Small in size, portable, fast in loading, and compatible with the latest format of the Web, WASM is a new technology to run portable programs safely and effectively. This article analyzes the introduction, advantages, operation mechanism and use of the PlatON WASM contract in detail.

    Introduction of WASM#

    WASM was mainly applied on the Web in the early days. As it continues to develop, it is used as the final format of smart contracts by increasing projects, and runs with the corresponding VM loaded, such as wavm and wagon. Bytecodes are parsed and operate in the core virtual machine module.

    The virtual machine (VM) refers to a complete computer system that is simulated by software, has functions of a complete hardware system and runs in an isolated environment, such as the Vmware virtual machine for operating system virtualization and the JVM virtual machine for the software operating environment. The virtual machine in the blockchain is a code operating environment built on the blockchain, mainly to process the smart contracts of the blockchain.

    Why does PlatON introduce the WASM virtual machine as a supplement to the EVM?

    As the demand for virtual machines and smart contracts in blockchain applications grows, the blockchain virtual machine technology is being improved as time goes by. At present, WASM-based virtual machines have been significantly improved in terms of speed and performance, and support multiple high-level development languages such as C, C++, Rust, and Golang, lowering the development threshold.

    To facilitate the development of blockchain applications, PlatON has launched a dual virtual machine engine that supports the WASM virtual machine and the EVM at the same time. Blockchain applications that originally run on public chains that support EVM, such as Ethereum, can migrate easily and seamlessly if they need to use PlatON due to performance and other reasons.

    EVM is essentially a script program, a stack-based virtual machine, which needs to be executed after being translated into instructions by a compiler, which is quite inefficient. At the same time, EVM also has some problems in its architecture and use, such as:

    • Strong coupling and difficult scalability: The chain and the EVM are internally dependent upon each other;
    • Lack of a standard library: There is basically no standard library in solidity, and you must independently code corresponding functions, such as string comparison.

    Compared with EVM, WASM, as a kind of intermediate code, runs smart contracts faster, and can be developed in any familiar programming language (C/C++/Rust/Golang). It also has many other features:

    • Efficient performance: Binary coding adopted has superior performance during program execution;
    • Support by multiple languages: You can use C/C++/Rust/Golang and other languages to write the contract and then compile the contract into bytecode;
    • Abundant standard libraries: There are abundant standard libraries available for use in different languages.

    At the same time, WASM has been applied by a growing number of projects, including Ethereum that has introduced the EVM. The popularity of WASM has driven its community ecosystem to improve.

    In order to adapt the existing WASM applications and developers familiar with WASM to the PlatON ecosystem, PlatON decided after comprehensive consideration to adopt dual virtual machines, that is, to introduce the WASM virtual machine as a supplement to the EVM.

    Advantages of PlatON to Introduce WASM#

    PlatON factored in some of the disadvantages of the EVM upon its decision to introduce the virtual machine. Right after the EVM was introduced, PlatON began the design and development of the WASM virtual machine, and kept making innovations and improvements in terms of scalability, stability, and operating efficiency. The main functions include:

    • With a complete set of contract development kit PlatON-CDT;
    • Smaller contract bytecode. WASM binary code compiled by CDT suite is half smaller compared with other projects;
    • With a smart contract framework PlatON-Truffle for rapid development;
    • With support for string, address, hash, u128 and other data types;
    • The gas mechanism introduced. Every time a contract instruction is executed, the corresponding gas will be deducted to ensure that the execution of the contract instruction can be terminated after a limited number of operations, thereby effectively preventing code from attacks of the infinite loop;
    • Contract nested call introduced, which can immediately obtain the result of another contract call, making calls between contracts as convenient as function calls;
    • With support for the automatic expansion of linear memory and caching WASM module to optimize the loading performance of the contract, thereby greatly improving the operating performance of the virtual machine.

    Based on the application and optimization of WASM, PlatON's smart contract module boasts higher compatibility and performance, as well as better security and flexibility. After successfully integrating WASM and applying dual virtual machines, PlatON tested the performance of the EVM and WASM for comparison under the same environment.

    The test results show that the execution efficiency of the WASM virtual machine is much higher than that of the EVM. EVM uses 256-bit machine code that greatly affects the performance of the execution and at the same time increases the memory usage.

    PlatON has the following advantages after introducing the WASM virtual machine as part of the dual virtual machines:

    • Mainstream WASM smart contracts can be easily and quickly migrated to the PlatON network;

    • The threshold for contract developers is lowered, with little learning cost;

    • Developers who use other WASM-based networks can be well-adapted to the WASM virtual machine and get started quickly;

    • The execution of smart contracts is more efficient;

    • Abundant development libraries can improve the efficiency of smart contract development.

    The Operating Mechanism of WASM#

    The WASM virtual machine is a completely independent sandbox. Fully isolated from the outside, the contract code runs inside the virtual machine, and cannot access the network, file system or other processes. At the same time, to prevent the virtual machine from executing too many computation instructions and falling into an infinite loop, both the gas mechanism and the timeout mechanism are introduced as dual controls.

    The working principle of dual virtual machines:

    As shown in the figure: Smart contracts written in languages such as solidity/c/c++ are compiled into bytecode by a compiler. At the same time, different types of contracts come with different bytecode features. By recognizing the features, the engine of the dual virtual machines of PlatON can select a specific virtual machine to load the bytecode, parse it, and then execute the corresponding function according to the instruction.

    Usage process of the smart contract:

    As shown in the figure, you can use C++ to write a smart contract based on WASM, or solidity to write a smart contract that belongs to the EVM, then compile and generate bytecode and other information through the toolset, and then send it to a node on the PlatON network by the transaction through the SDK development toolset. That is a complete process of a contract-related transaction.

    PlatON provides a complete WASM contract development kit named PlatON-CDT. Using this kit, you can quickly write smart contracts for the WASM virtual machine. The kit encapsulates various types of data, and is equipped with a simple API interface and detailed interface documentation. At the same time, you can also use the smart contract testing framework PlatON-Truffle for development, compilation, deployment, contract interface testing and other functions, which is convenient for developers to develop and test contracts.

    PlatON provides an automated Contract SDK generation tool, which can automatically generate the code for the back-end system to call the contract interface and can shield the parameter encoding and decoding details when calling the contract. In this way, it helps developers quickly integrate contract business into the system, so that they can be more focused on developing the business logic of smart contracts.

    Summary#

    This article mainly discusses the background and original intention of PlatON to support the WASM virtual machine and introduces the unique advantages brought by the introduction of WASM. It also briefly explains the basic principles and operating mechanisms of the WASM virtual machine. With this article, the author hopes to provide some useful experience for community users, developers, and blockchain professionals participating in PlatON. From a bust to a boom, WASM will be applied in increasing projects as the underlying level of distributed application development in the future.

    - + \ No newline at end of file diff --git a/en/adapting_to_new_chainid/index.html b/en/adapting_to_new_chainid/index.html index 8c9a962c1..1a6e36698 100644 --- a/en/adapting_to_new_chainid/index.html +++ b/en/adapting_to_new_chainid/index.html @@ -8,7 +8,7 @@ Adapting to new chainid | PlatON - + @@ -16,7 +16,7 @@

    Adapting to new chainid

    How new DApp can be adapted to PlatON's new ChainId#

    The PlatON mainnet proposal to support the new ChainId PIP-7has been adopted and the first phase has been implemented in the mainnet, which means that the ChainId of the PlatON mainnet will be gradually switched from 100 to the new value 210425. In order to minimise the impact on applications during subsequent version upgrades, new applications should try to support the new ChainId from the beginning ChainId.

    However, at this stage the ChainId returned to the contract by the PlatON EVM virtual machine is still 100 (after which it will return 210425), so in the process of developing the application if there is logic related to the ChainId special adaptations need to be made. The following examples will introduce the adaptations from two scenarios, the first is the PRC20 token permit method and the second governance token voting rights proxy.

    PRC20 permit func#

    Usually Swap needs to use metamask's eth_signTypedData_v4 interface to sign the client first each time it removes liquidity (the signature contains the ChainId), and then use the signature as an argument to call the router contract's removeLiquidityWithPermit, which is used to do PRC20 contract's permit (allowing the contract to deduct the user's PRC20 assets)

    The adaptation code is shown below.

    constructor() function adds DOMAIN_SEPARATOR_NEW, generating method containing the ChainId of 210425

    ......DOMAIN_SEPARATOR = keccak256(    abi.encode(        keccak256('EIP712Domain(string name,string version,uint256 ChainId,address verifyingContract)'),        keccak256(bytes(name)),        keccak256(bytes('1')),        ChainId,        address(this)    ));DOMAIN_SEPARATOR_NEW = keccak256(    abi.encode(        keccak256('EIP712Domain(string name,string version,uint256 ChainId,address verifyingContract)'),        keccak256(bytes(name)),        keccak256(bytes('1')),        210425,        address(this)    ));......

    permit function adds verification of two ChainId related signatures

    require(deadline >= block.timestamp, 'EXPIRED');bytes32 digest = keccak256(    abi.encodePacked(        '\x19\x01',        DOMAIN_SEPARATOR_NEW,        keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner], deadline))    ));address recoveredAddress = ecrecover(digest, v, r, s);if (recoveredAddress == address(0) || recoveredAddress != owner) {    digest = keccak256(        abi.encodePacked(            '\x19\x01',            DOMAIN_SEPARATOR,            keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner], deadline))        )    );    recoveredAddress = ecrecover(digest, v, r, s);    require(recoveredAddress != address(0) && recoveredAddress == owner, 'INVALID_SIGNATURE');}
     nonces[owner] += 1;......

    Governance Token Voting Proxy#

    Similar signature and verification logic is used when governing the token voting rights proxy. The code is modified as follows.

    The delegateBySig function adds validation for the signatures associated with the two ChainId

    constructor(address account, address minter_) public {        ......        DOMAIN_SEPARATOR = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));        DOMAIN_SEPARATOR_NEW = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), 210425, address(this)));}    ......
     function delegateBySig(address delegatee, uint nonce, uint expiry, uint8 v, bytes32 r, bytes32 s) public {    bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));    bytes32 digest = keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR_NEW, structHash));    address signatory = ecrecover(digest, v, r, s);    if (signatory == address(0) || nonce != nonces[signatory]) {        digest = keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, structHash));        signatory = ecrecover(digest, v, r, s);        require(signatory != address(0), "delegateBySig: invalid signature");        require(nonce == nonces[signatory], "delegateBySig: invalid nonce");    }    nonces[signatory] += 1;    require(now <= expiry, "delegateBySig: signature expired");    return _delegate(signatory, delegatee);}
    - + \ No newline at end of file diff --git a/en/assets/js/ebf40b11.121f6cc8.js b/en/assets/js/ebf40b11.8ca1e803.js similarity index 99% rename from en/assets/js/ebf40b11.121f6cc8.js rename to en/assets/js/ebf40b11.8ca1e803.js index 9cc0e63c4..ca0ee9d4c 100644 --- a/en/assets/js/ebf40b11.121f6cc8.js +++ b/en/assets/js/ebf40b11.8ca1e803.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[1736],{5680:(e,t,n)=>{n.d(t,{xA:()=>d,yg:()=>y});var a=n(6540);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},g=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,l=e.originalType,s=e.parentName,d=r(e,["components","mdxType","originalType","parentName"]),c=p(n),g=o,y=c["".concat(s,".").concat(g)]||c[g]||u[g]||l;return n?a.createElement(y,i(i({ref:t},d),{},{components:n})):a.createElement(y,i({ref:t},d))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var l=n.length,i=new Array(l);i[0]=g;var r={};for(var s in t)hasOwnProperty.call(t,s)&&(r[s]=t[s]);r.originalType=e,r[c]="string"==typeof e?e:o,i[1]=r;for(var p=2;p{n.r(t),n.d(t,{contentTitle:()=>i,default:()=>c,frontMatter:()=>l,metadata:()=>r,toc:()=>s});var a=n(8168),o=(n(6540),n(5680));const l={id:"Become_PlatON_Main_Verification",title:"Run a validator node",sidebar_label:"Run a validator node"},i=void 0,r={unversionedId:"Become_PlatON_Main_Verification",id:"Become_PlatON_Main_Verification",isDocsHomePage:!1,title:"Run a validator node",description:"This guide demonstrates how to install the PlatON Node software on Linux.",source:"@site/../docs/\u6210\u4e3a\u4e3b\u7f51\u9a8c\u8bc1\u8282\u70b9.md",sourceDirName:".",slug:"/Become_PlatON_Main_Verification",permalink:"/docs/en/Become_PlatON_Main_Verification",editUrl:"https://github.com/PlatONnetwork/docs/tree/master/docs/\u6210\u4e3a\u4e3b\u7f51\u9a8c\u8bc1\u8282\u70b9.md",version:"current",frontMatter:{id:"Become_PlatON_Main_Verification",title:"Run a validator node",sidebar_label:"Run a validator node"},sidebar:"docs",previous:{title:"Intro to validator",permalink:"/docs/en/PlatON_Validation_Introduce"},next:{title:"MTool online tutorial",permalink:"/docs/en/OnLine_MTool_Manual"}},s=[{value:"System Requirements",id:"system-requirements",children:[]},{value:"Installation Overview",id:"installation-overview",children:[]},{value:"Installing on Ubuntu",id:"installing-on-ubuntu",children:[]},{value:"Generate keys",id:"generate-keys",children:[]},{value:"Join the PlatON main network",id:"join-the-platon-main-network",children:[{value:"Join the Main Network",id:"join-the-main-network",children:[]},{value:"View node status",id:"view-node-status",children:[]}]},{value:"Upgrade to Validator Node",id:"upgrade-to-validator-node",children:[{value:"Install PlatON MTool",id:"install-platon-mtool",children:[]},{value:"Configure PlatON MTool",id:"configure-platon-mtool",children:[]},{value:"Initiate a staking operation",id:"initiate-a-staking-operation",children:[]}]}],p={toc:s},d="wrapper";function c(e){let{components:t,...n}=e;return(0,o.yg)(d,(0,a.A)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.yg)("p",null,"This guide demonstrates how to install the PlatON Node software on Linux."),(0,o.yg)("h3",{id:"system-requirements"},"System Requirements"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"Server: Server and backup server running PlatON software (both have a firewall)"),(0,o.yg)("li",{parentName:"ul"},"Memory: 16GB RAM"),(0,o.yg)("li",{parentName:"ul"},"Local storage: 100GB system disk, 200GB data disk (can be expanded online)"),(0,o.yg)("li",{parentName:"ul"},"Processor: 64-bit 4 cores (each core above 2.4 GHz)"),(0,o.yg)("li",{parentName:"ul"},"Bandwidth: 5 MB/sec (can be expanded online)")),(0,o.yg)("h3",{id:"installation-overview"},"Installation Overview"),(0,o.yg)("p",null,"It takes three or four steps to install a new node, which depends on the operating system used. The detailed procedures are list below."),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"Installing on Ubuntu (18.04)")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},(0,o.yg)("strong",{parentName:"p"},"Note: Use the normal user to execute the following command."))),(0,o.yg)("h3",{id:"installing-on-ubuntu"},"Installing on Ubuntu"),(0,o.yg)("h4",{id:"install-and-run-ntp-service"},"Install and run NTP service"),(0,o.yg)("h5",{id:"open-a-terminal-and-run-the-following-commands"},"Open a terminal and run the following commands"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"sudo apt-get update &&\nsudo apt-get install -y gnupg2 curl software-properties-common ntp &&\nsudo systemctl enable ntp && sudo systemctl start ntp\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"Notes:"),(0,o.yg)("p",{parentName:"blockquote"},"NTP service is used for time synchronization, incorrect system time will affect the normal operation of PlatON")),(0,o.yg)("h5",{id:"validate-the-ntp-time-synchronization"},"Validate the NTP time synchronization"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"ntpq -4c rv | grep leap_none\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"Notes:"),(0,o.yg)("p",{parentName:"blockquote"},"Display ",(0,o.yg)("strong",{parentName:"p"},"associd=0 status=0615 ",(0,o.yg)("font",{color:"red"},"leap_none"),", sync_ntp, 1 event, clock_sync,")," where ",(0,o.yg)("inlineCode",{parentName:"p"},"leap_none")," is red, indicating that the NTP time synchronization is normal.")),(0,o.yg)("h4",{id:"install-platon"},"Install PlatON"),(0,o.yg)("p",null,"Ubuntu 18.04\uff1a"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"sudo wget https://download.platon.network/platon/platon/1.4.4/platon -O /usr/bin/platon\nsudo wget https://download.platon.network/platon/platon/1.4.2/platonkey -O /usr/bin/platonkey\n")),(0,o.yg)("p",null,"Ubuntu 20.04\uff1a"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"sudo wget https://download.platon.network/platon/platon/ubuntu20.04/1.4.4/platon -O /usr/bin/platon\nsudo wget https://download.platon.network/platon/platon/ubuntu20.04/1.4.2/platonkey -O /usr/bin/platonkey\n")),(0,o.yg)("p",null,"Ubuntu 22.04\uff1a"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"sudo wget https://download.platon.network/platon/platon/ubuntu22.04/1.4.4/platon -O /usr/bin/platon\nsudo wget https://download.platon.network/platon/platon/ubuntu22.04/1.4.2/platonkey -O /usr/bin/platonkey\n")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"sudo chmod +x /usr/bin/platon /usr/bin/platonkey\nplaton version\n")),(0,o.yg)("p",null,"After executing the commands above, ",(0,o.yg)("inlineCode",{parentName:"p"},"platon")," and",(0,o.yg)("inlineCode",{parentName:"p"}," platonkey")," binary should be successfully installed in the ",(0,o.yg)("inlineCode",{parentName:"p"},"/usr/bin")," directory on your system. You can execute corresponding commands in any directory."),(0,o.yg)("p",null,"After you execute the platon version, please double check whether your Git Commit value is consistent with the following, if it is consistent, it means that it has been installed correctly:"),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"PlatON",(0,o.yg)("br",null),"\nVersion: 1.4.4-unstable",(0,o.yg)("br",null),"\nGit Commit: ",(0,o.yg)("font",{color:"red"},"af1168d0b62febf53913cb1ceebaa6413d3ba9b3"),(0,o.yg)("br",null),"\nGit Commit Date: 20230719",(0,o.yg)("br",null),"\nArchitecture: amd64",(0,o.yg)("br",null),"\nGo Version: go1.22.8",(0,o.yg)("br",null),"\nOperating System: linux",(0,o.yg)("br",null),"\n...",(0,o.yg)("br",null))),(0,o.yg)("h3",{id:"generate-keys"},"Generate keys"),(0,o.yg)("h4",{id:"public-and-private-keys"},"Public and private keys"),(0,o.yg)("p",null,"Each node in the network has an unique identity to distinguish it from others. This identity is a public and private key pair, generated in the node's working directory ( ",(0,o.yg)("inlineCode",{parentName:"p"},"~/platon-node"),") by the following command:"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"mkdir -p ~/platon-node/data && platonkey genkeypair | tee >(grep \"PrivateKey\" | awk '{print $2}' > ~/platon-node/data/nodekey) >(grep \"PublicKey\" | awk '{print $3}' > ~/platon-node/data/nodeid)\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"Remark:"),(0,o.yg)("p",{parentName:"blockquote"},"Displays the following, indicating that the key pair has been successfully generated (x stands for number or letter) :"),(0,o.yg)("p",{parentName:"blockquote"},"PrivateKey: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),(0,o.yg)("p",{parentName:"blockquote"},"PublicKey: : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")),(0,o.yg)("p",null," ",(0,o.yg)("inlineCode",{parentName:"p"},"PrivateKey")," is the private key of the node, and",(0,o.yg)("inlineCode",{parentName:"p"}," PublicKey")," is the public key of the node. The public key is used to identify the identity of the node and can be made public."),(0,o.yg)("p",null,"Two files will be generated in the subdirectory ",(0,o.yg)("inlineCode",{parentName:"p"},"data")," under the working directory of the node\uff1a"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"nodeid: node public key (ID) file, which holds the node's public key"),(0,o.yg)("li",{parentName:"ul"},"nodekey: node private key file, which holds the node's private key")),(0,o.yg)("h4",{id:"bls-public-and-private-key"},"BLS public and private key"),(0,o.yg)("p",null,"In addition to the public and private keys of the node, the PlatON node also needs a key pair called the BLS public and private key. This key pair will be used in the consensus protocol. The key pair can be generated in the node's working directory (such as ",(0,o.yg)("inlineCode",{parentName:"p"},"~/platon-node"),") by the following command:"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"mkdir -p ~/platon-node/data && platonkey genblskeypair | tee >(grep \"PrivateKey\" | awk '{print $2}' > ~/platon-node/data/blskey) >(grep \"PublicKey\" | awk '{print $3}' > ~/platon-node/data/blspub)\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"PrivateKey: f22a785c80bd1095beff1f356811268eae6c94abf0b2b4e2d64918957b74783e\nPublicKey : 4bf873a66df92ada50a8c6bacb132ffd63437bcde7fd338d2d8696170034a6332e404ac3abb50326ee517ec5f63caf12891ce794ed14f8528fa7c54bc0ded7c5291f708116bb8ee8adadf1e88588866325d764230f4a45929d267a9e8f264402")),(0,o.yg)("p",null," ",(0,o.yg)("inlineCode",{parentName:"p"},"PrivateKey")," is the BLS private key of the node, and",(0,o.yg)("inlineCode",{parentName:"p"}," PublicKey")," is the BLS public key of the node. The BLS public key is used to quickly verify the signature in the consensus protocol and can be published. The BLS private key cannot be made public and needs to be backed up."),(0,o.yg)("p",null,"Two files will be generated in the subdirectory ",(0,o.yg)("inlineCode",{parentName:"p"},"data")," under the working directory of the node:"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"blspub: Node BLS public key file, which holds the node's BLS public key")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"blskey: Node BLS private key file, which holds the node's BLS private key"))),(0,o.yg)("h2",{id:"join-the-platon-main-network"},"Join the PlatON main network"),(0,o.yg)("p",null,"PlatON mainnet launch date to be determined, Chainid to be determined."),(0,o.yg)("p",null,"This section assumes that the server is Ubuntu 18.04, and the working directory of the executable file is ",(0,o.yg)("inlineCode",{parentName:"p"},"~/platon-node"),". Note that all subsequent commands should be run under the same working directory."),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"cd ~/platon-node\n")),(0,o.yg)("h3",{id:"join-the-main-network"},"Join the Main Network"),(0,o.yg)("p",null,"Anyone or any organization can join PlatON main network."),(0,o.yg)("h4",{id:"start-as-a-validator-node"},"Start as a validator node"),(0,o.yg)("p",null,"Execute the following command to start the verification node to join the main network of Platon (please access it after the main network is online)"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},'nohup platon --identity platon --datadir ./data --port 16789 --http.port 6789 --http.api "platon,net,web3,admin,personal" --http --nodekey ./data/nodekey --cbft.blskey ./data/blskey --verbosity 1 --http.addr 127.0.0.1 --syncmode "fast" > ./data/platon.log 2>&1 &\n')),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Prompt:")),(0,o.yg)("table",null,(0,o.yg)("thead",{parentName:"table"},(0,o.yg)("tr",{parentName:"thead"},(0,o.yg)("th",{parentName:"tr",align:null},(0,o.yg)("strong",{parentName:"th"},"Parameters")),(0,o.yg)("th",{parentName:"tr",align:null},(0,o.yg)("strong",{parentName:"th"},"Description")))),(0,o.yg)("tbody",{parentName:"table"},(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--identity"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the network name")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--datadir"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the data directory path")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--port"),(0,o.yg)("td",{parentName:"tr",align:null},"Specifying the P2P port number, TCP and UDP protocol corresponding ports need to be open to all hosts on the host firewall")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--http.addr"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify rpc server address")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--http.port"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the RPC protocol communication port, and open the TCP protocol corresponding port on the host firewall where MTool is located")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--http.api"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the rpcapi name open by the node")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--http"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify http-rpc communication method")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--nodekey"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the node private key file")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--cbft.blskey"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the node bls private key file")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--verbosity"),(0,o.yg)("td",{parentName:"tr",align:null},"The level of logging, 0: CRIT; 1: ERROR; 2: WARN; 3: INFO; 4: DEBUG; 5: TRACE")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--syncmode"),(0,o.yg)("td",{parentName:"tr",align:null},"fast: Fast synchronization mode, full: All synchronous mode")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--db.nogc"),(0,o.yg)("td",{parentName:"tr",align:null},"Enable archive mode")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--allow-insecure-unlock"),(0,o.yg)("td",{parentName:"tr",align:null},"Enable unlockAccount function")))),(0,o.yg)("p",null,"See more parameters with the command ",(0,o.yg)("inlineCode",{parentName:"p"},"platon --help")),(0,o.yg)("h3",{id:"view-node-status"},"View node status"),(0,o.yg)("p",null,"When PlatON is successfully started, under normal circumstances, it will automatically establish a connection with the node closest to it through the node discovery protocol. After the connection is successful, block synchronization will be started. You can determine whether joining the network successfully by looking at the peers of the node and confirming whether the block height of the node is increasing."),(0,o.yg)("p",null,"If the key is not generated in advance, the node is automatically generated in the node's data directory at startup. If it is automatically generated, only the node private key and BLS private key will be generated, and the relevant public key will not be automatically generated."),(0,o.yg)("h4",{id:"enter-platon--console"},"Enter ",(0,o.yg)("inlineCode",{parentName:"h4"},"PlatON ")," console"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon attach http://localhost:6789\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"Print ",(0,o.yg)("inlineCode",{parentName:"p"},"Welcome to the Platon JavaScript Console!")," Relevant information, indicating successful access to the console, otherwise it will be deemed as failure to access the console, if there is any problem, you can contact the official customer service personnel.")),(0,o.yg)("h4",{id:"view-peers-of-a-node"},"View peers of a node"),(0,o.yg)("p",null,"View the connection node information by executing the following command in the Platon console."),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"admin.peers\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"If the related Peers information is printed, it means that the connected node is successful, as follows:"),(0,o.yg)("p",{parentName:"blockquote"},"[{\ncaps: ",'["cbft/1", "platon/66"]',',\nid: "c72a4d2cb8228ca6f9072daa66566bcafa17bec6a9e53765c85c389434488c393357c5c7c5d18cf9b26ceda46aca4da20755cd01bcc1478fff891a201042ba84",\nname: "PlatONnetwork/alaya-47.241.93.189/v1.0.0-unstable-62b9a900/linux-amd64/go1.13.4",\nnetwork: {\nconsensus: false,\ninbound: false,\nlocalAddress: "192.168.2.128:55572",\nremoteAddress: "47.241.93.189:16789",\nstatic: false,\ntrusted: false\n},\nprotocols: {\ncbft: {\ncommitBn: 1404934,\nhighestQCBn: 1407304,\nlockedBn: 1404935,\nprotocolVersion: 1\n},\nplaton: {\nhead: "0xf31395262f876935c94e33b1d9f3314b2cb6effc33fcffa3b17b725678fd525f",\nnumber: 1407295,\nversion: 63\n}\n}\n}'),(0,o.yg)("p",{parentName:"blockquote"},"...]"),(0,o.yg)("p",{parentName:"blockquote"},"If the printed information is empty, it means that the connection node failed. If there is any problem, you can contact the official customer service personnel.")),(0,o.yg)("h4",{id:"view-the-current-block-height"},"View the current block height"),(0,o.yg)("p",null,"View the block height of the current node by executing the following command in the Platon console."),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon.blockNumber\n")),(0,o.yg)("blockquote",null,(0,o.yg)("ul",{parentName:"blockquote"},(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"Execute this command several times, if the block height value increases continuously, then the connection is successful;")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"If it is a new node and the block height is always 0, it means that the node is in the synchronous block and there may be delay. You can use the command:"),(0,o.yg)("pre",{parentName:"li"},(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon.syncing\n")),(0,o.yg)("ul",{parentName:"li"},(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"If ",(0,o.yg)("inlineCode",{parentName:"p"},"false")," is printed, the node is not in a synchronous block state.")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"If the following message is printed, the node is in a synchronous block state;"),(0,o.yg)("pre",{parentName:"li"},(0,o.yg)("code",{parentName:"pre",className:"language-json"},"{\n currentBlock: 1412416,\n highestBlock: 1416699,\n knownStates: 522,\n pulledStates: 522,\n startingBlock: 1408247\n}\n"))))))),(0,o.yg)("h4",{id:"exit-console"},"Exit console"),(0,o.yg)("p",null,"Type Exit to exit the console."),(0,o.yg)("h2",{id:"upgrade-to-validator-node"},"Upgrade to Validator Node"),(0,o.yg)("p",null,"PlatON is a blockchain project that implements democratic governance. Verification nodes are jointly selected by all LAT holders to maintain and develop the PlatON network. The 201 nodes with the most votes will become candidate nodes, from which 43 verification nodes will be randomly selected using VRF to participate in the management of the entire PlatON network."),(0,o.yg)("p",null,"This section describes how to operate as a validator node."),(0,o.yg)("h3",{id:"install-platon-mtool"},"Install PlatON MTool"),(0,o.yg)("p",null,"Proceed as follows:"),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Step1. Download PlatON MTool toolkit")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"cd ~ && wget https://download.platon.network/platon/mtool/linux/1.1.1/platon_mtool.zip\n")),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Step2. Extract the PlatON MTool toolkit")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"(if ! command -v unzip;then sudo apt install unzip; fi;) && unzip platon_mtool.zip && cd platon_mtool\n")),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Step3. Download script")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"The script is downloaded to the ",(0,o.yg)("font",{color:"red"},"platon_mtool")," directory, otherwise the script cannot find the path of the new version of mtool.")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"wget https://download.platon.network/platon/scripts/mtool_install.sh\n")),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Step4. Execute command")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"chmod +x mtool_install.sh && ./mtool_install.sh\n")),(0,o.yg)("blockquote",null,(0,o.yg)("ul",{parentName:"blockquote"},(0,o.yg)("li",{parentName:"ul"},"When the message ",(0,o.yg)("font",{color:"red"},"Install platon mtool succeed.")," is displayed, PlatON MTool is successfully installed. If it is not successfully installed, please contact our official customer service to provide feedback on specific issues."))),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Step5. Restart the session window")),(0,o.yg)("p",null,"After installation is complete, you need to ",(0,o.yg)("font",{color:"red"},"restart the session window (do not restart the server, close the session window or SSH tool to reopen the window)")," for the newly added environment variables to take effect."),(0,o.yg)("h3",{id:"configure-platon-mtool"},"Configure PlatON MTool"),(0,o.yg)("h4",{id:"generate-wallet"},"Generate wallet"),(0,o.yg)("p",null,"To participate in the verification node to produce blocks, two wallets must be created. ",(0,o.yg)("font",{color:"red"}," If you want to create a node using an existing wallet, rename the wallet file for the mortgaging account to ",(0,o.yg)("inlineCode",{parentName:"p"},"staking.json"),", rename the wallet file for the income account to ",(0,o.yg)("inlineCode",{parentName:"p"},"reward.json"),", and copy the wallet file to the ",(0,o.yg)("inlineCode",{parentName:"p"},"$PLATON_MTOOLDIR/keystore")," directory to")," ",(0,o.yg)("a",{parentName:"p",href:"#configure-verification-node-information"},"skip this step"),"."),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"Staking wallet: The staking wallet is used to stake tokens. To become a candidate node, you must stake successfully. Run the following command to create a staking wallet:")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon_mtool account new staking\n")),(0,o.yg)("p",null,"Enter the password once and confirm the password again to create a wallet file. After the creation is successful, a staking wallet file ",(0,o.yg)("inlineCode",{parentName:"p"},"staking.json")," will be generated in the directory",(0,o.yg)("inlineCode",{parentName:"p"}," $PLATON_MTOOLDIR/keystore"),"."),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"Reward wallet: It is used to collect block rewards and staking rewards. Staking rewards are uniformly distributed to verification nodes, which are distributed by the verification nodes themselves. Run the following command to create a reward wallet")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon_mtool account new reward\n")),(0,o.yg)("p",null,"Enter the password once and confirm the password again to create the wallet file. After the creation is successful, the staking wallet file ",(0,o.yg)("inlineCode",{parentName:"p"},"reward.json")," will be generated in the directory",(0,o.yg)("inlineCode",{parentName:"p"}," $PLATON_MTOOLDIR/keystore"),"."),(0,o.yg)("h4",{id:"configure-verification-node-information"},"Configure verification node information"),(0,o.yg)("h5",{id:"download-the-script"},"Download the script"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"cd $PLATON_MTOOLDIR && wget https://download.platon.network/platon/scripts/validator_conf.sh\n")),(0,o.yg)("h5",{id:"run-the-script-configuration"},"Run the script configuration"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"chmod +x validator_conf.sh && ./validator_conf.sh\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},(0,o.yg)("strong",{parentName:"p"},"Note:")),(0,o.yg)("ul",{parentName:"blockquote"},(0,o.yg)("li",{parentName:"ul"},'When the prompt shows "Please enter the platon node IP address:", please enter the PlatON node server ip address.'),(0,o.yg)("li",{parentName:"ul"},'When the prompt shows "validator conf success", and when the validator_config.json content printed at the end is normal, it means that the script is executed successfully. If the script is not executed successfully, please contact our official customer service to feedback specific questions.'))),(0,o.yg)("h5",{id:"validator-node-information-configuration-file-description"},"Validator node information configuration file description"),(0,o.yg)("p",null,"After the configuration of the validator node information is completed, the validator node information file validator_config.json will be generated in the validator subdirectory of the PlatON MTool installation directory. The file content is as follows:"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-json"},'{\n "nodePublicKey": "0abaf3219f454f3d07b6cbcf3c10b6b4ccf605202868e2043b6f5db12b745df0604ef01ef4cb523adc6d9e14b83a76dd09f862e3fe77205d8ac83df707969b47",\n "blsPubKey": "82d740cbc0314ec558c5426f88fdad6f07a07f9846c6be4e40cd628b74b9f641ddad01e4c281a2c3693f8ff2a73a410297aff379ee0575127d51de99b97acc9a1b7bc8ca132ef6f0379a3ec9d76a603d623176e49e1c53e87fead36317895099",\n "nodeAddress": "http://192.168.120.146",\n "nodePort": "16789",\n "nodeRpcPort": "6789"\n}\n')),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},(0,o.yg)("strong",{parentName:"p"},"Parameter description:")),(0,o.yg)("ul",{parentName:"blockquote"},(0,o.yg)("li",{parentName:"ul"},"nodePublicKey: Node ID, which can be viewed in the nodeid file under the node data directory data"),(0,o.yg)("li",{parentName:"ul"},"blsPubKey: BLS public key, which can be viewed in the blspub file under the node data directory data."),(0,o.yg)("li",{parentName:"ul"},"nodeAddress: If PlatON MTool and the node are on the same machine or in the same local area network, you can use the intranet IP, otherwise use the public IP whose format is: ",(0,o.yg)("inlineCode",{parentName:"li"},"http://18.238.183.12"),"."),(0,o.yg)("li",{parentName:"ul"},"nodePort: Node P2P port, default is 16789."),(0,o.yg)("li",{parentName:"ul"},"nodeRpcPort: rpc port, the default port is 6789."))),(0,o.yg)("h5",{id:"custom-platscan-avatar"},"Custom PlatScan avatar"),(0,o.yg)("p",null,"If users do not need to display their specified avatar on PlatScan, they can skip this step. Otherwise, the following operations are required:"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},(0,o.yg)("strong",{parentName:"p"},"Register a keybase account")),(0,o.yg)("p",{parentName:"li"},"Users first need to register on the official website of ",(0,o.yg)("a",{parentName:"p",href:"https://keybase.io/"},"keybase.io")," . If they have already registered, they can log on the official website of keybase.")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},(0,o.yg)("strong",{parentName:"p"},"Upload specified avatar")),(0,o.yg)("p",{parentName:"li"},"Click the user avatar to upload the avatar.")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},(0,o.yg)("strong",{parentName:"p"},"Generate PGP key")),(0,o.yg)("p",{parentName:"li"},"If the user has a ",(0,o.yg)("inlineCode",{parentName:"p"},"PGP key"),", after a successful login, a series of 16-bit public keys will be displayed next to the user's avatar, such as: ",(0,o.yg)("inlineCode",{parentName:"p"},"EB621920A48D0699"),"; if the user does not already have a ",(0,o.yg)("inlineCode",{parentName:"p"},"PGP key"),", click ",(0,o.yg)("inlineCode",{parentName:"p"},"add a PGP key")," next to the user's avatar to generate.")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},(0,o.yg)("strong",{parentName:"p"},"Specify the externalId value")),(0,o.yg)("p",{parentName:"li"},"When issuing the staking operation, specify the ",(0,o.yg)("inlineCode",{parentName:"p"},"--external_id")," parameter to be the PGP key generated in the previous step."))),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"Note: After the user completes the staking operation, the avatar customized by the user can be displayed on PlatScan.")),(0,o.yg)("h3",{id:"initiate-a-staking-operation"},"Initiate a staking operation"),(0,o.yg)("p",null,"If the consensus node deployment is complete and is catching up the blocknumber of ",(0,o.yg)("a",{parentName:"p",href:"https://scan.platon.network/?lang=en"},"Platscan"),", you can use PlatON MTool for staking operations. Please ensure that the balance of the staking account is sufficient before staking. The minimum threshold for staking is one hundred thousand LAT. "),(0,o.yg)("p",null,"Note: "),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"Please keep at least 1 LAT in the staking account, so that the transactions initiated by the subsequent node management have sufficient transaction fees, such as voting for upgrade proposals, and unsecured transactions.")),(0,o.yg)("p",null,"Excuting command"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon_mtool staking --config $PLATON_MTOOLDIR/validator/validator_config.json --keystore $PLATON_MTOOLDIR/keystore/staking.json --autoamount 100000 --benefit_address xxx196278ns22j23awdfj9f2d4vz0pedld8a2fzwwj --delegated_reward_rate 5000 --node_name myNode --website www.mywebsite.com --details myNodeDescription --external_id 121412312\n")),(0,o.yg)("p",null,"Enter the password of the staking wallet and press Enter. If the following information is displayed, the staking is successful:"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"operation finished\ntransaction hash:\n0x89b964d27d0caf1d8bf268f721eb123c4af57aed36187bea90b262f4769eeb9b\nSUCCESS\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},(0,o.yg)("strong",{parentName:"p"},"Parameter description:")),(0,o.yg)("ul",{parentName:"blockquote"},(0,o.yg)("li",{parentName:"ul"},"config\uff1anode configuration file"),(0,o.yg)("li",{parentName:"ul"},"keystore: staking wallet file"),(0,o.yg)("li",{parentName:"ul"},"amount: staking amount, not less than 100000LAT-staking threshold, no more than 8 decimal places"),(0,o.yg)("li",{parentName:"ul"},"restrictedamount: not less than 100000LAT - staking threshold, no more than 8 decimal points (staking using locked balance)"),(0,o.yg)("li",{parentName:"ul"},"autoamount: Not less than 10000LAT-Priority to use the lock-up balance staking, if the lock-up balance is not enough for the staking deposit, then use free amount staking"),(0,o.yg)("li",{parentName:"ul"},"benefit_address: benefit account to receive block-packing reward and staking reward"),(0,o.yg)("li",{parentName:"ul"},"delegated_reward_rate\uff1aDelegated bonus ratio, type is integer range is ","[","0,10000","]",", unit: ten thousand percent, e.g. enter 5000, it means the bonus ratio is 50%"),(0,o.yg)("li",{parentName:"ul"},"node",(0,o.yg)("em",{parentName:"li"},"name\uff1anode name\uff0c30 bytes(beginning with a letter, including alphabet, number, space, "),", -, #)"),(0,o.yg)("li",{parentName:"ul"},"website\uff1anode website, 30 bytes"),(0,o.yg)("li",{parentName:"ul"},"details\uff1anode description, 280 bytes"),(0,o.yg)("li",{parentName:"ul"},"external_id\uff1anode Icon ID of ",(0,o.yg)("a",{parentName:"li",href:"https://keybase.io"},"keybase.io"),", or identity authentication ID"))))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[1736],{5680:(e,t,n)=>{n.d(t,{xA:()=>d,yg:()=>y});var a=n(6540);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},c="mdxType",u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},g=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,l=e.originalType,s=e.parentName,d=r(e,["components","mdxType","originalType","parentName"]),c=p(n),g=o,y=c["".concat(s,".").concat(g)]||c[g]||u[g]||l;return n?a.createElement(y,i(i({ref:t},d),{},{components:n})):a.createElement(y,i({ref:t},d))}));function y(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var l=n.length,i=new Array(l);i[0]=g;var r={};for(var s in t)hasOwnProperty.call(t,s)&&(r[s]=t[s]);r.originalType=e,r[c]="string"==typeof e?e:o,i[1]=r;for(var p=2;p{n.r(t),n.d(t,{contentTitle:()=>i,default:()=>c,frontMatter:()=>l,metadata:()=>r,toc:()=>s});var a=n(8168),o=(n(6540),n(5680));const l={id:"Become_PlatON_Main_Verification",title:"Run a validator node",sidebar_label:"Run a validator node"},i=void 0,r={unversionedId:"Become_PlatON_Main_Verification",id:"Become_PlatON_Main_Verification",isDocsHomePage:!1,title:"Run a validator node",description:"This guide demonstrates how to install the PlatON Node software on Linux.",source:"@site/../docs/\u6210\u4e3a\u4e3b\u7f51\u9a8c\u8bc1\u8282\u70b9.md",sourceDirName:".",slug:"/Become_PlatON_Main_Verification",permalink:"/docs/en/Become_PlatON_Main_Verification",editUrl:"https://github.com/PlatONnetwork/docs/tree/master/docs/\u6210\u4e3a\u4e3b\u7f51\u9a8c\u8bc1\u8282\u70b9.md",version:"current",frontMatter:{id:"Become_PlatON_Main_Verification",title:"Run a validator node",sidebar_label:"Run a validator node"},sidebar:"docs",previous:{title:"Intro to validator",permalink:"/docs/en/PlatON_Validation_Introduce"},next:{title:"MTool online tutorial",permalink:"/docs/en/OnLine_MTool_Manual"}},s=[{value:"System Requirements",id:"system-requirements",children:[]},{value:"Installation Overview",id:"installation-overview",children:[]},{value:"Installing on Ubuntu",id:"installing-on-ubuntu",children:[]},{value:"Generate keys",id:"generate-keys",children:[]},{value:"Join the PlatON main network",id:"join-the-platon-main-network",children:[{value:"Join the Main Network",id:"join-the-main-network",children:[]},{value:"View node status",id:"view-node-status",children:[]}]},{value:"Upgrade to Validator Node",id:"upgrade-to-validator-node",children:[{value:"Install PlatON MTool",id:"install-platon-mtool",children:[]},{value:"Configure PlatON MTool",id:"configure-platon-mtool",children:[]},{value:"Initiate a staking operation",id:"initiate-a-staking-operation",children:[]}]}],p={toc:s},d="wrapper";function c(e){let{components:t,...n}=e;return(0,o.yg)(d,(0,a.A)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.yg)("p",null,"This guide demonstrates how to install the PlatON Node software on Linux."),(0,o.yg)("h3",{id:"system-requirements"},"System Requirements"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"Server: Server and backup server running PlatON software (both have a firewall)"),(0,o.yg)("li",{parentName:"ul"},"Memory: 16GB RAM"),(0,o.yg)("li",{parentName:"ul"},"Local storage: 100GB system disk, 200GB data disk (can be expanded online)"),(0,o.yg)("li",{parentName:"ul"},"Processor: 64-bit 4 cores (each core above 2.4 GHz)"),(0,o.yg)("li",{parentName:"ul"},"Bandwidth: 5 MB/sec (can be expanded online)")),(0,o.yg)("h3",{id:"installation-overview"},"Installation Overview"),(0,o.yg)("p",null,"It takes three or four steps to install a new node, which depends on the operating system used. The detailed procedures are list below."),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"Installing on Ubuntu (18.04)")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},(0,o.yg)("strong",{parentName:"p"},"Note: Use the normal user to execute the following command."))),(0,o.yg)("h3",{id:"installing-on-ubuntu"},"Installing on Ubuntu"),(0,o.yg)("h4",{id:"install-and-run-ntp-service"},"Install and run NTP service"),(0,o.yg)("h5",{id:"open-a-terminal-and-run-the-following-commands"},"Open a terminal and run the following commands"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"sudo apt-get update &&\nsudo apt-get install -y gnupg2 curl software-properties-common ntp &&\nsudo systemctl enable ntp && sudo systemctl start ntp\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"Notes:"),(0,o.yg)("p",{parentName:"blockquote"},"NTP service is used for time synchronization, incorrect system time will affect the normal operation of PlatON")),(0,o.yg)("h5",{id:"validate-the-ntp-time-synchronization"},"Validate the NTP time synchronization"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"ntpq -4c rv | grep leap_none\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"Notes:"),(0,o.yg)("p",{parentName:"blockquote"},"Display ",(0,o.yg)("strong",{parentName:"p"},"associd=0 status=0615 ",(0,o.yg)("font",{color:"red"},"leap_none"),", sync_ntp, 1 event, clock_sync,")," where ",(0,o.yg)("inlineCode",{parentName:"p"},"leap_none")," is red, indicating that the NTP time synchronization is normal.")),(0,o.yg)("h4",{id:"install-platon"},"Install PlatON"),(0,o.yg)("p",null,"Ubuntu 18.04\uff1a"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"sudo wget https://download.platon.network/platon/platon/1.4.4/platon -O /usr/bin/platon\nsudo wget https://download.platon.network/platon/platon/1.4.2/platonkey -O /usr/bin/platonkey\n")),(0,o.yg)("p",null,"Ubuntu 20.04\uff1a"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"sudo wget https://download.platon.network/platon/platon/ubuntu20.04/1.4.4/platon -O /usr/bin/platon\nsudo wget https://download.platon.network/platon/platon/ubuntu20.04/1.4.2/platonkey -O /usr/bin/platonkey\n")),(0,o.yg)("p",null,"Ubuntu 22.04\uff1a"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"sudo wget https://download.platon.network/platon/platon/ubuntu22.04/1.4.4/platon -O /usr/bin/platon\nsudo wget https://download.platon.network/platon/platon/ubuntu22.04/1.4.4/platonkey -O /usr/bin/platonkey\n")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"sudo chmod +x /usr/bin/platon /usr/bin/platonkey\nplaton version\n")),(0,o.yg)("p",null,"After executing the commands above, ",(0,o.yg)("inlineCode",{parentName:"p"},"platon")," and",(0,o.yg)("inlineCode",{parentName:"p"}," platonkey")," binary should be successfully installed in the ",(0,o.yg)("inlineCode",{parentName:"p"},"/usr/bin")," directory on your system. You can execute corresponding commands in any directory."),(0,o.yg)("p",null,"After you execute the platon version, please double check whether your Git Commit value is consistent with the following, if it is consistent, it means that it has been installed correctly:"),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"PlatON",(0,o.yg)("br",null),"\nVersion: 1.4.4-unstable",(0,o.yg)("br",null),"\nGit Commit: ",(0,o.yg)("font",{color:"red"},"af1168d0b62febf53913cb1ceebaa6413d3ba9b3"),(0,o.yg)("br",null),"\nGit Commit Date: 20230719",(0,o.yg)("br",null),"\nArchitecture: amd64",(0,o.yg)("br",null),"\nGo Version: go1.22.8",(0,o.yg)("br",null),"\nOperating System: linux",(0,o.yg)("br",null),"\n...",(0,o.yg)("br",null))),(0,o.yg)("h3",{id:"generate-keys"},"Generate keys"),(0,o.yg)("h4",{id:"public-and-private-keys"},"Public and private keys"),(0,o.yg)("p",null,"Each node in the network has an unique identity to distinguish it from others. This identity is a public and private key pair, generated in the node's working directory ( ",(0,o.yg)("inlineCode",{parentName:"p"},"~/platon-node"),") by the following command:"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"mkdir -p ~/platon-node/data && platonkey genkeypair | tee >(grep \"PrivateKey\" | awk '{print $2}' > ~/platon-node/data/nodekey) >(grep \"PublicKey\" | awk '{print $3}' > ~/platon-node/data/nodeid)\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"Remark:"),(0,o.yg)("p",{parentName:"blockquote"},"Displays the following, indicating that the key pair has been successfully generated (x stands for number or letter) :"),(0,o.yg)("p",{parentName:"blockquote"},"PrivateKey: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"),(0,o.yg)("p",{parentName:"blockquote"},"PublicKey: : xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")),(0,o.yg)("p",null," ",(0,o.yg)("inlineCode",{parentName:"p"},"PrivateKey")," is the private key of the node, and",(0,o.yg)("inlineCode",{parentName:"p"}," PublicKey")," is the public key of the node. The public key is used to identify the identity of the node and can be made public."),(0,o.yg)("p",null,"Two files will be generated in the subdirectory ",(0,o.yg)("inlineCode",{parentName:"p"},"data")," under the working directory of the node\uff1a"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"nodeid: node public key (ID) file, which holds the node's public key"),(0,o.yg)("li",{parentName:"ul"},"nodekey: node private key file, which holds the node's private key")),(0,o.yg)("h4",{id:"bls-public-and-private-key"},"BLS public and private key"),(0,o.yg)("p",null,"In addition to the public and private keys of the node, the PlatON node also needs a key pair called the BLS public and private key. This key pair will be used in the consensus protocol. The key pair can be generated in the node's working directory (such as ",(0,o.yg)("inlineCode",{parentName:"p"},"~/platon-node"),") by the following command:"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"mkdir -p ~/platon-node/data && platonkey genblskeypair | tee >(grep \"PrivateKey\" | awk '{print $2}' > ~/platon-node/data/blskey) >(grep \"PublicKey\" | awk '{print $3}' > ~/platon-node/data/blspub)\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"PrivateKey: f22a785c80bd1095beff1f356811268eae6c94abf0b2b4e2d64918957b74783e\nPublicKey : 4bf873a66df92ada50a8c6bacb132ffd63437bcde7fd338d2d8696170034a6332e404ac3abb50326ee517ec5f63caf12891ce794ed14f8528fa7c54bc0ded7c5291f708116bb8ee8adadf1e88588866325d764230f4a45929d267a9e8f264402")),(0,o.yg)("p",null," ",(0,o.yg)("inlineCode",{parentName:"p"},"PrivateKey")," is the BLS private key of the node, and",(0,o.yg)("inlineCode",{parentName:"p"}," PublicKey")," is the BLS public key of the node. The BLS public key is used to quickly verify the signature in the consensus protocol and can be published. The BLS private key cannot be made public and needs to be backed up."),(0,o.yg)("p",null,"Two files will be generated in the subdirectory ",(0,o.yg)("inlineCode",{parentName:"p"},"data")," under the working directory of the node:"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"blspub: Node BLS public key file, which holds the node's BLS public key")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"blskey: Node BLS private key file, which holds the node's BLS private key"))),(0,o.yg)("h2",{id:"join-the-platon-main-network"},"Join the PlatON main network"),(0,o.yg)("p",null,"PlatON mainnet launch date to be determined, Chainid to be determined."),(0,o.yg)("p",null,"This section assumes that the server is Ubuntu 18.04, and the working directory of the executable file is ",(0,o.yg)("inlineCode",{parentName:"p"},"~/platon-node"),". Note that all subsequent commands should be run under the same working directory."),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"cd ~/platon-node\n")),(0,o.yg)("h3",{id:"join-the-main-network"},"Join the Main Network"),(0,o.yg)("p",null,"Anyone or any organization can join PlatON main network."),(0,o.yg)("h4",{id:"start-as-a-validator-node"},"Start as a validator node"),(0,o.yg)("p",null,"Execute the following command to start the verification node to join the main network of Platon (please access it after the main network is online)"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},'nohup platon --identity platon --datadir ./data --port 16789 --http.port 6789 --http.api "platon,net,web3,admin,personal" --http --nodekey ./data/nodekey --cbft.blskey ./data/blskey --verbosity 1 --http.addr 127.0.0.1 --syncmode "fast" > ./data/platon.log 2>&1 &\n')),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Prompt:")),(0,o.yg)("table",null,(0,o.yg)("thead",{parentName:"table"},(0,o.yg)("tr",{parentName:"thead"},(0,o.yg)("th",{parentName:"tr",align:null},(0,o.yg)("strong",{parentName:"th"},"Parameters")),(0,o.yg)("th",{parentName:"tr",align:null},(0,o.yg)("strong",{parentName:"th"},"Description")))),(0,o.yg)("tbody",{parentName:"table"},(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--identity"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the network name")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--datadir"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the data directory path")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--port"),(0,o.yg)("td",{parentName:"tr",align:null},"Specifying the P2P port number, TCP and UDP protocol corresponding ports need to be open to all hosts on the host firewall")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--http.addr"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify rpc server address")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--http.port"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the RPC protocol communication port, and open the TCP protocol corresponding port on the host firewall where MTool is located")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--http.api"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the rpcapi name open by the node")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--http"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify http-rpc communication method")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--nodekey"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the node private key file")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--cbft.blskey"),(0,o.yg)("td",{parentName:"tr",align:null},"Specify the node bls private key file")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--verbosity"),(0,o.yg)("td",{parentName:"tr",align:null},"The level of logging, 0: CRIT; 1: ERROR; 2: WARN; 3: INFO; 4: DEBUG; 5: TRACE")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--syncmode"),(0,o.yg)("td",{parentName:"tr",align:null},"fast: Fast synchronization mode, full: All synchronous mode")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--db.nogc"),(0,o.yg)("td",{parentName:"tr",align:null},"Enable archive mode")),(0,o.yg)("tr",{parentName:"tbody"},(0,o.yg)("td",{parentName:"tr",align:null},"--allow-insecure-unlock"),(0,o.yg)("td",{parentName:"tr",align:null},"Enable unlockAccount function")))),(0,o.yg)("p",null,"See more parameters with the command ",(0,o.yg)("inlineCode",{parentName:"p"},"platon --help")),(0,o.yg)("h3",{id:"view-node-status"},"View node status"),(0,o.yg)("p",null,"When PlatON is successfully started, under normal circumstances, it will automatically establish a connection with the node closest to it through the node discovery protocol. After the connection is successful, block synchronization will be started. You can determine whether joining the network successfully by looking at the peers of the node and confirming whether the block height of the node is increasing."),(0,o.yg)("p",null,"If the key is not generated in advance, the node is automatically generated in the node's data directory at startup. If it is automatically generated, only the node private key and BLS private key will be generated, and the relevant public key will not be automatically generated."),(0,o.yg)("h4",{id:"enter-platon--console"},"Enter ",(0,o.yg)("inlineCode",{parentName:"h4"},"PlatON ")," console"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon attach http://localhost:6789\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"Print ",(0,o.yg)("inlineCode",{parentName:"p"},"Welcome to the Platon JavaScript Console!")," Relevant information, indicating successful access to the console, otherwise it will be deemed as failure to access the console, if there is any problem, you can contact the official customer service personnel.")),(0,o.yg)("h4",{id:"view-peers-of-a-node"},"View peers of a node"),(0,o.yg)("p",null,"View the connection node information by executing the following command in the Platon console."),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"admin.peers\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"If the related Peers information is printed, it means that the connected node is successful, as follows:"),(0,o.yg)("p",{parentName:"blockquote"},"[{\ncaps: ",'["cbft/1", "platon/66"]',',\nid: "c72a4d2cb8228ca6f9072daa66566bcafa17bec6a9e53765c85c389434488c393357c5c7c5d18cf9b26ceda46aca4da20755cd01bcc1478fff891a201042ba84",\nname: "PlatONnetwork/alaya-47.241.93.189/v1.0.0-unstable-62b9a900/linux-amd64/go1.13.4",\nnetwork: {\nconsensus: false,\ninbound: false,\nlocalAddress: "192.168.2.128:55572",\nremoteAddress: "47.241.93.189:16789",\nstatic: false,\ntrusted: false\n},\nprotocols: {\ncbft: {\ncommitBn: 1404934,\nhighestQCBn: 1407304,\nlockedBn: 1404935,\nprotocolVersion: 1\n},\nplaton: {\nhead: "0xf31395262f876935c94e33b1d9f3314b2cb6effc33fcffa3b17b725678fd525f",\nnumber: 1407295,\nversion: 63\n}\n}\n}'),(0,o.yg)("p",{parentName:"blockquote"},"...]"),(0,o.yg)("p",{parentName:"blockquote"},"If the printed information is empty, it means that the connection node failed. If there is any problem, you can contact the official customer service personnel.")),(0,o.yg)("h4",{id:"view-the-current-block-height"},"View the current block height"),(0,o.yg)("p",null,"View the block height of the current node by executing the following command in the Platon console."),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon.blockNumber\n")),(0,o.yg)("blockquote",null,(0,o.yg)("ul",{parentName:"blockquote"},(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"Execute this command several times, if the block height value increases continuously, then the connection is successful;")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"If it is a new node and the block height is always 0, it means that the node is in the synchronous block and there may be delay. You can use the command:"),(0,o.yg)("pre",{parentName:"li"},(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon.syncing\n")),(0,o.yg)("ul",{parentName:"li"},(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"If ",(0,o.yg)("inlineCode",{parentName:"p"},"false")," is printed, the node is not in a synchronous block state.")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},"If the following message is printed, the node is in a synchronous block state;"),(0,o.yg)("pre",{parentName:"li"},(0,o.yg)("code",{parentName:"pre",className:"language-json"},"{\n currentBlock: 1412416,\n highestBlock: 1416699,\n knownStates: 522,\n pulledStates: 522,\n startingBlock: 1408247\n}\n"))))))),(0,o.yg)("h4",{id:"exit-console"},"Exit console"),(0,o.yg)("p",null,"Type Exit to exit the console."),(0,o.yg)("h2",{id:"upgrade-to-validator-node"},"Upgrade to Validator Node"),(0,o.yg)("p",null,"PlatON is a blockchain project that implements democratic governance. Verification nodes are jointly selected by all LAT holders to maintain and develop the PlatON network. The 201 nodes with the most votes will become candidate nodes, from which 43 verification nodes will be randomly selected using VRF to participate in the management of the entire PlatON network."),(0,o.yg)("p",null,"This section describes how to operate as a validator node."),(0,o.yg)("h3",{id:"install-platon-mtool"},"Install PlatON MTool"),(0,o.yg)("p",null,"Proceed as follows:"),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Step1. Download PlatON MTool toolkit")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"cd ~ && wget https://download.platon.network/platon/mtool/linux/1.1.1/platon_mtool.zip\n")),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Step2. Extract the PlatON MTool toolkit")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"(if ! command -v unzip;then sudo apt install unzip; fi;) && unzip platon_mtool.zip && cd platon_mtool\n")),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Step3. Download script")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"The script is downloaded to the ",(0,o.yg)("font",{color:"red"},"platon_mtool")," directory, otherwise the script cannot find the path of the new version of mtool.")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"wget https://download.platon.network/platon/scripts/mtool_install.sh\n")),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Step4. Execute command")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"chmod +x mtool_install.sh && ./mtool_install.sh\n")),(0,o.yg)("blockquote",null,(0,o.yg)("ul",{parentName:"blockquote"},(0,o.yg)("li",{parentName:"ul"},"When the message ",(0,o.yg)("font",{color:"red"},"Install platon mtool succeed.")," is displayed, PlatON MTool is successfully installed. If it is not successfully installed, please contact our official customer service to provide feedback on specific issues."))),(0,o.yg)("p",null,(0,o.yg)("strong",{parentName:"p"},"Step5. Restart the session window")),(0,o.yg)("p",null,"After installation is complete, you need to ",(0,o.yg)("font",{color:"red"},"restart the session window (do not restart the server, close the session window or SSH tool to reopen the window)")," for the newly added environment variables to take effect."),(0,o.yg)("h3",{id:"configure-platon-mtool"},"Configure PlatON MTool"),(0,o.yg)("h4",{id:"generate-wallet"},"Generate wallet"),(0,o.yg)("p",null,"To participate in the verification node to produce blocks, two wallets must be created. ",(0,o.yg)("font",{color:"red"}," If you want to create a node using an existing wallet, rename the wallet file for the mortgaging account to ",(0,o.yg)("inlineCode",{parentName:"p"},"staking.json"),", rename the wallet file for the income account to ",(0,o.yg)("inlineCode",{parentName:"p"},"reward.json"),", and copy the wallet file to the ",(0,o.yg)("inlineCode",{parentName:"p"},"$PLATON_MTOOLDIR/keystore")," directory to")," ",(0,o.yg)("a",{parentName:"p",href:"#configure-verification-node-information"},"skip this step"),"."),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"Staking wallet: The staking wallet is used to stake tokens. To become a candidate node, you must stake successfully. Run the following command to create a staking wallet:")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon_mtool account new staking\n")),(0,o.yg)("p",null,"Enter the password once and confirm the password again to create a wallet file. After the creation is successful, a staking wallet file ",(0,o.yg)("inlineCode",{parentName:"p"},"staking.json")," will be generated in the directory",(0,o.yg)("inlineCode",{parentName:"p"}," $PLATON_MTOOLDIR/keystore"),"."),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"Reward wallet: It is used to collect block rewards and staking rewards. Staking rewards are uniformly distributed to verification nodes, which are distributed by the verification nodes themselves. Run the following command to create a reward wallet")),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon_mtool account new reward\n")),(0,o.yg)("p",null,"Enter the password once and confirm the password again to create the wallet file. After the creation is successful, the staking wallet file ",(0,o.yg)("inlineCode",{parentName:"p"},"reward.json")," will be generated in the directory",(0,o.yg)("inlineCode",{parentName:"p"}," $PLATON_MTOOLDIR/keystore"),"."),(0,o.yg)("h4",{id:"configure-verification-node-information"},"Configure verification node information"),(0,o.yg)("h5",{id:"download-the-script"},"Download the script"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"cd $PLATON_MTOOLDIR && wget https://download.platon.network/platon/scripts/validator_conf.sh\n")),(0,o.yg)("h5",{id:"run-the-script-configuration"},"Run the script configuration"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"chmod +x validator_conf.sh && ./validator_conf.sh\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},(0,o.yg)("strong",{parentName:"p"},"Note:")),(0,o.yg)("ul",{parentName:"blockquote"},(0,o.yg)("li",{parentName:"ul"},'When the prompt shows "Please enter the platon node IP address:", please enter the PlatON node server ip address.'),(0,o.yg)("li",{parentName:"ul"},'When the prompt shows "validator conf success", and when the validator_config.json content printed at the end is normal, it means that the script is executed successfully. If the script is not executed successfully, please contact our official customer service to feedback specific questions.'))),(0,o.yg)("h5",{id:"validator-node-information-configuration-file-description"},"Validator node information configuration file description"),(0,o.yg)("p",null,"After the configuration of the validator node information is completed, the validator node information file validator_config.json will be generated in the validator subdirectory of the PlatON MTool installation directory. The file content is as follows:"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-json"},'{\n "nodePublicKey": "0abaf3219f454f3d07b6cbcf3c10b6b4ccf605202868e2043b6f5db12b745df0604ef01ef4cb523adc6d9e14b83a76dd09f862e3fe77205d8ac83df707969b47",\n "blsPubKey": "82d740cbc0314ec558c5426f88fdad6f07a07f9846c6be4e40cd628b74b9f641ddad01e4c281a2c3693f8ff2a73a410297aff379ee0575127d51de99b97acc9a1b7bc8ca132ef6f0379a3ec9d76a603d623176e49e1c53e87fead36317895099",\n "nodeAddress": "http://192.168.120.146",\n "nodePort": "16789",\n "nodeRpcPort": "6789"\n}\n')),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},(0,o.yg)("strong",{parentName:"p"},"Parameter description:")),(0,o.yg)("ul",{parentName:"blockquote"},(0,o.yg)("li",{parentName:"ul"},"nodePublicKey: Node ID, which can be viewed in the nodeid file under the node data directory data"),(0,o.yg)("li",{parentName:"ul"},"blsPubKey: BLS public key, which can be viewed in the blspub file under the node data directory data."),(0,o.yg)("li",{parentName:"ul"},"nodeAddress: If PlatON MTool and the node are on the same machine or in the same local area network, you can use the intranet IP, otherwise use the public IP whose format is: ",(0,o.yg)("inlineCode",{parentName:"li"},"http://18.238.183.12"),"."),(0,o.yg)("li",{parentName:"ul"},"nodePort: Node P2P port, default is 16789."),(0,o.yg)("li",{parentName:"ul"},"nodeRpcPort: rpc port, the default port is 6789."))),(0,o.yg)("h5",{id:"custom-platscan-avatar"},"Custom PlatScan avatar"),(0,o.yg)("p",null,"If users do not need to display their specified avatar on PlatScan, they can skip this step. Otherwise, the following operations are required:"),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},(0,o.yg)("strong",{parentName:"p"},"Register a keybase account")),(0,o.yg)("p",{parentName:"li"},"Users first need to register on the official website of ",(0,o.yg)("a",{parentName:"p",href:"https://keybase.io/"},"keybase.io")," . If they have already registered, they can log on the official website of keybase.")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},(0,o.yg)("strong",{parentName:"p"},"Upload specified avatar")),(0,o.yg)("p",{parentName:"li"},"Click the user avatar to upload the avatar.")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},(0,o.yg)("strong",{parentName:"p"},"Generate PGP key")),(0,o.yg)("p",{parentName:"li"},"If the user has a ",(0,o.yg)("inlineCode",{parentName:"p"},"PGP key"),", after a successful login, a series of 16-bit public keys will be displayed next to the user's avatar, such as: ",(0,o.yg)("inlineCode",{parentName:"p"},"EB621920A48D0699"),"; if the user does not already have a ",(0,o.yg)("inlineCode",{parentName:"p"},"PGP key"),", click ",(0,o.yg)("inlineCode",{parentName:"p"},"add a PGP key")," next to the user's avatar to generate.")),(0,o.yg)("li",{parentName:"ul"},(0,o.yg)("p",{parentName:"li"},(0,o.yg)("strong",{parentName:"p"},"Specify the externalId value")),(0,o.yg)("p",{parentName:"li"},"When issuing the staking operation, specify the ",(0,o.yg)("inlineCode",{parentName:"p"},"--external_id")," parameter to be the PGP key generated in the previous step."))),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},"Note: After the user completes the staking operation, the avatar customized by the user can be displayed on PlatScan.")),(0,o.yg)("h3",{id:"initiate-a-staking-operation"},"Initiate a staking operation"),(0,o.yg)("p",null,"If the consensus node deployment is complete and is catching up the blocknumber of ",(0,o.yg)("a",{parentName:"p",href:"https://scan.platon.network/?lang=en"},"Platscan"),", you can use PlatON MTool for staking operations. Please ensure that the balance of the staking account is sufficient before staking. The minimum threshold for staking is one hundred thousand LAT. "),(0,o.yg)("p",null,"Note: "),(0,o.yg)("ul",null,(0,o.yg)("li",{parentName:"ul"},"Please keep at least 1 LAT in the staking account, so that the transactions initiated by the subsequent node management have sufficient transaction fees, such as voting for upgrade proposals, and unsecured transactions.")),(0,o.yg)("p",null,"Excuting command"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"platon_mtool staking --config $PLATON_MTOOLDIR/validator/validator_config.json --keystore $PLATON_MTOOLDIR/keystore/staking.json --autoamount 100000 --benefit_address xxx196278ns22j23awdfj9f2d4vz0pedld8a2fzwwj --delegated_reward_rate 5000 --node_name myNode --website www.mywebsite.com --details myNodeDescription --external_id 121412312\n")),(0,o.yg)("p",null,"Enter the password of the staking wallet and press Enter. If the following information is displayed, the staking is successful:"),(0,o.yg)("pre",null,(0,o.yg)("code",{parentName:"pre",className:"language-bash"},"operation finished\ntransaction hash:\n0x89b964d27d0caf1d8bf268f721eb123c4af57aed36187bea90b262f4769eeb9b\nSUCCESS\n")),(0,o.yg)("blockquote",null,(0,o.yg)("p",{parentName:"blockquote"},(0,o.yg)("strong",{parentName:"p"},"Parameter description:")),(0,o.yg)("ul",{parentName:"blockquote"},(0,o.yg)("li",{parentName:"ul"},"config\uff1anode configuration file"),(0,o.yg)("li",{parentName:"ul"},"keystore: staking wallet file"),(0,o.yg)("li",{parentName:"ul"},"amount: staking amount, not less than 100000LAT-staking threshold, no more than 8 decimal places"),(0,o.yg)("li",{parentName:"ul"},"restrictedamount: not less than 100000LAT - staking threshold, no more than 8 decimal points (staking using locked balance)"),(0,o.yg)("li",{parentName:"ul"},"autoamount: Not less than 10000LAT-Priority to use the lock-up balance staking, if the lock-up balance is not enough for the staking deposit, then use free amount staking"),(0,o.yg)("li",{parentName:"ul"},"benefit_address: benefit account to receive block-packing reward and staking reward"),(0,o.yg)("li",{parentName:"ul"},"delegated_reward_rate\uff1aDelegated bonus ratio, type is integer range is ","[","0,10000","]",", unit: ten thousand percent, e.g. enter 5000, it means the bonus ratio is 50%"),(0,o.yg)("li",{parentName:"ul"},"node",(0,o.yg)("em",{parentName:"li"},"name\uff1anode name\uff0c30 bytes(beginning with a letter, including alphabet, number, space, "),", -, #)"),(0,o.yg)("li",{parentName:"ul"},"website\uff1anode website, 30 bytes"),(0,o.yg)("li",{parentName:"ul"},"details\uff1anode description, 280 bytes"),(0,o.yg)("li",{parentName:"ul"},"external_id\uff1anode Icon ID of ",(0,o.yg)("a",{parentName:"li",href:"https://keybase.io"},"keybase.io"),", or identity authentication ID"))))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/en/assets/js/runtime~main.10d91a1e.js b/en/assets/js/runtime~main.4917b9c8.js similarity index 99% rename from en/assets/js/runtime~main.10d91a1e.js rename to en/assets/js/runtime~main.4917b9c8.js index a9201c96f..f8c7337b6 100644 --- a/en/assets/js/runtime~main.10d91a1e.js +++ b/en/assets/js/runtime~main.4917b9c8.js @@ -1 +1 @@ -(()=>{"use strict";var e,a,c,f,d,b={},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var c=t[e]={id:e,loaded:!1,exports:{}};return b[e].call(c.exports,c,c.exports,r),c.loaded=!0,c.exports}r.m=b,r.c=t,e=[],r.O=(a,c,f,d)=>{if(!c){var b=1/0;for(i=0;i=d)&&Object.keys(r.O).every((e=>r.O[e](c[o])))?c.splice(o--,1):(t=!1,d0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[c,f,d]},r.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return r.d(a,{a:a}),a},c=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,f){if(1&f&&(e=this(e)),8&f)return e;if("object"==typeof e&&e){if(4&f&&e.__esModule)return e;if(16&f&&"function"==typeof e.then)return e}var d=Object.create(null);r.r(d);var b={};a=a||[null,c({}),c([]),c(c)];for(var t=2&f&&e;"object"==typeof t&&!~a.indexOf(t);t=c(t))Object.getOwnPropertyNames(t).forEach((a=>b[a]=()=>e[a]));return b.default=()=>e,r.d(d,b),d},r.d=(e,a)=>{for(var c in a)r.o(a,c)&&!r.o(e,c)&&Object.defineProperty(e,c,{enumerable:!0,get:a[c]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((a,c)=>(r.f[c](e,a),a)),[])),r.u=e=>"assets/js/"+({9:"7c01219a",141:"47bf852f",182:"26f00032",266:"02a5bd6e",410:"de5a5c02",503:"ffc5bc4e",767:"00513cca",926:"1b068446",1003:"7e0360c4",1065:"2fd65cec",1117:"281e6da7",1147:"57134b77",1192:"4b49a9aa",1205:"45050860",1230:"40d6bc37",1293:"c5399940",1399:"90c1fbfa",1592:"2f159d55",1624:"8d917970",1656:"3753d290",1666:"a651144a",1736:"ebf40b11",1987:"ecfe08ed",2351:"844b6fa5",2543:"a6cdf279",2640:"2880f02a",2758:"036a08cd",2800:"8cbb4dac",2840:"c458cc87",3107:"08eba0e5",3110:"cab29a5d",3450:"ef89d78f",3563:"2da079c0",3637:"8811c6c2",3639:"2aef6c43",3740:"358b1e47",3805:"1f88cea0",4063:"1795b996",4191:"4d453fb0",4224:"6ef51888",4334:"a0eb819e",4336:"187563fc",4455:"c2741d85",4533:"c767ba33",4537:"a7d3d7e1",4628:"5f68a137",4736:"8f82a138",5041:"5744c87b",5234:"4b04a897",5260:"b76ab335",5362:"78533e48",5517:"fdc56f1c",5801:"65c9d618",5939:"0f657be9",5952:"088efce4",6128:"6fbe188c",6163:"3477cd5e",6246:"92824bd0",6519:"280b88e7",6674:"850568e0",7239:"a969db61",7589:"12753c0a",7819:"d024cf01",7906:"a11a4b2e",8078:"03a88bad",8123:"82833145",8199:"ab973480",8249:"4d9f9a52",8309:"23e63a37",8324:"d60b69ec",8401:"17896441",8581:"935f2afb",8714:"1be78505",8748:"a146a1e2",8772:"ee3e85c9",8991:"d630c820",9004:"7d827ebb",9146:"2d862f0a",9237:"61730ff7",9239:"31489098",9425:"3d44375b",9448:"467850cb",9572:"d6cba0fc",9632:"0ae93a6f"}[e]||e)+"."+{9:"142f9517",141:"fc4b075e",182:"182f4ecc",266:"bc36b107",410:"7bee7a7c",503:"31567320",596:"dfdcb649",767:"027a491d",926:"53720638",1003:"e266c9f9",1065:"f3676cf4",1117:"1cdcdaa1",1147:"6dbe6976",1192:"8afa1d80",1205:"1b5c7db5",1230:"fd03a1b8",1293:"d5356963",1399:"bc0b3446",1592:"bbba0dd4",1624:"0dfae583",1656:"f5b924e2",1666:"e40be319",1736:"121f6cc8",1987:"80c92bc8",2351:"0a98019d",2543:"04e7d38f",2640:"8dbec63e",2758:"5fb9c839",2800:"173e6c4c",2840:"f678f4aa",3107:"3b15d413",3110:"86b7c728",3450:"975a6d91",3563:"0a44cf9c",3637:"48aa9077",3639:"2c888392",3740:"8fc53991",3760:"b6d2456f",3805:"e4774f0b",4063:"0d65c024",4191:"70698a12",4224:"074d7969",4334:"b27371f9",4336:"b57fd7f3",4455:"e51b21c2",4533:"dff29f1c",4537:"d129a837",4628:"b3ab29c4",4736:"d59a6257",5041:"445f5b7d",5130:"cb8451ca",5169:"91014125",5234:"39d0e4bd",5260:"a56ae0a6",5343:"476f8e03",5345:"4618d5bb",5362:"1e187421",5517:"00cec021",5801:"2f49c44d",5939:"3de95f32",5952:"bd3ff30d",6128:"68b8edfb",6163:"c50c9462",6246:"2085dac8",6519:"6557efa2",6674:"df6e2746",7239:"870a33ed",7589:"f00d8b5b",7819:"e2513495",7906:"ca704b7c",8078:"d17ad37d",8123:"2268617a",8199:"80eb51e7",8249:"06b75b44",8309:"3add7928",8324:"8b1d8690",8401:"751f566b",8581:"5d46630b",8714:"13b3e506",8748:"c0c66c9a",8772:"c372a8e4",8913:"480b5b18",8991:"bddfae76",9004:"d7d72405",9146:"9398f156",9237:"c25854ea",9239:"b578ce25",9425:"03037382",9448:"345f513f",9572:"c3915f82",9632:"166f3fe5"}[e]+".js",r.miniCssF=e=>"assets/css/styles.4b88b956.css",r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),f={},d="docs:",r.l=(e,a,c,b)=>{if(f[e])f[e].push(a);else{var t,o;if(void 0!==c)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(l);var d=f[e];if(delete f[e],t.parentNode&&t.parentNode.removeChild(t),d&&d.forEach((e=>e(c))),a)return a(c)},l=setTimeout(u.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=u.bind(null,t.onerror),t.onload=u.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/docs/en/",r.gca=function(e){return e={17896441:"8401",31489098:"9239",45050860:"1205",82833145:"8123","7c01219a":"9","47bf852f":"141","26f00032":"182","02a5bd6e":"266",de5a5c02:"410",ffc5bc4e:"503","00513cca":"767","1b068446":"926","7e0360c4":"1003","2fd65cec":"1065","281e6da7":"1117","57134b77":"1147","4b49a9aa":"1192","40d6bc37":"1230",c5399940:"1293","90c1fbfa":"1399","2f159d55":"1592","8d917970":"1624","3753d290":"1656",a651144a:"1666",ebf40b11:"1736",ecfe08ed:"1987","844b6fa5":"2351",a6cdf279:"2543","2880f02a":"2640","036a08cd":"2758","8cbb4dac":"2800",c458cc87:"2840","08eba0e5":"3107",cab29a5d:"3110",ef89d78f:"3450","2da079c0":"3563","8811c6c2":"3637","2aef6c43":"3639","358b1e47":"3740","1f88cea0":"3805","1795b996":"4063","4d453fb0":"4191","6ef51888":"4224",a0eb819e:"4334","187563fc":"4336",c2741d85:"4455",c767ba33:"4533",a7d3d7e1:"4537","5f68a137":"4628","8f82a138":"4736","5744c87b":"5041","4b04a897":"5234",b76ab335:"5260","78533e48":"5362",fdc56f1c:"5517","65c9d618":"5801","0f657be9":"5939","088efce4":"5952","6fbe188c":"6128","3477cd5e":"6163","92824bd0":"6246","280b88e7":"6519","850568e0":"6674",a969db61:"7239","12753c0a":"7589",d024cf01:"7819",a11a4b2e:"7906","03a88bad":"8078",ab973480:"8199","4d9f9a52":"8249","23e63a37":"8309",d60b69ec:"8324","935f2afb":"8581","1be78505":"8714",a146a1e2:"8748",ee3e85c9:"8772",d630c820:"8991","7d827ebb":"9004","2d862f0a":"9146","61730ff7":"9237","3d44375b":"9425","467850cb":"9448",d6cba0fc:"9572","0ae93a6f":"9632"}[e]||e,r.p+r.u(e)},(()=>{var e={5354:0,1869:0};r.f.j=(a,c)=>{var f=r.o(e,a)?e[a]:void 0;if(0!==f)if(f)c.push(f[2]);else if(/^(1869|5354)$/.test(a))e[a]=0;else{var d=new Promise(((c,d)=>f=e[a]=[c,d]));c.push(f[2]=d);var b=r.p+r.u(a),t=new Error;r.l(b,(c=>{if(r.o(e,a)&&(0!==(f=e[a])&&(e[a]=void 0),f)){var d=c&&("load"===c.type?"missing":c.type),b=c&&c.target&&c.target.src;t.message="Loading chunk "+a+" failed.\n("+d+": "+b+")",t.name="ChunkLoadError",t.type=d,t.request=b,f[1](t)}}),"chunk-"+a,a)}},r.O.j=a=>0===e[a];var a=(a,c)=>{var f,d,b=c[0],t=c[1],o=c[2],n=0;if(b.some((a=>0!==e[a]))){for(f in t)r.o(t,f)&&(r.m[f]=t[f]);if(o)var i=o(r)}for(a&&a(c);n{"use strict";var e,a,c,f,d,b={},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var c=t[e]={id:e,loaded:!1,exports:{}};return b[e].call(c.exports,c,c.exports,r),c.loaded=!0,c.exports}r.m=b,r.c=t,e=[],r.O=(a,c,f,d)=>{if(!c){var b=1/0;for(i=0;i=d)&&Object.keys(r.O).every((e=>r.O[e](c[o])))?c.splice(o--,1):(t=!1,d0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[c,f,d]},r.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return r.d(a,{a:a}),a},c=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,f){if(1&f&&(e=this(e)),8&f)return e;if("object"==typeof e&&e){if(4&f&&e.__esModule)return e;if(16&f&&"function"==typeof e.then)return e}var d=Object.create(null);r.r(d);var b={};a=a||[null,c({}),c([]),c(c)];for(var t=2&f&&e;"object"==typeof t&&!~a.indexOf(t);t=c(t))Object.getOwnPropertyNames(t).forEach((a=>b[a]=()=>e[a]));return b.default=()=>e,r.d(d,b),d},r.d=(e,a)=>{for(var c in a)r.o(a,c)&&!r.o(e,c)&&Object.defineProperty(e,c,{enumerable:!0,get:a[c]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((a,c)=>(r.f[c](e,a),a)),[])),r.u=e=>"assets/js/"+({9:"7c01219a",141:"47bf852f",182:"26f00032",266:"02a5bd6e",410:"de5a5c02",503:"ffc5bc4e",767:"00513cca",926:"1b068446",1003:"7e0360c4",1065:"2fd65cec",1117:"281e6da7",1147:"57134b77",1192:"4b49a9aa",1205:"45050860",1230:"40d6bc37",1293:"c5399940",1399:"90c1fbfa",1592:"2f159d55",1624:"8d917970",1656:"3753d290",1666:"a651144a",1736:"ebf40b11",1987:"ecfe08ed",2351:"844b6fa5",2543:"a6cdf279",2640:"2880f02a",2758:"036a08cd",2800:"8cbb4dac",2840:"c458cc87",3107:"08eba0e5",3110:"cab29a5d",3450:"ef89d78f",3563:"2da079c0",3637:"8811c6c2",3639:"2aef6c43",3740:"358b1e47",3805:"1f88cea0",4063:"1795b996",4191:"4d453fb0",4224:"6ef51888",4334:"a0eb819e",4336:"187563fc",4455:"c2741d85",4533:"c767ba33",4537:"a7d3d7e1",4628:"5f68a137",4736:"8f82a138",5041:"5744c87b",5234:"4b04a897",5260:"b76ab335",5362:"78533e48",5517:"fdc56f1c",5801:"65c9d618",5939:"0f657be9",5952:"088efce4",6128:"6fbe188c",6163:"3477cd5e",6246:"92824bd0",6519:"280b88e7",6674:"850568e0",7239:"a969db61",7589:"12753c0a",7819:"d024cf01",7906:"a11a4b2e",8078:"03a88bad",8123:"82833145",8199:"ab973480",8249:"4d9f9a52",8309:"23e63a37",8324:"d60b69ec",8401:"17896441",8581:"935f2afb",8714:"1be78505",8748:"a146a1e2",8772:"ee3e85c9",8991:"d630c820",9004:"7d827ebb",9146:"2d862f0a",9237:"61730ff7",9239:"31489098",9425:"3d44375b",9448:"467850cb",9572:"d6cba0fc",9632:"0ae93a6f"}[e]||e)+"."+{9:"142f9517",141:"fc4b075e",182:"182f4ecc",266:"bc36b107",410:"7bee7a7c",503:"31567320",596:"dfdcb649",767:"027a491d",926:"53720638",1003:"e266c9f9",1065:"f3676cf4",1117:"1cdcdaa1",1147:"6dbe6976",1192:"8afa1d80",1205:"1b5c7db5",1230:"fd03a1b8",1293:"d5356963",1399:"bc0b3446",1592:"bbba0dd4",1624:"0dfae583",1656:"f5b924e2",1666:"e40be319",1736:"8ca1e803",1987:"80c92bc8",2351:"0a98019d",2543:"04e7d38f",2640:"8dbec63e",2758:"5fb9c839",2800:"173e6c4c",2840:"f678f4aa",3107:"3b15d413",3110:"86b7c728",3450:"975a6d91",3563:"0a44cf9c",3637:"48aa9077",3639:"2c888392",3740:"8fc53991",3760:"b6d2456f",3805:"e4774f0b",4063:"0d65c024",4191:"70698a12",4224:"074d7969",4334:"b27371f9",4336:"b57fd7f3",4455:"e51b21c2",4533:"dff29f1c",4537:"d129a837",4628:"b3ab29c4",4736:"d59a6257",5041:"445f5b7d",5130:"cb8451ca",5169:"91014125",5234:"39d0e4bd",5260:"a56ae0a6",5343:"476f8e03",5345:"4618d5bb",5362:"1e187421",5517:"00cec021",5801:"2f49c44d",5939:"3de95f32",5952:"bd3ff30d",6128:"68b8edfb",6163:"c50c9462",6246:"2085dac8",6519:"6557efa2",6674:"df6e2746",7239:"870a33ed",7589:"f00d8b5b",7819:"e2513495",7906:"ca704b7c",8078:"d17ad37d",8123:"2268617a",8199:"80eb51e7",8249:"06b75b44",8309:"3add7928",8324:"8b1d8690",8401:"751f566b",8581:"5d46630b",8714:"13b3e506",8748:"c0c66c9a",8772:"c372a8e4",8913:"480b5b18",8991:"bddfae76",9004:"d7d72405",9146:"9398f156",9237:"c25854ea",9239:"b578ce25",9425:"03037382",9448:"345f513f",9572:"c3915f82",9632:"166f3fe5"}[e]+".js",r.miniCssF=e=>"assets/css/styles.4b88b956.css",r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),f={},d="docs:",r.l=(e,a,c,b)=>{if(f[e])f[e].push(a);else{var t,o;if(void 0!==c)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(l);var d=f[e];if(delete f[e],t.parentNode&&t.parentNode.removeChild(t),d&&d.forEach((e=>e(c))),a)return a(c)},l=setTimeout(u.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=u.bind(null,t.onerror),t.onload=u.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/docs/en/",r.gca=function(e){return e={17896441:"8401",31489098:"9239",45050860:"1205",82833145:"8123","7c01219a":"9","47bf852f":"141","26f00032":"182","02a5bd6e":"266",de5a5c02:"410",ffc5bc4e:"503","00513cca":"767","1b068446":"926","7e0360c4":"1003","2fd65cec":"1065","281e6da7":"1117","57134b77":"1147","4b49a9aa":"1192","40d6bc37":"1230",c5399940:"1293","90c1fbfa":"1399","2f159d55":"1592","8d917970":"1624","3753d290":"1656",a651144a:"1666",ebf40b11:"1736",ecfe08ed:"1987","844b6fa5":"2351",a6cdf279:"2543","2880f02a":"2640","036a08cd":"2758","8cbb4dac":"2800",c458cc87:"2840","08eba0e5":"3107",cab29a5d:"3110",ef89d78f:"3450","2da079c0":"3563","8811c6c2":"3637","2aef6c43":"3639","358b1e47":"3740","1f88cea0":"3805","1795b996":"4063","4d453fb0":"4191","6ef51888":"4224",a0eb819e:"4334","187563fc":"4336",c2741d85:"4455",c767ba33:"4533",a7d3d7e1:"4537","5f68a137":"4628","8f82a138":"4736","5744c87b":"5041","4b04a897":"5234",b76ab335:"5260","78533e48":"5362",fdc56f1c:"5517","65c9d618":"5801","0f657be9":"5939","088efce4":"5952","6fbe188c":"6128","3477cd5e":"6163","92824bd0":"6246","280b88e7":"6519","850568e0":"6674",a969db61:"7239","12753c0a":"7589",d024cf01:"7819",a11a4b2e:"7906","03a88bad":"8078",ab973480:"8199","4d9f9a52":"8249","23e63a37":"8309",d60b69ec:"8324","935f2afb":"8581","1be78505":"8714",a146a1e2:"8748",ee3e85c9:"8772",d630c820:"8991","7d827ebb":"9004","2d862f0a":"9146","61730ff7":"9237","3d44375b":"9425","467850cb":"9448",d6cba0fc:"9572","0ae93a6f":"9632"}[e]||e,r.p+r.u(e)},(()=>{var e={5354:0,1869:0};r.f.j=(a,c)=>{var f=r.o(e,a)?e[a]:void 0;if(0!==f)if(f)c.push(f[2]);else if(/^(1869|5354)$/.test(a))e[a]=0;else{var d=new Promise(((c,d)=>f=e[a]=[c,d]));c.push(f[2]=d);var b=r.p+r.u(a),t=new Error;r.l(b,(c=>{if(r.o(e,a)&&(0!==(f=e[a])&&(e[a]=void 0),f)){var d=c&&("load"===c.type?"missing":c.type),b=c&&c.target&&c.target.src;t.message="Loading chunk "+a+" failed.\n("+d+": "+b+")",t.name="ChunkLoadError",t.type=d,t.request=b,f[1](t)}}),"chunk-"+a,a)}},r.O.j=a=>0===e[a];var a=(a,c)=>{var f,d,b=c[0],t=c[1],o=c[2],n=0;if(b.some((a=>0!==e[a]))){for(f in t)r.o(t,f)&&(r.m[f]=t[f]);if(o)var i=o(r)}for(a&&a(c);n Community Projects | PlatON - +

    Community Projects

    Below is a categorized list of projects that use the PlatON blockchain,meet your related development and use tool needs. We welcome more community members to participate and continue to expand the PlatON ecosystem.

    The LatticeX Foundation has now opened the Grants program, and you can contribute your value through Grants.

    Wallets#

    ATON

    ATON is the first secure and user-friendly mobile wallet for PlatON Network.

    Block Explorers#

    PlatScan

    PlatScan is a Block Explorer and Analytics Platform for PlatON.

    Node Tools#

    PlatON MTool

    PlatON's Node Management Tool.

    Developer Forums#

    LatticeX Forum

    PlatON Developer Forums. Need help implementing a solution on PlatON? Want to provide feedback? Check out PlatON’s developer forums.

    Cooperation projects#

    Biteye

    Gateway to Web3 Investing.

    Band

    Band Protocol is a cross-chain data oracle platform that aggregates and connects real-world data and APIs to smart contracts.

    BOXTradEx

    BOXTradEx is a one-stop crypto platform for GameFi, game players, and guilds, providing the Gamefi portal for web3. We support NFT API service, crypto exchange, NFT marketplace, wallet, and Guild DAO tool.

    StoneAeon

    Stone Aeon is a game that happens in the world of Stone Age. The primitive men gather here. All the items and creatures exist based on the NFT of blockchain that is used for digitizing the unique contents. The P2E feature of Stone Aeon will maximize players’ yield while they're having fun in the game. Decentralized game plans guarantee a fair game. Visual effects and features of Stone Aeon are absolutely original.

    Celer

    Celer is a blockchain interoperability protocol enabling a one-click user experience accessing tokens, DeFi, GameFi, NFTs, governance, and more across multiple chains.

    Gitcoin

    Gitcoin is a community for developers to collaborate and monetize their skills while working on Open Source projects through bounties and grants.

    Coin98

    All In One DeFi Platform.

    TofuNFT

    tofuNFT.com is an NFT marketplace focused on GameFi and collectibles, rebranded from SCV’s NFT market.

    UBOX

    The first NFT copyright certification marketplace and MEX(CEX+DEX) in the meta-universe world.

    WinKrypto

    The first post-investment services firm for crypto players in the APAC region.

    NFTScan

    NFTScan is a multi-chain NFT explorer and NFT data infrastructure.

    Double Protocol

    Rental Protocol for Utility NFTs.
    - + \ No newline at end of file diff --git a/en/contributing/index.html b/en/contributing/index.html index 488053b51..97e46f40d 100644 --- a/en/contributing/index.html +++ b/en/contributing/index.html @@ -8,14 +8,14 @@ Contributing to PlatON | PlatON - +

    Contributing to PlatON

    PlatON is an open-source tech community collectively maintained and built by community contributors from around the world.

    There are many ways to contribute to PlatON and bring real changes to the community, regardless of the field or level of your expertise.

    Here are some tasks you can undertake and tips about how you can get started.

    We accept all your contributions, even if what you want to do isn’t listed here. If you’re still unsure, create a GitHub Issue or post on the Forum to seek advice from our community.

    Run a Validator#

    PlatON is currently maintained by 201 validators and will expand to over 1,000 validators in the future.

    Join the PlatON validator network to help maintain our security and further decentralize PlatON.

    More About Running Validators

    Stake Your LAT#

    You can delegate your LAT to a PlatON validator to earn rewards and help protect PlatON.

    More About Staking LAT

    Code Programming#

    PlatON is an open financial infrastructure with privacy-preserving computation at its core. Our vast project requires more than just a few core developers. We look forward to having more community developers help us write and maintain our code. Diving straight into development can be overwhelming; therefore, we introduced the “Help Wanted” tag for functionalities or bug fixes where you can help us. This is the best way for you to start contributing code.

    Check Out Our Repository: https://github.com/PlatONnetwork

    The PlatON community hosts bounty programs and hackathons from time to time. You can follow and participate in our events through the forum to help solve technical issues and earn cryptos!

    Write Documentation#

    As more codes, products, tools, and applications are added to PlatON, we need plenty of concise documents to help users understand and learn. We are looking for more people to help us write clear documents (including video tutorials) needed by PlatON projects or translate documents into your local language.

    The PlatON documentation library is constantly being revised, and contributions are welcome.

    Community Support and Education#

    If you enjoy connecting with people, you can join PlatON’s chat and discussion community. Here, you can build connections with individuals who share your goals, help those in need, and jointly maintain a healthy and orderly community.

    Current channels for communication and discussion primarily include: ,LatticeX Foundation GithubDiscordLatticeX ForumRedditTelegram

    Specific contributions include but are not limited to:

    • Linking repeated questions and organizing problem tags.
    • Articulating open issues to drive discussions.
    • Helping answer questions about the project and responding to public questions. You can also organize meetups or events in your city to seek, train, and support developers and community members interested in PlatON.

    Graphic Design#

    You can tap into your artistic talents and graphic design skills to contribute to the community by designing logos, icons, banners, and other content. Your designs will enhance the project’s experience and aesthetics. You can also contribute to PlatON by designing websites and promotional materials or providing illustrations for our document guides.

    Build Apps/Protocols#

    You can build anything imaginable on PlatON or integrate existing applications with PlatON. Perhaps you will change the world.

    If you’re unsure about something, join the chat and discussion forum to seek help and feedback. You can also apply for LatticeX Foundation’s developer grants (https://latticex.foundation/grants) to support your project.

    Research#

    There remain many unsolved problems in blockchain, privacy-preserving computation, and AI technologies. If you’re interested in a particular technical issue, join the community research group and contribute to PlatON. Your ideas might change the entire technological landscape.

    Feel free to contact us via developer@latticex.foundation and tell us your areas of interest. We’ll help you engage in interesting and valuable work.

    - + \ No newline at end of file diff --git a/en/eip55-bech32-compatible/index.html b/en/eip55-bech32-compatible/index.html index 3f52db648..2301f4de2 100644 --- a/en/eip55-bech32-compatible/index.html +++ b/en/eip55-bech32-compatible/index.html @@ -8,13 +8,13 @@ EIP55 and Bech32 address format compatibility scheme | PlatON - +

    EIP55 and Bech32 address format compatibility scheme

    JSON RPC interface#

    The jsonrpc interface of PlatON node supports EIP55 (0xxxxx...) address and Bech32 (latxxxxx...) Two kinds of address formats, but the parameters and return values when calling a specific interface can only be selected a certain address format, can not be mixed, the use of different address formats are as follows.

    • EIP55 address

      PlatON is fully compatible with the jsonrpc interface of Ethernet. To use the address in EIP55 format, just follow the way of calling Ethernet jsonrpc. Note the following points.

      1. cannot use the interface prefixed with platon_, must be modified to prefix eth_

      2. for interfaces with prefixes other than platon_ and eth_, PlatON adds an optional field bech32, which marks whether the Bech32 address needs to be used, with the default value of EIP55, note that if you want to use the EIP55 format, you cannot take the bech32 field

        curl -X POST --data '{"jsonrpc":"2.0", "method": "txpool_contents", "params": [], "id": 1}'

        The return value is

        {"jsonrpc":"2.0","id":1,"result":["0x407d73d8a49eeb85d32cf465507dd71d507100c1"]}
      3. The address fields in both the input and return values are in EIP55 format

    • Bech32 address

      To use Bech32 addresses, note the following.

      1. you cannot use an interface prefixed with eth_, you must modify it to be prefixed with platon_

      2. for interfaces with prefixes other than platon_ and eth_, PlatON adds an optional field bech32 which marks whether or not a Bech32 address needs to be used, the default value is EIP55, note that if you want to use the Bench32 format, you must bring the bech32 field and set it to true

        curl -X POST --data '{"jsonrpc":"2.0","bech32":true, "method": "txpool_contents", "params": [], "id": 1}'

        The return value is

        {"jsonrpc":"2.0","id":1,"result":["lat1zqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqp7pn3ep"]}
      3. the address fields in both the input and return values are in Bench32 format

    SDK#

    PlatON can be called using the Ethernet SDK and the PlatON SDK, noting the following points.

    1. you can only use the EIP55 address with the Ethernet SDK, not the Bech32 address
    2. Using PlatON SDK can only use Bech32 address at the moment, not EIP55 address

    How DAPP is compatible with EIP55 and Bech32#

    DAPP can achieve business support for both EIP55 and Bech32 addresses through address translation as follows.

    • Use jsonrpc interface

      If the DAPP calls the jsonrpc interface directly, it can choose any of the following methods.

      1. convert the Bech32 address to EIP55 address and call the EIP55 address according to the call method introduced earlier
      2. convert the EIP55 address to Bech32 address, and call the Bech32 address according to the call method described above
    • Using SDK

      If the DAPP uses the SDK to call PlatON, it can choose any of the following methods.

      1. Convert the Bech32 address to an EIP55 address and call it using the Ethernet SDK
      2. Convert EIP55 address to Bech32 address and call with PlatON SDK

    Address conversion method#

    The interconversion between Bech32 addresses and EIP55 addresses is provided in PlatON's SDK, which supports three development languages.

    from platon_utils import to_bech32_address, to_checksum_addressto_bech32_address('0x0000000000000000000000000000000000000001', 'lat')to_checksum_address('lat1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpfr7f80')
    Bech32.addressEncode("lat","0x676c0d9b7da640a25dabd5788612f5faa16cc6b9"));Bech32.addressDecodeHex("lat1vakqmxma5eq2yhdt64ugvyh4l2ske34eay86pg"));
    web3.utils.decodeBech32Address('lat', 'lat1zg69v7yszg69v7yszg69v7yszg69v7y30mluqx');web3.utils.toBech32Address('lat', '0x1234567890123456789012345678901234567891');
    - + \ No newline at end of file diff --git a/en/get_vrf_random_number/index.html b/en/get_vrf_random_number/index.html index 82a39a9a9..028ba5283 100644 --- a/en/get_vrf_random_number/index.html +++ b/en/get_vrf_random_number/index.html @@ -8,7 +8,7 @@ Get a Random Number | PlatON - + @@ -28,7 +28,7 @@ return randomWords; } /** * delegatecall * @param data contract input data * @param addr contract address */ function assemblyCall(bytes memory data, address addr) internal returns (bytes memory) { uint256 len = data.length; uint retsize; bytes memory resval; assembly { let result := delegatecall(gas(), addr, add(data, 0x20), len, 0, 0) retsize := returndatasize() } resval = new bytes(retsize); assembly { returndatacopy(add(resval, 0x20), 0, returndatasize()) } return resval; } function sliceUint(bytes memory bs, uint start) internal pure returns (uint256) { require(bs.length >= start + 32, "slicing out of range"); uint256 x; assembly { x := mload(add(bs, add(0x20, start))) } return x; }} - + \ No newline at end of file diff --git a/en/index.html b/en/index.html index d9cd3d243..768243b3a 100644 --- a/en/index.html +++ b/en/index.html @@ -8,13 +8,13 @@ Overview | PlatON - +

    Overview

    We shall always keep to the upper road and practice justice with prudence in every way.』 —— Plato

    Welcome to the PlatON documentation library. This document is designed to help different users understand PlatON from different perspectives and use PlatON.

    What is PlatON?#

    PlatON was initiated and promoted by the LatticeX Foundation. Based on the basic properties of the blockchain and supported by a privacy-preserving computing network, PlatON provides the next-generation Internet basic protocol featuring "computing interoperability". It builds a computing system jointly assembled by cryptographic algorithms such as verifiable computing, secure multi-party computing, zero-knowledge proof, homomorphic encryption, and blockchain technology to provide public infrastructure under an open-source architecture for global artificial intelligence, distributed application developers, data providers as well as various institutions, communities and individuals with computing needs.

    Basics#

    Advanced#

    • Architecture - Here you can learn about the overall architecture design of PlatON as a privacy computing infrastructure, and the introduction of related core modules.
    • Economic Model - Here you can learn about PlatON economic model design principles and specific economic model solutions.
    • Governance Mechanism - Here you can learn how to launch a proposal on PlatON, and the voting mechanism of the proposal.
    • Consensus Mechanism-Detailed introduction to PlatON consensus mechanism
    • WebAssembly - Introduces why PlatON introduced the WASM virtual machine, its mechanism, advantages and how to use it.

    Join us#

    Node#

    If you want to join the PlatON network as a node, the following documents can give you some help.

    • Intro to validator - Here you can learn what is a validation node, how to become a validation node, the benefits and responsibilities of a validation node, etc.
    • Run a validator node - How to deploy nodes and how to pledge to join PlatON's main network.
    • Node Tools - You can use the following tools to assist you with node management.

    Developers#

    General users#

    - + \ No newline at end of file diff --git a/en/lat_introduced/index.html b/en/lat_introduced/index.html index 64d13eda4..45b42a056 100644 --- a/en/lat_introduced/index.html +++ b/en/lat_introduced/index.html @@ -8,14 +8,14 @@ Intro to LAT | PlatON - +

    Intro to LAT

    What is LAT ? How to get LAT?#

    LAT is the native token of PlatON Network. It is a digital currency. You can transfer it through the PlatON network or use applications built on PlatON with LATs.

    Currently, you can obtain LAT by participating in the Grants Program supported by the LatticeX Foundation, Or you can follow up other community development programs to obtain LAT.

    What's unique about LAT?#

    LAT fuels and secures PlatON

    When you transfer LAT or use a PlatON application, you need to pay a small LAT as fee. The fee is used to incentivizes the node to process and verify your transaction.

    In the PPOS mechanism, LAT is of great importance to the network. With LAT, one can delegate to validators or become a validator by staking themselves, which help maintain PlatON network security. Both the validators and delegators can get LAT rewards. More about PlatON validators.

    If you want to know more about the economic mechanism of LAT, click for more inforamtion.

    LAT acts as medium of data trading market

    As a payment medium, LATs are used to settle trades in the PlatON market for data and computing power. Participants in the PlatON computation network earn LATs by providing data usage, computing power, and algorithms.

    LAT supports the development of PlatON DApp ecology

    PlatON will further support the development of DApps and DeFi and introduce economic coupling designs for DApps and DeFi. For example, DApps can issue their own tokens which must be backed by LAT reserves. PlatON will also support the development of stable coins collateralized by LAT.

    How to manage LAT?#

    PlatON Wallet is an application for users to manage LAT asstes and interact with PlatON DApps. Users can easily hold or transfer LAT through the wallet.

    Get a PlatON wallet

    • ATON - Mobile app wallet designed for iOS and Android platforms

    • Samurai - Web browser plugin wallet

    • Cobo - Mobile app wallet supporting multiple public chains

    Note: The above information is only a summary of resources and it does not mean that we are responsible for the security of the wallet.。

    keeping your LAT safe

    PlatON and LAT aren't controlled by any organizatio - they are decentralized. Therefore,LAT is open to everyone to use, which also means that you need to take the security of your funds seriously.

    • Responsible for your own funds

    Centralized exchanges will link your wallet to a username and password that you can recover in a traditional way. You need to choose a trustworthy and safe exchange. If that exchange is attacked or folds, down, your funds are at risk.

    • Backup mnemonic & private key

    Wallets will often give you a seed phrase or private key that you must write down somewhere safe. This is the only way you’ll be able to recover your wallet.

    Examples of mnemonic words:

    enlist goriia raw juice disagree toy kite tube behave video unusual may

    Don’t store it on a computer. Write it down and keep it safe.

    • Check everything carefully

    Please keep in mind that once a transaction is done, it cannot be reversed. a lost wallet cannot be easily retrieved. You cannot be too cautious.

    Want to learn more about wallet security?

    Where to browse LAT transactions?#

    With the growth of network utilization, there will be more and more valuable information in the data on the chain. The block explorer can provide you with real-time data of browsing blocks, transactions, accounts, nodes and other activities on the chain.

    • PlatScan - PlatON blockchain explorer and analysis platform, available in English and Chinese.
    - + \ No newline at end of file diff --git a/en/qianqian_prc721_tutorial/index.html b/en/qianqian_prc721_tutorial/index.html index 0acae9863..95d4a46f5 100644 --- a/en/qianqian_prc721_tutorial/index.html +++ b/en/qianqian_prc721_tutorial/index.html @@ -8,7 +8,7 @@ PRC721 NFT Release Tutorial | PlatON - + @@ -29,7 +29,7 @@ Token abbreviation: please fill in the corresponding abbreviation (short name)


    With all this preparation done, let's start making bla!

    Compile NFT_example contract [here is Ali cloud server oh]#

    Step1. Create a new directory for the NFT_example project#

    mkdir NFT_example && cd NFT_example
    • The following commands are carried out in the NFT_example directory if not otherwise specified

    Step2. Initialise a project with platon-truffle#

    platon-truffle init

    Once the operation has been completed, the following project structure will appear.

    • contracts : Contracts directory
    • migrations: directory of script files for deploying contracts
    • test: directory of test scripts
    • truffle-config.js : the platon-truffle configuration file

    Step3. Place all previously written NFT_example contracts in the NFT_example /contracts/ directory and archive the file directory#

    Step4. Modify the platon-truffle configuration file, truffle-config.js, to include the following changes.#

    networks: {    development: {      host: "35.247.155.162",     // Localhost (default: none)      port: 6789,            // Standard Ethereum port (default: none)      network_id: "*",       // Any network (default: none)      from: "lat1ex4ue95ap7tjcrxqnfjp8j479nn0927vuug2l7",        // Account to send txs from (default: accounts[0])    },},compilers: {    solc: {      version: "0.5.17",    // Fetch exact version from solc-bin (default: 0.6.12)      // docker: true,        // Use "0.5.1" you've installed locally with docker (default: false)      settings: {          // See the solidity docs for advice about optimization and evmVersion        optimizer: {          enabled: true,          runs: 200        },      //  evmVersion: "byzantium"      }    }  }
     

    Step5. Compilation contracts#

    platon-truffle compile

    Once compiled, a build folder will appear with a contracts folder inside as shown below.

    image|251x500

    [The json file in the red box will be used later].

    Deploying the NFT_example contract#

    Step1. New contract deployment script file#

    cd migrations/ && touch 2_initial_migration.js

    It reads as follows.

    const NFT_example = artifacts.require("NFT_example"); //括号中为迁移合约类名module.exports = function(deployer) {    deployer.deploy(NFT_example); };  

    Step2. Unlock your wallet account#

    Access to the platon-truffle console

    platon-truffle console

    Import the private key (if it has already been imported then you can skip this step)

    web3.platon.personal.importRawKey("Your wallet private key", "Your wallet password");

    Unlock your wallet account

     web3.platon.personal.unlockAccount('your wallet address','your wallet password',99999999);

    A successful unlock will return true.

    Step3. Deployment contracts#

    platon-truffle migrate

    After successful deployment, you will see a message containing your contract address contract address, which you will need to save for later.

    Calling the NFT_example contract#

    Step1. Access to the platon-truffle console#

    platon-truffle console

    Step2. Constructing contract objects#

    var abi = [{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"MinterAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"MinterRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"PauserRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"addMinter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isPauser","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"mint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"tokenURI","type":"string"}],"name":"mintWithTokenURI","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceMinter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeMint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeMint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]; //can be obtained from the HelloWorld/build/contracts/HelloWorld.json file
     var contractAddr = 'lat152f3ve4l6ly44k5v98e3lvfps6dfqeeshwpsht';//Addresses obtained when deploying the contractvar nftExample = new web3.platon.Contract(abi,contractAddr);

    Here's where abi comes from, remember the NFT_example.json I circled in red earlier? The abi file is in there.

    Step3. Calling the contract#

    nftExample.methods.mintWithTokenURI("Your test wallet address",1,'ipfs uri').send({from: 'Your test wallet address',gasPrice: '0x' + parseInt(80000000000).toString(16), gas: '0x' + parseInt(4999999).toString(16), value: '0x' + (0).toString(16)}).on('receipt', function(receipt) {console.log(receipt);}).on('error', console.error);

    As a note, the second parameter 1 indicates that the token number is 1, followed by ipfs uri in this post "Uploading Matedata to IPFS Networks"

    As for how to get online on the mainnet, you just need to find a node or deploy a mainnet node yourself and change the host of truffle-config.js to the corresponding ip.

    This tutorial was contributed by @LeQianQian

    - + \ No newline at end of file diff --git a/en/search/index.html b/en/search/index.html index ea841a7bc..ac9775b4a 100644 --- a/en/search/index.html +++ b/en/search/index.html @@ -8,13 +8,13 @@ Search the documentation | PlatON - + - + \ No newline at end of file diff --git a/en/staking_and_delegation/index.html b/en/staking_and_delegation/index.html index 0400f3ce3..44662a6b8 100644 --- a/en/staking_and_delegation/index.html +++ b/en/staking_and_delegation/index.html @@ -8,13 +8,13 @@ Staking&Delegation | PlatON - +

    Staking&Delegation

    What is staking?#

    In PlatON's network, pledge is the act of nodes joining to PlatON network by locking a certain amount of LAT. PlatON uses PPoS consensus mechanism to select validation nodes, and the nodes joining to PlatON network will be ranked according to the pledged The number of LATs will be ranked, and each round of consensus will randomly select 43 nodes from the top 201 nodes in the ranking to pack out blocks as validation nodes.

    What is a delegation?#

    Delegation is the act of LAT holders delegating LAT to nodes to indirectly participate in the network co-build. Delegation can not only improve the security of the network, but also bring revenue to the delegator.

    How to staking?#

    You can quickly initiate a staking operation using the Mtool tool, please refer to here.

    How to delegate?#

    Delegation can be done simply by using ATON wallet, please refer to here for details.

    Why become a delegator?#

    Staking is the core feature of the PlatON network. The larger the percentage of LAT involved in staking and delegating, the higher the security of PlatON network.

    Whether a validator can be selected as an active validator mainly depends on the amount of total staking, which is composed of the staking of LAT of the validator itself and the LAT delegated to it. Alternative Validator Candidates ranking top 201 can become alternative validators.

    The delegating is similar to an election in that we exercise our voting right by delegating, so as to fulfill our common expectation of electing the candidate contributing the most to the development of the network to become the validator. The participation of more delegators can prevent validators from misconduct and promote the healthy and sustainable development of PlatON ecosystem and the continuous increase of PlatON value.

    How to choose a validator worth delegating?#

    Based on the information provided by the ATON Wallet, you can examine a validator from the following aspects:

    • Ranking: the higher the ranking of a validator, the higher the chance of it becoming a validator producing blocks in the consensus round.
    • Expected annualized rate of yield: the yield of delegation can be estimated with the expected annualized rate of yield, which can be calculated by the yield per share of the delegation in the recent 4 Epochs.
    • Delegating reward ratio: the ratio of the rewards allocated to the delegators. The higher the ratio, the higher the total rewards earned by all delegators.
    • Delegation received: the total amount of delegated LAT received by the current validator. The higher percentage of the delegated LAT, the higher the rewards allocated to individuals from the total rewards received by all delegators.
    • Penalty count: validators with low block producing rate or malicious dual-signing will be penalized, and the more validators are penalized, the less trustworthy they are.
    • Community reputation: validators with good reputations and prestige in the community can be trusted and delegated.

    When does the delegation take effect and when can I get rewards after delegation?#

    Delegated LAT does not become effective (i.e., being locked) until the next Epoch.

    When the effective delegation is fully locked for an Epoch and the delegated validator is rewarded in the Epoch, the delegating reward is available in that settlement block.

    If the delegated validator is revoked, all delegating under that validator will be invalidated and there will be no delegating rewards for this Epoch and subsequent Epochs.

    How are delegating rewards calculated?#

    Rewards can be received when a validator becomes an active validator and participates in block production. The rewards are composed of staking rewards and block-producing rewards and are allocated to delegators in accordance with the delegating reward ratio.

    If a validator has a delegating reward ratio of 10% and receives a block-producing reward of 1000LAT and a staking reward of 2000 LAT for a certain period of time, rewards participating in allocation would be 3000 LAT.

    Total reward for all delegators: 1000 * 10%+2000*10% = 300 LAT

    Each delegator gets a reward based on the ratio of its valid delegation to the total valid delegation of the validator.

    Suppose a delegator has a total delegation of 1000 LAT and there are a total of 5000 LAT delegation on the validator,

    then the reward that the delegator can get is 1000/5000*300=60 LAT.

    - + \ No newline at end of file diff --git a/en/walletconnect_tutorial/index.html b/en/walletconnect_tutorial/index.html index 8f8ff93ee..2665e41a8 100644 --- a/en/walletconnect_tutorial/index.html +++ b/en/walletconnect_tutorial/index.html @@ -8,7 +8,7 @@ WalletConnect Example | PlatON - + @@ -21,7 +21,7 @@ connector.on("disconnect", (error, payload) => { if (error) { throw error; }}); // For the calling method, please refer to: https://docs.walletconnect.com/1.0/client-api// Example of how to send a transactionconnector.sendTransaction({ data: "0x", from: "0xc115ceadf9e5923330e5f42903fe7f926dda65d2", gasLimit: "0x5208", gasPrice: "0x746a528800", nonce: "0x12", to: "0xc115ceadf9e5923330e5f42903fe7f926dda65d2", value: "0x00"}).then(txHash => { // hash If the transaction is sent successfully, the wallet will return the transaction hash console.log('txHash: ', txHash)}) - + \ No newline at end of file diff --git a/get_vrf_random_number/index.html b/get_vrf_random_number/index.html index 1f99f6461..fae7be556 100644 --- a/get_vrf_random_number/index.html +++ b/get_vrf_random_number/index.html @@ -8,7 +8,7 @@ Get a Random Number | PlatON - + @@ -28,7 +28,7 @@ return randomWords; } /** * delegatecall * @param data contract input data * @param addr contract address */ function assemblyCall(bytes memory data, address addr) internal returns (bytes memory) { uint256 len = data.length; uint retsize; bytes memory resval; assembly { let result := delegatecall(gas(), addr, add(data, 0x20), len, 0, 0) retsize := returndatasize() } resval = new bytes(retsize); assembly { returndatacopy(add(resval, 0x20), 0, returndatasize()) } return resval; } function sliceUint(bytes memory bs, uint start) internal pure returns (uint256) { require(bs.length >= start + 32, "slicing out of range"); uint256 x; assembly { x := mload(add(bs, add(0x20, start))) } return x; }} - + \ No newline at end of file diff --git a/index.html b/index.html index 63656a2ec..ce8c84900 100644 --- a/index.html +++ b/index.html @@ -8,13 +8,13 @@ Overview | PlatON - +

    Overview

    We shall always keep to the upper road and practice justice with prudence in every way.』 —— Plato

    Welcome to the PlatON documentation library. This document is designed to help different users understand PlatON from different perspectives and use PlatON.

    What is PlatON?#

    PlatON was initiated and promoted by the LatticeX Foundation. Based on the basic properties of the blockchain and supported by a privacy-preserving computing network, PlatON provides the next-generation Internet basic protocol featuring "computing interoperability". It builds a computing system jointly assembled by cryptographic algorithms such as verifiable computing, secure multi-party computing, zero-knowledge proof, homomorphic encryption, and blockchain technology to provide public infrastructure under an open-source architecture for global artificial intelligence, distributed application developers, data providers as well as various institutions, communities and individuals with computing needs.

    Basics#

    Advanced#

    • Architecture - Here you can learn about the overall architecture design of PlatON as a privacy computing infrastructure, and the introduction of related core modules.
    • Economic Model - Here you can learn about PlatON economic model design principles and specific economic model solutions.
    • Governance Mechanism - Here you can learn how to launch a proposal on PlatON, and the voting mechanism of the proposal.
    • Consensus Mechanism-Detailed introduction to PlatON consensus mechanism
    • WebAssembly - Introduces why PlatON introduced the WASM virtual machine, its mechanism, advantages and how to use it.

    Join us#

    Node#

    If you want to join the PlatON network as a node, the following documents can give you some help.

    • Intro to validator - Here you can learn what is a validation node, how to become a validation node, the benefits and responsibilities of a validation node, etc.
    • Run a validator node - How to deploy nodes and how to pledge to join PlatON's main network.
    • Node Tools - You can use the following tools to assist you with node management.

    Developers#

    General users#

    - + \ No newline at end of file diff --git a/lat_introduced/index.html b/lat_introduced/index.html index 305caaa41..9efc8587c 100644 --- a/lat_introduced/index.html +++ b/lat_introduced/index.html @@ -8,14 +8,14 @@ Intro to LAT | PlatON - +

    Intro to LAT

    What is LAT ? How to get LAT?#

    LAT is the native token of PlatON Network. It is a digital currency. You can transfer it through the PlatON network or use applications built on PlatON with LATs.

    Currently, you can obtain LAT by participating in the Grants Program supported by the LatticeX Foundation, Or you can follow up other community development programs to obtain LAT.

    What's unique about LAT?#

    LAT fuels and secures PlatON

    When you transfer LAT or use a PlatON application, you need to pay a small LAT as fee. The fee is used to incentivizes the node to process and verify your transaction.

    In the PPOS mechanism, LAT is of great importance to the network. With LAT, one can delegate to validators or become a validator by staking themselves, which help maintain PlatON network security. Both the validators and delegators can get LAT rewards. More about PlatON validators.

    If you want to know more about the economic mechanism of LAT, click for more inforamtion.

    LAT acts as medium of data trading market

    As a payment medium, LATs are used to settle trades in the PlatON market for data and computing power. Participants in the PlatON computation network earn LATs by providing data usage, computing power, and algorithms.

    LAT supports the development of PlatON DApp ecology

    PlatON will further support the development of DApps and DeFi and introduce economic coupling designs for DApps and DeFi. For example, DApps can issue their own tokens which must be backed by LAT reserves. PlatON will also support the development of stable coins collateralized by LAT.

    How to manage LAT?#

    PlatON Wallet is an application for users to manage LAT asstes and interact with PlatON DApps. Users can easily hold or transfer LAT through the wallet.

    Get a PlatON wallet

    • ATON - Mobile app wallet designed for iOS and Android platforms

    • Samurai - Web browser plugin wallet

    • Cobo - Mobile app wallet supporting multiple public chains

    Note: The above information is only a summary of resources and it does not mean that we are responsible for the security of the wallet.。

    keeping your LAT safe

    PlatON and LAT aren't controlled by any organizatio - they are decentralized. Therefore,LAT is open to everyone to use, which also means that you need to take the security of your funds seriously.

    • Responsible for your own funds

    Centralized exchanges will link your wallet to a username and password that you can recover in a traditional way. You need to choose a trustworthy and safe exchange. If that exchange is attacked or folds, down, your funds are at risk.

    • Backup mnemonic & private key

    Wallets will often give you a seed phrase or private key that you must write down somewhere safe. This is the only way you’ll be able to recover your wallet.

    Examples of mnemonic words:

    enlist goriia raw juice disagree toy kite tube behave video unusual may

    Don’t store it on a computer. Write it down and keep it safe.

    • Check everything carefully

    Please keep in mind that once a transaction is done, it cannot be reversed. a lost wallet cannot be easily retrieved. You cannot be too cautious.

    Want to learn more about wallet security?

    Where to browse LAT transactions?#

    With the growth of network utilization, there will be more and more valuable information in the data on the chain. The block explorer can provide you with real-time data of browsing blocks, transactions, accounts, nodes and other activities on the chain.

    • PlatScan - PlatON blockchain explorer and analysis platform, available in English and Chinese.
    - + \ No newline at end of file diff --git a/qianqian_prc721_tutorial/index.html b/qianqian_prc721_tutorial/index.html index 7d7e18e9f..4a5fea02a 100644 --- a/qianqian_prc721_tutorial/index.html +++ b/qianqian_prc721_tutorial/index.html @@ -8,7 +8,7 @@ PRC721 NFT Release Tutorial | PlatON - + @@ -29,7 +29,7 @@ Token abbreviation: please fill in the corresponding abbreviation (short name)


    With all this preparation done, let's start making bla!

    Compile NFT_example contract [here is Ali cloud server oh]#

    Step1. Create a new directory for the NFT_example project#

    mkdir NFT_example && cd NFT_example
    • The following commands are carried out in the NFT_example directory if not otherwise specified

    Step2. Initialise a project with platon-truffle#

    platon-truffle init

    Once the operation has been completed, the following project structure will appear.

    • contracts : Contracts directory
    • migrations: directory of script files for deploying contracts
    • test: directory of test scripts
    • truffle-config.js : the platon-truffle configuration file

    Step3. Place all previously written NFT_example contracts in the NFT_example /contracts/ directory and archive the file directory#

    Step4. Modify the platon-truffle configuration file, truffle-config.js, to include the following changes.#

    networks: {    development: {      host: "35.247.155.162",     // Localhost (default: none)      port: 6789,            // Standard Ethereum port (default: none)      network_id: "*",       // Any network (default: none)      from: "lat1ex4ue95ap7tjcrxqnfjp8j479nn0927vuug2l7",        // Account to send txs from (default: accounts[0])    },},compilers: {    solc: {      version: "0.5.17",    // Fetch exact version from solc-bin (default: 0.6.12)      // docker: true,        // Use "0.5.1" you've installed locally with docker (default: false)      settings: {          // See the solidity docs for advice about optimization and evmVersion        optimizer: {          enabled: true,          runs: 200        },      //  evmVersion: "byzantium"      }    }  }
     

    Step5. Compilation contracts#

    platon-truffle compile

    Once compiled, a build folder will appear with a contracts folder inside as shown below.

    image|251x500

    [The json file in the red box will be used later].

    Deploying the NFT_example contract#

    Step1. New contract deployment script file#

    cd migrations/ && touch 2_initial_migration.js

    It reads as follows.

    const NFT_example = artifacts.require("NFT_example"); //括号中为迁移合约类名module.exports = function(deployer) {    deployer.deploy(NFT_example); };  

    Step2. Unlock your wallet account#

    Access to the platon-truffle console

    platon-truffle console

    Import the private key (if it has already been imported then you can skip this step)

    web3.platon.personal.importRawKey("Your wallet private key", "Your wallet password");

    Unlock your wallet account

     web3.platon.personal.unlockAccount('your wallet address','your wallet password',99999999);

    A successful unlock will return true.

    Step3. Deployment contracts#

    platon-truffle migrate

    After successful deployment, you will see a message containing your contract address contract address, which you will need to save for later.

    Calling the NFT_example contract#

    Step1. Access to the platon-truffle console#

    platon-truffle console

    Step2. Constructing contract objects#

    var abi = [{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"MinterAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"MinterRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"}],"name":"PauserRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"addMinter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"addPauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isMinter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isPauser","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"mint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"tokenURI","type":"string"}],"name":"mintWithTokenURI","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceMinter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renouncePauser","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeMint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeMint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]; //can be obtained from the HelloWorld/build/contracts/HelloWorld.json file
     var contractAddr = 'lat152f3ve4l6ly44k5v98e3lvfps6dfqeeshwpsht';//Addresses obtained when deploying the contractvar nftExample = new web3.platon.Contract(abi,contractAddr);

    Here's where abi comes from, remember the NFT_example.json I circled in red earlier? The abi file is in there.

    Step3. Calling the contract#

    nftExample.methods.mintWithTokenURI("Your test wallet address",1,'ipfs uri').send({from: 'Your test wallet address',gasPrice: '0x' + parseInt(80000000000).toString(16), gas: '0x' + parseInt(4999999).toString(16), value: '0x' + (0).toString(16)}).on('receipt', function(receipt) {console.log(receipt);}).on('error', console.error);

    As a note, the second parameter 1 indicates that the token number is 1, followed by ipfs uri in this post "Uploading Matedata to IPFS Networks"

    As for how to get online on the mainnet, you just need to find a node or deploy a mainnet node yourself and change the host of truffle-config.js to the corresponding ip.

    This tutorial was contributed by @LeQianQian

    - + \ No newline at end of file diff --git a/search/index.html b/search/index.html index 32d0326b7..e6dff43b6 100644 --- a/search/index.html +++ b/search/index.html @@ -8,13 +8,13 @@ Search the documentation | PlatON - + - + \ No newline at end of file diff --git a/staking_and_delegation/index.html b/staking_and_delegation/index.html index efdae1798..47f5d1c2a 100644 --- a/staking_and_delegation/index.html +++ b/staking_and_delegation/index.html @@ -8,13 +8,13 @@ Staking&Delegation | PlatON - +

    Staking&Delegation

    What is staking?#

    In PlatON's network, pledge is the act of nodes joining to PlatON network by locking a certain amount of LAT. PlatON uses PPoS consensus mechanism to select validation nodes, and the nodes joining to PlatON network will be ranked according to the pledged The number of LATs will be ranked, and each round of consensus will randomly select 43 nodes from the top 201 nodes in the ranking to pack out blocks as validation nodes.

    What is a delegation?#

    Delegation is the act of LAT holders delegating LAT to nodes to indirectly participate in the network co-build. Delegation can not only improve the security of the network, but also bring revenue to the delegator.

    How to staking?#

    You can quickly initiate a staking operation using the Mtool tool, please refer to here.

    How to delegate?#

    Delegation can be done simply by using ATON wallet, please refer to here for details.

    Why become a delegator?#

    Staking is the core feature of the PlatON network. The larger the percentage of LAT involved in staking and delegating, the higher the security of PlatON network.

    Whether a validator can be selected as an active validator mainly depends on the amount of total staking, which is composed of the staking of LAT of the validator itself and the LAT delegated to it. Alternative Validator Candidates ranking top 201 can become alternative validators.

    The delegating is similar to an election in that we exercise our voting right by delegating, so as to fulfill our common expectation of electing the candidate contributing the most to the development of the network to become the validator. The participation of more delegators can prevent validators from misconduct and promote the healthy and sustainable development of PlatON ecosystem and the continuous increase of PlatON value.

    How to choose a validator worth delegating?#

    Based on the information provided by the ATON Wallet, you can examine a validator from the following aspects:

    • Ranking: the higher the ranking of a validator, the higher the chance of it becoming a validator producing blocks in the consensus round.
    • Expected annualized rate of yield: the yield of delegation can be estimated with the expected annualized rate of yield, which can be calculated by the yield per share of the delegation in the recent 4 Epochs.
    • Delegating reward ratio: the ratio of the rewards allocated to the delegators. The higher the ratio, the higher the total rewards earned by all delegators.
    • Delegation received: the total amount of delegated LAT received by the current validator. The higher percentage of the delegated LAT, the higher the rewards allocated to individuals from the total rewards received by all delegators.
    • Penalty count: validators with low block producing rate or malicious dual-signing will be penalized, and the more validators are penalized, the less trustworthy they are.
    • Community reputation: validators with good reputations and prestige in the community can be trusted and delegated.

    When does the delegation take effect and when can I get rewards after delegation?#

    Delegated LAT does not become effective (i.e., being locked) until the next Epoch.

    When the effective delegation is fully locked for an Epoch and the delegated validator is rewarded in the Epoch, the delegating reward is available in that settlement block.

    If the delegated validator is revoked, all delegating under that validator will be invalidated and there will be no delegating rewards for this Epoch and subsequent Epochs.

    How are delegating rewards calculated?#

    Rewards can be received when a validator becomes an active validator and participates in block production. The rewards are composed of staking rewards and block-producing rewards and are allocated to delegators in accordance with the delegating reward ratio.

    If a validator has a delegating reward ratio of 10% and receives a block-producing reward of 1000LAT and a staking reward of 2000 LAT for a certain period of time, rewards participating in allocation would be 3000 LAT.

    Total reward for all delegators: 1000 * 10%+2000*10% = 300 LAT

    Each delegator gets a reward based on the ratio of its valid delegation to the total valid delegation of the validator.

    Suppose a delegator has a total delegation of 1000 LAT and there are a total of 5000 LAT delegation on the validator,

    then the reward that the delegator can get is 1000/5000*300=60 LAT.

    - + \ No newline at end of file diff --git a/walletconnect_tutorial/index.html b/walletconnect_tutorial/index.html index 537b798d9..a53f2663f 100644 --- a/walletconnect_tutorial/index.html +++ b/walletconnect_tutorial/index.html @@ -8,7 +8,7 @@ WalletConnect Example | PlatON - + @@ -21,7 +21,7 @@ connector.on("disconnect", (error, payload) => { if (error) { throw error; }}); // For the calling method, please refer to: https://docs.walletconnect.com/1.0/client-api// Example of how to send a transactionconnector.sendTransaction({ data: "0x", from: "0xc115ceadf9e5923330e5f42903fe7f926dda65d2", gasLimit: "0x5208", gasPrice: "0x746a528800", nonce: "0x12", to: "0xc115ceadf9e5923330e5f42903fe7f926dda65d2", value: "0x00"}).then(txHash => { // hash If the transaction is sent successfully, the wallet will return the transaction hash console.log('txHash: ', txHash)}) - + \ No newline at end of file