Used to check for browser translation.
用于检测浏览器翻译。
ブラウザの翻訳を検出する
Blocklet Specification (blocklet.yml)

Monetization


The Blocklet Framework provides a robust, on-chain monetization system. Developers can set prices for their blocklets, define complex revenue-sharing models with contributors, and even create pricing tiers for components used within other blocklets. When a user makes a purchase, they receive an NFT that acts as a verifiable credential of ownership.

Important: Configuration Has Moved While the underlying monetization engine remains the same, the configuration of the payment and nftFactory fields has been moved from the blocklet.yml file to the Blocklet Store's user interface. This change simplifies the publishing workflow and ensures compatibility with the latest on-chain protocols.

The technical details below are provided for developers maintaining legacy blocklets or for those interested in the underlying mechanism.


The payment Object#

The payment object is the core of a blocklet's monetization strategy. It defines the price, how revenue is distributed, and how the blocklet should be priced when used as a component by other blocklets.

payment:
price: []
share: []
componentPrice: []

payment.price#

This field sets the purchase price of the blocklet. The system currently supports a single token and price per blocklet.

Field

Type

Description

value

number

The cost of the blocklet. Must be greater than 0.

address

string

The DID address of the token used for payment (e.g., the address for ABT).

Example: Setting a Price of 100 Tokens

payment:
price:
- value: 100
address: 'z2ia8e555g54t8k8y526d1p4t4f2j2g7q7k8'

payment.share#

This array defines how revenue from a sale is distributed among multiple beneficiaries after any component fees have been deducted. It allows for automated, on-chain revenue sharing between developers, contributors, or other stakeholders.

The sum of all value fields in the share array must equal 1, representing 100% of the remaining revenue.

Field

Type

Description

name

string

A descriptive name for the beneficiary.

address

string

The DID address of the beneficiary who will receive the funds.

value

number

The proportion of the revenue to be sent to this beneficiary (e.g., 0.7 for 70%). Maximum of 4 beneficiaries.

Example: 70/30 Revenue Share

payment:
price:
- value: 100
address: 'z2ia8e555g54t8k8y526d1p4t4f2j2g7q7k8'
share:
- name: 'Main Developer'
address: 'z1m2n3o4p5q6r7s8t9u0v1w2x3y4z5a6b7c8d9e0'
value: 0.7
- name: 'Designer'
address: 'z9f8e7d6c5b4a3z5y4x3w2v1u0t9s8r7q6p5o4n3'
value: 0.3

payment.componentPrice#

This property is defined within a component blocklet to set its price when it's included in another, parent blocklet. This enables flexible pricing models for reusable components.

Field

Type

Description

parentPriceRange

number[]

An array of two numbers [min, max] defining the parent blocklet's price range for this rule to apply. If omitted, it serves as the default rule.

type

string

The pricing model. Can be 'fixed' for a set amount or 'percentage' for a fraction of the parent's price.

value

number

The fixed amount or percentage value. For 'percentage', 0.1 represents 10%.

Example: Tiered Component Pricing

This component costs a fixed 5 tokens if the parent blocklet costs 50 or less, and 8% of the parent's price if it costs more.

# In a component's blocklet.yml
payment:
componentPrice:
- parentPriceRange: [0, 50]
type: 'fixed'
value: 5
- parentPriceRange: [50.01, 1000000] # A large upper bound
type: 'percentage'
value: 0.08

On-Chain Fund Distribution#

When a user purchases a composite blocklet (a blocklet that includes other components), a smart contract on the OCAP Chain executes to distribute the funds automatically and transparently. The process prioritizes component developers, ensuring they are paid first before the remaining funds are distributed to the parent blocklet's beneficiaries.

This entire process is now orchestrated by the Blocklet Store during the purchase flow.


nftFactory Field#

This field holds the DID of the asset factory responsible for minting the purchase NFT. This NFT serves as the user's proof of purchase and ownership.

nftFactory: 'z2q.......'

This value is now always generated and set by the Blocklet Store during the blocklet publish process. Developers should not set this field manually in blocklet.yml.


Understanding monetization is key to distributing your blocklet. To ensure your blocklet's metadata is authentic and tamper-proof, proceed to the Security & Resources section.