Skip to main content

Wallet integration

Learn how to integrate your web3 wallet or other dApp with Milkomeda

Start building the future of decentralized finances

The following article helps to get to know the milkomeda-js-sdk package allowing developers to integrate web3 wallet on Milkomeda Sidechain.

Integrate Wallet with Milkomeda protocol

1. Download milkomeda-js-sdk package

Here you can find the milkomeda-js-sdk package. This is a package that hosts static configurations of Milkomeda deployments.


This is useful to avoid having each project integrate Milkomeda hard-coding static configurations.

2. Install milkomeda-js-sdk package

To install the package using npm:

npm i @dcspark/milkomeda-js-sdk

To install the package using yarn:

yarn add @dcspark/milkomeda-js-sdk

3. Import the package into your project

Using import:

import { generateMilkomedaMetadata, milkomedaNetworks } from "@dcspark/milkomeda-js-sdk";

Using require:

const milkomedaJsSdk = require("@dcspark/milkomeda-js-sdk");

Learn more about milkomeda-js-sdk package

Milkomeda-js-sdk is a package that hosts static configurations of Milkomeda deployments. This is useful to avoid having each project integrate Milkomeda hard-coding static configurations.

isMainnetboolean informing if the specific network configuration is mainnet (e.g. Cardano) or not,
mainchainconsists of mainchain information such as protocol and its id,
sidechainconsists of sidechain information such as protocol name (e.g. MilkomedaC1) and sidechain id,
backendEndpointprovides URL value for the service, which exposes additional information about a specific version of the sidechain,
protocolMagicintroduces protocol magic compatible with appropriate Milkomeda network,
timeIntervalForAddressMsa time interval of a possible address change defined in milliseconds,
sidechainContractaddress of the sidechain contract to which any client can connect.

Example of the exposed payload

Below you can find an example of the exposed payload of one of the Milkomeda Networks (devnet)

isMainnet: false,
mainchain: {
protocol: ProtocolNames.cardanoProtocol,
id: toChainId({
networkId: registry.Testnet.NetworkId,
networkMagic: registry.Testnet.NetworkMagic
sidechain: { protocol: ProtocolNames.evmProtocol, id: 200101 },
backendEndpoint: BackendEndpoints.devnet,
protocolMagic: ProtocolMagic.devnet,
timeIntervalForAddressMs: 86400000,
sidechainContract: "0x000000000000000000000000000000000000BbBB"

Additionally, the package introduces helper types and a function that helps to create proper metadata for Milkomeda transactions.

# Milkomeda metadata generator
address, # address is EVM address
protocolMagic # protocol magic for specific network

The metadata of a transaction consists of two parameters - protocol magic & EVM address. Exemplary metadata for testnet transaction is as follows:

87: "devnet.cardano-evm.c1"

Example of generating Milkomeda metadata for transaction

generateMilkomedaMetadata("0x000…", milkomedaNetworks["c1-devnet"].protocolMagic);

Remember to replace "0x000..." with your EVM address

Milkomeda REST API

Except for the Milkomeda-js-sdk package, we have introduced a REST API that allows to fetch more data regarding the Milkomeda Sidechain itself.


In this example, we use the Flint Wallet integration example for a better explanation

Base url for REST API is given as the backendEndpoint parameter using milkomeda-js-sdk. You can take it out from the package using the following code:


When you have the base URL included in your code, you can use one of the following endpoint:

Using Milkomeda REST API stargate endpoint you can get the same properties of the payload for both devnet and mainnet. Below you can find an example payload for devnet:

"current_address": "addr_test1wz6lvjg3anml96vl22mls5vae3x2cgaqwy2ewp5gj3fcxdcw652wz",
"ttl_expiry": 1646438400000,
"ada": {
"minLovelace": "3000000",
"fromADAFeeLovelace": "500000",
"toADAFeeGWei": "500000"
"assets": [
"idCardano": "b4004c2f3edfdd2016d0fead9b927064f345534b000000000000000000000000",
"idMilkomeda": "9c223e1dAf6184672E982d9AA560D9FD1d09A01B",
"minCNTInt": "1",
"minGWei": "1000000000"


If you have any additional questions regarding this article and Milkomeda integration go to or visit our discord server and don’t hesitate to ask us.