{"id":13517854,"url":"https://github.com/stellar/js-stellar-base","last_synced_at":"2026-02-27T20:18:48.182Z","repository":{"id":29786265,"uuid":"33330420","full_name":"stellar/js-stellar-base","owner":"stellar","description":"The lowest-level stellar helper library. It consists of classes to read, write, hash, and sign Stellar xdr","archived":false,"fork":false,"pushed_at":"2025-03-28T23:24:27.000Z","size":9776,"stargazers_count":112,"open_issues_count":37,"forks_count":138,"subscribers_count":41,"default_branch":"master","last_synced_at":"2025-04-13T16:08:21.685Z","etag":null,"topics":["blockchain","cryptocurrency","javascript","stellar"],"latest_commit_sha":null,"homepage":"https://stellar.github.io/js-stellar-base/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stellar.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-04-02T20:32:20.000Z","updated_at":"2025-03-28T23:19:20.000Z","dependencies_parsed_at":"2024-01-02T17:51:21.803Z","dependency_job_id":"1c015025-aaab-47a1-a92b-ac2e133315d4","html_url":"https://github.com/stellar/js-stellar-base","commit_stats":{"total_commits":763,"total_committers":65,"mean_commits":"11.738461538461538","dds":0.6710353866317169,"last_synced_commit":"6930a70d7fbde675514b5933baff605d97453ba7"},"previous_names":[],"tags_count":144,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stellar%2Fjs-stellar-base","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stellar%2Fjs-stellar-base/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stellar%2Fjs-stellar-base/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stellar%2Fjs-stellar-base/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stellar","download_url":"https://codeload.github.com/stellar/js-stellar-base/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248741206,"owners_count":21154255,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blockchain","cryptocurrency","javascript","stellar"],"created_at":"2024-08-01T05:01:38.078Z","updated_at":"2026-02-27T20:18:48.177Z","avatar_url":"https://github.com/stellar.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# JS Stellar Base\n\n[![Tests](https://github.com/stellar/js-stellar-base/actions/workflows/tests.yml/badge.svg)](https://github.com/stellar/js-stellar-base/actions/workflows/tests.yml)\n[![Code Climate](https://codeclimate.com/github/stellar/js-stellar-base/badges/gpa.svg)](https://codeclimate.com/github/stellar/js-stellar-base)\n[![Coverage Status](https://coveralls.io/repos/stellar/js-stellar-base/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/stellar/js-stellar-base?branch=master)\n[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/stellar/js-stellar-base)\n\nThe stellar-base library is the lowest-level stellar helper library. It consists\nof classes to read, write, hash, and sign the xdr structures that are used in\n[stellar-core](https://github.com/stellar/stellar-core). This is an\nimplementation in JavaScript that can be used on either Node.js or web browsers.\n\n- **[API Reference](https://stellar.github.io/js-stellar-base/)**\n\n\u003e **Warning!** The Node version of this package uses the [`sodium-native`](https://www.npmjs.com/package/sodium-native) package, a native implementation of [Ed25519](https://ed25519.cr.yp.to/) in Node.js, as an [optional dependency](https://docs.npmjs.com/files/package.json#optionaldependencies).\n\u003e This means that if for any reason installation of this package fails, `stellar-base` will fallback to the much slower implementation contained in [`tweetnacl`](https://www.npmjs.com/package/tweetnacl).\n\u003e\n\u003e 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`).\n\u003e\n\u003e 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`.\n\u003e If `sodium-native` is successfully installed and working,\n\u003e `StellarBase.FastSigning` variable will be equal `true`. Otherwise it will be\n\u003e `false`.\n\n## Quick start\n\nUsing yarn to include js-stellar-base in your own project:\n\n```shell\nyarn add @stellar/stellar-base\n```\n\nFor browsers, [use Bower to install it](#to-use-in-the-browser). It exports a\nvariable `StellarBase`. The example below assumes you have `stellar-base.js`\nrelative to your html file.\n\n```html\n\u003cscript src=\"stellar-base.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  console.log(StellarBase);\n\u003c/script\u003e\n```\n\n## Install\n\n### To use as a module in a Node.js project\n\n1. Install it using yarn:\n\n```shell\nyarn add @stellar/stellar-base\n```\n\n2. require/import it in your JavaScript:\n\n```js\nvar StellarBase = require(\"@stellar/stellar-base\");\n```\n\n### To self host for use in the browser\n\n1. Install it using [bower](http://bower.io):\n\n```shell\nbower install stellar-base\n```\n\n2. Include it in the browser:\n\n```html\n\u003cscript src=\"./bower_components/stellar-base/stellar-base.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  console.log(StellarBase);\n\u003c/script\u003e\n```\n\nIf you don't want to use install Bower, you can copy built JS files from the\n[bower-js-stellar-base repo](https://github.com/stellar/bower-js-stellar-base).\n\n### To use the [cdnjs](https://cdnjs.com/libraries/stellar-base) hosted script in the browser\n\n1. Instruct the browser to fetch the library from\n   [cdnjs](https://cdnjs.com/libraries/stellar-base), a 3rd party service that\n   hosts js libraries:\n\n```html\n\u003cscript src=\"https://cdnjs.cloudflare.com/ajax/libs/stellar-base/{version}/stellar-base.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  console.log(StellarBase);\n\u003c/script\u003e\n```\n\nNote that this method relies using a third party to host the JS library. This\nmay not be entirely secure.\n\nMake sure that you are using the latest version number. They can be found on the\n[releases page in Github](https://github.com/stellar/js-stellar-base/releases).\n\n### To develop and test js-stellar-base itself\n\n1. Install Node 20.x\n\nWe support the oldest LTS release of Node, which is [currently 20.x](https://nodejs.org/en/about/releases/).\n\nIf you work on several projects that use different Node versions, you might find helpful to install a NodeJS version manager:\n\n- https://github.com/creationix/nvm\n- https://github.com/wbyoung/avn\n- https://github.com/asdf-vm/asdf\n\n2. Install Yarn\n\nThis project uses [Yarn](https://yarnpkg.com/) to manages its dependencies. To install Yarn, follow the project instructions available at https://yarnpkg.com/en/docs/install.\n\n3. Clone the repo\n\n```shell\ngit clone https://github.com/stellar/js-stellar-base.git\n```\n\n4. Install dependencies inside js-stellar-base folder\n\n```shell\ncd js-stellar-base\nyarn\n```\n\n5. Observe the project's code style\n\nWhile you're making changes, make sure to regularly run the linter to catch any\nlinting errors (in addition to making sure your text editor supports ESLint)\n\n```shell\nyarn lint\n```\n\nas well as fixing any formatting errors with\n\n```shell\nyarn fmt\n```\n\n#### Updating XDR definitions\n\nXDR updates are complicated due to the fact that you need workarounds for bugs\nin the generator, formatter, or a namespace adjustment.\n\n1. Make sure you have [Docker](https://www.docker.com/) installed and running.\n2. Change the commit hash to the right version of [stellar-xdr](https://github.com/stellar/stellar-xdr) and add any filenames that might've been introduced.\n3. Run `make reset-xdr`\n4. Run `sed -ie s/\\\"/\\'/g types/{curr,next}.d.ts` to minimize the diff (the generator's formatter uses `\"` but the repo uses `'`).\n5. Move `xdr.Operation` into a hidden namespace to avoid conflicts with the SDK's `Operation`.\n6. Add generator workarounds:\n\n- `type Hash = Opaque[]` is a necessary alias that doesn't get generated\n- `Hyper`, `UnsignedHyper`, and `ScSpecEventV0` need their signatures\n  fixed because linting wants an `Array` instead of a naked `[]`.\n- Some constants aren't generated correctly (e.g, Ctrl+F `SCSYMBOL_LIMIT` in `src/curr_generated.js`)\n\n7. Finally, make code adjustments related to the XDR (these are usually revealed by running the tests).\n\nAs an example PR to follow, [stellar-base#800](https://github.com/stellar/js-stellar-base/pull/800) has detailed steps for each part of the process.\n\n## Usage\n\nFor information on how to use js-stellar-base, take a look at the docs in the\n[docs folder](./docs).\n\n## Testing\n\nTo run all tests:\n\n```shell\nyarn test\n```\n\nTo run a specific set of tests:\n\n```shell\nyarn test:node\nyarn test:browser\n```\n\nTests are also run automatically in Github Actions for every master commit and\npull request.\n\n## Documentation\n\nDocumentation for this repo lives inside the [docs folder](./docs).\n\n## Contributing\n\nPlease see the [CONTRIBUTING.md](./CONTRIBUTING.md) for details on how to\ncontribute to this project.\n\n## Publishing to npm\n\n```\nnpm version [\u003cnewversion\u003e | major | minor | patch | premajor | preminor | prepatch | prerelease]\n```\n\nA new version will be published to npm **and** Bower by GitHub Actions.\n\nnpm \u003e= 2.13.0 required. Read more about\n[npm version](https://docs.npmjs.com/cli/version).\n\n## License\n\njs-stellar-base is licensed under an Apache-2.0 license. See the\n[LICENSE](./LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstellar%2Fjs-stellar-base","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstellar%2Fjs-stellar-base","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstellar%2Fjs-stellar-base/lists"}