https://github.com/bitcoin-com/dappid
BITBOX lib for BDIP-2
https://github.com/bitcoin-com/dappid
Last synced: 23 days ago
JSON representation
BITBOX lib for BDIP-2
- Host: GitHub
- URL: https://github.com/bitcoin-com/dappid
- Owner: Bitcoin-com
- License: mit
- Created: 2018-11-03T16:19:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-03T22:55:43.000Z (over 7 years ago)
- Last Synced: 2024-11-27T09:18:29.641Z (over 1 year ago)
- Language: TypeScript
- Size: 289 KB
- Stars: 0
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: code-of-conduct.md
Awesome Lists containing this project
README
# BDIP-2 Codec
[BITBOX](https://developer.bitcoin.com/bitbox) lib for encoding/decoding [BDIP-2](https://github.com/web3bch/BDIPs/blob/master/BDIPs/bdip-2.md#create-dapp)
## Installation
```bash
npm install dappid --save
```
## Usage
### Encode BDIP-2
```js
// require lib
let dappid = require('dappid')
// create instance
let d = new dappid()
// encode BDIP-2
d.encodeBDIP2(
'00',
'0000',
'00',
'BitcoinCashApp',
'0eac357541b0ba572849113c5faa1d1990f6382741dc3e2f5507e3ca8346dc0e',
'web3bch.cash',
'Hello Bitcoin Cash'
)
// OP_RETURN 64617070 00 0000 00 426974636f696e43617368417070 0eac357541b0ba572849113c5faa1d1990f6382741dc3e2f5507e3ca8346dc0e 776562336263682e63617368 48656c6c6f20426974636f696e2043617368
```
### Decode BDIP-2
```js
d.decodeBDIP2(
'OP_RETURN 64617070 00 0000 00 426974636f696e43617368417070 0eac357541b0ba572849113c5faa1d1990f6382741dc3e2f5507e3ca8346dc0e 776562336263682e63617368 48656c6c6f20426974636f696e2043617368'
)
// { magicNumber: '64617070',
// txType: '00',
// txVersion: '0000',
// appType: '00',
// name: 'itcoinCashApp',
// protocolSpec: '0eac357541b0ba572849113c5faa1d1990f6382741dc3e2f5507e3ca8346dc0e',
// url: '119,101,98,bch.cash',
// metaData: 'ello Bitcoin Cash' }
```