This repository contains simple examples demonstrating how to use LAOS to scale the minting and evolution of assets on any EVM chain.
- The EVM folder contains examples to interact directly with the EVM RPC endpoints of both LAOS and the chosen EVM chain. This approach is fully decentralized and permissionless.
- The API folder contains examples that use the API maintained by the LAOS Foundation. This approach simplifies integration and supports development similar to traditional Web2 systems.
For further documentation about LAOS, the following can be of interest:
To get started, either use:
- LAOS Mainnet, with public RPC node at https://rpc.laos.laosfoundation.io
- LAOS Sigma Testnet, with public RPC node at https://rpc.laossigma.laosfoundation.io
If using the testnet, please use this faucet to obtain testnet tokens if needed.
Rename the example.env file to .env, and fill in the three fields:
- The private key field must start with
0x..., and the corresponding account must have tokens of the corresponding network. This field is required. - The
ipfs-uploader.jsexample uses Pinata to upload and store data in IPFS. Either use your Pinata API key or create a free Pinata account to get one. Paste the key and secret in the fields in the .env file. If you are minting using IPFS addresses from a different source, you need not fill in these fields. - The API examples require a LAOS API key. Please contact info@laosnetwork.io to obtain one.
To run the node.js examples, first install dependencies via:
npm ciEach script contains comments in its code that should make it understandable. Modify the required values to adapt to your needs (e.g. contract addresses, recipient of mints, etc.).
Run the scripts via:
node evm/script_name.js
node api/script_name.jsSupported scripts:
# Deploys properly configured contracts on LAOS and an EVM chain of choice
# to enable scaling via Bridgeless Minting:
node evm/setup-bridgeless-minting.js
node api/setup-bridgeless-minting.js
# Creates a sibling collection on the LAOS Network. This is the 1st step used by 'setup-bridgeless-minting'.
node evm/create-laos-collection.js
# Deploys a uERC721 contract on the chosen EVM chain. This is the 2nd step used by 'setup-bridgeless-minting'.
node evm/deploy721.js
# Mints assets to an existing sibling collection on the LAOS Network...
# ...one asset using direct EVM calls:
node evm/mint.js # mints one asset using direct EVM calls
# ...multiple assets using the API, using the recommended 2-step process, where a TX is sent first, and the caller later queries for confirmation
node api/mintAsync.js
# ...multiple assets using the API a monolithic 1-step process, where TX sending and confirmation may keep the caller waiting for several seconds
node api/mint.js
# Mints a large number of assets in batches, efficiently filling each block to maximize throughput.
node evm/mint-in-batches.js
# Evolves assets previously minted on a sibling collection...
# ...one asset using direct EVM calls:
node evm/evolve.js
# ...multiple assets using the API, using the recommended 2-step process, where a TX is sent first, and the caller later queries for confirmation
node api/evolveAsync.js
# ...multiple assets using the API a monolithic 1-step process, where TX sending and confirmation may keep the caller waiting for several seconds
node api/evolve.js
# Demonstrates how to upload asset metadata to IPFS.
node ipfs/ipfs-uploader.js
# Emits a transfer event on the EVM chain to notify marketplaces that do not yet natively integrate with LAOS.
node evm/broadcast.js
node api/broadcast.js
# Extends the metadata of any asset on any EVM chain in a permissionless manner.
node evm/asset-metadata-extender.jsThe fastest way to bridgelessly mint an asset on Ethereum or Polygon (without paying any ETH or MATIC) is to use existing collections that have Public Minting enabled.
The steps are as follows:
- Place an image that you would like to be associated with the asset in the
./ipfsfolder. - Edit the
main()function of theipfs-uploader.jsscript to use the path to the image, as well as the title, description, and associated metadata of the asset. Run the script. - Paste the resulting
ipfs://...output fromipfs-uploader.jsinto thetokenURIvariable of themint.jsscript. - Ensure that the
laosCollectionAddrandrecipientvariables are set to your requirements, as explained in the script comments. Run the script. - The output of the script is a
tokenID.
If you used the suggested public collections in the example, the minted assets can be viewed at:
-
For assets minted on the Ethereum Public collection:
https://testnet.apps.laosnetwork.io/asset/1/0xee5b64092fb09a219baa4d0df909ed730a85c67e/<tokenID> -
For assets minted on the Polygon Public collection:
https://testnet.apps.laosnetwork.io/collection/137/0x30ebd8d3e9b5b303d2b0a81c5cc0ce90ff185e9c/<tokenID>