cl-dogechain-api

View project on github

dogechain-api is a Common Lisp library for working with the dogechain.info API. It can be used to query dogecoin addresses and fetch general information about the dogecoin network.

It’s unit tested using prove and uses drakma for making http requests.

Simple Query API - Function Reference

dogechain-api currently supports all endpoints for the simple api which are mapped as follows:

API Method Local Function
addressbalance dogechain-api:get-address-balance
addresstohash dogechain-api:address-to-hash
checkaddress dogechain-api:valid-address-p
decode_address dogechain-api:decode-address
getblockcount dogechain-api:get-block-count
getdifficulty dogechain-api:get-difficulty
getreceivedbyaddress dogechain-api:get-address-received
getsentbyaddress dogechain-api:get-address-sent
totalbc dogechain-api:get-total-mined

Functions

dogechain-api:get-address-balance address

Get the total amount ever received, minus the total amount ever sent for address.

Raises an invalid-address-error if the address is invalid.

CL-USER> (dogechain-api:get-address-balance "DTnt7VZqR5ofHhAxZuDy4m3PhSjKFXpw3e")
12345.6789

dogechain-api:address-to-hash address

Get the public key hash for a valid Dogecoin address.

Raises an invalid-address-error if the address is invalid.

CL-USER> (dogechain-api:address-to-hash "DTnt7VZqR5ofHhAxZuDy4m3PhSjKFXpw3e")
"F8783344AF8532A73DFA97EBDDFCC7527A2C6E5A"

dogechain-api:valid-address-p address

Check address for validity. An invalid address will return NIL rather than raising an error like other API functions.

CL-USER> (dogechain-api:valid-address-p "DTnt7VZqR5ofHhAxZuDy4m3PhSjKFXpw3e")
T
CL-USER> (dogechain-api:valid-address-p "INVALID")
NIL

dogechain-api:decode-address address

Get the version prefix and hash encoded in address. Returns an association list containing :version and :hash keys.

Raises an invalid-address-error if the address is invalid.

CL-USER> (dogechain-api:decode-address "DTnt7VZqR5ofHhAxZuDy4m3PhSjKFXpw3e")
((:version . "1E")
 (:hash . "F8783344AF8532A73DFA97EBDDFCC7527A2C6E5A"))

dogechain-api:get-block-count

Get the current block number. This is the total number of blocks that have been mined.

CL-USER> (dogechain-api:get-block-count)
123456

dogechain-api:get-difficulty

Get the difficulty of the most recently solved block.

CL-USER> (dogechain-api:get-difficulty)
123456

dogechain-api:get-address-received address

Get the total amount ever received by address.

Raises an invalid-address-error if the address is invalid.

CL-USER> (dogechain-api:get-received-by-address "DTnt7VZqR5ofHhAxZuDy4m3PhSjKFXpw3e")
123456.7890

dogechain-api:get-address-sent address

Get the total amount ever sent by address.

Raises an invalid-address-error if the address is invalid.

CL-USER> (dogechain-api:get-sent-by-address "DTnt7VZqR5ofHhAxZuDy4m3PhSjKFXpw3e")
123456.7890

dogechain-api:get-total-mined

Get the total amount of currency ever mined.

CL-USER> (dogechain-api:get-total-mined)
123456.7890