An IOTA Client Library Implemented in Clojure
This library aims to be an idiomatic, feature-complete, client implementation of the full IOTA API Command Set.
Get Clota from clojars:
or download and install directly:
git clone https://github.com/tuddman/iota.lib.clj
cd iota.lib.clj
lein clean && lein install
;; Include Clota Library in your project
> (require '[clota.client :as iota])
;; Commands - from a REPL
> (def node-uri "http://0.0.0.0:14625")
;; OPTIONAL - if you have REMOTE_AUTH set for the node. If so, you will need to send the token along with every command.
> (def token (iota/make-auth-token "user:password")
> (iota/get-node-info node-uri token)
> (iota/get-neighbors node-uri token)
> (iota/add-neighbors node-uri ["udp://good.neighbor:14265" ...] token)
> (iota/remove-neighbors node-uri ["udp://bad.neighbor:14265" ...] token)
> (iota/get-tips node-uri token)
> (iota/find-transactions node-uri {:addresses ["SOMEIOTAHASHADDRESS..." ...]} token)
> (iota/get-trytes node-uri ["SOMEIOTATRYTES...999"] token)
> (iota/get-inclusion-states node-uri {:transactions ["..." ...] :tips ["..." ...]} token)
> (iota/get-balances node-uri {:addresses ["..." ...] :threshold 100} token)
> (iota/get-transactions-to-approve node-uri {:depth 27} token)
> (iota/attach-to-tangle node-uri {:trunkTransaction "..." :branchTransaction "..." :min-weight-magnitude 18 :trytes ["..." ...]} token)
> (iota/interrupt-attaching-to-tangle node-uri token)
> (iota/broadcast-transactions node-uri ["SOMETXHASH..." ...] token)
> (iota/store-transactions node-uri ["SOMETXHASH..." ...] token)
API Command | Clota Function | Status | Test Coverage |
---|---|---|---|
getNodeInfo | (get-node-info ...) |
Implemented | Complete |
getNeighbors | (get-neighbors ...) |
Implemented | Complete |
removeNeighbors | (remove-neighbors ...) |
Implemented | Complete |
getTips | (get-tips ...) |
Implemented | Complete |
findTransactions | (find-transactions ...) |
Implemented | None |
getTrytes | (get-trytes ...) |
Implemented | None |
getInclusionStates | (get-inclusion-states ...) |
Implemented | None |
getBalances | (get-balances ...) |
Implemented | None |
getTransactionsToApprove | (get-transactions-to-approve ...) |
Implemented | None |
attachToTangle | (attach-to-tangle ...) |
Implemented | None |
interruptAttachingToTangle | (interrupt-attaching-to-tangle ...) |
Implemented | None |
broadcastTransactions | (broadcast-transactions ...) |
Implemented | None |
storeTransactions | (store-transactions ...) |
Implemented | None |
for more, look in src/clota/client.clj
;; PLEASE BE ADVISED : DO NOT SHARE YOUR PRIVATE SEED WITH ANYONE. EVER!
;; To Generate a Secure Random Seed:
> (clota.crypto/generate-seed)
=> "9KHKESVOHBOMHCL9ADINALYVHSBKRHITKMOJJJHFKOHWBZDFQDVLKQMTVZTUTWHIWXISBRIFXPZEEZTUU"
;; Or, if that's not good enough for 'ya,
;; and you want to do some more randomized matrix math to generate your seed:
> (clota.crypto/generate-paranoid-seed)
=> "IKAGOIVHXAR9XRJMC9LIXHMFAXYAAXKSAXJE99ODVRMISXWNJIIGGVCQIKLVHMRQRQKESJDESRSQOUZTA"
Continuous Integration Tests are provided by Travis CI.
To run the tests yourself:
$ lein test
Pull Requests Welcome.
Donate: F99IWXVIZPSXTDT9YUMHRAIGKXDQAUZCXWQJZWM9SIIOOFDHGEGCJVZOJJHMAZISPKVUYNUJQLANFXOMWNHNFJKPOB
Copyright © 2018 - now tuddman
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.