Getting Started
To develop for Marina, install Marina on your development machine. Download here.
tip
This guide assumes intermediate knowledge of HTML, CSS, and JavaScript.
Once Marina is installed and running, you should find that new browser tabs have a window.marina object available in the developer console. This is how your website will interact with Marina.
You can review the full API for that object here.
#
Install marina-providerTo make things easier, we have created a package that provides utilities and common types related to Marina.
or using yarn
#
Browser detectionTo verify if the browser is running Marina, you can use the marina-provider package that provides a function detectProvider
to inspect and fetch the window.marina
provider.
You can review the full API for the window.marina
object here.
## Connect to outside world
Marina connects to Blockstream's ElectrumX server via WebSocket by default. You can customize the WS endpoint in the settings/explorer tab of the extension.
#
Running in RegTestDon't be too reckless. You should develop your applications against a local testnet. Marina defaults to ws://localhost:1234
wich is the websocket endpoint of the Electrs-compatible server exposed by Nigiri box. You can download and run an Electrs instance from here, but we strongly suggest Nigiri which setup a complete RegTest environment in one click. Moreover the Electrs-compatible server exposed adds nice features for developers suchs as /mint
and /faucet
endpoints with automatic block generation and a Liquid asset registry similar to what Blockstream maintains.
#
Install Nigiri#
Start Nigiri with LiquidOn http://localhost:5001 you can see Esplora frontend
#
Choosing a JavaScript libraryBrowser libraries will help you develop faster your apps that handle Liquid transactions and doing operations such as creating, funding and build unsigned transactions or decode transaction built from other parties.
We suggest using liquidjs-lib.