waves_logo Docs
  • Overview
    Overview
  • How-to Guides
    • Reading Blockchain Data
      Reading Blockchain Data
    • Creating & Broadcasting Transactions
      Creating & Broadcasting Transactions
    • Tokenization
      Tokenization
    • Airdrop
      Airdrop
    • Payments
      Payments
    • Exchange Tokens
      Exchange Tokens
    • Simple Voting
      Simple Voting
    • List as argument
      List as argument
    How-to Guides
  • Waves Smart Contracts
    Waves Smart Contracts
  • dApp
    • Creating & Launching dApp
      Creating & Launching dApp
    dApp
  • Smart Account
    • Creating smart account
      Creating smart account
    • Creating and deploying a script manually
      Creating and deploying a script manually
    • Video tutorials
      • Introduction to the Waves blockchain, Waves Smart Accounts and Waves Smart Assets
        Introduction to the Waves blockchain, Waves Smart Accounts and Waves Smart Assets
      • Waves Smart Account with multisignature
        Waves Smart Account with multisignature
      • Waves Smart Account with escrow service
        Waves Smart Account with escrow service
      • Creating multisignature account via Waves IDE tools
        Creating multisignature account via Waves IDE tools
      • Creating multisignature account via Waves Client
        Creating multisignature account via Waves Client
      • Waves console explained
        Waves console explained
      Video tutorials
    Smart Account
  • Smart Asset
    Smart Asset
  • Developer Tools
    • Waves IDE
      Waves IDE
    • Visual Studio Code Extension
      Visual Studio Code Extension
    • Surfboard
      Surfboard
    • Ride REPL
      Ride REPL
    Developer Tools
  • Signer ◆
    Signer ◆
  • Waves API
    • Data Service API
      Data Service API
    • Node REST API
      Node REST API
    • Node gRPC Server
      Node gRPC Server
    • Blockchain Updates
      Blockchain Updates
    Waves API
  • Client Libraries
    • Waves C#
      • Install SDK
        Install SDK
      • Run Code Sample
        • Send Transactions
          Send Transactions
        • Use Crypto Utilities
          Use Crypto Utilities
        • Interact With Node
          Interact With Node
        • Set Up Smart Contracts
          Set Up Smart Contracts
        Run Code Sample
      Waves C#
    • Gowaves
      • Install SDK
        Install SDK
      • Run Code Sample
        • Send Transactions
          Send Transactions
        • Use Crypto Utilities
          Use Crypto Utilities
        • Interact With Node
          Interact With Node
        • Set Up Smart Contracts
          Set Up Smart Contracts
        Run Code Sample
      Gowaves
    • WavesJ
      • Install SDK
        Install SDK
      WavesJ
    • Ts-lib-crypto
      • Install SDK
        Install SDK
      Ts-lib-crypto
    • Waves-PHP
      • Install SDK
        Install SDK
      Waves-PHP
    • Waves-python
      • Install SDK
        Install SDK
      Waves-python
    • Waves-rust
      • Install SDK
        Install SDK
      Waves-rust
    Client Libraries
      • English
      • Русский
      On this page
        • Assets API
        • Addresses API
      waves_logo Docs

          # Interact With Node

          Use you can Assets and Address API methods.

          # Assets API

          You can get:

          • Asset Balance Distribution.
          • All Asset Balances for an Address.
          • Balance of a Specific Asset.
          • Asset Details.
          • Non-Fungible Tokens (NFTs) at an Address.

          # Asset Balance Distribution

          Endpoint: GET /assets/{assetId}/distribution/{height}/limit/{limit}

          package main
          
          // Required imports.
          import (
          	"encoding/json"
          	"fmt"
          	"io"
          	"log"
          	"math"
          	"net/http"
          )
          
          // `AssetDistribution` represents the JSON structure returned by the distribution endpoint.
          type AssetDistribution struct {
          	Items    map[string]uint64 `json:"items"`
          	LastItem string            `json:"lastItem"`
          	HasNext  bool              `json:"hasNext"`
          }
          
          // `BlockHeight` represents the current blockchain height.
          type BlockHeight struct {
          	Height int `json:"height"`
          }
          
          // `AssetInfo` holds the metadata for a specific asset (e.g., decimals).
          type AssetInfo struct {
          	Decimals byte `json:"decimals"`
          }
          
          func main() {
          	// 1. Set the asset ID and limit.
          	assetId := "PASTE AN ASSET ID"
          	limit := 100
          
          	/* 2. Set the base node URL for the selected network:
          	- Mainnet: "https://nodes.wavesnodes.com"
          	- Testnet: "https://nodes-testnet.wavesnodes.com"
          	- Stagenet: "https://nodes-stagenet.wavesnodes.com"
          	*/
          	baseURL := "https://nodes-testnet.wavesnodes.com"
          
          	// 3. Get the latest block height.
          	heightResp, err := http.Get(baseURL + "/blocks/height")
          	if err != nil {
          		log.Fatalf("Failed to get block height: %v", err)
          	}
          	defer heightResp.Body.Close()
          
          	if heightResp.StatusCode != http.StatusOK {
          		body, _ := io.ReadAll(heightResp.Body)
          		log.Fatalf("Failed to get height: %s - %s", heightResp.Status, string(body))
          	}
          
          	var bh BlockHeight
          	if err := json.NewDecoder(heightResp.Body).Decode(&bh); err != nil {
          		log.Fatalf("Failed to decode height: %v", err)
          	}
          	stableHeight := bh.Height - 1
          
          	// 4. Fetch asset decimals.
          	infoResp, err := http.Get(baseURL + "/assets/details/" + assetId)
          	if err != nil {
          		log.Fatalf("Failed to get asset info: %v", err)
          	}
          	defer infoResp.Body.Close()
          
          	if infoResp.StatusCode != http.StatusOK {
          		body, _ := io.ReadAll(infoResp.Body)
          		log.Fatalf("Failed to get asset info: %s - %s", infoResp.Status, string(body))
          	}
          
          	var assetInfo AssetInfo
          	if err := json.NewDecoder(infoResp.Body).Decode(&assetInfo); err != nil {
          		log.Fatalf("Failed to parse asset info: %v", err)
          	}
          
          	// 5. Build the distribution URL.
          	url := fmt.Sprintf("%s/assets/%s/distribution/%d/limit/%d", baseURL, assetId, stableHeight, limit)
          
          	// 6. Perform the HTTP GET request.
          	resp, err := http.Get(url)
          	if err != nil {
          		log.Fatalf("Failed to make request: %v", err)
          	}
          	defer resp.Body.Close()
          
          	if resp.StatusCode != http.StatusOK {
          		body, _ := io.ReadAll(resp.Body)
          		log.Fatalf("Non-OK HTTP status: %s - %s", resp.Status, string(body))
          	}
          
          	// 7. Decode the JSON response.
          	var dist AssetDistribution
          	if err := json.NewDecoder(resp.Body).Decode(&dist); err != nil {
          		log.Fatalf("Failed to parse JSON: %v", err)
          	}
          
          	// 8. Print distribution.
          	fmt.Println("––––––––––––––––––––––––––––––––––––––")
          	fmt.Println("Asset Distribution (address: quantity):")
          	divisor := math.Pow10(int(assetInfo.Decimals))
          	for addr, bal := range dist.Items {
          		fmt.Printf("%s: %.2f\n", addr, float64(bal)/divisor)
          	}
          	if dist.HasNext {
          		fmt.Printf("\nMore pages available. Last item: %s\n", dist.LastItem)
          	}
          }
          

          # All Asset Balances for an Address

          Endpoint: GET /assets/balance/{address}

          package main
          
          import (
          	"context"
          	"fmt"
          	"log"
          	"net/http"
          	"time"
          
          	"github.com/wavesplatform/gowaves/pkg/client"
          	"github.com/wavesplatform/gowaves/pkg/proto"
          )
          
          func getAssetsBalance() {
          	const (
          		/*
                  Specify the network:
                  - Mainnet: `proto.MainNetScheme`
                  - Testnet: `proto.TestNetScheme`
                  - Stagenet: `proto.StageNetScheme`
                  */
          		network = proto.MainNetScheme
          		// Specify an account address.
          		address = "PASTE AN ACCOUNT ADDRESS"
          	)
          
          	// Step 1: Create the node client.
          	nodeClient, err := client.NewClient(client.Options{
          		/*
          		Specify the link for the same network as mentioned above:
          		- Mainnet: "https://nodes.wavesnodes.com/"
          		- Testnet: "https://nodes-testnet.wavesnodes.com/"
          		- Stagenet: "https://nodes-stagenet.wavesnodes.com/"
          		*/
          		BaseUrl: "https://nodes.wavesnodes.com/",
          		Client:  &http.Client{Timeout: 10 * time.Second},
          		ChainID: network,
          	})
          	// Throw the error if caught.
          	if err != nil {
          		log.Fatalf("NewClient failed: %v", err)
          	}
          
          	// Step 2: Convert the address string to the address object.
          	addr, err := proto.NewAddressFromString(address)
          	// Throw the error if caught.
          	if err != nil {
          		log.Fatalf("NewAddressFromString failed: %v", err)
          	}
          
          	// Step 3: Fetch the asset balances of the address.
          	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
          	defer cancel()
          
          	// Throw the error if caught.
          	res, _, err := nodeClient.Assets.BalanceByAddress(ctx, addr)
          	if err != nil {
          		log.Fatalf("BalanceByAddress failed: %v", err)
          	}
          
          	// Step 4: Output the result.
          	for _, asset := range res.Balances {
          		info := asset.IssueTransaction
          		fmt.Println("––––––––––––––––––––––––––––––––")
          		fmt.Println("Asset ID:", asset.AssetId.String())
          		fmt.Println("Name:", info.Name)
          		fmt.Println("Description:", info.Description)
          		fmt.Println("Quantity:", float64(asset.Balance)/float64(pow10(info.Decimals)))
          		fmt.Println("Reissuable:", info.Reissuable)
          		fmt.Println("Issuer Public Key:", info.SenderPK.String())
          	}
          }
          
          // Calculates 10^n.
          func pow10(n byte) int64 {
          	res := int64(1)
          	for i := byte(0); i < n; i++ {
          		res *= 10
          	}
          	return res
          }
          
          // Run the function.
          func main() {
          	getAssetsBalance()
          }
          

          # Balance of a Specific Asset

          Endpoint: GET /assets/balance/{address}/{assetId}

          package main
          
          // Required imports.
          import (
          	"context"
          	"fmt"
          	"log"
          	"net/http"
          	"time"
          
          	"github.com/wavesplatform/gowaves/pkg/client"
          	"github.com/wavesplatform/gowaves/pkg/proto"
          	"github.com/wavesplatform/gowaves/pkg/crypto"
          )
          
          func getAssetBalance() {
          	const (
          		/*
                  Specify the network:
                  - Mainnet: `proto.MainNetScheme`
                  - Testnet: `proto.TestNetScheme`
                  - Stagenet: `proto.StageNetScheme`
                  */
          		network    = proto.TestNetScheme
          		address    = "PASTE AN ACCOUNT ADDRESS"
          		assetIDStr = "PASTE AN ASSET ID"
          	)
          
          	// Step 1: Create the node client.
          	nodeClient, err := client.NewClient(client.Options{
          		/*
          		Specify the link for the same network as mentioned above:
          		- Mainnet: "https://nodes.wavesnodes.com/"
          		- Testnet: "https://nodes-testnet.wavesnodes.com/"
          		- Stagenet: "https://nodes-stagenet.wavesnodes.com/"
          		*/
          		BaseUrl: "https://nodes-testnet.wavesnodes.com/",
          		Client:  &http.Client{Timeout: 10 * time.Second},
          		ChainID: network,
          	})
          	// Throw the error if caught.
          	if err != nil {
          		log.Fatalf("NewClient failed: %v", err)
          	}
          
          	// Step 2: Convert the address string to the address object.
          	addr, err := proto.NewAddressFromString(address)
          	// Throw the error if caught.
          	if err != nil {
          		log.Fatalf("NewAddressFromString failed: %v", err)
          	}
          
          	// Step 3: Parse the asset ID from the base58 string.
          	assetID, err := crypto.NewDigestFromBase58(assetIDStr)
          	// Throw the error if caught.
          	if err != nil {
          		log.Fatalf("NewDigestFromBase58 failed: %v", err)
          	}
          
          	// Step 4: Fetch the asset balance for the address and asset ID.
          	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
          	defer cancel()
          
          	res, _, err := nodeClient.Assets.BalanceByAddressAndAsset(ctx, addr, assetID)
          	// Throw the error if caught.
          	if err != nil {
          		log.Fatalf("BalanceByAddressAndAsset failed: %v", err)
          	}
          
          	// Step 5: Fetch the asset info to get decimals.
          	info, _, err := nodeClient.Assets.Details(ctx, assetID)
          	// Throw the error if caught.
          	if err != nil {
          		log.Fatalf("Asset details fetch failed: %v", err)
          	}
          
          	// Step 6: Format the balance using decimals (e.g., 923 → 9.23).
          	divisor := 1.0
          	for i := uint64(0); i < info.Decimals; i++ {
          		divisor *= 10
          	}
          
          	// Step 7: Output the formatted balance.
          	fmt.Printf("Asset Balance: %.2f\n", float64(res.Balance)/divisor)
          }
          
          // Run the function.
          func main() {
          	getAssetBalance()
          }
          

          # Asset Details

          Endpoint: GET /assets/details/{assetId}

          package main
          
          // Required imports.
          import (
          	"context"
          	"fmt"
          	"log"
          	"net/http"
          	"time"
          	"github.com/wavesplatform/gowaves/pkg/client"
          	"github.com/wavesplatform/gowaves/pkg/proto"
          	"github.com/wavesplatform/gowaves/pkg/crypto"
          )
          
          func getAssetDetails() {
          	const (
          		/*
                  Specify the network:
                  - Mainnet: `proto.MainNetScheme`
                  - Testnet: `proto.TestNetScheme`
                  - Stagenet: `proto.StageNetScheme`
                  */
          		network    = proto.TestNetScheme
          		assetIDStr = "PASTE AN ASSET ID"
          	)
          
          	// Step 1: Create the node client.
          	nodeClient, err := client.NewClient(client.Options{
          		/*
          		Specify the link for the same network as mentioned above:
          		- Mainnet: "https://nodes.wavesnodes.com/"
          		- Testnet: "https://nodes-testnet.wavesnodes.com/"
          		- Stagenet: "https://nodes-stagenet.wavesnodes.com/"
          		*/
          		BaseUrl: "https://nodes-testnet.wavesnodes.com/",
          		Client:  &http.Client{Timeout: 10 * time.Second},
          		ChainID: network,
          	})
          	// Throw the error if caught.
          	if err != nil {
          		log.Fatalf("NewClient failed: %v", err)
          	}
          
          	// Step 2: Parse the asset ID.
          	assetID, err := crypto.NewDigestFromBase58(assetIDStr)
          	// Throw the error if caught.
          	if err != nil {
          		log.Fatalf("NewDigestFromBase58 failed: %v", err)
          	}
          
          	// Step 3: Fetch the asset details.
          	ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
          	defer cancel()
          	res, _, err := nodeClient.Assets.Details(ctx, assetID)
          	// Throw the error if caught.
          	if err != nil {
          		log.Fatalf("GetAssetDetails failed: %v", err)
          	}
          
          	// Step 4: Format and output the result.
          	fmt.Println("Asset Details:")
          	// Accessing the correct fields based on the available struct fields.
          	fmt.Printf("Name: %s\n", res.Name)
          	fmt.Printf("Description: %s\n", res.Description)
          	fmt.Printf("Decimals: %d\n", res.Decimals)
          	fmt.Printf("Total Issued: %.2f\n", float64(res.Quantity)/100)
          	fmt.Printf("Reissuable: %v\n", res.Reissuable)
          	fmt.Printf("Issuer: %s\n", res.Issuer)
          }
          
          // Run the function.
          func main() {
          	getAssetDetails()
          }
          

          # Non-Fungible Tokens (NFTs) at an Address

          Endpoint: GET /assets/nft/{address}/limit/{limit}

          package main
          
          // Required imports.
          import (
          	"encoding/json"
          	"fmt"
          	"io"
          	"log"
          	"net/http"
          	"time"
          )
          
          // `NftAsset` represents the minimal structure of an NFT.
          type NftAsset struct {
          	ID          string `json:"assetId"`
          	Name        string `json:"name"`
          	Description string `json:"description"`
          	Quantity    int    `json:"quantity"`
          	Decimals    int    `json:"decimals"`
          	Reissuable  bool   `json:"reissuable"`
          	Ticker      string `json:"ticker"`
          }
          
          func getNFTs() {
          	const (
          		/*
          		Specify the link for the same network as mentioned above:
          		- Mainnet: "https://nodes.wavesnodes.com/"
          		- Testnet: "https://nodes-testnet.wavesnodes.com/"
          		- Stagenet: "https://nodes-stagenet.wavesnodes.com/"
          		*/
          		nodeURL = "https://nodes-testnet.wavesnodes.com"
          		address = "PASTE AN ACCOUNT ADDRESS"
          		limit   = 100
          	)
          
          	// Step 1: Build the request URL.
          	url := fmt.Sprintf("%s/assets/nft/%s/limit/%d", nodeURL, address, limit)
          
          	// Step 2: Create the HTTP client.
          	client := &http.Client{Timeout: 10 * time.Second}
          
          	// Step 3: Perform the GET request.
          	resp, err := client.Get(url)
          	// Throw the error if caught.
          	if err != nil {
          		log.Fatalf("Request failed: %v", err)
          	}
          	defer resp.Body.Close()
          
          	// Throw the error if caught.
          	if resp.StatusCode != http.StatusOK {
          		body, _ := io.ReadAll(resp.Body)
          		log.Fatalf("Status %s: %s", resp.Status, string(body))
          	}
          
          	// Step 4: Parse the JSON response.
          	var nfts []NftAsset
          	// Throw the error if caught.
          	if err := json.NewDecoder(resp.Body).Decode(&nfts); err != nil {
          		log.Fatalf("Decode failed: %v", err)
          	}
          
          	// Step 5: Output the results.
          	if len(nfts) == 0 {
          		fmt.Println("No NFTs found at this address.")
          		return
          	}
          
          	fmt.Println("NFTs at the address:")
          	for i, nft := range nfts {
          		fmt.Printf("%d. ID: %s | Name: %s | Description: %s\n", i+1, nft.ID, nft.Name, nft.Description)
          	}
          }
          
          // Run the function.
          func main() {
          	getNFTs()
          }
          

          # Addresses API

          You can get:

          • All Addresses in the Node Wallet.
          • A Range of Addresses.
          • WAVES Balance of an Address.
          • WAVES Balance with Confirmations.
          • Detailed Balance Information.
          • Balances for Multiple Addresses.
          • Account Data Entries by Address.
          • Data Entry by Key.
          • Script Information of an Account.
          • Account Script Metadata.

          # All Addresses in the Node Wallet

          Endpoint: GET /addresses

          package main
          
          // Required imports.
          import (
          	"encoding/json"
          	"fmt"
          	"io"
          	"log"
          	"net/http"
          	"time"
          )
          
          func main() {
          	/*
          	Specify the link for the same network as mentioned above:
          	- Mainnet: "https://nodes.wavesnodes.com/"
          	- Testnet: "https://nodes-testnet.wavesnodes.com/"
          	- Stagenet: "https://nodes-stagenet.wavesnodes.com/"
          	*/
          	const nodeURL = "https://nodes-testnet.wavesnodes.com"
          
          	// Step 1: Build request URL.
          	url := nodeURL + "/addresses"
          
          	// Step 2: Create the HTTP client.
          	client := &http.Client{Timeout: 10 * time.Second}
          
          	// Step 3: Perform the GET request.
          	resp, err := client.Get(url)
          	if err != nil {
          		log.Fatalf("Request failed: %v", err)
          	}
          	defer resp.Body.Close()
          
          	if resp.StatusCode != http.StatusOK {
          		body, _ := io.ReadAll(resp.Body)
          		// Throw the error if caught.
          		log.Fatalf("Status %s: %s", resp.Status, string(body))
          	}
          
          	// Step 4: Parse the response.
          	var addresses []string
          	// Throw the error if caught.
          	if err := json.NewDecoder(resp.Body).Decode(&addresses); err != nil {
          		log.Fatalf("Decode failed: %v", err)
          	}
          
          	// Step 5: Output the results.
          	fmt.Println("Node Wallet Addresses:")
          	for i, addr := range addresses {
          		fmt.Printf("%d. %s\n", i+1, addr)
          	}
          }
          

          # Range of Addresses

          Endpoint: GET /addresses/seq/{from}/{to}

          package main
          
          // Required imports.
          import (
          	"encoding/json"
          	"fmt"
          	"io"
          	"log"
          	"net/http"
          	"time"
          )
          
          func main() {
          	/*
          	Specify the link for the same network as mentioned above:
          	- Mainnet: "https://nodes.wavesnodes.com/"
          	- Testnet: "https://nodes-testnet.wavesnodes.com/"
          	- Stagenet: "https://nodes-stagenet.wavesnodes.com/"
          	*/
          	const nodeURL = "https://nodes-testnet.wavesnodes.com"
          
          	// Start index of the node's wallet.
          	const from int = 0 
          
          	// End index of the node's wallet.
          	const to int = 4
          
          	// Step 1: Build the request URL.
          	url := fmt.Sprintf("%s/addresses/seq/%d/%d", nodeURL, from, to)
          
          	// Step 2: Create the HTTP client.
          	client := &http.Client{Timeout: 10 * time.Second}
          
          	// Step 3: Perform the GET request.
          	resp, err := client.Get(url)
          	if err != nil {
          		// Throw the error if caught.
          		log.Fatalf("Request failed: %v", err)
          	}
          	defer resp.Body.Close()
          
          	if resp.StatusCode != http.StatusOK {
          		body, _ := io.ReadAll(resp.Body)
          		// Throw the error if caught.
          		log.Fatalf("Status %s: %s", resp.Status, string(body))
          	}
          
          	// Step 4: Parse response.
          	var addresses []string
          	if err := json.NewDecoder(resp.Body).Decode(&addresses); err != nil {
          		// Throw the error if caught.
          		log.Fatalf("Decode failed: %v", err)
          	}
          
          	// Step 5: Output results.
          	fmt.Printf("Node Wallet Addresses from %d to %d:\n", from, to)
          	for i, addr := range addresses {
          		fmt.Printf("%d. %s\n", from+i+1, addr)
          	}
          }
          

          # WAVES Balance of an Address

          Endpoint: GET /addresses/balance/{address}

          package main
          
          // Required imports.
          import (
          	"encoding/json"
          	"fmt"
          	"io"
          	"log"
          	"net/http"
          	"time"
          )
          
          // Response struct from `/addresses/balance/{address}`.
          type BalanceResponse struct {
          	Address string `json:"address"`
          	Balance int64  `json:"balance"`
          }
          
          func main() {
          	/*
          	Specify the link for the same network as mentioned above:
          	- Mainnet: "https://nodes.wavesnodes.com/"
          	- Testnet: "https://nodes-testnet.wavesnodes.com/"
          	- Stagenet: "https://nodes-stagenet.wavesnodes.com/"
          	*/
          	const nodeURL = "https://nodes-testnet.wavesnodes.com"
          
          	// Specify an account address.
          	const address string = "PASTE AN ACCOUNT ADDRESS"
          
          	// Step 1: Build the request URL.
          	url := fmt.Sprintf("%s/addresses/balance/%s", nodeURL, address)
          
          	// Step 2: Create the HTTP client.
          	client := &http.Client{Timeout: 10 * time.Second}
          
          	// Step 3: Perform the GET request.
          	resp, err := client.Get(url)
          	// Throw the error if caught.
          	if err != nil {
          		log.Fatalf("Request failed: %v", err)
          	}
          	defer resp.Body.Close()
          
          	if resp.StatusCode != http.StatusOK {
          		body, _ := io.ReadAll(resp.Body)
          		// Throw the error if caught.
          		log.Fatalf("Status %s: %s", resp.Status, string(body))
          	}
          
          	// Step 4: Parse the response.
          	var balanceRes BalanceResponse
          	if err := json.NewDecoder(resp.Body).Decode(&balanceRes); err != nil {
          		// Throw the error if caught.
          		log.Fatalf("Decode failed: %v", err)
          	}
          
          	// Step 5: Output the results (WAVES = 10^8).
          	fmt.Printf("Balance at %s: %.8f WAVES\n", balanceRes.Address, float64(balanceRes.Balance)/1e8)
          }
          

          # WAVES Balance with Confirmations

          Endpoint: GET /addresses/balance/{address}/{confirmations}

          package main
          
          // Required imports.
          import (
          	"encoding/json"
          	"fmt"
          	"io"
          	"log"
          	"net/http"
          	"time"
          )
          
          // Response struct from `/addresses/balance/{address}`.
          type BalanceResponse struct {
          	Address string `json:"address"`
          	Balance int64  `json:"balance"`
          }
          
          func main() {
          	/*
          	Specify the link for the same network as mentioned above:
          	- Mainnet: "https://nodes.wavesnodes.com/"
          	- Testnet: "https://nodes-testnet.wavesnodes.com/"
          	- Stagenet: "https://nodes-stagenet.wavesnodes.com/"
          	*/
          	const nodeURL = "https://nodes-testnet.wavesnodes.com"
          
          	// Specify an account address.
          	const address string = "PASTE AN ACCOUNT ADDRESS"
          	
          	// Enter the number of confirmations.
          	const confirmations int = 2
          
          	// Step 1: Build the request URL.
          	url := fmt.Sprintf("%s/addresses/balance/%s/%d", nodeURL, address, confirmations)
          
          	// Step 2: Create the HTTP client.
          	client := &http.Client{Timeout: 10 * time.Second}
          
          	// Step 3: Perform the GET request.
          	resp, err := client.Get(url)
          	// Throw the error if caught.
          	if err != nil {
          		log.Fatalf("Request failed: %v", err)
          	}
          	defer resp.Body.Close()
          
          	if resp.StatusCode != http.StatusOK {
          		body, _ := io.ReadAll(resp.Body)
          		// Throw the error if caught.
          		log.Fatalf("Status %s: %s", resp.Status, string(body))
          	}
          
          	// Step 4: Parse the response.
          	var balanceRes BalanceResponse
          	// Throw the error if caught.
          	if err := json.NewDecoder(resp.Body).Decode(&balanceRes); err != nil {
          		log.Fatalf("Decode failed: %v", err)
          	}
          
          	// Step 5: Output the results (WAVES = 10^8).
          	fmt.Printf("Balance at %s (≥ %d confirmations): %.8f WAVES\n", balanceRes.Address, confirmations, float64(balanceRes.Balance)/1e8)
          }
          

          # Detailed Balance Information

          Endpoint: GET /addresses/balance/details/{address}

          NOTE: The method shows the available, regular, generating, and effective account balances.

          package main
          
          // Required imports.
          import (
          	"encoding/json"
          	"fmt"
          	"io"
          	"log"
          	"net/http"
          	"time"
          )
          
          // Response struct from `/addresses/balance/details/{address}`.
          type BalanceDetails struct {
          	Address     string `json:"address"`
          	Regular     int64  `json:"regular"`
          	Generating  int64  `json:"generating"`
          	Available   int64  `json:"available"`
          	Effective   int64  `json:"effective"`
          }
          
          func main() {
          	/*
          	Specify the link for the same network as mentioned above:
          	- Mainnet: "https://nodes.wavesnodes.com/"
          	- Testnet: "https://nodes-testnet.wavesnodes.com/"
          	- Stagenet: "https://nodes-stagenet.wavesnodes.com/"
          	*/
          	const nodeURL = "https://nodes-testnet.wavesnodes.com"
          
          	// Specify an account address.
          	const address string = "PASTE AN ACCOUNT ADDRESS"
          
          	// Step 1: Build the request URL.
          	url := fmt.Sprintf("%s/addresses/balance/details/%s", nodeURL, address)
          
          	// Step 2: Create the HTTP client.
          	client := &http.Client{Timeout: 10 * time.Second}
          
          	// Step 3: Perform the GET request.
          	resp, err := client.Get(url)
          	if err != nil {
          		// Throw the error if caught.
          		log.Fatalf("Request failed: %v", err)
          	}
          	defer resp.Body.Close()
          
          	if resp.StatusCode != http.StatusOK {
          		body, _ := io.ReadAll(resp.Body)
          		// Throw the error if caught.
          		log.Fatalf("Status %s: %s", resp.Status, string(body))
          	}
          
          	// Step 4: Parse the response.
          	var details BalanceDetails
          	if err := json.NewDecoder(resp.Body).Decode(&details); err != nil {
          		// Throw the error if caught.
          		log.Fatalf("Decode failed: %v", err)
          	}
          
          	// Step 5: Output the results (WAVES = 10^8).
          	fmt.Printf("Balance Details for %s:\n", details.Address)
          	fmt.Printf("Regular: %.8f WAVES\n", float64(details.Regular)/1e8)
          	fmt.Printf("Available:  %.8f WAVES\n", float64(details.Available)/1e8)
          	fmt.Printf("Generating: %.8f WAVES\n", float64(details.Generating)/1e8)
          	fmt.Printf("Effective:  %.8f WAVES\n", float64(details.Effective)/1e8)
          }
          

          # Balances for Multiple Addresses

          Endpoint: POST /addresses/balance

          package main
          
          // Required imports.
          import (
          	"encoding/json"
          	"fmt"
          	"io"
          	"log"
          	"net/http"
          	"time"
          	"bytes"
          )
          
          // Request body format for POST `/addresses/balance`.
          type AddressRequest struct {
          	Addresses []string `json:"addresses"`
          }
          
          // Response struct for each item in `/addresses/balance` response.
          type AddressBalance struct {
          	Balance int64 `json:"balance"`
          }
          
          func main() {
          	/*
          	Specify the link for the same network as mentioned above:
          	- Mainnet: "https://nodes.wavesnodes.com/"
          	- Testnet: "https://nodes-testnet.wavesnodes.com/"
          	- Stagenet: "https://nodes-stagenet.wavesnodes.com/"
          	*/
          	const nodeURL = "https://nodes-testnet.wavesnodes.com/addresses/balance"
          
          	// Specify account addresses.
          	addresses := []string{
          		"PASTE THE FIRST ACCOUNT ADDRESS",
          		"PASTE THE SECOND ACCOUNT ADDRESS",
          		// ...
          	}
          
          	// Step 1: Create the JSON body with addresses.
          	bodyData, err := json.Marshal(AddressRequest{Addresses: addresses})
          	if err != nil {
          		// Throw the error if caught.
          		log.Fatalf("Marshal failed: %v", err)
          	}
          
          	// Step 2: Create the HTTP client and POST request.
          	client := &http.Client{Timeout: 10 * time.Second}
          	req, err := http.NewRequest("POST", nodeURL, io.NopCloser(bytes.NewReader(bodyData)))
          	if err != nil {
          		// Throw the error if caught.
          		log.Fatalf("Request creation failed: %v", err)
          	}
          	req.Header.Set("Content-Type", "application/json")
          
          	// Step 3: Perform the request.
          	resp, err := client.Do(req)
          	if err != nil {
          		// Throw the error if caught.
          		log.Fatalf("Request failed: %v", err)
          	}
          	defer resp.Body.Close()
          
          	if resp.StatusCode != http.StatusOK {
          		body, _ := io.ReadAll(resp.Body)
          		// Throw the error if caught.
          		log.Fatalf("Status %s: %s", resp.Status, string(body))
          	}
          
          	// Step 4: Parse the response.
          	var results []AddressBalance
          	if err := json.NewDecoder(resp.Body).Decode(&results); err != nil {
          		// Throw the error if caught.
          		log.Fatalf("Decode failed: %v", err)
          	}
          
          	// Step 5: Print each address and balance in WAVES.
          	for i, item := range results {
          		// Throw the error if caught.
          		fmt.Printf("%s: %.8f WAVES\n", addresses[i], float64(item.Balance)/1e8)
          	}
          }
          

          # Account Data Entries by Address

          Endpoint: GET /addresses/data/{address}

          package main
          
          // Required imports.
          import (
          	"encoding/json"
          	"fmt"
          	"io"
          	"log"
          	"net/http"
          	"time"
          )
          
          // `DataEntry` represents a single key-value data entry stored in an address.
          type DataEntry struct {
          	Key   string      `json:"key"`
          	Type  string      `json:"type"`
          	Value interface{} `json:"value"`
          }
          
          func main() {
          	// Specify an account address.
          	const address = "PASTE AN ACCOUNT ADDRESS"
          
          	/*
          	Specify the link for the same network as mentioned above:
          	- Mainnet: "https://nodes.wavesnodes.com/"
          	- Testnet: "https://nodes-testnet.wavesnodes.com/"
          	- Stagenet: "https://nodes-stagenet.wavesnodes.com/"
          	*/
          	const nodeURL = "https://nodes-testnet.wavesnodes.com/addresses/data/" + address
          
          	// Step 1: Create the HTTP client and GET request.
          	client := &http.Client{Timeout: 10 * time.Second}
          	resp, err := client.Get(nodeURL)
          	if err != nil {
          		// Throw the error if caught.
          		log.Fatalf("GET failed: %v", err)
          	}
          	defer resp.Body.Close()
          
          	if resp.StatusCode != http.StatusOK {
          		body, _ := io.ReadAll(resp.Body)
          		// Throw the error if caught.
          		log.Fatalf("Status %s: %s", resp.Status, string(body))
          	}
          
          	// Step 2: Decode the JSON response.
          	var entries []DataEntry
          	if err := json.NewDecoder(resp.Body).Decode(&entries); err != nil {
          		// Throw the error if caught.
          		log.Fatalf("Decode failed: %v", err)
          	}
          
          	// Step 3: Print the account data entries.
          	for _, entry := range entries {
          		fmt.Printf("%s (%s): %v\n", entry.Key, entry.Type, entry.Value)
          	}
          }
          

          # Data Entry by Key

          Endpoint: GET /addresses/data/{address}/{key}

          package main
          
          // Required imports.
          import (
          	"encoding/json"
          	"fmt"
          	"io"
          	"log"
          	"net/http"
          )
          
          // Data struct required for the operation.
          type DataEntry struct {
          	Key   string      `json:"key"`
          	Type  string      `json:"type"`
          	Value interface{} `json:"value"`
          }
          
          func main() {
          	/*
          	Specify the link for the same network as mentioned above:
          	- Mainnet: "https://nodes.wavesnodes.com/"
          	- Testnet: "https://nodes-testnet.wavesnodes.com/"
          	- Stagenet: "https://nodes-stagenet.wavesnodes.com/"
          	*/
          	const nodeURL = "https://nodes-testnet.wavesnodes.com"
          
          	// Specify an account address.
          	address := "PASTE AN ACCOUNT ADDRESS"
          
          	// Specify an account key.
          	key := "PASTE AN ACCOUNT KEY"
          
          	url := fmt.Sprintf("%s/addresses/data/%s/%s", nodeURL, address, key)
          
          	resp, err := http.Get(url)
          	if err != nil {
          		// Throw the error if caught.
          		log.Fatalf("Request failed: %v", err)
          	}
          	defer resp.Body.Close()
          
          	if resp.StatusCode != http.StatusOK {
          		body, _ := io.ReadAll(resp.Body)
          		// Throw the error if caught.
          		log.Fatalf("Status %s: %s", resp.Status, string(body))
          	}
          
          	var entry DataEntry
          	if err := json.NewDecoder(resp.Body).Decode(&entry); err != nil {
          		// Throw the error if caught.
          		log.Fatalf("Decode failed: %v", err)
          	}
          
          	// Output the result.
          	fmt.Printf("Key: %s\nType: %s\nValue: %v\n", entry.Key, entry.Type, entry.Value)
          }
          

          # Script Information of an Account

          Endpoint: GET /addresses/scriptInfo/{address}

          package main
          
          // Required imports.
          import (
          	"encoding/json"
          	"fmt"
          	"io"
          	"log"
          	"net/http"
          )
          
          // Script info struct.
          type ScriptInfo struct {
          	Script string `json:"script"`
          	Complexity int `json:"complexity"`
          	ExtraFee   int `json:"extraFee"`
          }
          
          func main() {
          	/*
          	Specify the link for the same network as mentioned above:
          	- Mainnet: "https://nodes.wavesnodes.com/"
          	- Testnet: "https://nodes-testnet.wavesnodes.com/"
          	- Stagenet: "https://nodes-stagenet.wavesnodes.com/"
          	*/
          	const nodeURL = "https://nodes-testnet.wavesnodes.com"
          
          	// Specify an account address.
          	address := "PASTE AN ACCOUNT ADDRESS"
          
          	url := fmt.Sprintf("%s/addresses/scriptInfo/%s", nodeURL, address)
          
          	resp, err := http.Get(url)
          	if err != nil {
          		// Throw the error if caught.
          		log.Fatalf("Request failed: %v", err)
          	}
          	defer resp.Body.Close()
          
          	if resp.StatusCode != http.StatusOK {
          		body, _ := io.ReadAll(resp.Body)
          		// Throw the error if caught.
          		log.Fatalf("Status %s: %s", resp.Status, string(body))
          	}
          
          	var info ScriptInfo
          	if err := json.NewDecoder(resp.Body).Decode(&info); err != nil {
          		// Throw the error if caught.
          		log.Fatalf("Decode failed: %v", err)
          	}
          
          	// Output the result.
          	fmt.Printf("Script:\n%s\nComplexity: %d\nExtra Fee: %d\n", info.Script, info.Complexity, info.ExtraFee)
          }
          

          # Account Script Metadata

          Endpoint: GET /addresses/scriptInfo/{address}/meta

          package main
          
          // Required imports.
          import (
          	"encoding/json"
          	"fmt"
          	"io"
          	"log"
          	"net/http"
          )
          
          // Script meta struct data.
          type ScriptMeta struct {
          	Version       int      `json:"version"`
          	CallableFunc  []string `json:"callableFunc"`
          	VerifierFunc  string   `json:"verifierFunc"`
          }
          
          func main() {
          	/*
          	Specify the link for the same network as mentioned above:
          	- Mainnet: "https://nodes.wavesnodes.com/"
          	- Testnet: "https://nodes-testnet.wavesnodes.com/"
          	- Stagenet: "https://nodes-stagenet.wavesnodes.com/"
          	*/
          	const nodeURL = "https://nodes-testnet.wavesnodes.com"
          
          	// Specify an account address.
          	address := "PASTE AN ACCOUNT ADDRESS"
          
          	url := fmt.Sprintf("%s/addresses/scriptInfo/%s/meta", nodeURL, address)
          
          	resp, err := http.Get(url)
          	if err != nil {
          		// Throw the error if caught.
          		log.Fatalf("Request failed: %v", err)
          	}
          	defer resp.Body.Close()
          
          	if resp.StatusCode != http.StatusOK {
          		body, _ := io.ReadAll(resp.Body)
          		// Throw the error if caught.
          		log.Fatalf("Status %s: %s", resp.Status, string(body))
          	}
          
          	var meta ScriptMeta
          	if err := json.NewDecoder(resp.Body).Decode(&meta); err != nil {
          		// Throw the error if caught.
          		log.Fatalf("Decode failed: %v", err)
          	}
          
          	// Output the results.
          	fmt.Printf("Version: %d\nVerifier: %s\nCallable functions: %v\n", meta.Version, meta.VerifierFunc, meta.CallableFunc)
          }
          
          Use Crypto Utilities
          Set Up Smart Contracts
          Use Crypto Utilities
          Set Up Smart Contracts