Lecture 1 Installing and using Conflux-Portal
The form of blockchain application is mainly webpage end, DAPP end for most scenarios, as well as a small number of server-side scenarios. This lesson will teach you how to create a wallet on the Conflux public chain in Google Chrome. We need to download the plug-in, install the plug-in, through the mnemonic to create a wallet, and then get your personal wallet process.
Download the plugin
Conflux-portal download address: github.com/Conflux-Cha…
2. After opening the address, the page for downloading the address looks like the following picture:
You will notice that the highest available version of this tutorial is 0.2.2, so I will show you how to install and use the Conflux-portal-Chrome-0.2.2.zip plug-in wallet.
3. Click conflux-portal-chrome-0.2.2.zip to download the Google Chrome add-on version.
4. After downloading it, you can put it anywhere on your computer. It is not recommended to put it on your system disk.
2. Install plug-ins
1. We will decompress the compressed package (friendly tips: Conflux-portal-chrome-0.2.2: conflux-portal-chrome-0.2.2: Conflux-portal-chrome-0.2.2: Conflux-portal-chrome-0.2.2 Open the extension panel as shown in the following figure:
2. Your extension panel may not be in Developer mode, so you need to open developer mode and click the button next to developer mode.
3. After opening the panel, there will be columns such as “Load uncompressed extension”, so we continue to click this column
4. Find the directory we extracted and click OK. The installation is complete.
5. After the completion of the above steps, the page as shown in the figure will automatically jump to indicate that we have successfully installed the plug-in and can use it, as shown in the figure:
Create a wallet
1. Then click “Start using” in the above steps to enter the Conflux-Portal page, as shown in the picture:
2. There are two options in the figure above, we can import the wallet we have created previously, or we can create a new wallet. I believe that most of the friends reading this tutorial do not have their own wallet, I will first create a wallet, in the import wallet, the way to explain, have a wallet friends can directly jump into the import wallet tutorial. Creating a wallet will jump to the page below, so don’t hesitate to just say ‘I agree’. As shown in figure:
4, click agree will enter the following page, here we have to enter the password twice, and check the agreement button, be sure to remember your password, otherwise lost, but can not find back. As shown in figure:
5, click “create” jump to the mnemonic page, the mnemonic must remember, remember which small book. As shown in figure:
6, click show secret language, write it down, this tutorial is used to create a wallet, so the release of the mnemonic also doesn’t matter, everyone’s mnemonic do not leak, or your wallet to be careful.
able peanut rate myself menu funny logic focus hedgehog arrest real box
Copy the code
7, the next step is to complete the mnemonic into the confirmation page, this step is really redundant, I do not like, but there is no way, who call we are users, fill in. As shown in figure:
8, after entering the correct order, it is created successfully, as shown in the figure below:
9. Click ‘Complete’ to enter the wallet page. As shown in figure:
It is not very simple to have a wallet of your own. Friends can move their hands to make a wallet of their own. This is the tutorial public address x12ea0fa7d2acaa4ef52ee7650bd16f56d60b51dc “0” the public key can be show anyone. The key address must be well received.
Import the wallet
Once we have created the wallet, we must remember the mnemonic and password so that we can log in to any app that can use the mnemonic. Let’s use the wallet created in this tutorial to demonstrate how to import a wallet.
1. There are two import portals of plug-in wallet: one is just after the installation, and the other is the corner icon of the program that can be imported through the plug-in. We import in the corner icon way first.
2. Click the “Use account mnemonic import” to enter the following page, as shown in the picture:
3, we use the above mnemonic, fill in, password re-enter can also, can also use our previous password, it is ok. After filling in, we click restore, and we will find that we have entered the page after successfully creating above.
4, isn’t it amazing, “0 x12ea0fa7d2acaa4ef52ee7650bd16f56d60b51dc” get public address is the same.
Five, password unlock
I believe many partners have a doubt that the password we set up above is what to use, right! In fact, this password is used by the browser you are using this time. For example, if you close the browser and open it, you will be asked to enter the password to unlock it, as shown in the picture:
We can enter the password we entered above and unlock it. If you forget your password, you’ll use the mnemonic to retrieve your wallet and reset your password. Repeat step 4 above.
Module 2 js-conflux-SDK call
1. Check the Conflux-portal plug-in
async function checkConflux() {
if (window.conflux === 'undefined') {
if(confirm('Detecting that the Conflux Wallet plug-in is not installed in your browser, click OK to download. \n\n Note: If there is no redirect to see if it is blocked by the browser ')){
window.open("https://github.com/Conflux-Chain/conflux-portal/releases")
}
var body = document.getElementById("body");
body.innerHTML = "This site need to install the plug-in conflux purse, please < a href =" https://github.com/Conflux-Chain/conflux-portal/releases "> to download < / a > conflux wallet plug-in";
return false;
}
accounts = await conflux.enable();
return true;
}
Copy the code
2. Get a contract
var contract;
function buildContract() {
contract = confluxJS.Contract({
abi: abiJson,
address: "0x8067244e0b629610eb24cc9da4fe8b023fc02fd9"}); }Copy the code
3, call
let result = await contract.likeSupply();
console.log(result.toString());
Copy the code
4. Send call
await contract.startUp()
.sendTransaction({ from: accounts[0] })
.confirmed();
Copy the code
The project address
Project address link