loading-img

API Connect

To connect to the api, use the link to your node.

http://127.0.0.1:6100/api
Accounts

Get the balance of an account

http://127.0.0.1:6100/api/accounts/getBalance
Parameters Description
address *
string
(query)
SmartHoldem Address
nethash *
string
(header)
fc46bfaf9379121dd6b09f5014595c7b7bd52a0a6d57c5aff790b42a73c76da7
port *
integer
(header)
6100

Get the public key of an account

http://127.0.0.1:6100/api/accounts/getPublickey
Parameters Description
address *
string
(query)
SmartHoldem Address
nethash *
string
(header)
fc46bfaf9379121dd6b09f5014595c7b7bd52a0a6d57c5aff790b42a73c76da7
port *
integer
(header)
6100

Get the delegate fee of an account

http://127.0.0.1:6100/api/accounts/delegates/fee
Parameters Description
nethash *
string
(header)
fc46bfaf9379121dd6b09f5014595c7b7bd52a0a6d57c5aff790b42a73c76da7
port *
integer
(header)
6100

Get the delegates of an account

http://127.0.0.1:6100/api/accounts/delegates
Parameters Description
address *
string
(query)
SmartHoldem Address
nethash *
string
(header)
fc46bfaf9379121dd6b09f5014595c7b7bd52a0a6d57c5aff790b42a73c76da7
port *
integer
(header)
6100

Returns account information of an address

http://127.0.0.1:6100/api/accounts
Parameters Description
address *
string
(query)
SmartHoldem Address
nethash *
string
(header)
fc46bfaf9379121dd6b09f5014595c7b7bd52a0a6d57c5aff790b42a73c76da7
port *
integer
(header)
6100

Get a list of top accounts

http://127.0.0.1:6100/api/accounts/top
Parameters Description
limit
integer
(query)
An unsigned integer that specifies the maximum number of records.
offset
integer
(query)
An unsigned integer that specified the number of records to skip.
nethash *
string
(header)
fc46bfaf9379121dd6b09f5014595c7b7bd52a0a6d57c5aff790b42a73c76da7
port *
integer
(header)
6100

Get a list of top accounts is available if the node is running in the counting mode of top accounts.

Blocks

Get block by id

http://127.0.0.1:6100/api/blocks/get
Parameters Description
id
string
(query)
block id
nethash *
string
(header)
fc46bfaf9379121dd6b09f5014595c7b7bd52a0a6d57c5aff790b42a73c76da7
port *
integer
(header)
6100

Get all blocks

http://127.0.0.1:6100/api/blocks
http://127.0.0.1:6100/api/blocks/getHeight

Get the blockchain nethash

http://127.0.0.1:6100/api/blocks/getNethash

Get the transaction fee for sending "normal" transactions

http://127.0.0.1:6100/api/blocks/getFee

Get the transaction fee for sending "standard" transactions

http://127.0.0.1:6100/api/blocks/getFee

Get the network fees

http://127.0.0.1:6100/api/blocks/getFees
Delegates

Get the count of delegates

http://127.0.0.1:6100/api/delegates/count
Parameters Description
address
string
(query)
A valid address.
nethash *
string
(header)
fc46bfaf9379121dd6b09f5014595c7b7bd52a0a6d57c5aff790b42a73c76da7
port *
integer
(header)
6100

Search for specific delegates

http://127.0.0.1:6100/api/delegates/search
Parameters Description
q *
string
(query)
A search query.
limit
integer
(query)
An unsigned integer that specifies the maximum number of records.
nethash *
string
(header)
fc46bfaf9379121dd6b09f5014595c7b7bd52a0a6d57c5aff790b42a73c76da7
port *
integer
(header)
6100

ex: http://127.0.0.1:6100/api/delegates/search/?q=davinchi

Get a list of voters for a delegate

http://127.0.0.1:6100/api/delegates/voters
Parameters Description
publicKey *
string
(query)
A valid Public Key
nethash *
string
(header)
fc46bfaf9379121dd6b09f5014595c7b7bd52a0a6d57c5aff790b42a73c76da7
port *
integer
(header)
6100

ex: http://127.0.0.1:6100/api/delegates/voters?publicKey=02be233e7d9e46407cdcdc5793a792b52f399cab61ccd8eb256a32a6cd06b5b7d3

Transactions

Get a single transaction

http://127.0.0.1:6100/api/transactions/get
Parameters Description
id *
string
(query)
A valid transaction ID.
nethash *
string
(header)
fc46bfaf9379121dd6b09f5014595c7b7bd52a0a6d57c5aff790b42a73c76da7
port *
integer
(header)
6100

Get all transactions

http://127.0.0.1:6100/api/transactions
Parameters Description
blockId
string
(query)
An unsigned integer that specifies the block ID.
limit
integer
(query)
An unsigned integer that specifies the maximum number of records.
type
integer
(query)
An unsigned integer that specifies the transaction type.
orderBy
string
(query)
A string that specifies the column by which to sort the records.
offset
integer
(query)
An unsigned integer that specified the number of records to skip.
senderPublicKey
string
(query)
A valid Public Key.
ownerPublicKey
string
(query)
A valid Public Key.
ownerAddress
string
(query)
A valid Address.
senderId
string
(query)
A valid Address.
recipientId
string
(query)
A valid Address.
amount
integer
(query)
An unsigned integer that specifies the transaction amount.
fee
integer
(query)
An unsigned integer that specifies the transaction fee.
nethash *
string
(header)
fc46bfaf9379121dd6b09f5014595c7b7bd52a0a6d57c5aff790b42a73c76da7
port *
integer
(header)
6100
Peers

Get a single peer

http://127.0.0.1:6100/api/peers/get
Parameters Description
ip *
string
(query)
A valid server IP.
nethash *
string
(header)
fc46bfaf9379121dd6b09f5014595c7b7bd52a0a6d57c5aff790b42a73c76da7
port *
integer
(query)
A valid node Port.

Get all peers

http://127.0.0.1:6100/api/peers
Parameters Description
state
integer
(query)
An unsigned integer that specifies the peer state.
port
integer
(query)
A valid peer port.
os
string
(query)
A valid operating system.
version
string
(query)
A valid node version.
limit
integer
(query)
An unsigned integer that specifies the maximum number of records.
offset
integer
(query)
An unsigned integer that specified the number of records to skip.
nethash *
string
(header)
fc46bfaf9379121dd6b09f5014595c7b7bd52a0a6d57c5aff790b42a73c76da7
RPC Library

Security Warning

All calls should be made from the server where RPC is running at localhost or 127.0.0.1. The RPC server should never be publicly accessible.

How To Use It

  • install Node.JS
  • install forever npm install -g forever
  • git clone https://github.com/smartholdem/smartholdem-rpc.git
  • install smartholdem-rpc: npm install
  • start RPC server: forever start server.js
  • stop RPC server: forever stop server.js

RPC API

default port 8081

Accounts

Get account balance from address: GET /mainnet/account/:address


Create account from passphrase: POST /mainnet/account params: passphrase

Create (or get if already existing) account and encrypt using bip38: POST /mainnet/account/bip38 params: bip38

GET backup account from userid: GET /:network/account/bip38/:userid

Transactions

Get last transactions from address GET /mainnet/transactions/:address

Create a transaction: POST /mainnet/transaction params: recipientId, amount in satoshis, passphrase

Create a transaction using bip38 for userid: POST /mainnet/transaction/bip38 params: recipientId, amount in satoshis, bip38 (password to encode wif), userid

Broadcast transaction: POST /mainnet/broadcast params: id of the transaction

Examples

Create address: curl -H "Content-Type: application/json" -X POST "http://127.0.0.1:8081/mainnet/account" -d '{"passphrase":"TestPassWord"}'

Get Balance:
http://127.0.0.1:8081/mainnet/account/SUeGCt31AHwTZVcfZQwpPVL4jEUCtMMDTg


Send Tx Example
Prepare tx (RPC Library)
curl -H "Content-Type: application/json" -X POST "http://127.0.0.1:8081/mainnet/transaction" -d '{"recipientId":"Sa9JKodiNeM7tbYjxwEhvvG1kBczhQxTN3","amount":"10000000","passphrase":"this is a test"}'

Prepare Tx Result:
{"success":true, "transaction": {"type":0,"amount":10000000,"fee":10000000,"recipientId":"Sa9JKodiNeM7tbYjxwEhvvG1kBczhQxTN3", "timestamp":4249572,"asset":{},"senderPublicKey":"03675c61dcc23eab75f9948c6510b54d34fced4a73d3c9f2132c76a29750e7a614","signature": "304402205925f30f481e29e77d8d3be2c240522780c133343c3d8da6de246cc4b9a5b4bf0220231f538693a0c1f438711410b825a5b491fc8814f9f65a49551506ca210a7b2f", "id":"e6df301685ed502e5519d499e93b208899bcf2c9e0f6382b22e6c722f7be5b0e"}}

Broadcast Tx:
curl -X POST "http://127.0.01:8081/mainnet/broadcast" -H "port: 8081" -H "accept: application/json" -H "content-type: application/json" -d '{"id":"e6df301685ed502e5519d499e93b208899bcf2c9e0f6382b22e6c722f7be5b0e"}'

Broadcast Tx Result:
{"success":true,"transaction":{"type":0,"amount":10000000,"fee":10000000,"recipientId":"Sa9JKodiNeM7tbYjxwEhvvG1kBczhQxTN3","timestamp":4249572,"asset":{},"senderPublicKey":"03675c61dcc23eab75f9948c6510b54d34fced4a73d3c9f2132c76a29750e7a614","signature":"304402205925f30f481e29e77d8d3be2c240522780c133343c3d8da6de246cc4b9a5b4bf0220231f538693a0c1f438711410b825a5b491fc8814f9f65a49551506ca210a7b2f","id":"e6df301685ed502e5519d499e93b208899bcf2c9e0f6382b22e6c722f7be5b0e"}}

timestamp is calculated as time start blockchain 21.11.2017 13:00:00 GMT (1511269200)
ex: 1511269200 + 4249572

Curl for test windows os https://curl.haxx.se/dlwiz/?type=bin&os=Win64&flav=-