rodentrabies / bp Goto Github PK
View Code? Open in Web Editor NEWBitcoin Protocol components in Common Lisp
License: MIT License
Bitcoin Protocol components in Common Lisp
License: MIT License
Ideally it should look like this:
(defmacro define-opcode (op-name op-code op-hex-code
(&rest args)
&body (doc &rest body))
"Define opcode function named OP-NAME for a given OP-CODE.
OP-HEX-CODE is ignored and used only for documentation purposes.
- Arithmetic:
(define-opcode op_add 147 #x93 (state (a :integer) (b :integer)) :integer
(@push (+ a b))
t)
(define-opcode op_add 147 #x93 (state)
(when (>= (length (@stack state)) 2)
(let ((b (decode-integer (pop (@stack state))))
(a (decode-integer (pop (@stack state)))))
(push (encode-integer (+ a b)) (@stack state))
t)))
- Stack:
(define-opcode op_pick 121 #x79 (state (n :integer) :null
(when (>= (length (@stack state)) (1- n))
(push (nth (1- n) (@stack state)) (@stack state))
t))))
(define-opcode op_pick 121 #x79 (state)
(when (>= (length (@stack state)) 1)
(let ((n (decode-integer (pop (@stack state)))))
(when (>= (length (@stack state)) (1- n))
(push (nth (1- n) (@stack state)) (@stack state))
t))))
- Crypto:
(define-opcode op_ripemd160 166 #xa6 (state (a :bytes)) :bytes
(@push (ripemd160 a))
t)
(define-opcode op_ripemd160 166 #xa6 (state)
(when (>= (length (@stack state)) 1)
(push (ripemd160 (pop (@stack state))) (@stack state))
t))
"
)
The following targets currently fail the CI:
allegro
(32-bit) - exit code 255, unknown reason;clisp
, clisp32
, ecl
- package lock violation;abcl
- exits with 0, but doesn't run tests because of an ASDF-related exception.Since this commit sharplispers/ironclad@4c689d0 Ironclad supports libsecp256k1
. It would be more convenient to not depend on external libraries with cffi
but use cl-native code. If you need some help I can try to assists (even though my cryptographic knowledge is also limited).
This is really cool!
CL-USER> (bp:with-chain-supplier (bp:node-connection
:url "http://localhost:8332"
:username *rpcuser*
:password *rpcpsswrd*)
(let* ((genesis-hash (bp:get-block-hash 0))
(genesis-block (bp:get-block genesis-hash))
(genesis-tx-input (aref (bp:tx-inputs (aref (bp:block-transactions genesis-block) 0)) 0))
(genesis-commands (bp:script-commands (bp:txin-script-sig genesis-tx-input)))
(genesis-note (cdr (aref genesis-commands 2))))
(flexi-streams:octets-to-string genesis-note)))
"The Times 03/Jan/2009 Chancellor on brink of second bailout for banks"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.