{"id":23330463,"url":"https://github.com/vekexasia/dpos-offline","last_synced_at":"2025-08-23T00:31:03.575Z","repository":{"id":23372024,"uuid":"98666348","full_name":"vekexasia/dpos-offline","owner":"vekexasia","description":"Offline Signing Transactions for DPOS Blockchains","archived":false,"fork":false,"pushed_at":"2023-01-07T06:22:48.000Z","size":3121,"stargazers_count":10,"open_issues_count":20,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-03-28T22:03:26.114Z","etag":null,"topics":["blockchain","dpos","signing"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vekexasia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-28T16:10:11.000Z","updated_at":"2020-07-08T10:13:54.000Z","dependencies_parsed_at":"2023-01-14T01:00:46.070Z","dependency_job_id":null,"html_url":"https://github.com/vekexasia/dpos-offline","commit_stats":null,"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vekexasia%2Fdpos-offline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vekexasia%2Fdpos-offline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vekexasia%2Fdpos-offline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vekexasia%2Fdpos-offline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vekexasia","download_url":"https://codeload.github.com/vekexasia/dpos-offline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230650813,"owners_count":18259320,"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","dpos","signing"],"created_at":"2024-12-20T22:18:08.905Z","updated_at":"2024-12-20T22:18:09.502Z","avatar_url":"https://github.com/vekexasia.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm](https://img.shields.io/npm/v/dpos-offline.svg)](https://npmjs.org/package/dpos-offline) [![Build Status](https://travis-ci.org/vekexasia/dpos-offline.svg?branch=master)](https://travis-ci.org/vekexasia/dpos-offline) [![Coverage Status](https://coveralls.io/repos/github/vekexasia/dpos-offline/badge.svg?branch=master)](https://coveralls.io/github/vekexasia/dpos-offline?branch=master)\n\n# Offline signing DPOS utils 2.0\n\nThis library can ease adoption on offline transaction signing for some Dpos coins. Works both server-side (using sodium c++ bindings) and client-side (using tweetnacl lib).\n\n## Motivation\n\nI've built this library cause there were no such library that had **all the following** :\n  - uses c++ binding when in node environment leveraging native code execution speed\n  - easy to use/understand\n  - had proper tests for both node and browsers\n\nFurthermore the library is written in TypeScript which also provide **code assist utilities** to developers making it even easier to use.\n\n## Quick Start\n\nInstall using `npm i dpos-offline` and use it with webpack or node by requiring it in your code\n\n```javascript\nvar dposOffline = require('dpos-offline').dposOffline\n```\n\nOr directly use it in your browser by including it:\n\n```html\n\u003cscript type=\"text/javascript\" src=\"https://gitcdn.xyz/cdn/vekexasia/dpos-offline/master/dist/browser/index.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\"\u003e\n  // use dposOffline variable.\n\u003c/script\u003e\n```\n\n## What does this library do?\n\n### Create a Send Transaction\n\nAn example worths more than 100 words.\n\n```javascript\nconst Lisk = require('dpos-offline').Lisk;\nconst Rise = require('dpos-offline').Rise;\nconst tx = Lisk.txs.createAndSign(\n  {\n    kind: 'send',\n    amount: 100000000, // Satoshi\n    recipient: '1L'\n  },\n  'my Lisk secret'\n);\n\n// tx will now contain a postable (via API) transaction object\n\n// It works the same for Rise (or the other supported coins)\nconst riseTx = Rise.txs.createAndSign(\n  {\n    kind: 'send',\n    amount: 100000000, // Satoshi\n    recipient: '1R'\n  },\n  'my RISE secret'\n)\n\n```\n\n### Create a Vote Transaction\n\n```javascript\nconst voteTx = Rise.txs.createAndSign(\n  {\n    kind: 'vote',\n    preferences: [\n      {\n        delegateIdentifier: Buffer.from('pubKey of delegate to vote'),\n        action: '+'\n      },\n      {\n        delegateIdentifier: Buffer.from('pubKey of delegate to unvote'),\n        action: '-'\n      }\n    ]\n  },\n  'my RISE secret'\n);\n```\n\n### Second signing existing signed transaction\n\n```javascript\n// const signedTx;\nsignedTx.signSignature = Rise.txs.calcSignature(signedTx, 'second secret');\n\n// Will recalc id and transform the transaction to a postable format via API.\nconst transformedTx = Rise.txs.toPostable(signedTx);\n\n```\n\n\n### Registering a delegate\n\n```javascript\nconst tx = Rise.txs.createAndSign({\n  kind: 'register-delegate',\n  identifier: 'vekexasia'\n});\n```\n\n### Other transaction types.\n\nThe following transaction types are supported using the `.createAndSign` method:\n \n * send\n * vote\n * register delegate\n * add second signature (Lisk and all Lisk derived coins)\n * create multisignature (Lisk and all Lisk derived coins)\n \n### Raw transaction creation\n\nSometimes you want to decide `fee` and `timestamp` (also referenced as `nonce` within the library). The `.createAndSign` method allows to specify both `fee` and `nonce`.\n\nIf you want to create your own object you can use the `.fromPostable` method that converts a tx in postable-via-api format to an inner tx format that could be used with the majority of methods provided.\n\n\n### Verify transaction signature\n\nthe `.txs.verify` method allows checking the provided signature object is valid (against the given pubKey).\n\n\n## Message Signing and Verify\n\nSigning and verifying a message is critical for some applications. The `.msgs` package will provide the methods:\n\n * sign(msg: Buffer | string, kp: IKeypair) =\u003e Buffer \u0026 As\u003c'signature'\u003e\n * verify(msg: Buffer | string, signature: Buffer \u0026 As\u003c'signature'\u003e, publicKey: Buffer \u0026 As\u003c'publicKey'\u003e) =\u003e boolean\n\nThat could be used to sign and verify messages using the format used for such coin. \n\n---\n\n## FAQs \n\n**Where can I find the documentation?**\n\n[vekexasia.github.io/dpos-offline](https://vekexasia.github.io/dpos-offline/)\n\n**Is this library secure**?\n\nWell offline signing is considered a best practice in terms of security\n\n\n**Is this library tested**? \n\nThe library is baked by over 1000 single tests. Most of them are equality checks between this library and original code.\n\n\n**Does this library work on any browser**?\n\nShould work on any modern browser. Feel free to report a bug if not.\n\n\n**What are the tested browsers**?\n\nChrome and Firefox through `karma` library \n\n\n**Can I add support to another coin**?\n\nYes the library is created with extendibility in mind. Adding a new (even very different) coin support should be really easy by extending and overriding the code.\n\n\n**Is this library fast as \"equivalent\" core-code routines**?\n\nYes. When used in node.js it uses `sodium-native` native bindings for node (just like core code). Yeah it's fast.\n\n\n**Should I use this in production**?\n\nWhile it's tested, use it at your own risk!\n\n\n## Donations\n\nIf you like my work and would like to support my work. You could consider to donate me something at the following addresses:\n\n - **LISK**: 9102643396261850794L\n - **SHIFT**: 16159457535471071047S\n - **RISE**: 9857707766596718725R\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvekexasia%2Fdpos-offline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvekexasia%2Fdpos-offline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvekexasia%2Fdpos-offline/lists"}