bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 41쪽 중 38쪽
nce
(
ssdb server
)
cp
-r
aelf-testnet-mainchain-chaindb-*/* /path/to/install/chaindb/ssdb/var/
start your chain database instance
ssdb-cli info
Restore State Database:
tar
xvzf aelf-testnet-mainchain-statedb-*.tar.gz
stop your state database instance
(
ssdb server
)
cp
-r
aelf-testnet-mainchain-statedb-*/* /path/to/install/statedb/ssdb/var/
start your state database instance
ssdb-cli info
Node Configuration
Generate Node Account
Install aelf-command:
npm
i
-g
aelf-command
Create Account:
aelf-command create
Follow the prompts and save the account info.
Prepare Node Configuration
Download Settings Template and Docker Script:
cd
/tmp/
wget
https://github.com/aelfProject/aelf/releases/download/v1.0.0-rc1/aelf-testnet-mainchain.zip
unzip
aelf-testnet-mainchain.zip
mv
aelf-testnet-mainchain /opt/aelf-node
Update appsettings.json:
{
"Account"
:
{
"NodeAccount"
:
"your-node-account"
,
"NodeAccountPassword"
:
"your-password"
}
,
"ConnectionStrings"
:
{
"BlockchainDb"
:
"redis://chain-db-server:port"
,
"StateDb"
:
"redis://state-db-server:port"
}
,
"Network"
:
{
"BootNodes"
:
[
"node-ip:6800"
]
,
"ListeningPort"
:
6800
}
,
"CrossChain"
:
{
"Grpc"
:
{
"LocalServerPort"
:
5000
}
}
}
Running a Full Node
With Docker
Run Node:
docker
pull aelf/node:testnet-v1.6.0
cd
/opt/aelf-node
sh
aelf-node.sh start aelf/node:testnet-v1.6.0
Stop Node:
sh
aelf-node.sh stop
With Binary Release
Install .NET Core SDK 6.0.
Download and Run Node:
cd
/tmp/
wget
https://github.com/aelfProject/aelf/releases/download/v1.0.0-rc1/aelf.zip
unzip
aelf.zip
mv
aelf /opt/aelf-node/
cd
/opt/aelf-node
dotnet aelf/aelf.Launcher.dll
Check the Node
To check the node, query its current block height:
aelf-command get-blk-height
-e
http://your-node-ip:port
Running Side-Chains
Download and Restore Snapshot Data.
Run Side-Chain Node:
cd
/tmp/
wget
https://github.com/aelfProject/aelf/releases/download/v1.0.0-rc1/aelf-testnet-sidechain1.zip
unzip
aelf-testnet-sidechain1.zip
mv
aelf-testnet-sidechain1 /opt/aelf-node
Update appsettings.SideChain.TestNet.json with your node information:
{
"CrossChain"
:
{
"Grpc"
:
{
"ParentChainServerPort"
:
5000
,
"ParentChainServerIp"
:
"mainchain-ip"
,
"ListeningPort"
:
5001
}
,
"ParentChainId"
:
"aelf"
}
,
"Network"
:
{
"BootNodes"
:
[
"sidechain-bootnode-ip:6800"
]
,
"ListeningPort"
:
6800
}
}
Note
Each side chain has its own P2P network, add the mainnet dAppChain nodes as peer:
```sh
bootnode → ["xxx.xxxx.xxx.xxx:6800", "..."]
```
```json
{
"Network": {
"BootNodes": [
"Add the right boot node according to sidechain"
],
"ListeningPort": 6800
}
}
```
Steps to Set Up a Node:
Minimum Configuration:
Recommended Configuration:
Setup the Database
Import the Snapshot Data
Node Configuration
Generate Node Account
Prepare Node Configuration
Running a Full Node
With Docker
With Binary Release
Check the Node
Running Side-Chains
Note
## /quick-start/node-operators/set-up-a-node-on-mainnet
On this page
Description
: Instructions on how to join the aelf mainnet by setting up and running a node using Docker or binaries, along with necessary configuration and database setup.
Purpose
: To guide users through the process of configuring, deploying, and maintaining an aelf mainnet node, ensuring proper setup for node communication and blockchain synchronization.
There are two ways to run an aelf node: using Docker (recommended) or running binaries from GitHub. Before starting, you need to install some tools and frameworks. Command line instructions are provided for most dependencies. For complex needs, see the
environment setup
section.
Steps to Set Up a Node
Execute the snapshot download script and load the snapshot into the database.
Download our template setting files and Docker run script.
Modify the appsettings according to your needs.
Run and check the node.
Configuration Requirements
Minimum Configuration:
c5.xlarge or N2 instance: 4 vCPU, 8GiB RAM, 1TB storage, 5 Mbps bandwidth
Recommended Configuration:
c5.2xlarge or N2 instance: 8 vCPU, 16GiB RAM, 1TB storage, 100 Mbps bandwidth
Note:
For non-block producing nodes, there is no requirement on the number of nodes.
To become a BP, run individual nodes for both aelf MainChain and all dAppChains.
Time Syncing:
Ensure your server is time-synced via NTP to avoid syncing issues.
Setup the Database
We support Redis and SSDB for storing node data. For mainnet, we provide snapshots for SSDB only. Configure two SSDB instances: one for the chain database and one for the state database (run on different machines for better performance).
Import the Snapshot Data
Create a snapshot directory and navigate to it:
Terminal
mkdir
snapshot
cd
snapshot
Fetch the snapshot download script:
Terminal
curl
-O
-s
https://aelf-backup.s3.ap-northeast-2.amazonaws.com/snapshot/mainnet/download-mainchain-db.sh
Execute the script (specify a date if needed):
Terminal
sh
download-mainchain-db.sh
Restore the chain database from snapshot:
tar
xvzf aelf-mainnet-mainchain-chaindb-*.tar.gz
stop your chain database instance
(
ssdb server
)
cp
-r
aelf-mainnet-mainchain-chaindb-*/* /path/to/install/chaindb/ssdb/var/
start your chain database instance
enter ssdb console
(
ssdb-cli
)
use the
"info"
command
to confirm that the data has been imported
)
Restore the state database from snapshot:
tar
xvzf aelf-mainnet-mainchain-statedb-*.tar.gz
stop your state database instance
(
ssdb server
)
cp
-r
aelf-mainnet-mainchain-statedb-*/* /path/to/install/statedb/ssdb/var/
start your state database instance
enter ssdb console
(
ssdb-cli
)
use the
"info"
command
to confirm that the data has been imported
)
Node Configuration
Generating the Node's Account
Install the
aelf-command
npm package:
Terminal
npm
i
-g
aelf-command
Create an account/key-pair:
Terminal
aelf-command create
Follow the prompts to set a password and save the account info.
Prepare Node Configuration
Download the settings template and Docker script:
Terminal
cd
/tmp/
wget
https://github.com/aelfProject/aelf/releases/download/v1.6.0/aelf-mainnet-mainchain.zip
unzip
aelf-mainnet-mainchain.zip
mv
aelf-mainnet-mainchain /opt/aelf-node
Update the
appsettings.json
file with your account information:
appsettings.json
{
"Account"
:
{
"NodeAccount"
:
"2Ue31YTuB5Szy7cnr3SCEGU2gtGi5uMQBYarYUR5oGin1sys6H"
,
"NodeAccountPassword"
:
"********"
}
,
"ConnectionStrings"
:
{
"BlockchainDb"
:
"redis://your chain database server ip address:port"
,
"StateDb"
:
"redis://your state database server ip address:port"
}
,
"Network"
:
{
"BootNodes"
:
[
"xxx.xxxx.xxx.xxx:6800"
]
,
"ListeningPort"
:
6800
}
,
"CrossChain"
:
{
"Grpc"
:
{
"LocalServerPort"
:
5000
}
}
}
Running a Full Node with Docker
Pull aelf’s Docker image and start the node:
Terminal
docker
pull aelf/node:mainnet-v1.6.0
cd
/opt/aelf-node
sh
aelf-node.sh start aelf/node:mainnet-v1.6.0
To stop the node:
Terminal
sh
aelf-node.sh stop
Running a Full Node with the Binary Release
Install the .NET Core SDK (version 6.0).
Get the latest release and run the node:
Terminal
cd
/tmp/
wget
https://github.com/aelfProject/aelf/releases/download/v1.6.0/aelf.zip
unzip
aelf.zip
mv
aelf /opt/aelf-node/
cd
/opt/aelf-node
dotnet aelf/aelf.Launcher.dll
Running a Full Node with the Source
Ensure the code version is consistent (aelf v1.6.0).
Compile on an Ubuntu Linux machine (recommended Ubuntu 18.04.2 LTS) with .NET Core SDK version 6.0.
Check the Node
Run the following command to check the node's block height:
Terminal
aelf-command get-blk-height
-e
http://your
node
ip
address:port
Running Side-Chains
Download and Restore Snapshot Data
(steps are the same as in Setup the Database).
Run Side-Chain Node:
Terminal
cd
/tmp/
wget
https://github.com/aelfProject/aelf/releases/download/v1.6.0/aelf-mainnet-sidechain1.zip
unzip
aelf-mainnet-sidechain1.zip
mv
aelf-mainnet-sidechain1 /opt/aelf-node
Update appsettings.SideChain.MainNet.json with your node information:
appsettings.SideChain.MainNet.json
{
"CrossChain"
:
{
"Grpc"
:
{
"ParentChainServerPort"
:
5001
,
"ParentChainServerIp"
:
"your mainchain ip address"
,
"ListeningPort"
:
5011
}
,
"ParentChainId"
:
"aelf"
,
"Economic"
:
{
"SymbolListToPayTxFee"
:
"WRITE,READ,STORAGE,TRAFFIC"
,
"SymbolListToPayRental"
:
"CPU,RAM,DISK,NET"
}
}
,
"Network"
:
{
"BootNodes"
:
[
"sidechain-bootnode-ip:6800"
]
,
"ListeningPort"
:
6800
}
}
Note
Ensure P2P ports are open and configured correctly for node communication.
```sh
bootnode → ["xxx.xxxx.xxx.xxx:6800", "..."]
```
```json
{
"Network": {
"BootNodes": [
"Add the right boot node according to sidechain"
],
"ListeningPort": 6800
}
}
```
Steps to Set Up a Node
Configuration Requirements
Minimum Configuration:
Recommended Configuration:
Setup the Database
Import the Snapshot Data
Node Configuration
Generating the Node's Account
Prepare Node Configuration
Running a Full Node with Docker
Running a Full Node with the Binary Release
Running a Full Node with the Source
Check the Node
Running Side-Chains
Note
## /quick-start/node-operators/apply-to-be-a-bp
On this page
Description
: Guidelines for setting up nodes and participating in the Block Producer (BP) election process in the aelf blockchain ecosystem.
Purpose
: To provide step-by-step instructions for users to become Block Producers, participate in BP elections, and understand the voting and election outcomes within the aelf network.
Steps to Become a BP
Set up nodes.
Participate in BP election using nodes.
Note:
Voters stake ELF tokens to vote for their preferred nodes.
Outcome of Election:
Block Producer:
Elected based on top
2
N
+
1
2N+1
2
N
+
1
.
Candidate Nodes:
Elected based on top
5
∗
(
2
N
+
1
)
5*(2N+1)
5
∗
(
2
N
+
1
)
.
Nodes
Set up Nodes
aelf doesn't have light nodes, so all nodes are full nodes.
Click here
to learn how to set up a full node.
Note:
To become a BP, you need to run individual nodes for both aelf MainChain and all the dAppChains.
Participate in BP Election
Stake 100,000 ELF to join the node election. Ensure you have enough balance.
Go to the
Governance
page.
Click "Become a candidate node."
Stake 100,000 ELF.
Users Vote for Nodes
Users can vote for candidate nodes at Governance -> Vote -> Node Table.
The top
2
N
+
1
2N+1
2
N
+
1
nodes become BPs.
The top
5
∗
(
2
N
+
1
)
5*(2N+1)
5
∗
(
2
N
+
1
)
nodes become candidate nodes.
N starts from
8
8
8
in 2022 and increases by
1
1
1
each year.
BPs are Elected
BPs are elected every seven days, starting at 7:23 (UTC) every Thursday. If your node ranks in the top
2
N
+
1
2N+1
2
N
+
1
, it becomes a BP in the next term. If it ranks between top
2
N
+
1
2N+1
2
N
+
1
and top
5
∗
(
2
N
+
1
)
5*(2N+1)
5
∗
(
2
N
+
1
)
, it becomes a candidate node. Check the current elected BPs in real-time on the
election
page.
Simulate in Local Environment
To try setting up a node and running as a BP locally, follow the instructions
here
to simulate it in the local environment.
Steps to Become a BP
Nodes
Set up Nodes
Participate in BP Election
Users Vote for Nodes
BPs are Elected
Simulate in Local Environment
## /quick-start/node-operators/set-up-a-side-chain
On this page
Description
:
Detailed guidelines and API documentation for creating and managing side chains in the aelf blockchain ecosystem.
Purpose
: To provide developers with step-by-step instructions and code examples for proposing, approving, and deploying side chains, enhancing scalability and customization within the aelf network.
Side chains can be created in the aelf ecosystem to enable scalability. This section introduces the process in detail.
Side Chain Creation API
Anyone can request the creation of a side chain in the aelf ecosystem. The proposer/creator of a new side chain needs to request the creation through the cross-chain contract on the main chain. The request contains fields that determine the type of side chain to be created.
API for Proposing Side Chain Creation
The fields in the
SideChainCreationRequest
determine the type of side chain that is created. For more details, follow
RequestSideChainCreation
in the
Crosschain contract documentation
.
Upon creating a new proposal for the side chain, the
ProposalCreated
event containing the proposal ID will be fired. A parliament organization, specified since the chain's launch, will approve this proposal within 24 hours (refer to the
Parliament contract documentation
for details). The proposer can release the side chain creation request with the proposal ID once it can be released. Refer to
ReleaseSideChainCreation
in the
Crosschain contract documentation
.
Once the side chain is created, the
SideChainCreatedEvent
containing the chain ID will be fired.
The side chain node can be launched once it is created on the main chain. Ensure the side chain ID from the creation result is configured correctly before launching the side chain node. Make sure the cross-chain communication context is correctly set, as the side chain node will request main chain node for chain initialization data.
Side Chain Types
Two types of side chains currently exist:
exclusive
and
shared
. An
exclusive
side chain allows developers to choose the transaction fee model and set the transaction fee price. Only the creator of an
exclusive
side chain can propose deploying a new contract.
Paying for Side Chain
Indexing Fee
The indexing fee is paid for side chain indexing. You can specify the indexing fee price and prepayments amount when requesting side chain creation. The cross-chain contract charges prepayments once the side chain is created and pays the miner who indexes the side chain block every time.
Resource Fee
Developers of an exclusive side chain pay producers for running it by paying CPU, RAM, DISK, and NET resource tokens. This model is called
charge-by-time
. The amount the side chain creator must share with the producers is set after the chain's creation. The
exclusive
side chain is priced according to the time used. The unit price of the fee is determined through negotiation between the production node and the developer.
Simple Demo for Side Chain Creation Request
When a user (usually a developer) feels the need to create a new side chain on aelf, they must call the cross-chain contract and request a side chain creation. After the request, parliament organization members will either approve or reject the creation. If the request is approved, the developer must then release the proposal.
Step-by-Step Code Snippets
We'll use the
aelf-js-sdk
to create a new side chain. The full script will be provided at the end.
This creation of a side chain (logical, on-chain creation) is done in four steps:
The developer must
allow/approve
some tokens to the cross-chain contract of the main chain.
The developer calls the cross-chain contract of the main chain to
request
the creation.
The parliament organization members must
approve
this request.
Finally, the developer must
release
the request to finalize the creation.
Set-Up
To test the creation process, you will need a producer node running and the following:
A key-pair (account) created; this will be your Producer (also used to create the creation request in this tutorial).
The node needs to be configured with an API endpoint, account, and miner list that correspond to what is in the script.
Here is the initialization code:
const
AElf
=
require
(
'aelf-sdk'
)
;
const
Wallet
=
AElf
.
wallet
;
const
{
sha256
}
=
AElf
.
utils
;
// set the private key of the block producer.
// REPLACE
const
defaultPrivateKey
=
'e119487fea0658badc42f089fbaa56de23d8c0e8d999c5f76ac12ad8ae897d76'
;
const
defaultPrivateKeyAddress
=
'HEtBQStfqu53cHVC3PxJU6iGP3RGxiNUfQGvAPTjfrF3ZWH3U'
;
// load the wallet associated with your block producer's account.
const
wallet
=
Wallet
.
getWalletByPrivateKey
(
defaultPrivateKey
)
;
// API link to the node
// REPLACE
const
aelf
=
new
AElf
(
new
AElf
.
providers
.
HttpProvider
(
'http://127.0.0.1:1234'
)
)
;
// names of the contracts that will be used.
const
tokenContractName
=
'AElf.ContractNames.Token'
;
const
parliamentContractName
=
'AElf.ContractNames.Parliament'
;
const
crossChainContractName
=
'AElf.ContractNames.CrossChain'
;
...
const
createSideChain
=
async
(
)
=>
{
// check the chain status to make sure the node is running
const
chainStatus
=
await
aelf
.
chain
.
getChainStatus
(
{
sync
:
true
}
)
;
const
genesisContract
=
await
aelf
.
chain
.
contractAt
(
chainStatus
.
GenesisContractAddress
,
wallet
)
.
catch
(
(
err
)
=>
{
console
.
log
(
err
)
;
}
)
;
// get the addresses of the contracts that we'll need to call
const
tokenContractAddress
=
await
genesisContract
.
GetContractAddressByName
.
call
(
sha256
(
tokenContractName
)
)
;
const
parliamentContractAddress
=
await
genesisContract
.
GetContractAddressByName
.
call
(
sha256
(
parliamentContractName
)
)
;
const
crossChainContractAddress
=
await
genesisContract
.
GetContractAddressByName
.
call
(
sha256
(
crossChainContractName
)
)
;
// build the aelf-sdk contract instance objects
const
parliamentContract
=
await
aelf
.
chain
.
contractAt
(
parliamentContractAddress
,
wallet
)
;
const
tokenContract
=
await
aelf
.
chain
.
contractAt
(
tokenContractAddress
,
wallet
)
;
const
crossChainContract
=
await
aelf
.
chain
.
contractAt
(
crossChainContractAddress
,
wallet
)
;
...
}
When running the script, the
createSideChain
function will be executed and will run through the full process of creating the side chain.
Creation of the Side Chain
Set the Allowance
First, the developer must approve some ELF tokens for use by the cross-chain contract.
var
setAllowance
=
async
function
(
tokenContract
,
crossChainContractAddress
)
{
// set some allowance to the cross-chain contract
const
approvalResult
=
await
tokenContract
.
Approve
(
{
symbol
:
"ELF"
,
spender
:
crossChainContractAddress
,
amount
:
20000
,
}
)
;
let
approveTransactionResult
=
await
pollMining
(
approvalResult
.
TransactionId
)
;
}
;
Creation Request
To request a side chain creation, the developer must call
RequestSideChainCreation
on the cross-chain contract. This creates a proposal with the
Parliament
contract. After calling this method, a
ProposalCreated
log will be created containing the
ProposalId
.
rpc
RequestSideChainCreation
(
SideChainCreationRequest
)
returns
(
google.protobuf.Empty
)
{
}
message
SideChainCreationRequest
{
int64
indexing_price
=
1
;
// The cross chain indexing price.
int64
locked_token_amount
=
2
;
// Initial locked balance for a new side chain.
bool
is_privilege_preserved
=
3
;
// Creator privilege boolean flag.
SideChainTokenCreationRequest
side_chain_token_creation_request
=
4
;
// Side chain token information.
repeated
SideChainTokenInitialIssue
side_chain_token_initial_issue_list
=
5
;
// A list of accounts and amounts that will be issued when the chain starts.
map
<
string
,
int32
>
initial_resource_amount
=
6
;
// The initial rent resources.
}
message
SideChainTokenCreationRequest
{
string
side_chain_token_symbol
=
1
;
// Token symbol of the side chain to be created.
string
side_chain_token_name
=
2
;
// Token name of the side chain to be created.
int64
side_chain_token_total_supply
=
3
;
// Token total supply of the side chain to be created.
int32
side_chain_token_decimals
=
4
;
// Token decimals of the side chain to be created.
}
message
SideChainTokenInitialIssue
{
aelf
.
Address
address
=
1
;
// The account that will be issued.
int64
amount
=
2
;
// The amount that will be issued.
}
In orde프로젝트로 돌아가기