Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/donpdonp/bitcoin-wasm
The bitcoin script interpreter (cpp) compiled to webassembly.
https://github.com/donpdonp/bitcoin-wasm
bitcoin webassembly
Last synced: about 2 months ago
JSON representation
The bitcoin script interpreter (cpp) compiled to webassembly.
- Host: GitHub
- URL: https://github.com/donpdonp/bitcoin-wasm
- Owner: donpdonp
- License: cc0-1.0
- Created: 2018-02-26T04:54:22.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-08-26T18:12:46.000Z (over 2 years ago)
- Last Synced: 2024-08-03T18:15:14.196Z (5 months ago)
- Topics: bitcoin, webassembly
- Language: C
- Homepage: http://donpdonp.github.io/bitcoin-wasm/
- Size: 8.6 MB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- AwesomeInterpreter - bitcoin-wasm
README
Build the script/interpreter part of the bitcoin code base for webasm.
## status
2018-Mar-13 All opcode are supported except OP_CHECKSIG (openssl/ecdsa libs are not ported to webasm yet)## build
```bash
bitcoin-wasm $ make
building for dogecoin 1.10.0
emcc -s 'EXPORTED_FUNCTIONS...
-rw-rw-r-- 1 donp donp 636982 Mar 5 14:13 build/bridge.wasm
```## run in node
The run.js file loads a script containing 1, 2, OP_ADD operation. This pushes
two values to the stack, then runs OP_ADD. The resulting stack is the result
of the ADD.```bash
bitcoin-wasm $ make node
cd build; node ../run.js
loading bridge.wasm
compiling script: [ '1', '2', 'OP_ADD' ]
stringCompile 3 opcode strings
#0 1 (0x1) number
#1 2 (0x2) number
#2 93 OP_ADD opcode
script opcount: 3 hex: 0101010293
input script compiled to: 1 2 OP_ADD
scriptRun #0 begin
scriptRun GOOD
stacktoChar memcopy row 0 len 1
script SUCCESS
Uint8Array [ 3 ]
```## run in a browser
bridge.js is loaded as any other .js file in an html script tag. it will expect
bridge.wasm to exist at the same path.