diff --git a/docs/Architecture/Core/Implementation.md b/docs/Architecture/Core/Implementation.md index 4814df4..a9bbc89 100644 --- a/docs/Architecture/Core/Implementation.md +++ b/docs/Architecture/Core/Implementation.md @@ -1,6 +1,12 @@ +--- +sidebar_position: 2 +title: Implementations +description: Implementations +--- + # Design Principles -![image](node-archi.png) +![image](../../../static/img/node-archi.png) The diagram above shows the conceptual structure of the node and the separation between the OS and Kernel. diff --git a/docs/Architecture/Core/Introduction.md b/docs/Architecture/Core/Introduction.md index c390e24..b41c842 100644 --- a/docs/Architecture/Core/Introduction.md +++ b/docs/Architecture/Core/Introduction.md @@ -1,3 +1,9 @@ +--- +sidebar_position: 1 +title: Introduction +description: Introduction +--- + # Application Pattern We follow generally accepted good practices in programming, especially those that align with our project needs. Some of these practices are specific to C#, while others pertain to general Object-Oriented Programming (OOP) principles like **SOLID** and **DRY**. diff --git a/docs/Architecture/Cross Chain/Architecture.md b/docs/Architecture/Cross Chain/Architecture.md index 9475bc2..0aaa7ae 100644 --- a/docs/Architecture/Cross Chain/Architecture.md +++ b/docs/Architecture/Cross Chain/Architecture.md @@ -1,3 +1,9 @@ +--- +sidebar_position: 2 +title: Architecture +description: Architecture +--- + # Side Chain and Main Chain Node Documentation ## Overview @@ -17,7 +23,7 @@ Through this link, messages are exchanged, and indexing is performed to ensure t In the current architecture, both the side chain node and the main chain node have one server and exactly one client. This forms the basis for AElf's two-way communication between the main chain and side chains. Both the server and the client are implemented as node plugins (a node has a collection of plugins). Interaction (listening and requesting) can start once both nodes are running. -![Node Level Architecture](side-chain-nodes.png) +![Node Level Architecture](../../../static/img/side-chain-nodes.png) The diagram above illustrates two nodes run by an entity: one main chain node and one side chain node. Note that the nodes don't have to be in the same physical location. @@ -58,4 +64,4 @@ Apart from the data in blocks, most cross-chain data will be stored by the cross Conceptually, the node operates as described in the following diagram. The main/side chain node receives cross-chain data from the other side and stores it in local memory. The indexing transaction is packed by the miner, and the cross-chain data is written into the `State` through the `Crosschain Contract`. -![Data Flow](architecture-node.png) \ No newline at end of file +![Data Flow](../../../static/img/architecture-node.png) diff --git a/docs/Architecture/Cross Chain/Cross Chain Transfer.md b/docs/Architecture/Cross Chain/Cross Chain Transfer.md index 088f7c5..0a7df59 100644 --- a/docs/Architecture/Cross Chain/Cross Chain Transfer.md +++ b/docs/Architecture/Cross Chain/Cross Chain Transfer.md @@ -1,8 +1,15 @@ +--- +sidebar_position: 5 +title: Crosschain Transfer +description: Crosschain Transfer +--- + # Cross Chain Transfer Cross chain transfer is one of the most commonly used cases when it comes to cross chain verification. AElf already supports cross chain transfer functionality in its contract. This section will explain how to transfer tokens across chains. It assumes a side chain is already deployed and has been indexed by the main chain. The transfer process will always use the same contract methods and follow these two steps: + - **Initiate the transfer** - **Receive the tokens** @@ -14,65 +21,65 @@ Let's say you want to transfer token **FOO** from chain **A** to chain **B**. Be - **Validate `Token Contract` address on chain A** - Send transaction `tx_1` to the `Genesis Contract` with the method `ValidateSystemContractAddress`. You need to provide `system_contract_hash_name` and the address of the `Token Contract`. `tx_1` should be successfully packed in the block. + Send transaction `tx_1` to the `Genesis Contract` with the method `ValidateSystemContractAddress`. You need to provide `system_contract_hash_name` and the address of the `Token Contract`. `tx_1` should be successfully packed in the block. - ```protobuf - rpc ValidateSystemContractAddress(ValidateSystemContractAddressInput) returns (google.protobuf.Empty){} + ```protobuf + rpc ValidateSystemContractAddress(ValidateSystemContractAddressInput) returns (google.protobuf.Empty){} - message ValidateSystemContractAddressInput { - aelf.Hash system_contract_hash_name = 1; - aelf.Address address = 2; - } - ``` + message ValidateSystemContractAddressInput { + aelf.Hash system_contract_hash_name = 1; + aelf.Address address = 2; + } + ``` - **Register the token contract address of chain A on chain B** - Create a proposal for the `RegisterCrossChainTokenContractAddress` for the default parliament organization on chain B. Refer to the [Parliament contract documentation](../../reference/smart-contract-api/parliament) for more details. Apart from cross chain verification context, you also need to provide the origin data of `tx_1` and the `Token Contract` address on chain A. + Create a proposal for the `RegisterCrossChainTokenContractAddress` for the default parliament organization on chain B. Refer to the [Parliament contract documentation](../../reference/smart-contract-api/parliament) for more details. Apart from cross chain verification context, you also need to provide the origin data of `tx_1` and the `Token Contract` address on chain A. - ```protobuf - rpc RegisterCrossChainTokenContractAddress (RegisterCrossChainTokenContractAddressInput) returns (google.protobuf.Empty) {} + ```protobuf + rpc RegisterCrossChainTokenContractAddress (RegisterCrossChainTokenContractAddressInput) returns (google.protobuf.Empty) {} - message RegisterCrossChainTokenContractAddressInput { - int32 from_chain_id = 1; - int64 parent_chain_height = 2; - bytes transaction_bytes = 3; - aelf.MerklePath merkle_path = 4; - aelf.Address token_contract_address = 5; - } - ``` + message RegisterCrossChainTokenContractAddressInput { + int32 from_chain_id = 1; + int64 parent_chain_height = 2; + bytes transaction_bytes = 3; + aelf.MerklePath merkle_path = 4; + aelf.Address token_contract_address = 5; + } + ``` - **Validate `TokenInfo` of FOO on chain A** - Send transaction `tx_2` to the `Token Contract` with the method `ValidateTokenInfoExists` on chain A. You need to provide `TokenInfo` of FOO. `tx_2` should be successfully packed in the block. + Send transaction `tx_2` to the `Token Contract` with the method `ValidateTokenInfoExists` on chain A. You need to provide `TokenInfo` of FOO. `tx_2` should be successfully packed in the block. - ```protobuf - rpc ValidateTokenInfoExists(ValidateTokenInfoExistsInput) returns (google.protobuf.Empty){} + ```protobuf + rpc ValidateTokenInfoExists(ValidateTokenInfoExistsInput) returns (google.protobuf.Empty){} - message ValidateTokenInfoExistsInput { - string symbol = 1; - string token_name = 2; - int64 total_supply = 3; - int32 decimals = 4; - aelf.Address issuer = 5; - bool is_burnable = 6; - int32 issue_chain_id = 7; - } - ``` + message ValidateTokenInfoExistsInput { + string symbol = 1; + string token_name = 2; + int64 total_supply = 3; + int32 decimals = 4; + aelf.Address issuer = 5; + bool is_burnable = 6; + int32 issue_chain_id = 7; + } + ``` - **Create token FOO on chain B** - Send transaction `tx_3` to the `Token Contract` with the method `CrossChainCreateToken` on chain B. You need to provide the origin data of `tx_2` and the cross chain verification context of `tx_2`. + Send transaction `tx_3` to the `Token Contract` with the method `CrossChainCreateToken` on chain B. You need to provide the origin data of `tx_2` and the cross chain verification context of `tx_2`. - ```protobuf - rpc CrossChainCreateToken(CrossChainCreateTokenInput) returns (google.protobuf.Empty) {} + ```protobuf + rpc CrossChainCreateToken(CrossChainCreateTokenInput) returns (google.protobuf.Empty) {} - message CrossChainCreateTokenInput { - int32 from_chain_id = 1; - int64 parent_chain_height = 2; - bytes transaction_bytes = 3; - aelf.MerklePath merkle_path = 4; - } - ``` + message CrossChainCreateTokenInput { + int32 from_chain_id = 1; + int64 parent_chain_height = 2; + bytes transaction_bytes = 3; + aelf.MerklePath merkle_path = 4; + } + ``` ## Initiate the Transfer @@ -82,23 +89,23 @@ On the token contract of the source chain, the `CrossChainTransfer` method is us rpc CrossChainTransfer (CrossChainTransferInput) returns (google.protobuf.Empty) { } message CrossChainTransferInput { - aelf.Address to = 1; + aelf.Address to = 1; string symbol = 2; sint64 amount = 3; string memo = 4; - int32 to_chain_id = 5; + int32 to_chain_id = 5; int32 issue_chain_id = 6; } ``` ### The fields of the input: -- **to**: the target address to receive the token -- **symbol**: the symbol of the token to be transferred -- **amount**: the amount of the token to be transferred -- **memo**: a memo field for this transfer -- **to_chain_id**: the destination chain ID where the tokens will be received -- **issue_chain_id**: the chain ID where the token was issued +- `to`: the target address to receive the token +- `symbol`: the symbol of the token to be transferred +- `amount`: the amount of the token to be transferred +- `memo`: a memo field for this transfer +- `to_chain_id`: the destination chain ID where the tokens will be received +- `issue_chain_id`: the chain ID where the token was issued ## Receive on the Destination Chain @@ -126,13 +133,13 @@ message CrossChainMerkleProofContext { ### The fields of the input: -- **from_chain_id**: the source chain ID from which the cross chain transfer was launched +- `from_chain_id`: the source chain ID from which the cross chain transfer was launched -- **parent_chain_height**: the height of the block on the main chain that contains the `CrossChainTransfer` transaction (for main chain to side chain transfer). For side chain to side chain or side chain to main chain transfer, it is the result of `GetBoundParentChainHeightAndMerklePathByHeight` (input is the height of the `CrossChainTransfer`), accessible in the `bound_parent_chain_height` field. +- `parent_chain_height`: the height of the block on the main chain that contains the `CrossChainTransfer` transaction (for main chain to side chain transfer). For side chain to side chain or side chain to main chain transfer, it is the result of `GetBoundParentChainHeightAndMerklePathByHeight` (input is the height of the `CrossChainTransfer`), accessible in the `bound_parent_chain_height` field. -- **transfer_transaction_bytes**: the serialized form of the `CrossChainTransfer` transaction. +- `transfer_transaction_bytes`: the serialized form of the `CrossChainTransfer` transaction. -- **merkle_path**: obtained from the source chain. The construction of merkle path data differs among cases: +- `merkle_path`: obtained from the source chain. The construction of merkle path data differs among cases: - **Main chain to side chain transfer**: merkle path from the main chain’s web API `GetMerklePathByTransactionIdAsync` (with `CrossChainTransfer` transaction ID as input). - **Side chain to side chain or side chain to main chain transfer**: - merkle path from the source chain’s web API `GetMerklePathByTransactionIdAsync` (with `CrossChainTransfer` transaction ID as input). diff --git a/docs/Architecture/Cross Chain/Cross Chain Verification.md b/docs/Architecture/Cross Chain/Cross Chain Verification.md index e69de29..7d83f43 100644 --- a/docs/Architecture/Cross Chain/Cross Chain Verification.md +++ b/docs/Architecture/Cross Chain/Cross Chain Verification.md @@ -0,0 +1,45 @@ +--- +sidebar_position: 3 +title: Crosschain Verification +description: Crosschain Verification +--- + +# Cross Chain Verification + +Verification is the key feature that enables side chains. Because side chains do not have direct knowledge about other side chains, they need a way to verify information from other chains. Side chains need the ability to verify that a transaction was included in another side chain's block. + +## Indexing + +- The role of the main chain node is to index all the side chains' blocks. + - This way, it knows exactly the current state of all the side chains. + - Side chains also index main chain blocks, which is how they gain knowledge about the inclusion of transactions in other chains. +- Indexing is a continuous process: + - The main chain permanently gathers information from the side chains. + - The side chains permanently gather information from the main chain. +- When a side chain wants to verify a transaction from another side chain, it must wait until the correct main chain block has been indexed. + +## Merkle Tree + +- A Merkle tree is a basic binary tree structure. + - For cross-chain in AElf, the leaf value is the hash from transaction data. + - The node value (which is not a leaf node) is the hash calculated from its children's values up to the tree root. + +![Merkle Tree](../../../static/img/merkle.png) + +## Merkle Root + +- When a transaction is included in a side chain's block, the block will also include a Merkle root of the transactions in this block. + - This root is local to this side chain's blockchain and, by itself, of little value to other side chains because they follow a different protocol. + - Communication between side chains goes through the main chain in the form of a Merkle path. + - During the indexing process, the main chain calculates the root with the data from side chains, and side chains in turn get the root in future indexing. + - This root is used for the final check in cross-chain transaction verification. + +## Merkle Path + +- A Merkle path is the node collection for one leaf node to calculate to the root. + - A correct Merkle path is necessary to complete any work related to cross-chain verification. +- For the transaction **tx** from chain **A**: + - You need the whole Merkle path root for **tx** to calculate the final root if you want to verify the existence of this transaction on other chains. + - Verify the root by checking whether it is equal to the one obtained from indexing before. + +![Merkle Path](../../../static/img/merkle-path.png) diff --git a/docs/Architecture/Cross Chain/Introduction.md b/docs/Architecture/Cross Chain/Introduction.md index f5bb819..da79409 100644 --- a/docs/Architecture/Cross Chain/Introduction.md +++ b/docs/Architecture/Cross Chain/Introduction.md @@ -1,3 +1,9 @@ +--- +sidebar_position: 1 +title: Introduction +description: Introduction +--- + # Introduction One of the major issues with current blockchain systems is scalability. This is mainly due to **congestion problems** in existing blockchains. The core problem is that when a single chain needs to sequentially order and process transactions, a popular dApp consuming a lot of resources can negatively impact other dApps. @@ -5,16 +11,19 @@ One of the major issues with current blockchain systems is scalability. This is To address this issue, AElf introduced side chains in its initial design. The concept is that each side-chain handles one or more similar business scenarios, distributing different tasks across multiple chains to improve overall processing efficiency. ## Key Points: + - **Independent and Specialized**: Side-chains are designed to be independent and specialized, ensuring that the dApps running on them perform efficiently and smoothly. - **Network Link**: There is a network link between the main-chain node and side-chain nodes, with communication indirectly facilitated through a Merkle root. -![image](introduction-topology.png) +![image](../../../static/img/introduction-topology.png) -*The diagram above illustrates the conceptual idea behind side chains.* +_The diagram above illustrates the conceptual idea behind side chains._ Side chains are isolated but still need a way to interact with each other. To enable cross-chain verification scenarios, AElf introduces a communication mechanism through **Merkle roots** and **indexing**. ## Overview + The following sections of this documentation will provide: + - An overview of the architecture of AElf's side chains. - A guide explaining how to set up a main-chain and a side chain node. diff --git a/docs/Architecture/Cross Chain/Verify.md b/docs/Architecture/Cross Chain/Verify.md index 898d90b..2c8741a 100644 --- a/docs/Architecture/Cross Chain/Verify.md +++ b/docs/Architecture/Cross Chain/Verify.md @@ -1,3 +1,9 @@ +--- +sidebar_position: 4 +title: Verify +description: Verify +--- + # Cross Chain Transaction Verification This section provides guidance on verifying transactions across different blockchain chains, assuming that a side chain has already been deployed and indexed by the main chain. @@ -28,7 +34,7 @@ message VerifyTransactionInput { The **VerifyTransaction** method is used for verification and returns whether the transaction was mined and indexed by the destination chain. The method is the same for both scenarios; only the input values differ. -### Verifying a Main Chain Transaction +## Verifying a Main Chain Transaction To verify a main chain transaction on a side chain, use the **VerifyTransaction** method on the side chain with the following input values: @@ -39,7 +45,7 @@ To verify a main chain transaction on a side chain, use the **VerifyTransaction* You can retrieve the Merkle path of a transaction in a block by using the chain's API method **GetMerklePathByTransactionIdAsync**. -### Verifying a Side Chain Transaction +## Verifying a Side Chain Transaction For verifying a side chain transaction: diff --git a/docs/References/Web API/Chain API.md b/docs/References/Web API/Chain API.md index 9adcc45..6ddb584 100644 --- a/docs/References/Web API/Chain API.md +++ b/docs/References/Web API/Chain API.md @@ -1,8 +1,12 @@ -# AELF API 1.0 +--- +sidebar_position: 1 +title: Chain API +description: Chain API +--- -## Chain API +# Chain API -### Get information about a given block by block hash. Optionally with the list of its transactions. +## Get information about a given block by block hash. Optionally with the list of its transactions. ```http GET /api/blockChain/block @@ -13,24 +17,24 @@ GET /api/blockChain/block | `blockHash` | `string` | Block hash _(optional)_ | | | `includeTransactions` | `boolean` | Include transactions _(optional)_ | `"false"` | -#### Responses +### Responses - **200**: Success (`BlockDto`) -#### Produces +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -#### Tags +### Tags - **BlockChain** --- -### Get information about a given block by block height. Optionally with the list of its transactions. +## Get information about a given block by block height. Optionally with the list of its transactions. ```http GET /api/blockChain/blockByHeight @@ -41,47 +45,47 @@ GET /api/blockChain/blockByHeight | `blockHeight` | `integer` | Block height _(optional)_ | | | `includeTransactions` | `boolean` | Include transactions _(optional)_ | `"false"` | -#### Responses +### Responses - **200**: Success (`BlockDto`) -#### Produces +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -#### Tags +### Tags - **BlockChain** --- -### Get the height of the current chain. +## Get the height of the current chain. ```http GET /api/blockChain/blockHeight ``` -#### Responses +### Responses - **200**: Success (integer, int64) -#### Produces +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -#### Tags +### Tags - **BlockChain** --- -### Get the current state about a given block. +## Get the current state about a given block. ```http GET /api/blockChain/blockState @@ -91,47 +95,47 @@ GET /api/blockChain/blockState | :---------- | :------- | :---------------------- | | `blockHash` | `string` | Block hash _(optional)_ | -#### Responses +### Responses - **200**: Success (`BlockStateDto`) -#### Produces +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -#### Tags +### Tags - **BlockChain** --- -### Get the current status of the block chain. +## Get the current status of the block chain. ```http GET /api/blockChain/chainStatus ``` -#### Responses +### Responses - **200**: Success (`ChainStatusDto`) -#### Produces +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -#### Tags +### Tags - **BlockChain** --- -### Get the protobuf definitions related to a contract. +## Get the protobuf definitions related to a contract. ```http GET /api/blockChain/contractFileDescriptorSet @@ -141,42 +145,42 @@ GET /api/blockChain/contractFileDescriptorSet | :-------- | :------- | :---------------------------- | | `address` | `string` | Contract address _(optional)_ | -#### Responses +### Responses - **200**: Success (string, byte) -#### Produces +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -#### Tags +### Tags - **BlockChain** --- -### Execute a raw transaction. +## Execute a raw transaction. ```http POST /api/blockChain/executeRawTransaction ``` -#### Parameters +### Parameters | Type | Name | Schema | | :------- | :------ | :-------------------------------------- | | **Body** | `input` | `ExecuteRawTransactionDto` _(optional)_ | -#### Responses +### Responses | HTTP Code | Description | Schema | | :-------: | :---------- | :----- | | **200** | Success | string | -#### Consumes +### Consumes - `application/json-patch+json; v=1.0` - `application/json; v=1.0` @@ -184,38 +188,38 @@ POST /api/blockChain/executeRawTransaction - `application/*+json; v=1.0` - `application/x-protobuf; v=1.0` -#### Produces +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -#### Tags +### Tags - **BlockChain** --- -### Call a read-only method on a contract. +## Call a read-only method on a contract. ```http POST /api/blockChain/executeTransaction ``` -#### Parameters +### Parameters | Type | Name | Schema | | :------- | :------ | :----------------------------------- | | **Body** | `input` | `ExecuteTransactionDto` _(optional)_ | -#### Responses +### Responses | HTTP Code | Description | Schema | | :-------: | :---------- | :----- | | **200** | Success | string | -#### Consumes +### Consumes - `application/json-patch+json; v=1.0` - `application/json; v=1.0` @@ -223,69 +227,69 @@ POST /api/blockChain/executeTransaction - `application/*+json; v=1.0` - `application/x-protobuf; v=1.0` -#### Produces +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -#### Tags +### Tags - **BlockChain** --- -### Get the merkle path of a transaction. +## Get the merkle path of a transaction. ```http GET /api/blockChain/merklePathByTransactionId ``` -#### Parameters +### Parameters | Type | Name | Schema | | :-------: | :-------------- | :------------------ | | **Query** | `transactionId` | string _(optional)_ | -#### Responses +### Responses | HTTP Code | Description | Schema | | :-------: | :---------- | :-------------- | | **200** | Success | `MerklePathDto` | -#### Produces +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -#### Tags +### Tags - **BlockChain** --- -### Creates an unsigned serialized transaction. +## Creates an unsigned serialized transaction. ```http POST /api/blockChain/rawTransaction ``` -#### Parameters +### Parameters | Type | Name | Schema | | :------- | :------ | :--------------------------------------- | | **Body** | `input` | `CreateRawTransactionInput` _(optional)_ | -#### Responses +### Responses | HTTP Code | Description | Schema | | :-------: | :---------- | :--------------------------- | | **200** | Success | `CreateRawTransactionOutput` | -#### Consumes +### Consumes - `application/json-patch+json; v=1.0` - `application/json; v=1.0` @@ -293,38 +297,38 @@ POST /api/blockChain/rawTransaction - `application/*+json; v=1.0` - `application/x-protobuf; v=1.0` -#### Produces +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -#### Tags +### Tags - **BlockChain** --- -### Send a transaction. +## Send a transaction. ```http POST /api/blockChain/sendRawTransaction ``` -#### Parameters +### Parameters | Type | Name | Schema | | :------- | :------ | :------------------------------------- | | **Body** | `input` | `SendRawTransactionInput` _(optional)_ | -#### Responses +### Responses | HTTP Code | Description | Schema | | :-------: | :---------- | :------------------------- | | **200** | Success | `SendRawTransactionOutput` | -#### Consumes +### Consumes - `application/json-patch+json; v=1.0` - `application/json; v=1.0` @@ -332,36 +336,38 @@ POST /api/blockChain/sendRawTransaction - `application/*+json; v=1.0` - `application/x-protobuf; v=1.0` -#### Produces +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -#### Tags +### Tags - **BlockChain** --- -### Broadcast a Transaction +## Broadcast a Transaction -**POST** `/api/blockChain/sendTransaction` +```http +POST /api/blockChain/sendTransaction +``` -**Parameters** +### Parameters | Type | Name | Schema | Description | Required | | -------- | ------- | ---------------------- | ----------- | -------- | | **Body** | `input` | `SendTransactionInput` | - | No | -**Responses** +### Responses | HTTP Code | Description | Schema | | --------- | ----------- | ----------------------- | | **200** | Success | `SendTransactionOutput` | -**Consumes** +### Consumes - `application/json-patch+json; v=1.0` - `application/json; v=1.0` @@ -369,36 +375,38 @@ POST /api/blockChain/sendRawTransaction - `application/*+json; v=1.0` - `application/x-protobuf; v=1.0` -**Produces** +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -**Tags** +\*\*Tags - BlockChain --- -### Broadcast Multiple Transactions +## Broadcast Multiple Transactions -**POST** `/api/blockChain/sendTransactions` +```http +POST /api/blockChain/sendTransactions +``` -**Parameters** +### Parameters | Type | Name | Schema | Description | Required | | -------- | ------- | ----------------------- | ----------- | -------- | | **Body** | `input` | `SendTransactionsInput` | - | No | -**Responses** +### Responses | HTTP Code | Description | Schema | | --------- | ----------- | ------------ | | **200** | Success | `` | -**Consumes** +### Consumes - `application/json-patch+json; v=1.0` - `application/json; v=1.0` @@ -406,36 +414,38 @@ POST /api/blockChain/sendRawTransaction - `application/*+json; v=1.0` - `application/x-protobuf; v=1.0` -**Produces** +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -**Tags** +### Tags - BlockChain --- -### Estimate Transaction Fee +## Estimate Transaction Fee -**POST** `/api/blockChain/calculateTransactionFee` +```http +POST /api/blockChain/calculateTransactionFee +``` -**Parameters** +### Parameters | Type | Name | Schema | Description | Required | | -------- | ------- | ------------------------------ | ----------- | -------- | | **Body** | `input` | `CalculateTransactionFeeInput` | - | No | -**Responses** +### Responses | HTTP Code | Description | Schema | | --------- | ----------- | ------------------------------- | | **200** | Success | `CalculateTransactionFeeOutput` | -**Consumes** +### Consumes - `application/json-patch+json; v=1.0` - `application/json; v=1.0` @@ -443,74 +453,80 @@ POST /api/blockChain/sendRawTransaction - `application/*+json; v=1.0` - `application/x-protobuf; v=1.0` -**Produces** +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -**Tags** +### Tags - BlockChain --- -### Get the Current Status of a Transaction +## Get the Current Status of a Transaction -**GET** `/api/blockChain/transactionResult` +```http +GET /api/blockChain/transactionResult +``` -**Parameters** +### Parameters | Type | Name | Schema | Description | Required | | --------- | --------------- | -------- | -------------- | -------- | | **Query** | `transactionId` | `string` | Transaction ID | No | -**Responses** +### Responses | HTTP Code | Description | Schema | | --------- | ----------- | ---------------------- | | **200** | Success | `TransactionResultDto` | -**Produces** +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -**Tags** +### Tags - BlockChain --- -### Get the Transaction Pool Status +## Get the Transaction Pool Status -**GET** `/api/blockChain/transactionPoolStatus` +```http +GET /api/blockChain/transactionPoolStatus +``` -**Responses** +### Responses | HTTP Code | Description | Schema | | --------- | ----------- | -------------------------------- | | **200** | Success | `GetTransactionPoolStatusOutput` | -**Produces** +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -**Tags** +### Tags - BlockChain --- -### Get the Current Status of a Transaction +## Get the Current Status of a Transaction -**GET** `/api/blockChain/transactionResult` +```http +GET /api/blockChain/transactionResult +``` **Parameters** @@ -518,30 +534,32 @@ POST /api/blockChain/sendRawTransaction | --------- | ----------------- | -------------------------- | ------ | | **Query** | **transactionId** | _Optional_. Transaction ID | string | -**Responses** +### Responses | HTTP Code | Description | Schema | | --------- | ----------- | ---------------------- | | **200** | Success | `TransactionResultDto` | -**Produces** +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -**Tags** +### Tags - BlockChain --- -### Get Multiple Transaction Results +## Get Multiple Transaction Results -**GET** `/api/blockChain/transactionResults` +```http +GET /api/blockChain/transactionResults +``` -**Parameters** +### Parameters | Type | Name | Description | Schema | Default | | --------- | ------------- | --------------------------------- | --------------- | ------- | @@ -549,610 +567,19 @@ POST /api/blockChain/sendRawTransaction | **Query** | **limit** | _Optional_. Limit results | integer (int32) | `10` | | **Query** | **offset** | _Optional_. Offset for pagination | integer (int32) | `0` | -**Responses** +### Responses | HTTP Code | Description | Schema | | --------- | ----------- | ------------------------ | | **200** | Success | `TransactionResultDto[]` | -**Produces** +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -**Tags** +### Tags - BlockChain - ---- - -### Net API - -#### Get Network Information - -**GET** `/api/net/networkInfo` - -**Responses** - -| HTTP Code | Description | Schema | -| --------- | ----------- | ---------------------- | -| **200** | Success | `GetNetworkInfoOutput` | - -**Produces** - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Tags** - -- Net - ---- - -#### Add a Node to Connected Network Nodes - -**POST** `/api/net/peer` - -**Parameters** - -| Type | Name | Description | Schema | -| -------- | --------- | -------------------------- | -------------- | -| **Body** | **input** | _Optional_. Add peer input | `AddPeerInput` | - -**Responses** - -| HTTP Code | Description | Schema | -| --------- | ----------- | ------- | -| **200** | Success | boolean | - -| **401** | Unauthorized| | - -**Security** - -- Basic Authentication - -**Consumes** - -- `application/json-patch+json; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/*+json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Produces** - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Tags** - -- Net - ---- - -#### Remove a Node from Connected Network Nodes - -**DELETE** `/api/net/peer` - -**Parameters** - -| Type | Name | Description | Schema | -| --------- | ----------- | ---------------------- | ------ | -| **Query** | **address** | _Optional_. IP address | string | - -**Responses** - -| HTTP Code | Description | Schema | -| --------- | ----------- | ------- | -| **200** | Success | boolean | - -| **401** | Unauthorized| | - -**Security** - -- Basic Authentication - -**Produces** - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Tags** - -- Net - ---- - -#### Get Peer Info about Connected Network Nodes - -**GET** `/api/net/peers` - -**Parameters** - -| Type | Name | Description | Schema | Default | -| --------- | --------------- | --------------------------- | ------- | --------- | -| **Query** | **withMetrics** | _Optional_. Include metrics | boolean | `"false"` | - -**Responses** - -| HTTP Code | Description | Schema | -| --------- | ----------- | ----------- | -| **200** | Success | `PeerDto[]` | - -**Produces** - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Tags** - -- BlockChain - ---- - -## Definitions - -### AddPeerInput - -##### Description - -Represents the input parameters for adding a peer. - -#### Schema - -| Name | Description | Schema | -| --------- | ----------- | ------ | -| Address\* | IP address | string | - -### BlockBodyDto - -#### Description - -Represents the body of a block, including transactions and transaction count. - -#### Schema - -| Name | Schema | -| ----------------- | ---------------- | -| Transactions\* | < string > array | -| TransactionsCount | integer (int32) | - -### BlockDto - -#### Description - -Represents a block, including its hash, body, header, and size. - -#### Schema - -| Name | Schema | -| --------- | ---------------- | -| BlockHash | string | -| Body\* | `BlockBodyDto` | -| Header\* | `BlockHeaderDto` | -| BlockSize | integer (int32) | - -### BlockHeaderDto - -#### Description - -Represents the header of a block, including various metadata. - -#### Schema - -| Name | Schema | -| -------------------------------- | ------------------ | -| Bloom | string | -| ChainId | string | -| Extra | string | -| Height | integer (int64) | -| MerkleTreeRootOfTransactions | string | -| MerkleTreeRootOfWorldState | string | -| MerkleTreeRootOfTransactionState | string | -| PreviousBlockHash | string | -| SignerPubkey | string | -| Time | string (date-time) | - -### BlockStateDto - -#### Description - -Represents the state of a block, including hash, height, changes, deletes, and previous hash. - -#### Schema - -| Name | Schema | -| ------------ | ---------------------- | -| BlockHash | string | -| BlockHeight | integer (int64) | -| Changes\* | < string, string > map | -| Deletes\* | < string > array | -| PreviousHash | string | - -### ChainStatusDto - -#### Description - -Represents the status of a blockchain network, including chain details and block heights. - -#### Schema - -| Name | Schema | -| ----------------------------- | ------------------------------- | -| BestChainHash\* | string | -| BestChainHeight\* | integer (int64) | -| Branches\* | < string, integer (int64) > map | -| ChainId\* | string | -| GenesisBlockHash\* | string | -| GenesisContractAddress | string | -| LastIrreversibleBlockHash\* | string | -| LastIrreversibleBlockHeight\* | integer (int64) | -| LongestChainHash\* | string | -| LongestChainHeight\* | integer (int64) | -| NotLinkedBlocks\* | < string, string > map | - -### CreateRawTransactionInput - -#### Description - -Represents the input parameters for creating a raw transaction. - -#### Schema - -| Name | Description | Schema | -| ---------------- | -------------------------- | --------------- | -| From\* | From address | string | -| MethodName\* | Contract method name | string | -| Params\* | Contract method parameters | string | -| RefBlockHash\* | Reference block hash | string | -| RefBlockNumber\* | Reference block height | integer (int64) | -| To\* | To address | string | - -### CreateRawTransactionOutput - -#### Description - -Represents the output of creating a raw transaction. - -#### Schema - -| Name | Schema | -| -------------- | ------ | -| RawTransaction | string | - -### ExecuteRawTransactionDto - -#### Description - -Represents the input parameters for executing a raw transaction. - -#### Schema - -| Name | Description | Schema | -| ---------------- | --------------- | ------ | -| RawTransaction\* | Raw transaction | string | -| Signature\* | Signature | string | - -### ExecuteTransactionDto - -#### Description - -Represents the input parameters for executing a transaction. - -#### Schema - -| Name | Description | Schema | -| ---------------- | --------------- | ------ | -| RawTransaction\* | Raw transaction | string | - -### GetNetworkInfoOutput - -#### Description - -Represents the output of getting network information. - -#### Schema - -| Name | Description | Schema | -| ----------------- | ----------------- | --------------- | -| Connections\* | Total connections | integer (int32) | -| ProtocolVersion\* | Network protocol | integer (int32) | -| Version\* | Node version | string | - -### GetTransactionPoolStatusOutput - -#### Description - -Represents the output of getting transaction pool status. - -#### Schema - -| Name | Schema | -| ----------- | --------------- | -| Queued\* | integer (int32) | -| Validated\* | integer (int32) | - -### LogEventDto - -#### Description - -Represents a log event. - -#### Schema - -| Name | Schema | -| ------------ | ---------------- | -| Address\* | string | -| Indexed\* | < string > array | -| Name\* | string | -| NonIndexed\* | string | - -### MerklePathDto - -#### Description - -Represents a Merkle path. - -#### Schema - -| Name | Schema | -| ----------------- | ----------------------------- | -| MerklePathNodes\* | < `MerklePathNodeDto` > array | - -### MerklePathNodeDto - -#### Description - -Represents a node in a Merkle path. - -#### Schema - -| Name | Schema | -| ----------------- | ------- | -| Hash\* | string | -| IsLeftChildNode\* | boolean | - -### MinerInRoundDto - -#### Description - -Represents information about a miner in a round. - -#### Schema - -| Name | Schema | -| ------------------------------ | ---------------------------- | -| ActualMiningTimes\* | < string (date-time) > array | -| ExpectedMiningTime\* | string (date-time) | -| ImpliedIrreversibleBlockHeight | integer (int64) | -| InValue\* | string | -| MissedBlocks\* | integer (int64) | -| Order\* | integer (int32) | -| OutValue\* | string | -| PreviousInValue\* | string | -| ProducedBlocks\* | integer (int64) | -| ProducedTinyBlocks\* | integer (int32) | - -### PeerDto - -#### Description - -Represents information about a peer node. - -#### Schema - -| Name | Schema | -| ---------------------------- | ------------------------- | -| BufferedAnnouncementsCount\* | integer (int32) | -| BufferedBlocksCount\* | integer (int32) | -| BufferedTransactionsCount\* | integer (int32) | -| ConnectionTime\* | integer (int64) | -| Inbound\* | boolean | -| IpAddress\* | string | -| ProtocolVersion\* | integer (int32) | -| RequestMetrics\* | < `RequestMetric` > array | -| ConnectionStatus\* | string | -| NodeVersion\* | string | - -### RequestMetric - -#### Description - -Represents metrics for a request. - -#### Schema - -| Name | Schema | -| --------------- | --------------- | -| Info\* | string | -| MethodName\* | string | -| RequestTime\* | `Timestamp` | -| RoundTripTime\* | integer (int64) | - -### RoundDto - -#### Description - -Represents a round in the blockchain. - -#### Schema - -| Name | Schema | -| --------------------------------------- | --------------------------------- | -| ConfirmedIrreversibleBlockHeight\* | integer (int64) | -| ConfirmedIrreversibleBlockRoundNumber\* | integer (int64) | -| ExtraBlockProducerOfPreviousRound\* | string | -| IsMinerListJustChanged\* | boolean | -| RealTimeMinerInformation\* | < string, `MinerInRoundDto` > map | -| RoundId\* | integer (int64) | -| RoundNumber\* | integer (int64) | -| TermNumber\* | integer (int64) | - -### SendRawTransactionInput - -#### Description - -Represents the input parameters for sending a raw transaction. - -#### Schema - -| Name | Description | Schema | -| ------------------- | --------------- | ------- | -| ReturnTransaction\* | Return detail | boolean | -| Signature\* | Signature | string | -| Transaction\* | Raw transaction | string | - -### SendRawTransactionOutput - -#### Description - -Represents the output of sending a raw transaction. - -#### Schema - -| Name | Schema | -| --------------- | ---------------- | -| Transaction | `TransactionDto` | -| TransactionId\* | string | - -### SendTransactionInput - -#### Description - -Represents the input parameters for sending a transaction. - -#### Schema - -| Name | Description | Schema | -| ---------------- | --------------- | ------ | -| RawTransaction\* | Raw transaction | string | - -### SendTransactionOutput - -#### Description - -Represents the output of sending a transaction. - -#### Schema - -| Name | Schema | -| --------------- | ------ | -| TransactionId\* | string | - -### SendTransactionsInput - -#### Description - -Represents the input parameters for sending multiple transactions. - -#### Schema - -| Name | Description | Schema | -| ----------------- | ---------------- | ------ | -| RawTransactions\* | Raw transactions | string | - -### TaskQueueInfoDto - -#### Description - -Represents information about a task queue. - -#### Schema - -| Name | Schema | -|--------- - -|-----------------| -| Count* | integer (int32) | -| Time* | string (date-time)| - -### Timestamp - -#### Description - -Represents a timestamp. - -#### Schema - -| Name | Schema | -| --------- | --------------- | -| Seconds\* | integer (int64) | -| Nanos\* | integer (int32) | - -### TransactionDto - -#### Description - -Represents a transaction. - -#### Schema - -| Name | Schema | -| ----------------- | ------------------ | -| Hash\* | string | -| Height\* | integer (int64) | -| MethodName\* | string | -| Params\* | string | -| Receiver\* | string | -| RefBlockNumber\* | integer (int64) | -| Sender\* | string | -| Time\* | string (date-time) | -| TransactionSize\* | integer (int32) | -| TxStatus\* | string | - -### TransactionResultDto - -#### Description - -Represents the result of a transaction. - -#### Schema - -| Name | Description | Schema | -| --------------- | ------------------------------ | ----------------------- | -| BlockHash | Block hash (optional) | string | -| BlockNumber | Block number (optional) | integer (int64) | -| Bloom | Bloom filter (optional) | string | -| Error | Error message (optional) | string | -| Logs | Logs (optional) | < `LogEventDto` > array | -| ReturnValue | Return value (optional) | string | -| Status | Transaction status (optional) | string | -| Transaction | Transaction details (optional) | `TransactionDto` | -| TransactionId | Transaction ID (optional) | string | -| TransactionSize | Transaction size (optional) | integer (int32) | - -### CalculateTransactionFeeInput - -#### Description - -Represents the input parameters for calculating transaction fees. - -#### Schema - -| Name | Description | Schema | -| -------------- | ------------------------------- | ------ | -| RawTransaction | Raw transaction data (optional) | string | - -### CalculateTransactionFeeOutput - -#### Description - -Represents the output of calculating transaction fees. - -#### Schema - -| Name | Description | Schema | -| -------------- | ---------------------------------- | ------------------------ | -| Success | Success flag (optional) | bool | -| TransactionFee | Transaction fee details (optional) | Dictionary`` | -| ResourceFee | Resource fee details (optional) | Dictionary` `| diff --git a/docs/References/Web API/Net API.md b/docs/References/Web API/Net API.md index 98c6e30..c1ca575 100644 --- a/docs/References/Web API/Net API.md +++ b/docs/References/Web API/Net API.md @@ -1,640 +1,31 @@ -# AELF API 1.0 - -## Chain API - -### Get information about a given block by block hash. Optionally with the list of its transactions. - -```http -GET /api/blockChain/block -``` - -**Parameters** - -| Type | Name | Description | Schema | Default | -| --------- | --------------------- | ------------ | ------- | ------- | -| **Query** | `blockHash` | block hash | string | | -| | _optional_ | | | | -| **Query** | `includeTransactions` | include | boolean | "false" | -| | | transactions | | | -| | _optional_ | or not | | | - -**Responses** - -| HTTP Code | Description | Schema | -| --------- | ----------- | ---------- | -| **200** | Success | `BlockDto` | - -**Produces** - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Tags** - -- BlockChain - ---- - -### Get information about a given block by block height. Optionally with the list of its transactions. - -```http -GET /api/blockChain/blockByHeight -``` - -**Parameters** - -| Type | Name | Description | Schema | Default | -| --------- | --------------------- | ------------ | ------- | ------- | -| **Query** | `blockHeight` | block height | integer | | -| | _optional_ | | (int64) | | -| **Query** | `includeTransactions` | include | boolean | "false" | -| | | transactions | | | -| | _optional_ | or not | | | - -**Responses** - -| HTTP Code | Description | Schema | -| --------- | ----------- | ---------- | -| **200** | Success | `BlockDto` | - -**Produces** - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Tags** - -- BlockChain - ---- - -### Get the height of the current chain. - -```http -GET /api/blockChain/blockHeight -``` - -**Responses** - -| HTTP Code | Description | Schema | -| --------- | ----------- | --------------- | -| **200** | Success | integer (int64) | - -**Produces** - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Tags** - -- BlockChain - ---- - -### Get the current state about a given block - -```http -GET /api/blockChain/blockState -``` - -**Parameters** - -| Type | Name | Description | Schema | -| --------- | ----------- | ----------- | ------ | -| **Query** | `blockHash` | block hash | string | - -**Responses** - -| HTTP Code | Description | Schema | -| --------- | ----------- | --------------- | -| **200** | Success | `BlockStateDto` | - -**Produces** - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Tags** - -- BlockChain - ---- - -### Get the current status of the block chain. - -```http -GET /api/blockChain/chainStatus -``` - -**Responses** - -| HTTP Code | Description | Schema | -| --------- | ----------- | ---------------- | -| **200** | Success | `ChainStatusDto` | - -**Produces** - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Tags** - -- BlockChain - ---- - -### Get the protobuf definitions related to a contract - -```http -GET /api/blockChain/contractFileDescriptorSet -``` - -**Parameters** - -| Type | Name | Description | Schema | -| --------- | --------- | ---------------- | ------ | -| **Query** | `address` | contract address | string | - -**Responses** - -| HTTP Code | Description | Schema | -| --------- | ----------- | ------ | -| **200** | Success | byte | - -**Produces** - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Tags** - -- BlockChain - ---- - -### Execute a raw transaction - -```http -POST /api/blockChain/executeRawTransaction -``` - -**Parameters** - -| Type | Name | Schema | -| -------- | ------- | -------------------------- | -| **Body** | `input` | `ExecuteRawTransactionDto` | - -**Responses** - -| HTTP Code | Description | Schema | -| --------- | ----------- | ------ | -| **200** | Success | string | - -**Consumes** - -- `application/json-patch+json; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/*+json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Produces** - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Tags** - -- BlockChain - ---- - -### Call a read-only method on a contract - -```http -POST /api/blockChain/executeTransaction -``` - -**Parameters** - -| Type | Name | Schema | -| -------- | ------- | ----------------------- | -| **Body** | `input` | `ExecuteTransactionDto` | - -**Responses** - -| HTTP Code | Description | Schema | -| --------- | ----------- | ------ | -| **200** | Success | string | - -**Consumes** - -- `application/json-patch+json; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/*+json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Produces** - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Tags** - -- BlockChain - --- - -### Get the merkle path of a transaction - -```http -GET /api/blockChain/merklePathByTransactionId -``` - -**Parameters** - -| Type | Name | Schema | -| --------- | --------------- | ------ | -| **Query** | `transactionId` | string | - -**Responses** - -| HTTP Code | Description | Schema | -| --------- | ----------- | --------------- | -| **200** | Success | `MerklePathDto` | - -**Produces** - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Tags** - -- BlockChain - ---- - -### Create an unsigned serialized transaction - -```http -POST /api/blockChain/rawTransaction -``` - -**Parameters** - -| Type | Name | Schema | -| -------- | ------- | --------------------------- | -| **Body** | `input` | `CreateRawTransactionInput` | - -**Responses** - -| HTTP Code | Description | Schema | -| --------- | ----------- | ---------------------------- | -| **200** | Success | `CreateRawTransactionOutput` | - -**Consumes** - -- `application/json-patch+json; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/*+json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Produces** - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Tags** - -- BlockChain - ---- - -# Get the Current Status of a Transaction - -**GET** `/api/blockChain/transactionResult` - -**Parameters** - -| Type | Name | Schema | Description | Required | -| --------- | --------------- | -------- | -------------- | -------- | -| **Query** | `transactionId` | `string` | Transaction ID | No | - -**Responses** - -| HTTP Code | Description | Schema | -| --------- | ----------- | ---------------------- | -| **200** | Success | `TransactionResultDto` | - -**Produces** - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Tags** - -- BlockChain - ---- - -# Send a Transaction - -**POST** `/api/blockChain/sendRawTransaction` - -**Parameters** - -| Type | Name | Schema | -| -------- | --------- | -------------------------------------------------------- | -| **Body** | **input** | `SendRawTransactionInput <#sendrawtransactioninput>`\_\_ | - -**Responses** - -| HTTP Code | Description | Schema | -| --------- | ----------- | ---------------------------------------------------------- | -| **200** | Success | `SendRawTransactionOutput <#sendrawtransactionoutput>`\_\_ | - -**Consumes** - -- `application/json-patch+json; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/*+json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Produces** - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Tags** - -- BlockChain - ---- - -# Broadcast a Transaction - -**POST** `/api/blockChain/sendTransaction` - -**Parameters** - -| Type | Name | Schema | -| -------- | --------- | -------------------------------------------------- | -| **Body** | **input** | `SendTransactionInput <#sendtransactioninput>`\_\_ | - -**Responses** - -| HTTP Code | Description | Schema | -| --------- | ----------- | ---------------------------------------------------- | -| **200** | Success | `SendTransactionOutput <#sendtransactionoutput>`\_\_ | - -**Consumes** - -- `application/json-patch+json; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/*+json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Produces** - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Tags** - -- BlockChain - ---- - -# Broadcast Multiple Transactions - -**POST** `/api/blockChain/sendTransactions` - -**Parameters** - -| Type | Name | Schema | -| -------- | --------- | ---------------------------------------------------- | -| **Body** | **input** | `SendTransactionsInput <#sendtransactionsinput>`\_\_ | - -**Responses** - -| HTTP Code | Description | Schema | -| --------- | ----------- | ---------------- | -| **200** | Success | `` array | - -**Consumes** - -- `application/json-patch+json; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/*+json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Produces** - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Tags** - -- BlockChain - ---- - -# Estimate Transaction Fee - -**POST** `/api/blockChain/calculateTransactionFee` - -**Parameters** - -| Type | Name | Schema | Default | -| -------- | --------- | ------------------------------------------------------------------ | ------- | -| **Body** | **Input** | `CalculateTransactionFeeInput <#calculatetransactionfeeinput>`\_\_ | - | - -**Responses** - -| HTTP Code | Description | Schema | -| --------- | ----------- | -------------------------------------------------------------------- | -| **200** | Success | `CalculateTransactionFeeOutput <#calculatetransactionfeeoutput>`\_\_ | - -**Consumes** - -- `application/json-patch+json; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/*+json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Produces** - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -**Tags** - -- BlockChain - ---- - -# Get the Current Status of a Transaction - -**GET** `/api/blockChain/transactionResult` - -## Parameters - -| Type | Name | Schema | Description | Required | -| --------- | --------------- | -------- | -------------- | -------- | -| **Query** | `transactionId` | `string` | Transaction ID | No | - -## Responses - -| HTTP Code | Description | Schema | -| --------- | ----------- | ---------------------- | -| **200** | Success | `TransactionResultDto` | - -## Produces - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -## Tags - -- BlockChain - ---- - -# Get Task Queue Status - -**GET** `/api/blockChain/taskQueueStatus` - -## Responses - -| HTTP Code | Description | Schema | -| --------- | ----------- | ------------------------ | -| **200** | Success | `TaskQueueInfoDto` array | - -## Produces - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -## Tags - -- BlockChain - ---- - -# Get Transaction Pool Status - -**GET** `/api/blockChain/transactionPoolStatus` - -## Responses - -| HTTP Code | Description | Schema | -| --------- | ----------- | -------------------------------- | -| **200** | Success | `GetTransactionPoolStatusOutput` | - -## Produces - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -## Tags - -- BlockChain - ---- - -# Get Multiple Transaction Results - -**GET** `/api/blockChain/transactionResults` - -## Parameters - -| Type | Name | Description | Schema | Default | -| --------- | ----------- | ----------- | --------------- | ------- | -| **Query** | `blockHash` | block hash | string | | -| **Query** | `limit` | limit | integer (int32) | `10` | -| **Query** | `offset` | offset | integer (int32) | `0` | - -## Responses - -| HTTP Code | Description | Schema | -| --------- | ----------- | ---------------------------- | -| **200** | Success | `TransactionResultDto` array | - -## Produces - -- `text/plain; v=1.0` -- `application/json; v=1.0` -- `text/json; v=1.0` -- `application/x-protobuf; v=1.0` - -## Tags - -- BlockChain - +sidebar_position: 2 +title: Net API +description: Net API --- # Net API ## Get Network Information -**GET** `/api/net/networkInfo` +```http +GET /api/net/networkInfo +``` -## Responses +### Responses | HTTP Code | Description | Schema | | --------- | ----------- | ---------------------- | | **200** | Success | `GetNetworkInfoOutput` | -## Produces +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -## Tags +### Tags - Net @@ -642,26 +33,28 @@ POST /api/blockChain/rawTransaction ## Add Peer -**POST** `/api/net/peer` +```http +POST /api/net/peer +``` -## Parameters +#### Parameters | Type | Name | Schema | | -------- | ------- | -------------- | | **Body** | `input` | `AddPeerInput` | -## Responses +### Responses | HTTP Code | Description | Schema | | --------- | ------------ | ------- | | **200** | Success | boolean | | **401** | Unauthorized | | -## Security +### Security - Basic Authentication -## Consumes +### Consumes - `application/json-patch+json; v=1.0` - `application/json; v=1.0` @@ -669,14 +62,14 @@ POST /api/blockChain/rawTransaction - `application/*+json; v=1.0` - `application/x-protobuf; v=1.0` -## Produces +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -## Tags +### Tags - Net @@ -686,31 +79,31 @@ POST /api/blockChain/rawTransaction **DELETE** `/api/net/peer` -## Parameters +### Parameters | Type | Name | Description | Schema | | --------- | --------- | ----------- | ------ | | **Query** | `address` | ip address | string | -## Responses +### Responses | HTTP Code | Description | Schema | | --------- | ------------ | ------- | | **200** | Success | boolean | | **401** | Unauthorized | | -## Security +### Security - Basic Authentication -## Produces +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -## Tags +### Tags - Net @@ -720,61 +113,61 @@ POST /api/blockChain/rawTransaction **GET** `/api/net/peers` -## Parameters +### Parameters | Type | Name | Description | Schema | Default | | --------- | ------------- | ----------- | ------ | --------- | | **Query** | `withMetrics` | boolean | | `"false"` | -## Responses +### Responses | HTTP Code | Description | Schema | | --------- | ----------- | --------------- | | **200** | Success | `PeerDto` array | -## Produces +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -## Tags +### Tags - BlockChain --- -### Get the Current Status of a Transaction +## Get the Current Status of a Transaction **GET** `/api/blockChain/transactionResult` -**Parameters** +### Parameters | Type | Name | Schema | Description | Required | | --------- | --------------- | -------- | -------------- | -------- | | **Query** | `transactionId` | `string` | Transaction ID | No | -**Responses** +### Responses | HTTP Code | Description | Schema | | --------- | ----------- | ---------------------- | | **200** | Success | `TransactionResultDto` | -**Produces** +### Produces - `text/plain; v=1.0` - `application/json; v=1.0` - `text/json; v=1.0` - `application/x-protobuf; v=1.0` -**Tags** +### Tags - BlockChain --- -### Definitions +## Definitions #### AddPeerInput @@ -1122,7 +515,7 @@ This structure should provide a clear overview of each variable's name, schema, --- -### CalculateTransactionFeeOutput +#### CalculateTransactionFeeOutput **Name:** CalculateTransactionFeeOutput diff --git a/docs/Tutorials/Running aelf On The Cloud/googleCloud.md b/docs/Tutorials/Running aelf On The Cloud/googleCloud.md deleted file mode 100644 index ce22bac..0000000 --- a/docs/Tutorials/Running aelf On The Cloud/googleCloud.md +++ /dev/null @@ -1,50 +0,0 @@ -# Getting Started with Google Cloud - -This guide will walk you through the steps required to run an aelf node on Google Cloud Platform (GCP). - -## Step 1: Launch aelf Image - -1. Go to the [Google Cloud Marketplace](https://console.cloud.google.com/marketplace) and search for "aelf blockchain for enterprise". - - ![image](gcp-step1.png) - -2. Find the aelf image and click on "LAUNCH ON COMPUTE ENGINE". - - ![image](gcp-step2-b.png) - -3. Keep the default settings and click "DEPLOY" at the bottom left of the page. - - ![image](gcp-deployed.png) - -## Step 2: Access and Start the Chain - -1. Login to the launched VM instance via SSH. You can do this by clicking the SSH drop-down and selecting "Open in browser window". - - ![image](gcp-ssh-select.png) - -2. In the SSH session, execute `sudo bash` to elevate your privileges. - -3. Start the chain with one of the following commands: - - - Run it in the foreground: - ```bash - cd /opt/aelf-node && docker-compose up - ``` - - Or run it in the background: - ```bash - cd /opt/aelf-node && docker-compose up -d - ``` - - ![image](gcp-docker-compose.png) - -## Step 3: Verify Chain Status - -1. To verify that the node is working, use the following command to send an HTTP request and get the current chain status: - - ```bash - curl -X GET "http://127.0.0.1:8001/api/blockChain/chainStatus" -H "accept: text/plain; v=1.0" - ``` - - ![image](gcp-curl-chain-stat.png) - -2. If everything is working normally, you should see the chain status increase with each request. diff --git a/docs/tutorials/aelf On The Cloud/googleCloud.md b/docs/Tutorials/aelf-on-the-cloud/index.md similarity index 77% rename from docs/tutorials/aelf On The Cloud/googleCloud.md rename to docs/Tutorials/aelf-on-the-cloud/index.md index ce22bac..180aec5 100644 --- a/docs/tutorials/aelf On The Cloud/googleCloud.md +++ b/docs/Tutorials/aelf-on-the-cloud/index.md @@ -1,3 +1,9 @@ +--- +sidebar_position: 1 +title: aelf On Cloud +description: aelf On Cloud +--- + # Getting Started with Google Cloud This guide will walk you through the steps required to run an aelf node on Google Cloud Platform (GCP). @@ -6,21 +12,21 @@ This guide will walk you through the steps required to run an aelf node on Googl 1. Go to the [Google Cloud Marketplace](https://console.cloud.google.com/marketplace) and search for "aelf blockchain for enterprise". - ![image](gcp-step1.png) + ![image](../../../static/img/gcp-step1.png) 2. Find the aelf image and click on "LAUNCH ON COMPUTE ENGINE". - ![image](gcp-step2-b.png) + ![image](../../../static/img/gcp-step2-b.png) 3. Keep the default settings and click "DEPLOY" at the bottom left of the page. - ![image](gcp-deployed.png) + ![image](../../../static/img/gcp-deployed.png) ## Step 2: Access and Start the Chain 1. Login to the launched VM instance via SSH. You can do this by clicking the SSH drop-down and selecting "Open in browser window". - ![image](gcp-ssh-select.png) + ![image](../../../static/img/gcp-ssh-select.png) 2. In the SSH session, execute `sudo bash` to elevate your privileges. @@ -35,7 +41,7 @@ This guide will walk you through the steps required to run an aelf node on Googl cd /opt/aelf-node && docker-compose up -d ``` - ![image](gcp-docker-compose.png) + ![image](../../../static/img/gcp-docker-compose.png) ## Step 3: Verify Chain Status @@ -45,6 +51,6 @@ This guide will walk you through the steps required to run an aelf node on Googl curl -X GET "http://127.0.0.1:8001/api/blockChain/chainStatus" -H "accept: text/plain; v=1.0" ``` - ![image](gcp-curl-chain-stat.png) + ![image](../../../static/img/gcp-curl-chain-stat.png) 2. If everything is working normally, you should see the chain status increase with each request. diff --git a/docs/Tutorials/Running A Side Chain/requestSideChainCreation.md b/docs/Tutorials/running-a-side-chain/Request Side Chain Creation.md similarity index 98% rename from docs/Tutorials/Running A Side Chain/requestSideChainCreation.md rename to docs/Tutorials/running-a-side-chain/Request Side Chain Creation.md index ce12429..e8ad9f1 100644 --- a/docs/Tutorials/Running A Side Chain/requestSideChainCreation.md +++ b/docs/Tutorials/running-a-side-chain/Request Side Chain Creation.md @@ -1,4 +1,8 @@ -# Requesting the Creation of a Side Chain +--- +sidebar_position: 1 +title: Requesting the Creation of a Side Chain +description: Requesting the Creation of a Side Chain +--- Side chains can be created in the aelf ecosystem to enable scalability. This section introduces the process in detail. @@ -51,7 +55,7 @@ This creation of a side chain (logical, on-chain creation) is done in four steps 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). +- 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: diff --git a/docs/Tutorials/Running A Side Chain/runningASideChain.md b/docs/Tutorials/running-a-side-chain/runningASideChain.md similarity index 92% rename from docs/Tutorials/Running A Side Chain/runningASideChain.md rename to docs/Tutorials/running-a-side-chain/runningASideChain.md index 8c20565..f693d76 100644 --- a/docs/Tutorials/Running A Side Chain/runningASideChain.md +++ b/docs/Tutorials/running-a-side-chain/runningASideChain.md @@ -1,3 +1,9 @@ +--- +sidebar_position: 2 +title: Running a Side Chain +description: Running a Side Chain +--- + # Running a Side Chain (After its Release) This tutorial explains how to run a side chain node after it has been approved by the producers and released by the creator. After creating the side chain, producers need to run a side chain node. @@ -26,7 +32,7 @@ Two configuration files must be placed in the configuration folder of the side c After the release of the side chain creation request, the ChainId of the new side chain will be accessible in the SideChainCreatedEvent logged by the transaction that released it. -In this example, we will set up the side chain node with ChainId `tDVV` (1866392 converted to base58), connecting to Redis `db2`, and using web API port `1235`. Don’t forget to change the account, password, and initial miner. +In this example, we will set up the side chain node with ChainId `tDVV` (1866392 converted to base58), connecting to Redis `db2`, and using web API port `1235`. Don’t forget to change the `account`, `password`, and `initial miner`. #### appsettings.json diff --git a/docs/tutorials/aelf On The Cloud/gcp-curl-chain-stat.png b/docs/tutorials/aelf On The Cloud/gcp-curl-chain-stat.png deleted file mode 100644 index d9675ab..0000000 Binary files a/docs/tutorials/aelf On The Cloud/gcp-curl-chain-stat.png and /dev/null differ diff --git a/docs/tutorials/aelf On The Cloud/gcp-deployed.png b/docs/tutorials/aelf On The Cloud/gcp-deployed.png deleted file mode 100644 index 1bbd421..0000000 Binary files a/docs/tutorials/aelf On The Cloud/gcp-deployed.png and /dev/null differ diff --git a/docs/tutorials/aelf On The Cloud/gcp-docker-compose.png b/docs/tutorials/aelf On The Cloud/gcp-docker-compose.png deleted file mode 100644 index 31f069e..0000000 Binary files a/docs/tutorials/aelf On The Cloud/gcp-docker-compose.png and /dev/null differ diff --git a/docs/tutorials/aelf On The Cloud/gcp-ssh-select.png b/docs/tutorials/aelf On The Cloud/gcp-ssh-select.png deleted file mode 100644 index ef2d143..0000000 Binary files a/docs/tutorials/aelf On The Cloud/gcp-ssh-select.png and /dev/null differ diff --git a/docs/tutorials/aelf On The Cloud/gcp-step1.png b/docs/tutorials/aelf On The Cloud/gcp-step1.png deleted file mode 100644 index b447dbb..0000000 Binary files a/docs/tutorials/aelf On The Cloud/gcp-step1.png and /dev/null differ diff --git a/docs/tutorials/aelf On The Cloud/gcp-step2-a.png b/docs/tutorials/aelf On The Cloud/gcp-step2-a.png deleted file mode 100644 index 764e9f5..0000000 Binary files a/docs/tutorials/aelf On The Cloud/gcp-step2-a.png and /dev/null differ diff --git a/docs/tutorials/aelf On The Cloud/gcp-step2-b.png b/docs/tutorials/aelf On The Cloud/gcp-step2-b.png deleted file mode 100644 index 2c1d01e..0000000 Binary files a/docs/tutorials/aelf On The Cloud/gcp-step2-b.png and /dev/null differ diff --git a/docs/Architecture/Cross Chain/architecture-node.png b/static/img/architecture-node.png similarity index 100% rename from docs/Architecture/Cross Chain/architecture-node.png rename to static/img/architecture-node.png diff --git a/docs/Architecture/Cross Chain/architecture-topology.png b/static/img/architecture-topology.png similarity index 100% rename from docs/Architecture/Cross Chain/architecture-topology.png rename to static/img/architecture-topology.png diff --git a/docs/Tutorials/Running aelf On The Cloud/gcp-curl-chain-stat.png b/static/img/gcp-curl-chain-stat.png similarity index 100% rename from docs/Tutorials/Running aelf On The Cloud/gcp-curl-chain-stat.png rename to static/img/gcp-curl-chain-stat.png diff --git a/docs/Tutorials/Running aelf On The Cloud/gcp-deployed.png b/static/img/gcp-deployed.png similarity index 100% rename from docs/Tutorials/Running aelf On The Cloud/gcp-deployed.png rename to static/img/gcp-deployed.png diff --git a/docs/Tutorials/Running aelf On The Cloud/gcp-docker-compose.png b/static/img/gcp-docker-compose.png similarity index 100% rename from docs/Tutorials/Running aelf On The Cloud/gcp-docker-compose.png rename to static/img/gcp-docker-compose.png diff --git a/docs/Tutorials/Running aelf On The Cloud/gcp-ssh-select.png b/static/img/gcp-ssh-select.png similarity index 100% rename from docs/Tutorials/Running aelf On The Cloud/gcp-ssh-select.png rename to static/img/gcp-ssh-select.png diff --git a/docs/Tutorials/Running aelf On The Cloud/gcp-step1.png b/static/img/gcp-step1.png similarity index 100% rename from docs/Tutorials/Running aelf On The Cloud/gcp-step1.png rename to static/img/gcp-step1.png diff --git a/docs/Tutorials/Running aelf On The Cloud/gcp-step2-a.png b/static/img/gcp-step2-a.png similarity index 100% rename from docs/Tutorials/Running aelf On The Cloud/gcp-step2-a.png rename to static/img/gcp-step2-a.png diff --git a/docs/Tutorials/Running aelf On The Cloud/gcp-step2-b.png b/static/img/gcp-step2-b.png similarity index 100% rename from docs/Tutorials/Running aelf On The Cloud/gcp-step2-b.png rename to static/img/gcp-step2-b.png diff --git a/docs/Architecture/Cross Chain/introduction-topology.png b/static/img/introduction-topology.png similarity index 100% rename from docs/Architecture/Cross Chain/introduction-topology.png rename to static/img/introduction-topology.png diff --git a/docs/Architecture/Cross Chain/merkle-path.png b/static/img/merkle-path.png similarity index 100% rename from docs/Architecture/Cross Chain/merkle-path.png rename to static/img/merkle-path.png diff --git a/docs/Architecture/Cross Chain/merkle.png b/static/img/merkle.png similarity index 100% rename from docs/Architecture/Cross Chain/merkle.png rename to static/img/merkle.png diff --git a/docs/Architecture/Core/node-archi.png b/static/img/node-archi.png similarity index 100% rename from docs/Architecture/Core/node-archi.png rename to static/img/node-archi.png diff --git a/docs/Architecture/Cross Chain/side-chain-nodes.png b/static/img/side-chain-nodes.png similarity index 100% rename from docs/Architecture/Cross Chain/side-chain-nodes.png rename to static/img/side-chain-nodes.png