• Stars
    star
    103
  • Rank 333,046 (Top 7 %)
  • Language
    JavaScript
  • License
    Apache License 2.0
  • Created over 9 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The lowest-level stellar helper library. It consists of classes to read, write, hash, and sign Stellar xdr

JS Stellar Base

Tests Code Climate Coverage Status Dependency Status

The stellar-base library is the lowest-level stellar helper library. It consists of classes to read, write, hash, and sign the xdr structures that are used in stellar-core. This is an implementation in JavaScript that can be used on either Node.js or web browsers.

Warning! The Node version of this package uses the sodium-native package, a native implementation of Ed25519 in Node.js, as an optional dependency. This means that if for any reason installation of this package fails, stellar-base will fallback to the much slower implementation contained in tweetnacl.

If you'd explicitly prefer not to install the sodium-native package, pass the appropriate flag to skip optional dependencies when installing this package (e.g. --no-optional if using npm install or --without-optional using yarn install).

If you are using stellar-base in a browser you can ignore this. However, for production backend deployments you should most likely be using sodium-native. If sodium-native is successfully installed and working, StellarBase.FastSigning variable will be equal true. Otherwise it will be false.

Quick start

Using yarn to include js-stellar-base in your own project:

yarn add @stellar/stellar-base

For browsers, use Bower to install it. It exports a variable StellarBase. The example below assumes you have stellar-base.js relative to your html file.

<script src="stellar-base.js"></script>
<script>
  console.log(StellarBase);
</script>

Install

To use as a module in a Node.js project

  1. Install it using yarn:
yarn add @stellar/stellar-base
  1. require/import it in your JavaScript:
var StellarBase = require('@stellar/stellar-base');

To self host for use in the browser

  1. Install it using bower:
bower install stellar-base
  1. Include it in the browser:
<script src="./bower_components/stellar-base/stellar-base.js"></script>
<script>
  console.log(StellarBase);
</script>

If you don't want to use install Bower, you can copy built JS files from the bower-js-stellar-base repo.

To use the cdnjs hosted script in the browser

  1. Instruct the browser to fetch the library from cdnjs, a 3rd party service that hosts js libraries:
<script src="https://cdnjs.cloudflare.com/ajax/libs/stellar-base/{version}/stellar-base.js"></script>
<script>
  console.log(StellarBase);
</script>

Note that this method relies using a third party to host the JS library. This may not be entirely secure.

Make sure that you are using the latest version number. They can be found on the releases page in Github.

To develop and test js-stellar-base itself

  1. Install Node 18.x

We support the oldest LTS release of Node, which is currently 18.x. Please likewise install and develop on Node 16 so you don't get surprised when your code works locally but breaks in CI.

If you work on several projects that use different Node versions, you might find helpful to install a NodeJS version manager:

  1. Install Yarn

This project uses Yarn to manages its dependencies. To install Yarn, follow the project instructions available at https://yarnpkg.com/en/docs/install.

  1. Clone the repo
git clone https://github.com/stellar/js-stellar-base.git
  1. Install dependencies inside js-stellar-base folder
cd js-stellar-base
yarn
  1. Observe the project's code style

While you're making changes, make sure to regularly run the linter to catch any linting errors (in addition to making sure your text editor supports ESLint)

yarn lint

as well as fixing any formatting errors with

yarn fmt

If you're working on a file not in src, limit your code to Node 6.16 ES! See what's supported here: https://node.green/. (Our npm library must support earlier versions of Node, so the tests need to run on those versions.)

Updating XDR definitions

  1. Make sure you have Docker installed and running.
  2. make reset-xdr

Usage

For information on how to use js-stellar-base, take a look at the docs in the docs folder.

Testing

To run all tests:

yarn test

To run a specific set of tests:

yarn test:node
yarn test:browser

Tests are also run automatically in Github Actions for every master commit and pull request.

Documentation

Documentation for this repo lives inside the docs folder.

Contributing

Please see the CONTRIBUTING.md for details on how to contribute to this project.

Publishing to npm

npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease]

A new version will be published to npm and Bower by GitHub Actions.

npm >= 2.13.0 required. Read more about npm version.

License

js-stellar-base is licensed under an Apache-2.0 license. See the LICENSE file for details.

More Repositories

1

stellar-core

Reference implementation for the peer-to-peer agent that manages the Stellar network.
C
3,098
star
2

go

Stellar's public monorepo of go code
Go
1,268
star
3

kelp

Kelp is a free and open-source trading bot for the Stellar DEX and 100+ centralized exchanges
Go
1,054
star
4

soroban-example-dapp

End-to-End Example Soroban Dapp
Rust
951
star
5

js-stellar-sdk

Main Stellar client library for the JavaScript language.
JavaScript
606
star
6

stellar-protocol

Developer discussion about possible changes to the protocol.
RPC
506
star
7

slingshot

A new blockchain architecture under active development, with a strong focus on scalability, privacy and safety
Rust
403
star
8

stellar-client

INACTIVE. Browser based client for stellard. This repository is inactive. It points to the stellard network, which is being replaced by stellar-core. Please refer to the replacement repository, interstellar-client, which points to the stellar-core network.
JavaScript
306
star
9

dashboard

JavaScript
215
star
10

quickstart

Home of the stellar/quickstart docker image for development and testing
Shell
183
star
11

java-stellar-sdk

Java
173
star
12

awesome-stellar

πŸ‘¨β€πŸš€ A curated list of Stellar applications, blog posts, educational resources, tools, and more.
159
star
13

stellar-wallet

Holds encrypted data. Used by stellar-client to store the user's key in a secure way.
JavaScript
103
star
14

django-polaris

An extendable Django app for building modular Stellar services
Python
95
star
15

rs-soroban-sdk

Rust SDK for Soroban contracts.
Rust
89
star
16

laboratory

JavaScript
77
star
17

freighter

Stellar chrome extension
TypeScript
72
star
18

new-docs

JavaScript
68
star
19

js-stellar-wallets

A library to make it easier to write wallets that interact with Stellar
TypeScript
62
star
20

rs-soroban-env

Rust environment for Soroban contracts.
Rust
57
star
21

stellar-demo-wallet

Provides a front-end interface to test SEP interoperability. Website at https://demo-wallet.stellar.org/
TypeScript
51
star
22

soroban-cli

CLI for Soroban contracts.
Rust
51
star
23

soroban-docs

Documentation for Soroban
MDX
50
star
24

soroban-examples

Example Soroban Contracts
Rust
47
star
25

packages

SDF - Packages
Shell
46
star
26

paper-wallet

HTML
43
star
27

os-projects

42
star
28

sorobanathon

Sorobanathon: First Light
42
star
29

starlight

Layer 2 payment channel protocol for the Stellar network.
Go
40
star
30

starbridge

Software that facilitates bridge builders who are connecting the Stellar network to other blockchains.
Go
39
star
31

account-viewer-v2

A simple tool to view an account on the Stellar network and make transactions from it.
TypeScript
37
star
32

stellar-docs

Documentation for Stellar
MDX
35
star
33

java-stellar-anchor-sdk

Java SDK for the Stellar network anchor development.
Kotlin
35
star
34

developers

Stellar developer portal site generator.
JavaScript
33
star
35

stellar-etl-airflow

Airflow DAGs for the Stellar ETL project
Python
31
star
36

stellar-disbursement-platform-backend

Stellar Disbursement Platform Backend
Go
28
star
37

stellar-etl

Stellar ETL will enable real-time analytics on the Stellar network
Go
28
star
38

js-xdr

Read/write XDR encoded data structures (RFC 4506)
JavaScript
24
star
39

js-soroban-client

Main Soroban client library for the Javascript language
TypeScript
23
star
40

xdrgen

A code generator for XDR
Rust
22
star
41

stellar-xdr

Staging area for future version of Stellar XDR.
RPC
18
star
42

rs-stellar-xdr

Rust lib for Stellar XDR.
Rust
18
star
43

docs-wallet

SCSS
17
star
44

stellar-disbursement-platform-frontend

Stellar Disbursement Platform Frontend
TypeScript
16
star
45

stellar-turrets

Reference implementation of the Stellar Turrets protocol
JavaScript
15
star
46

stellar-anchor-tests

A library and CLI tool for testing Stellar anchors.
TypeScript
13
star
47

typescript-wallet-sdk

Typescript Wallet SDK to build Stellar wallets
TypeScript
12
star
48

stories

JavaScript
12
star
49

hack-stellar

TypeScript
12
star
50

.github

11
star
51

moneygram-access-wallet-mvp

An MVP wallet integrated with MoneyGram Access
Python
11
star
52

stellar-tutorials

This repository holds tools and tutorials to help developers build on Stellar.
JavaScript
10
star
53

scaffold-soroban

Soroban example dapps
JavaScript
10
star
54

hackathon-get-started

πŸ’» All the resources you'll need to begin your Stellar project.
10
star
55

integration-tests

JavaScript
9
star
56

stellar-design-system

Components for Stellar’s design system
TypeScript
9
star
57

supercluster

Stellar-core integration test automation tool
F#
9
star
58

bower-js-stellar-sdk

JavaScript
9
star
59

soroban-rpc

RPC server for Soroban contracts.
Go
9
star
60

react-starter

Stellar's starter kit for React projects.
TypeScript
9
star
61

stellar-core-prometheus-exporter

Stellar Core Prometheus Exporter
Python
8
star
62

scp-proofs

SCP proofs and models
Python
8
star
63

product-conventions

A layout of all conventions to be used by all Stellar frontend products
JavaScript
8
star
64

soroban-react-payment

Soroban example dapps
TypeScript
7
star
65

django-polaris-circle

A reusable Django app for Circle USDC custody support in django-polaris deployments
Python
6
star
66

fca00c-asteroids

Learn Soroban and compete for a top spot on the leaderboard in Fast, Cheap & Out of Control
Rust
6
star
67

sorobounty-spectacular

Sorobounty Spectacular
5
star
68

sep24-reference-ui

TypeScript
5
star
69

regulated-assets-poc

JavaScript
5
star
70

core-node-admin-panel

TypeScript
5
star
71

recoverysigner-firebase-auth

A simple demo frontend web app for performing Firebase phone auth for use with recoverysigner.
TypeScript
5
star
72

soroflare

The Soroban environment and vm running on a Cloudflare Worker. (a simplified version of the backend running fca00c.com)
Rust
5
star
73

kotlin-wallet-sdk

Kotlin Wallet SDK to build Stellar wallets
Kotlin
5
star
74

sorobounties

The Soroban content bounty program
5
star
75

stellar-community-fund-contracts

Rust
4
star
76

stellar-turrets-docs

Docs repo for the Stellar Turrets protocol
4
star
77

anchor-transfer-utils

Utilities for anchors and wallets implementing SEP6 transfer protocol
TypeScript
4
star
78

stellar-upgrade-web

JavaScript
4
star
79

stellar-upgrade

Go
4
star
80

convert-stellar-address

JavaScript
4
star
81

soroban-name-service

Soroban name service
Rust
4
star
82

soroban-react-atomic-swap

A react demo dapp for making an atomic swap on Soroban
TypeScript
4
star
83

recoverysigner-demo-client

A limited feature demo client for a SEP-30 Recoverysigner server.
JavaScript
4
star
84

soroban-quest

Soroban Quest is a gamified educational course where you’ll learn Soroban and earn rewards!
Rust
4
star
85

solar-stellarorg

Stellar.org's Solar CSS framework theme
CSS
4
star
86

js-stellar-elements

Styled basic components for Stellar projects
JavaScript
3
star
87

solar-stellarorg-pages

CSS
3
star
88

golistcmp

A tool for comparing the output of 'go list -m -json all' executions.
Go
3
star
89

basic-payment-app

An example payments application demonstrating integrations of various features and SEPs in a user-facing product.
Svelte
3
star
90

soroban-dapps-challenge

Dapps for the Soroban Dapps Challenge
3
star
91

stellar-dbt-public

Public DBT instance to aid in data transformation for analytics purposes
Shell
3
star
92

bower-js-stellar-base

JavaScript
3
star
93

amm-reference-ui

A reference codebase to serve as a proof of concept for an AMM UI
TypeScript
3
star
94

helm-charts

Helm charts for deploying SDF maintained software
Smarty
3
star
95

stellar-account-prometheus-exporter

Stellar Account Prometheus Exporter - Monitor Stellar Network Accounts
Python
3
star
96

dts-xdr

A library for generating TypeScript declarations (.d.ts) for js-xdr auto-generated files.
JavaScript
3
star
97

crate-git-revision

Embed git revision into crates built and published.
Rust
2
star
98

actions

GitHub Actions for Stellar repositories.
TypeScript
2
star
99

project-viewer

Navigating projects on Stellar
Go
2
star
100

soroban-react-mint-token

An example dapp for minting tokens on Soroban
TypeScript
2
star