[A big pit, continuously updated] Create a Tai'an chain account, Tai'an chain project and generate public and private keys in the blockchain of Fanwai

Tip: After the article is written, the table of contents can be automatically generated. How to generate it can refer to the help document on the right


foreword

提示:这里可以添加本文要记录的大概内容:

I first learned about BSN because of the BSN developer contest. If you want to try to develop or learn blockchain-related knowledge, I think it is a good entry platform.
Take a look at its introduction:

Blockchain Service Network BSN ("Service Network" or "BSN") provides developers with one-stop blockchain development, deployment and operating environment services, integrating major cloud service providers, framework providers and multiple Portal resources. Because it involves many aspects such as programming development, resource configuration, application deployment, gateway calling, and key certificates, the official BSN portal (bsnbase.com) has prepared a help manual for developers (http://kb.bsnbase.com /webdoc/view/Pub4028813e705bf9760170a92185bd1277.html), to help developers master the skills of using BSN, so that they can use BSN as the preferred tool for blockchain development and deployment.

For more content, you can go to his website to explore~, here is the Tai'an chain in the open alliance chain provided by BSN .

The Open Consortium Chain is a one-stop blockchain service operating environment for deploying and running various blockchain applications. Compared with traditional alliance chain services, open alliance chain applications share bookkeeping node resources, smart contracts of different applications can be seen and called each other, and share blockchain data ledgers; off-chain business systems can be easily and quickly connected through node gateways. into the blockchain network for transaction processing.
At present, the BSN open alliance chain has launched Wenchang Chain (based on IRITA), Taian Chain (based on FISCO BCOS), Wuhan Chain (based on Ethereum), Tangshan Chain (based on DBChain), Guangyuan Chain (based on Everscale) and China Mobile Chain (based on EOS) , BSN will continue to integrate more underlying frameworks in the future. We welcome your use and valuable comments and suggestions.

At present, except Guangyuan Chain which supports key escrow (this mode is suitable for developers who don’t want to write too much code), all other open consortium chains can only create chain accounts by uploading public documents and uploading account addresses. Before creating a Guangyuan Chain account, attention should be paid to creating Guangyuan Chain projects and deploying smart contracts in advance .


1. Create a Taian chain account

Select chain account management
insert image description here
Click Create Account on the right of the picture

insert image description here
Take a name and select the "upload public key" mode. At present, bsn has canceled the key escrow mode of Tai'an Chain (without the key escrow mode, smart contracts cannot be deployed online)

Then go to the next step to generate your own public key and private key. Do not choose to generate online .

2. Generate public and private keys

1. Download and install openssl

Download and install openssl and configure environment variables. https://www.openssl.org/source/Find
an installation tutorial and download the latest version of openssl from the official website

2. Generate public key

Open the command line, enter openssl in the terminal to enter the open ssl command line (if this step does not work, please check whether the environment variable is configured or whether the environment variable configuration is correct)

input the command:

The command provided in the official document is: ecparam -name prime256v1 -genkey -out key.pem.

However, the framework of Taian Chain is FISCO-secp256k1, and other algorithms also need to use corresponding encryption algorithms, so here we need to change the statement and use the secp256k1 encryption algorithm . Note that the algorithm cannot be wrong, and if it is wrong, it will cause the test to fail and cannot be successfully created.

ecparam -name secp256k1 -genkey -out key.pem

Because no directory is specified, the files I generated are saved in the C:\Users\Lenovo directory.

3. Generate a private key

Enter the command ec -in key.pem -pubout -out pub.pem to generate a public key file pub.pem with the private key in the key.pem file

ec -in key.pem -pubout -out pub.pem

Execution result:
read EC key
writing EC key

4. Generate signature file

First create a new file data.txt in the generated public key and private key folder , and write a string in it (helloworld can be in the programmer’s DNA)
and enter the command dgst -sha256 -sign key.pem -out signature. bin data.txt Sign the data.txt file with the private key in the key.pem file to generate the signature file signature.bin

 dgst -sha256 -sign key.pem -out signature.bin data.txt

If you report an error, then quickly check whether the data.txt file exists!

5. Signature verification

Enter the command dgst -verify pub.pem -sha256 -signature signature.bin data.txt to use the public key in the pub.pem file to perform signature verification on the data.txt and signature.bin files

dgst -verify pub.pem -sha256 -signature signature.bin data.txt

Execution result:
Verified OK

6. File conversion

If Verified OK is displayed, enter the command base64 -in signature.bin -out signature64.txt to convert the signature file signature.bin into a base64-encoded signature64.txt file

base64 -in signature.bin -out signature64.txt

Note that this step may report an error, and I don’t know the reason for the error, just try the same statement and run it again. . . very strange

Enter the command pkcs8 -topk8 -inform PEM -in key.pem -outform PEM -nocrypt -out keypkcs8.pem to convert the private key in the key.pem file to pkcs8 format

pkcs8 -topk8 -inform PEM -in key.pem -outform PEM -nocrypt -out keypkcs8.pem

Save the keypkcs8.pem file locally, and copy all the contents of pub.pem , data.txt , and signature64.txt to the public key, test data, and signature data text boxes on the upload public key mode page for verification and submission . If the test fails check that the algorithm used matches and that the entire content of the file is copied into the text box.
insert image description here


3. Create a Taian chain project

insert image description here
Select Project Management in the open alliance chain on the right, and click Create Project in the upper right corner.
Just enter a project name and select a framework. Once a frame is selected it cannot be changed.
Download the access parameter file for subsequent use.

Summarize

So far, it’s not very tricky, the next episode is about building your own FISCO-BCOS blockchain certificate.

Guess you like

Origin blog.csdn.net/qq_40810212/article/details/123796560