You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/dev/protocol/tx/babel-fleet.md
+115-87
Original file line number
Diff line number
Diff line change
@@ -1,56 +1,64 @@
1
1
# Babel Fees Plugin Documentation
2
2
3
-
The **Babel Fees Plugin** is a Fleet SDK extension that lets users pay transaction fees with tokens instead of ERG. This approach proves useful for users who start with empty wallets. It facilitates token-to-ERG swaps for fee payments. The plugin includes functions that create Babel Fee contracts, validate Babel Boxes, and manage contract states. It plugs into Fleet SDK's transaction framework, which makes it possible to build complex transactions that do not require a native ERG balance for fee payment.
3
+
The Babel Fees Plugin is a specialized extension for the Fleet SDK designed to simplify the process of using Babel Fees within Ergo transactions. Babel Fees is a mechanism that allows users to pay transaction fees with tokens instead of ERG, particularly beneficial for those with limited or no ERG balances. The plugin automates the complex process of token-to-ERG conversion necessary for utilizing Babel Fees. It integrates seamlessly into the Fleet SDK’s transaction framework, enabling developers to build sophisticated transactions that don't require users to have a native ERG balance for transaction fee payments.
4
+
5
+
## What are Babel Fees?
6
+
7
+
At its core, [Babel Fees](babel-fees.md) is an Ergo protocol feature that enables users to pay transaction fees using a variety of tokens, rather than being restricted to using ERG. This is done by leveraging smart contracts which act as liquidity sources (called “Babel Boxes”) for token-to-ERG swaps. These contracts are set up by others who wish to provide this liquidity to users.
8
+
9
+
Babel Fees offer key benefits:
10
+
11
+
-**Accessibility**: Allows users with limited or no ERG to interact with the Ergo network.
12
+
-**Flexibility**: Users can choose which tokens they want to use for paying fees.
13
+
-**Onboarding**: Makes it easier for new users to join the ecosystem.
4
14
5
15
---
6
16
7
-
###Key Features
17
+
## Key Features
8
18
9
-
1.**Token-Based Fee Payment**:
10
19
11
-
- Enables users to pay fees with tokens.
12
-
- Automates token-to-ERG swaps.
13
20
14
-
2.**Validation Utilities**:
21
+
- Transaction Extension:
15
22
16
-
-Validate Babel Boxes and their associated contracts.
17
-
-Check contract parameters and fields to ensure correct configurations.
23
+
-Provides a BabelSwapPlugin that seamlessly integrates with Fleet SDK's TransactionBuilder.
24
+
-Modifies transaction inputs and outputs to incorporate Babel Fee logic.
18
25
19
-
3.**Customizable Contracts**:
26
+
- Babel Box Validation:
20
27
21
-
-Developers define token prices and liquidity for Babel Boxes.
22
-
-Contracts adjust their parameters based on a specific token ID.
28
+
-Offers utilities to validate the structure and parameters of Babel Boxes.
29
+
-Ensures compliance with the Babel Fees protocol.
23
30
24
-
4.**Optimized for Modern Development**:
31
+
- Contract Script Generation:
25
32
26
-
- Supports both ESM and CommonJS modules.
27
-
- Offers tree-shaking for reduced bundle size.
33
+
- Includes functions for building and verifying Babel Fee contract scripts (ErgoTree).
28
34
35
+
- Developer-Friendly:
36
+
37
+
- Supports ESM and CommonJS modules.
38
+
- Tree-shakeable design for smaller bundle sizes.
29
39
---
30
40
31
-
###Installation
41
+
## Installation
32
42
33
-
Install the Babel Fees Plugin with npm:
43
+
To install the plugin, use the following commands in your project:
34
44
35
45
```bash
36
46
npm install @fleet-sdk/babel-fees-plugin
37
47
```
38
48
39
-
The Babel Fees Plugin requires Fleet SDK Core:
40
-
49
+
The core Fleet SDK is also required:
41
50
```bash
42
51
npm install @fleet-sdk/core
43
52
```
44
53
45
-
This plugin requires Node.js 18 or newer.
54
+
**System Requirements**: Node.js version 18 or newer.
46
55
47
56
---
48
57
49
-
###Usage Example
58
+
## Usage Example: Add Babel Fees to a Transaction
50
59
51
-
#### Add Babel Fees to a Transaction
60
+
This example demonstrates how to pay for transaction fees using tokens with BabelSwapPlugin.
52
61
53
-
The code below constructs a transaction that pays its fees with tokens instead of ERG. It sets the current blockchain height, adds inputs, integrates Babel fee logic, requests minimum fees, assigns a change address, and builds the final transaction object. After the build step completes, the transaction object includes instructions that convert a defined amount of tokens into the necessary ERG fees.
@@ -71,67 +79,87 @@ const tx = new TransactionBuilder(1000000) // Replace with current block height
71
79
console.log(tx);
72
80
```
73
81
74
-
This snippet demonstrates a transaction builder in action. The `BabelSwapPlugin` function takes a Babel Box and configuration parameters for token-to-ERG conversion. The plugin then attaches fee-paying logic to the transaction. When the transaction finalizes, the included Babel Box and token parameters ensure that any required ERG fees are sourced from the specified tokens.
75
-
76
-
---
77
-
78
-
### API Reference
79
-
80
-
#### Plugins
81
-
82
-
1.**`BabelSwapPlugin`**
83
-
84
-
-**Description**: Integrates Babel fee functionality into a transaction, converting tokens into ERG to meet fee requirements.
85
-
-**Parameters**:
86
-
87
-
- `babelBox`: A valid Babel Fee box. A Babel Box contains tokens and ERG that a contract uses to set a token price.
88
-
- `token`: An object that specifies the token ID and the token amount used to generate the necessary ERG fees.
- The code initializes a `TransactionBuilder` with the current block height.
85
+
-`from(inputs)` includes input boxes for the transaction.
86
+
-`extend(BabelSwapPlugin(...))` adds the BabelSwapPlugin to the transaction. The plugin takes a Babel Box, token ID, and the token amount to convert for ERG fees.
87
+
-`payMinFee()` ensures the inclusion of minimum required network fees.
88
+
-`sendChangeTo(...)` defines the address for remaining funds after fee conversion.
89
+
-`build()` finalizes the transaction object.
98
90
99
-
This plugin modifies a transaction so that the transaction no longer requires a direct ERG payment for fees. It uses the Babel Box as a liquidity source to convert specified tokens into enough ERG to cover the fee.
91
+
This example showcases how to use Babel Fees with the plugin without any direct ERG input from the user for transaction fees.
ReturnsaBabelFeeErgoTreeforagiventokenID. Thisfunction constructs the contract script that defines how tokens and ERG interact inside a Babel Box. Developers use this when they want to generate a Babel Box contract for a specific token.
@@ -163,15 +191,15 @@ This snippet uses the Ergo API to locate and return a Babel Box. Developers supp
163
191
164
192
---
165
193
166
-
###Step-by-Step
194
+
## Step-by-Step
167
195
168
-
Read [this guide](http://147.182.244.219/ergobabelfees.html) for details on minting a token, creating a Babel Box, and using a web application to self-sign transactions with Babel Fees involved. The guide walks through each stage, which includes preparing a token, generating a Babel Box contract, and integrating the BabelSwapPlugin within a Fleet SDK transaction.
169
196
197
+
For a detailed guide on how to mint a token, set up a Babel Box, and utilize the plugin within a web application, refer to [this guide](http://147.182.244.219/ergobabelfees.html).
170
198
---
171
199
172
-
###Development Insights
200
+
## Development Insights
173
201
174
-
####Key Updates from `CHANGELOG.md`
202
+
### Key Updates from `CHANGELOG.md`
175
203
176
204
-**Validation Enhancements**:
177
205
@@ -181,7 +209,7 @@ Read [this guide](http://147.182.244.219/ergobabelfees.html) for details on mint
181
209
182
210
- Adjusted the ESM and CommonJS exports in version `0.1.10` to prevent issues with package imports.
183
211
184
-
####Package Metadata
212
+
### Package Metadata
185
213
186
214
-**Version**: `0.1.18`
187
215
-**Dependencies**:
@@ -196,9 +224,9 @@ Read [this guide](http://147.182.244.219/ergobabelfees.html) for details on mint
196
224
197
225
---
198
226
199
-
###Testing and Validation
227
+
## Testing and Validation
200
228
201
-
####Unit Testing Example
229
+
### Unit Testing Example
202
230
203
231
The unit test below verifies that the `BabelSwapPlugin` integrates Babel fee logic into a transaction. It sets a mock Babel Box, builds a transaction that uses the plugin, and checks whether the resulting transaction includes the Babel Box as a source of fee liquidity.
204
232
@@ -223,14 +251,14 @@ This test confirms the presence of the Babel Box in the transaction inputs. If i
223
251
224
252
---
225
253
226
-
###Reference Implementations
254
+
## Reference Implementations
227
255
228
256
*[Implementing Ergo Babel Fees with Fleet-SDK - May 17, 2024](http://147.182.244.219/ergobabelfees.html)
Copy file name to clipboardexpand all lines: docs/mining/setup/join.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ This guide will walk you through the process of starting to mine Ergo using [Aut
7
7
Before you start mining, make sure you have the following:
8
8
9
9
- Familiarity with Ergo. If you're new, start with [What is Ergo?](why.md)
10
-
- A computer with at least one GPU that has more than 4GB of memory. Check the [Autolykos v2 hashrates spreadsheet](https://docs.google.com/spreadsheets/d/1NsuoDB27EwCo_BlSjCP3GMLfTSJRPIWIBsL-wPTllUg) for potential hashrates.
10
+
- A computer with at least one GPU that has more than 6GB of memory. Check the [Autolykos v2 hashrates spreadsheet](https://docs.google.com/spreadsheets/d/1NsuoDB27EwCo_BlSjCP3GMLfTSJRPIWIBsL-wPTllUg) for potential hashrates.
11
11
- If you're considering building a dedicated rig, refer to our guide on [Building a rig](rig.md).
0 commit comments