Table of Contents

JSON command reference

(add here complete JSON command reference)

Encoding

JSON data is encoded with UTF-8.

Binary fields (eg. sig_p field signature from bencoded DHT resources) must be converted to hex representation as strings.

Quick JSON command examples

In order to use JSON-RPC you must set user/password/port by either command line or configuration file. This is the same as in Bitcoin except that twister config file is /home/user/.twister/twister.conf

createwalletuser

To create a new (local) user key:

./twisterd createwalletuser myname

This command returns the secret which can be used to recreate the key in a different computer (in order to access the account). The user should be encouraged to make a copy of this information, either by printing, snapshoting or even writing it down to a piece of paper.

The newly created user only exists in the local database (wallet), so before the user is able to fully use the system (post messages), his public key must be propagated to the network with next command

sendnewusertransaction

./twisterd sendnewusertransaction myname

The above command may take a few seconds to run, depending on your CPU. This is normal.

newpostmsg

To create the first (1) public post:

./twisterd newpostmsg myname 1 "hello world"

follow

To add some users to the following list:

./twisterd follow myname '["myname","myfriend"]'

getposts

To get the last 5 posts from the users we follow:

./twisterd getposts 5 '[{"username":"myname"},{"username":"myfriend"}]'

newdirectmsg

To send a new (private) direct message:

./twisterd newdirectmsg myname 2 myfriend "secret message"

Notes for newdirectmsg:

getdirectmsgs

To get the last 10 direct messages to/from remote user:

./twisterd getdirectmsgs myname 10 '[{"username":"myfriend"}]'

Notes for `getdirectmsgs`:

dht commands

See detail of General structure

dhtput

To setup your profile:

./twisterd dhtput myname profile s '{"fullname":"My Name","bio":"just another user","location":"nowhere","url":"twister.net.co"}' myname 1

Note: increase the revision number (the last parameter) whenever you want to update something using dhtput.

dhtget

To obtain the profile of another user:

./twisterd dhtget myfriend profile s

To obtain the full list of commands

./twisterd help