Giter VIP home page Giter VIP logo

bp's Issues

Less verbose opcode definition

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))
"
  )

Investigate Lisp implementations failing the CI

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.

Not an issue, just a comment

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"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.