NAV Navbar
shell javascript

Plasma-Ion developers

This website documents the public API for PlasmaPay DApp

Plasma-Ion

#To quickly test one of these apis run
curl --request POST \
  --url https://localhost:8080/v1/chain/get_info \
  --header 'accept: application/json'
var data = null;

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === this.DONE) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://localhost:8080/v1/chain/get_info");
xhr.setRequestHeader("accept", "application/json");

xhr.send(data);

For the sake of simplicity we'll be connecting to an API endpoint of one of the 21 block producers. If you want a local node, install it according to the instructions. Node Setup Guide: find the producer’s public url Friedman Testnet

RPC API

Requests to Chain API use the same ionode RPC API paths and parameters

Get account

get_account

curl --request POST </span>
  --url https://localhost:8080/v1/chain/get_account </span>
  --header 'accept: application/json' </span>
  --header 'content-type: application/json'
var data = null;

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } });

xhr.open("POST", "https://localhost:8080/v1/chain/get_account"); xhr.setRequestHeader("accept", "application/json"); xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);

Response schema

Parameter Meaning
String account_name String representation of Plasma-Ion name type
String created Date/time string in the format YYYY-MM-DDTHH:MM:SS.sss
String core_liquid_balance A string representation of an Plasma-Ion symbol, composed of a float with a precision of 18, example 1.000000000000000000 ABC.
[Object] permissions Plasma-Ion permissions to request from the user.
String permissions[].perm_name Name of this permission
[Object] permissions[] required_auth Permissions authorization

Get info

get_info

curl --request POST </span>
  --url https://localhost:8080/v1/chain/get_info </span>
  --header 'accept: application/json'
curl --request POST </span>
  --url https://localhost:8080/v1/chain/get_info </span>
  --header 'accept: application/json'
});

xhr.open("POST", "https://localhost:8080/v1/chain/get_account"); xhr.setRequestHeader("accept", "application/json"); xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);

Response schema

Parameter Meaning
String chain_id Hash representing the ID of the chain
Integer head_block_num Highest block number on the chain
String head_block_id Highest block ID on the chain
String head_block_producer Producer that signed the highest block
Integer last_irreversible_block_num Highest block number on the chain that has
String last_irreversible_block_id Highest block ID on the chain that has been

Get transaction

get_transaction

curl --request POST </span>
  --url http://host/:port/v1/history/get_transaction </span>
  --header 'content-type: application/json'
var data = null;

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } });

xhr.open("POST", "http://host/:port/v1/history/get_transaction"); xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);

This method provides a transaction history

Push transaction

push_transaction

curl --request POST </span>
  --url https://localhost:8080/v1/chain/push_transaction </span>
  --header 'accept: application/json' </span>
  --header 'content-type: application/json'
var data = null;

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } });

xhr.open("POST", "https://localhost:8080/v1/chain/push_transaction"); xhr.setRequestHeader("accept", "application/json"); xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);

This method expects a transaction in JSON format and will attempt to apply it to the blockchain.

Push transactions

Push transactions

curl --request POST </span>
  --url https://localhost:8080/v1/chain/push_transactions </span>
  --header 'accept: application/json' </span>
  --header 'content-type: application/json'
var data = null;

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } });

xhr.open("POST", "https://localhost:8080/v1/chain/push_transactions"); xhr.setRequestHeader("accept", "application/json"); xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);

This method expects a transaction in JSON format and will attempt to apply it to the blockchain.

Get actions

get_actions

curl --request POST </span>
  --url https://localhost:8080/v1/chain/get_account </span>
  --header 'accept: application/json' </span>
  --header 'content-type: application/json'
var data = null;

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } });

xhr.open("POST", "https://localhost:8080/v1/chain/get_account"); xhr.setRequestHeader("accept", "application/json"); xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);

Response schema

Parameter Meaning
String account_name String representation of Plasma-Ion name type
String created Date/time string in the format YYYY-MM-DDTHH:MM:SS.sss
String core_liquid_balance A string representation of an Plasma-Ion symbol, composed of a float with a precision of 18, example 1.000000000000000000 ABC.
[Object] permissions Plasma-Ion permissions to request from the user.
String permissions[].perm_name Name of this permission
[Object] permissions[] required_auth Permissions authorization

Get abi

get_abi

curl --request POST </span>
  --url https://localhost:8080/v1/chain/get_abi </span>
  --header 'accept: application/json' </span>
  --header 'content-type: application/json'
var data = null;

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } });

xhr.open("POST", "https://localhost:8080/v1/chain/get_abi"); xhr.setRequestHeader("accept", "application/json"); xhr.setRequestHeader("content-type", "application/json");

xhr.send(data); });

xhr.open("POST", "https://localhost:8080/v1/chain/get_account"); xhr.setRequestHeader("accept", "application/json"); xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);

Response schema

Parameter Meaning
[Object] types String representation of Plasma-Ion name type
String types[].new_type_name String representation of ION name type
String types[].type Native and ION types
[Object] structs String representation of Plasma-Ion name type
String structs[].base String representation of Plasma-Ion name type
[Object] actions String representation of Plasma-Ion name type
String actions[].name actions[].type String representation of Plasma-Ion name type

Get currency balance

get_currency_balance

curl --request POST </span>
  --url https://localhost:8080/v1/chain/get_currency_balance </span>
  --header 'accept: application/json' </span>
  --header 'content-type: application/json'
var data = null;

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } });

xhr.open("POST", "https://localhost:8080/v1/chain/get_currency_balance"); xhr.setRequestHeader("accept", "application/json"); xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);

Response schema

Parameter Meaning
String name String representation of Plasma-Ion name type
String symbol A string representation of an Plasma-Ion symbol, composed of a float with a precision of 18, example 1.000000000000000000 ABC.

Get currency stats

get_currency_stats

curl --request POST </span>
  --url https://localhost:8080/v1/chain/get_currency_stats </span>
  --header 'accept: application/json' </span>
  --header 'content-type: application/json'
var data = null;

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } });

xhr.open("POST", "https://localhost:8080/v1/chain/get_currency_stats"); xhr.setRequestHeader("accept", "application/json"); xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);

Response schema

Parameter Meaning
String name String representation of Plasma-Ion name type
String symbol A string representation of an Plasma-Ion symbol, composed of a float with a precision of 18, example 1.000000000000000000 ABC.

Get required keys

get_required_keys

curl --request POST </span>
  --url https://localhost:8080/v1/chain/get_required_keys </span>
  --header 'accept: application/json' </span>
  --header 'content-type: application/json'
var data = null;

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } });

xhr.open("POST", "https://localhost:8080/v1/chain/get_required_keys"); xhr.setRequestHeader("accept", "application/json"); xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);

Returns the required keys needed to sign a transaction.

Get producers

get_producers

curl --request POST </span>
  --url https://localhost:8080/v1/chain/get_producers </span>
  --header 'accept: application/json' </span>
  --header 'content-type: application/json'
var data = null;

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } });

xhr.open("POST", "https://localhost:8080/v1/chain/get_producers"); xhr.setRequestHeader("accept", "application/json"); xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);

Response schema

Parameter Meaning
[Object] active active[].producers String representation of Plasma-Ion name type
String active[].producers[].producer_name String representation of Plasma-Ion name type
String active[].producers[].block_signing String representation of Plasma-Ion name type
[Object] pending pending[].producers String representation of Plasma-Ion name type
String pending[].producers[].block_signing String representation of Plasma-Ion name type

Get raw code and abi

get_raw_code_and_abi

curl --request POST </span>
  --url https://localhost:8080/v1/chain/get_raw_code_and_abi </span>
  --header 'accept: application/json' </span>
  --header 'content-type: application/json'
var data = null;

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } });

xhr.open("POST", "https://localhost:8080/v1/chain/get_raw_code_and_abi"); xhr.setRequestHeader("accept", "application/json"); xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);

Response schema

Parameter Meaning
String account_name String representation of Plasma-Ion name type
String wasm base64 encoded wasm
String abi base64 encoded ABI

Get table by scope

get_table_by_scope

curl --request POST </span>
  --url https://localhost:8080/v1/chain/get_table_by_scope </span>
  --header 'accept: application/json' </span>
  --header 'content-type: application/json'
var data = null;

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } });

xhr.open("POST", "https://localhost:8080/v1/chain/get_table_by_scope"); xhr.setRequestHeader("accept", "application/json"); xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);

Response schema

Parameter Meaning
String account_name String representation of Plasma-Ion name type
String created String representation of Plasma-Ion name type
String core_liquid_balance String representation of Plasma-Ion name type
[Object] rows String representation of Plasma-Ion name type
String rows[].code String representation of Plasma-Ion name type
String rows[].scope String representation of Plasma-Ion name type
String rows[].table String representation of Plasma-Ion name type
String rows[].payer String representation of Plasma-Ion name type
Integer rows[].count Number of matching items.

Get table rows

get_table_rows

curl --request POST </span>
  --url https://localhost:8080/v1/chain/get_table_rows </span>
  --header 'accept: application/json' </span>
  --header 'content-type: application/json'
var data = null;

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } });

xhr.open("POST", "https://localhost:8080/v1/chain/get_table_rows"); xhr.setRequestHeader("accept", "application/json"); xhr.setRequestHeader("content-type", "application/json");

xhr.send(data)

Returns an object containing rows from the specified table. Response schema

Parameter Meaning
String code The name of the smart contract that controls the provided table
String table The name of the table to query
String scope The account to which this data belongs
String index_position Position of the index used, accepted parameters primary, secondary, tertiary, fourth, fifth, sixth, seventh, eighth, ninth , tenth
String key_type Type of key specified by index_position (for example - uint64_t or name)
String encode_type

Abi json to bin

abi_json_to_bin

curl --request POST </span>
  --url https://localhost:8080/v1/chain/abi_json_to_bin </span>
  --header 'accept: application/json' </span>
  --header 'content-type: application/json'
var data = null;

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } });

xhr.open("POST", "https://localhost:8080/v1/chain/abi_json_to_bin"); xhr.setRequestHeader("accept", "application/json"); xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);

Returns an object containing rows from the specified table. Response schema

Parameter Meaning
String hex Request
String binargs String representation of Plasma-Ion name type

Abi bin to json

abi_bin_to_json

curl --request POST </span>
  --url https://localhost:8080/v1/chain/abi_bin_to_json </span>
  --header 'accept: application/json' </span>
  --header 'content-type: application/json'
var data = null;

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } });

xhr.open("POST", "https://localhost:8080/v1/chain/abi_bin_to_json"); xhr.setRequestHeader("accept", "application/json"); xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);

Response schema

Parameter Meaning
String name String representation of Plasma-Ion name type
String hex

Get code

get_code

curl --request POST </span>
  --url https://localhost:8080/v1/chain/get_code </span>
  --header 'accept: application/json' </span>
  --header 'content-type: application/json' </span>
  --data '{"code_as_wasm":1}'
var data = "{\"code_as_wasm\":1}";

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } });

xhr.open("POST", "https://localhost:8080/v1/chain/get_code"); xhr.setRequestHeader("accept", "application/json"); xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);

Response schema

Parameter Meaning
String name String representation of Plasma-Ion name type
String code_hash String representation of Plasma-Ion name type
String wast String representation of Plasma-Ion name type
String wasm String representation of Plasma-Ion name type
String abi String representation of Plasma-Ion name type
String abi.version String representation of Plasma-Ion name type
[Object] abi.types String representation of Plasma-Ion name type
String abi.types[].new_type_name abi.types[].type String representation of Plasma-Ion name type
[Object] abi.structs String representation of Plasma-Ion name type
String abi.structs[].name String representation of Plasma-Ion name type
String abi.structs[].base String representation of Plasma-Ion name type
[Object] abi.structs[].fields String representation of Plasma-Ion name type
[Object] abi.actions String representation of Plasma-Ion name type
String abi.actions[].type String representation of Plasma-Ion name type
[Object] abi.structs String representation of Plasma-Ion name type
String abi.tables String representation of Plasma-Ion name type
String abi.tables[].name String representation of Plasma-Ion name type
String abi.actions[].name abi.tables[].index_type String representation of Plasma-Ion name type
[String] abi.tables[].key_names String representation of Plasma-Ion name type
[String] abi.tables[].key_types String representation of Plasma-Ion name type
String abi.tables[].type String representation of Plasma-Ion name type
Array abi.abi_extensions String representation of Plasma-Ion name type
[String] abi.error_messages String representation of Plasma-Ion name type
[String] abi.variants String representation of Plasma-Ion name type

Push block request

push_block_request

curl --request POST </span>
--url https://localhost:8080/v1/chain/push_block </span>
--header 'accept: application/json' </span>
--header 'content-type: application/json'
var data = null;

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } });

xhr.open("POST", "https://localhost:8080/v1/chain/push_block"); xhr.setRequestHeader("accept", "application/json"); xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);

Response schema

Parameter Meaning
String DateTimeSeconds Date/time string in the format YYYY-MM-DDTHH:MM:SS.sss
String producer
Array transactions Array containing transactions included in this block

Get raw abi

get_raw_abi

curl --request POST </span>
  --url https://localhost:8080/v1/chain/get_raw_abi </span>
  --header 'accept: application/json' </span>
  --header 'content-type: application/json'
var data = null;

var xhr = new XMLHttpRequest();

xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { console.log(this.responseText); } });

xhr.open("POST", "https://localhost:8080/v1/chain/get_raw_abi"); xhr.setRequestHeader("accept", "application/json"); xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);

Response schema

Parameter Meaning
String chain_id String representation of Plasma-Ion name type
Integer code_hash
String abi_hash