Skip to content
DogeJS-DevPublic

About

Dogecoin keys, HD wallets, addresses, message signing, transactions and PSBT for JavaScript and TypeScript. Browser and Node, no server.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

DogeJS

DogeJS Core

Dogecoin keys, wallets, addresses, signed messages and transactions for JavaScript and TypeScript, in the browser or in Node, with no server.

Live demo · Documentation · All DogeJS projects

The Core demo: a transaction built and checked in the browser, next to the code

What it does

  • Makes Dogecoin wallets and addresses: recovery phrases, HD keys (BIP32, BIP39, BIP44), P2PKH and P2SH addresses and WIF keys.
  • Signs and checks messages the way Dogecoin Core's signmessage does, so someone can prove they own an address.
  • Builds, signs and checks payments: it picks coins, adds change, and checks dust and fee limits for you.
  • Handles multisig (m-of-n), PSBT (BIP174) and a versioned transaction file that carries a payment from the machine that builds it to the one that signs it.
  • Runs in browsers and in Node 20 or later as plain ES modules, with no server. Money is always whole koinu (bigint), never a float.

Try it

Open the live demo and make an address, sign a message or build a payment right in your browser: https://dogejs.com/core/

From a terminal, one command:

npm install github:DogeJS-Dev/core#v0.4.1

Screenshots

Sign a message with a demo key, then change one letter and watch the check fail.

Sign a message with a demo key, then change one letter and watch the check fail.

Check an address: the right network, the right checksum, and a typo caught.

Check an address: the right network, the right checksum, and a typo caught.

Install

Nothing is on npm yet, so install straight from this repository (it needs a public repository, or a GitHub login that can read it). The prepare script builds dist as part of the install.

npm install github:DogeJS-Dev/core#v0.4.1

Once the package is on npm this becomes npm install @dogejs/core. To work on it, clone the repository and run npm install and npm run build.

Make a key, an address and a signature, then check it (this is the code in docs/REFERENCE.md, and it was run against the built package):

import { generatePrivateKey, getPublicKey, encodeWif, p2pkhAddress, signMessage, verifyMessage, parseDoge, formatDoge, testnet } from '@dogejs/core';

const priv = generatePrivateKey();
const address = p2pkhAddress(getPublicKey(priv), testnet);
const signature = signMessage('hello doge', encodeWif(priv, { network: testnet }));
console.log(address.length, verifyMessage('hello doge', address, signature)); // 34 true
console.log(parseDoge('12.5'), formatDoge(1250000000n)); // 1250000000n 12.5

A bundler can pull in one function at a time through the subpath entries, for example import { isValidAddress } from '@dogejs/core/address'.

How it works

The cryptography comes from the audited noble and scure libraries by Paul Miller and contributors (secp256k1, SHA-256, RIPEMD-160, Base58, BIP32, BIP39). DogeJS adds only the Dogecoin layer: network parameters, encodings, validation, scripts, fee and dust rules, and Core-compatible formats. Protocol constants are copied from the Dogecoin Core source with a file and line in a comment. It is tested against Dogecoin Core's own test vectors (sighash, transaction validity, scripts, Base58), the BIP32, BIP39 and BIP174 reference vectors and values from libdogecoin.

The full reference, with an example for every area, is in docs/REFERENCE.md. File formats are in docs/FILE-FORMATS.md and docs/PSBT.md.

Works with

Core is the base of the other DogeJS projects. It needs nothing from them.

Status

Version 0.4.1. It is not published to npm yet, so you install it from git. It has had no external security review. It is tested against Dogecoin Core's own vectors and reference data, but nothing it produces has been broadcast to the real Dogecoin network (mainnet, testnet or regtest). Do not use it to hold or move real DOGE yet; use testnet or read-only tasks.

Contributing

Bug reports, ideas and pull requests are welcome. Read the contributing guide first: small, tested, explained.

npm install
npm run build
npm run typecheck
npm test

Report a security problem privately to hello@dogejs.com, never in a public issue. See SECURITY.md.

The maintainers keep one combined development workspace for all DogeJS projects and publish each project from it as a repository of its own. An accepted pull request is applied there and appears here with the next release.

Licence

MIT, see LICENSE. Bundled third-party code, where there is any, is listed in THIRD_PARTY_LICENSES.

About

Dogecoin keys, HD wallets, addresses, message signing, transactions and PSBT for JavaScript and TypeScript. Browser and Node, no server.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages