Create an account with the transfer open strategy
The transfer open strategy allows the creation of new accounts without requiring payment of registration fees. Instead, users must transfer a specific amount of tokens to a non-existent account. You can configure this amount by modifying the value of the min_amount
property in the chromia.yml
file. For detailed information, consult the relevant section in the Dapp Monetization course.
To enable the transfer open strategy for account registration, you need to make the following changes in the chromia.yml
file:
blockchains:
transfer-open:
module: main
moduleArgs:
lib.ft4.core.accounts.strategies.transfer:
rules:
- sender_blockchain: x"1203A19CC7DE2431E18AA1D055753931ABAE5F564E6BC9F99C86184ADDF56763"
sender: "X"
recipient: "X"
asset:
issuing_blockchain_rid: x"1203A19CC7DE2431E18AA1D055753931ABAE5F564E6BC9F99C86184ADDF56763"
name: "Test"
min_amount: 10000000L
timeout_days: 15
strategy: "open"
compile:
rellVersion: 0.13.5
database:
schema: schema_transfer_open
test:
modules:
- test
moduleArgs:
lib.ft4.core.accounts.strategies.transfer:
rules:
- sender_blockchain: x"0000000000000000000000000000000000000000000000000000000000000000"
sender: "*"
recipient: "*"
asset:
issuing_blockchain_rid: x"0000000000000000000000000000000000000000000000000000000000000000"
name: "Test"
min_amount: 10000000L
timeout_days: 15
strategy: "open"
lib.ft4.core.admin:
admin_pubkey: "020E362CD8F8A94F2DB470564E667BD906812BC4ABB1C075650E3787E711B779D7"
libs:
ft4:
registry: https://bitbucket.org/chromawallet/ft3-lib
path: rell/src/lib/ft4
tagOrBranch: v0.8.0r
rid: x"B6AE6AC82AC735BFB9E4E412FFB76BF95380E94F371F5F6A14E71A3AA7D5FEF6"
insecure: false
To complete the process, you'll also need to register a token and send it to a non-existent account for activation as shown in the code example below.
Additionally, don't forget to specify the asset icon URL for the registered token in the src/main.rell
file as displayed below:
module;
import lib.ft4.accounts.strategies.transfer.open;
import lib.ft4.assets.{ asset, Unsafe };
object dapp_meta {
asset = Unsafe.register_asset("Test", "TST", 6, chain_context.blockchain_rid, "https://url-to-asset-icon");
}
For a complete code example, refer to the Cookbook repository.