Sign inDemoInstall


Package Overview
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies



Version published



golem-js SDK logo

Golem JavaScript API

GitHub npm node-current npm type definitions GitHub Workflow Status GitHub issues Discord

Table of contents


Become a Requestor in the Golem Network and use this SDK to:

  • 🌐 Acquire compute resources from Providers using a convenient API
  • 🚢 Run your workloads with these resources and get the results back to your machine
  • 🔐 Build N-tier application deployments and run them within a VPN
  • 💰 Settle payments with Providers for the resources you've utilized

Getting Started

What's Golem and golem-js?

The Golem Network fosters a global group of creators building ambitious software solutions that will shape the technological landscape of future generations by accessing computing resources across the platform. Golem Network is an accessible, reliable, open access and censorship-resistant protocol, democratizing access to digital resources and connecting users through a flexible, open-source platform.

golem-js is the JavaScript API that allows developers to connect to their Golem nodes and manage their distributed, computational loads through Golem Network.

SDK Learning resources


To quickly get started with a new project using golem-js, you can use the following template:

npx @golem-sdk/cli@latest new my-awesome-golem-project

@golem-sdk/golem-js is available as a NPM package.

You can install it through npm:

npm install @golem-sdk/golem-js

or by yarn:

yarn add @golem-sdk/golem-js

Supported environments

The SDK is designed to work with LTS versions of Node (starting from 18) and with browsers. The minimum supported yagna version is 0.15.2.

Getting started with Golem Network

Before you start using the SDK, you need to have yagna installed and running on your machine. Yagna is a service that communicates and performs operations on the Golem Network, upon your requests via the SDK. You can follow the instructions below or visit the official documentation to set it up.

# Join the network as a requestor
curl -sSf | bash -

# Start the golem node on your machine,
# you can use `daemonize` to run this in background
yagna service run

Now that you have yagna running, you can initialize your requestor and request funds (tGLM tokens) on the test network.

# IN SEPARATE TERMINAL (if not daemonized)
# Initialize your requestor
yagna payment init --sender --network holesky

# Request funds on the test network
yagna payment fund --network holesky

# Check the status of the funds
yagna payment status --network holesky

Obtain an app-key to use with SDK

If you don't have any app-keys available from yagna app-key list, go ahead and create one with the command below. You will need this key in order to communicate with yagna from your application. You can set it as YAGNA_APPKEY environment variable.

yagna app-key create my-golem-app


You can rent a single machine and run a simple task on it:

import { MarketOrderSpec, GolemNetwork } from "@golem-sdk/golem-js";

// Define the order that we're going to place on the market
const order: MarketOrderSpec = {
  demand: {
    workload: { imageTag: "golem/alpine:latest" },
  market: {
    // We're only going to rent the provider for 5 minutes max
    rentHours: 5 / 60,
    pricing: {
      model: "linear",
      maxStartPrice: 0.5,
      maxCpuPerHourPrice: 1.0,
      maxEnvPerHourPrice: 0.5,

(async () => {
  const glm = new GolemNetwork();

  try {
    await glm.connect();
    // Rent a machine
    const rental = await glm.oneOf({ order });
    await rental
      .then((exe) =>"echo Hello, Golem! 👋"))
      .then((res) => console.log(res.stdout));
    await rental.stopAndFinalize();
  } catch (err) {
    console.error("Failed to run the example", err);
  } finally {
    await glm.disconnect();

Read about other available usage patterns to learn more on how you can leverage the SDK.


The examples directory in the repository contains various usage patterns for the SDK. You can browse through them and learn about the recommended practices. All examples are automatically tested during our release process.

You can find even more examples and tutorials in the JavaScript API section of the Golem Network Docs.


Visit our official documentation to learn more about the JavaScript SDK and how to use it.


The SDK uses the debug package to provide debug logs. To enable them, set the DEBUG environment variable to golem-js:* or golem-js:market:* to see all logs or only the market-related ones, respectively. For more information, please refer to the debug package documentation.


Read the dedicated testing documentation to learn more about how to run tests of the SDK.


Read the Contributing Guide for details on how you can get involved. In case you find an issue with the examples or the SDK itself, feel free to submit an issue report to the repository.


Feel invited to join our Discord. You can meet other SDK users and developers in the #sdk-discussion and #js-discussion channels.

See also



Last updated on 08 Jul 2024

Did you know?


Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.


Related posts

SocketSocket SOC 2 Logo


  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap


Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc