mokiService_sendMessage
Info
This function requires the
Authorization
Header, you can read more about this header here.Send a message to another identity on the Moki Network
Parameters
message data
: hex - The signed message data (`sender_identity`+`recipient_identity`+`encryptedMessage`+`nonce`+`timestamp`).
Returns
message
: object - Message objectid
: string - Message unique IDmessage
: string - Encrypted message as hexfrom
: address - Address of senderto
: address - Address of recipientsignature
: string - Message signature from sendersender_receipt
: hex - Receipt from sender service nodereceiver_receipt
: hex - Receipt from receiver service nodetimestamp
: number - Timestamp of message
Example
Request
- curl
- javascript
curl https://mainnet.moki.network \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "mokiService_sendMessage", "params": [], "id": 1}'
import fetch from "node-fetch"
fetch("https://mainnet.moki.network", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
jsonrpc: "2.0",
method: "mokiService_sendMessage",
params: [],
id: 1,
}),
})
.then((response) => response.json())
.then((data) => {
console.log(data)
})
.catch((error) => {
console.error(error)
})
Reponse
Example Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"id": "17539442452862540956057",
"message": "2863b7fa05d337...",
"from": "0x7085aa6e71f325ed88d04daba003020bfd9214ea",
"to": "0x22a4dc6353e087a5c37c7168bcf149e9342eb922",
"signature": "0xb7edb74193d54...",
"sender_receipt": "0xe80e5e4ccd1...",
"receiver_receipt": "0x450e5e4ccd1...",
"timestamp": 1753944245286
}
}