Value Chain API
The Value Chain is Dijets native chain and platform for creating and trading smart digital assets. It is an instance of Dijets Virtual Machine (DVM). This API allows clients to create and trade assets on the Value Chain and on other instances of Dijets Virtual Machine.
Format#
The Value Chain API uses the standard json 2.0
RPC format. For more information on making JSON RPC calls, see
here.
Endpoints#
/ext/bc/V
to interact with the Value Chain.
/ext/bc/blockchainID
to interact with other Dijets Virtual Machine instances, where blockchainID
is the ID of a
blockchain running the VM.
Methods#
Create Genesis Byte representation#
Given a JSON representation of this Virtual Machine’s genesis state, create the byte representation of that state.
Endpoint
This call is made to Dijets Virtual Machine's static API endpoint:
/ext/vm/avm
Signature:
_10avm.buildGenesis({_10 networkID: int,_10 genesisData: JSON,_10 encoding: string, //optional_10}) -> {_10 bytes: string,_10 encoding: string,_10}
Encoding specifies the encoding format to use for arbitrary bytes, that is the genesis bytes that are
returned. Can only be hex
when a value is provided.
genesisData
has this form:
_51{_51"genesisData" :_51 {_51 "assetAlias1": { // Each object defines an asset_51 "name": "rogue",_51 "symbol":"ROGE", // Symbol is between 0 and 4 characters_51 "initialState": {_51 "fixedCap" : [ // Choose the asset type._51 { // Can be "fixedCap", "variableCap", "limitedTransfer", "nonFungible"_51 "amount":1000, // At genesis, address A has_51 "address":"A" // 1000 units of asset named rogue_51 },_51 {_51 "amount":3000, // At genesis, address B has_51 "address":"B" // 3000 units of asset named rogue_51 },_51 {_51 "amount":5000, // At genesis, address B has_51 "address":"C" // 5000 units of asset named rogue_51 },_51 ... // Can have many initial holders_51 ]_51 }_51 },_51 "assetAliasCanBeAnythingUnique": { // Asset alias can be used in place of assetID in calls_51 "name": "rogue", // names need not be unique_51 "symbol": "ROGE", // symbols need not be unique_51 "initialState": {_51 "variableCap" : [ // No units of the asset exist at genesis_51 {_51 "minters": [ // The signature of A or B can mint more of_51 "A", // the asset._51 "B"_51 ],_51 "threshold":1_51 },_51 {_51 "minters": [ // The signatures of 2 of A, B and C can mint_51 "A", // more of the asset_51 "B",_51 "C"_51 ],_51 "threshold":2_51 },_51 ... // Can have many minter sets_51 ]_51 }_51 },_51 ... // Can list more assets_51 }_51}
Example Call:
_58curl -X POST --data '{_58 "jsonrpc": "2.0",_58 "id" : 1,_58 "method" : "avm.buildGenesis",_58 "params" : {_58 "networkId": 16,_58 "genesisData": {_58 "asset1": {_58 "name": "rogue",_58 "symbol":"ROGE",_58 "initialState": {_58 "fixedCap" : [_58 {_58 "amount":100000,_58 "address": "dijets1f2psulzw4k6al8t6hvz3ru5k38hk346g48xajk"_58 },_58 {_58 "amount":100000,_58 "address": "dijets1dl2pev4aj0mj4l8uwgpchgt6uj0amjf934ll23"_58 },_58 {_58 "amount":50000,_58 "address": "dijets1rl6cznpxruj4jfp9frrh7jd29pse9rl0mxu3x5"_58 },_58 {_58 "amount":50000,_58 "address": "dijets108k3478485gh5x5934fy48f8swxvjuaf3pf7gm"_58 }_58 ]_58 }_58 },_58 "asset2": {_58 "name": "myVarCapAsset",_58 "symbol":"MVCA",_58 "initialState": {_58 "variableCap" : [_58 {_58 "minters": [_58 "dijets13a5ued3penvdzmwczxrj65zux5vcr3adlt9r7r",_58 "dijets1djt3aenjey5s9ftrqsjsvn453e4fk4ym3har66"_58 ],_58 "threshold":1_58 },_58 {_58 "minters": [_58 "dijets1gku4usv9rssm9vs0j3nmlv60lums3956lmne6w",_58 "dijets1p59z4zh39pk8stc0shv8lwgxj3jsqh7cc2q0qm",_58 "dijets1e3asdkumfpx5fknmq9rtakwsznyxv6vl3lu7ak"_58 ],_58 "threshold":2_58 }_58 ]_58 }_58 }_58 },_58 "encoding": "hex"_58 }_58}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/vm/avm
Example Response:
_10{_10 "jsonrpc": "2.0",_10 "result": {_10 "bytes": "0x0000000000010006617373657431000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f6d794669786564436170417373657400044d464341000000000100000000000000010000000700000000000186a10000000000000000000000010000000152b219bc1b9ab0a9f2e3f9216e4460bd5db8d153bfa57c3c",_10 "encoding": "hex"_10 },_10 "id": 1_10}
Create a new Address.#
Not recommended for use on Mainnet. See warning notice in Keystore API.
Signature:
_10avm.createAddress({_10 username: string,_10 password: string_10}) -> {address: string}
Example Call:
_10curl -X POST --data '{_10 "jsonrpc": "2.0",_10 "method": "avm.createAddress",_10 "params": {_10 "username": "myUsername",_10 "password": "myPassword"_10 },_10 "id": 1_10}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
Example Response:
_10{_10 "jsonrpc": "2.0",_10 "result": {_10 "address": "X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"_10 },_10 "id": 1_10}
Create new Asset with Fixed Cap#
Not recommended for use on Mainnet. See warning notice in Keystore API.
Create a new fixed-cap, fungible asset. A quantity of it is created at initialization and then no
more is ever created. The asset can be sent with avm.send
.
Signature:
_17avm.createFixedCapAsset({_17 name: string,_17 symbol: string,_17 denomination: int, //optional_17 initialHolders: []{_17 address: string,_17 amount: int_17 },_17 from: []string, //optional_17 changeAddr: string, //optional_17 username: string,_17 password: string_17}) ->_17{_17 assetID: string,_17 changeAddr: string_17}
name
is a human-readable name for the asset. Not necessarily unique.symbol
is a shorthand symbol for the asset. Between 0 and 4 characters. Not necessarily unique. May be omitted.denomination
determines how balances of this asset are displayed by user interfaces. Ifdenomination
is 0, 100 units of this asset are displayed as 100. Ifdenomination
is 1, 100 units of this asset are displayed as 10.0. Ifdenomination
is 2, 100 units of this asset are displayed as 1.00, etc. Defaults to 0.from
are the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed.changeAddr
is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.username
andpassword
denote the user paying the transaction fee.- Each element in
initialHolders
specifies thataddress
holdsamount
units of the asset at genesis. assetID
is the ID of the new asset.
Example Call:
_23curl -X POST --data '{_23 "jsonrpc":"2.0",_23 "id" : 1,_23 "method" :"avm.createFixedCapAsset",_23 "params" :{_23 "name": "myFixedCapAsset",_23 "symbol":"MFCA",_23 "initialHolders": [_23 {_23 "address": "X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",_23 "amount": 10000_23 },_23 {_23 "address":"X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",_23 "amount":50000_23 }_23 ],_23 "from":["X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],_23 "changeAddr":"X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8",_23 "username":"myUsername",_23 "password":"myPassword"_23 }_23}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
Example Response:
_10{_10 "jsonrpc": "2.0",_10 "id": 1,_10 "result": {_10 "assetID": "ZiKfqRXCZgHLgZ4rxGU9Qbycdzuq5DRY4tdSNS9ku8kcNxNLD",_10 "changeAddr": "X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8"_10 }_10}
Create NFTs#
Not recommended for use on Mainnet. See warning notice in Keystore API.
Create a new non-fungible asset. No units of the asset exist at initialization. Minters can mint
units of this asset using avm.mintNFT
.
Signature:
_16avm.createNFTAsset({_16 name: string,_16 symbol: string,_16 minterSets: []{_16 minters: []string,_16 threshold: int_16 },_16 from: []string, //optional_16 changeAddr: string, //optional_16 username: string,_16 password: string_16}) ->_16 {_16 assetID: string,_16 changeAddr: string,_16}
name
is a human-readable name for the asset. Not necessarily unique.symbol
is a shorthand symbol for the asset. Between 0 and 4 characters. Not necessarily unique. May be omitted.minterSets
is a list where each element specifies thatthreshold
of the addresses inminters
may together mint more of the asset by signing a minting transaction.from
are the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed.changeAddr
is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.username
pays the transaction fee.assetID
is the ID of the new asset.changeAddr
in the result is the address where any change was sent.
Example Call:
_21curl -X POST --data '{_21 "jsonrpc":"2.0",_21 "id" : 1,_21 "method" :"avm.createNFTAsset",_21 "params" :{_21 "name":"Coincert",_21 "symbol":"TIXX",_21 "minterSets":[_21 {_21 "minters":[_21 "X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8"_21 ],_21 "threshold": 1_21 }_21 ],_21 "from": ["X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8"],_21 "changeAddr": "X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8",_21 "username":"myUsername",_21 "password":"myPassword"_21 }_21}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
Example Response:
_10{_10 "jsonrpc": "2.0",_10 "result": {_10 "assetID": "2KGdt2HpFKpTH5CtGZjYt5XPWs6Pv9DLoRBhiFfntbezdRvZWP",_10 "changeAddr": "X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8"_10 },_10 "id": 1_10}
Create Asset with Variable Cap#
Not recommended for use on Mainnet. See warning notice in Keystore API.
Create a new variable-cap, fungible asset. No units of the asset exist at initialization. Minters
can mint units of this asset using avm.mint
.
Signature:
_17avm.createVariableCapAsset({_17 name: string,_17 symbol: string,_17 denomination: int, //optional_17 minterSets: []{_17 minters: []string,_17 threshold: int_17 },_17 from: []string, //optional_17 changeAddr: string, //optional_17 username: string,_17 password: string_17}) ->_17{_17 assetID: string,_17 changeAddr: string,_17}
name
is a human-readable name for the asset. Not necessarily unique.symbol
is a shorthand symbol for the asset. Between 0 and 4 characters. Not necessarily unique. May be omitted.denomination
determines how balances of this asset are displayed by user interfaces. If denomination is 0, 100 units of this asset are displayed as 100. If denomination is 1, 100 units of this asset are displayed as 10.0. If denomination is 2, 100 units of this asset are displays as .100, etc.minterSets
is a list where each element specifies thatthreshold
of the addresses inminters
may together mint more of the asset by signing a minting transaction.from
are the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed.changeAddr
is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.username
pays the transaction fee.assetID
is the ID of the new asset.changeAddr
in the result is the address where any change was sent.
Example Call:
_29curl -X POST --data '{_29 "jsonrpc":"2.0",_29 "id" : 1,_29 "method" :"avm.createVariableCapAsset",_29 "params" :{_29 "name":"myVariableCapAsset",_29 "symbol":"MFCA",_29 "minterSets":[_29 {_29 "minters":[_29 "X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"_29 ],_29 "threshold": 1_29 },_29 {_29 "minters": [_29 "X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",_29 "X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",_29 "X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"_29 ],_29 "threshold": 2_29 }_29 ],_29 "from":["X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],_29 "changeAddr":"X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8",_29 "username":"myUsername",_29 "password":"myPassword"_29 }_29}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
Example Response:
_10{_10 "jsonrpc": "2.0",_10 "id": 1,_10 "result": {_10 "assetID": "2QbZFE7J4MAny9iXHUwq8Pz8SpFhWk3maCw4SkinVPv6wPmAbK",_10 "changeAddr": "X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8"_10 }_10}
Export Asset between chains#
Not recommended for use on Mainnet. See warning notice in Keystore API.
Send an asset from the Value Chain to the Method Chain or Utility Chain. After calling this method, you must call
the Utility Chain's djtx.import
or the Method Chain's
platform.importDJT
to complete the transfer.
Signature:
_13avm.export({_13 to: string,_13 amount: int,_13 assetID: string,_13 from: []string, //optional_13 changeAddr: string, //optional_13 username: string,_13 password: string,_13}) ->_13{_13 txID: string,_13 changeAddr: string,_13}
-
to
is the Method Chain or Utility Chain address the asset is sent to. -
amount
is the amount of the asset to send. -
assetID
is the asset id of the asset which is sent. UseDJT
for DJT exports. -
from
are the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed. -
changeAddr
is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user. -
The asset is sent from addresses controlled by
username
-
password
isusername
‘s password. -
txID
is this transaction’s ID. -
changeAddr
in the result is the address where any change was sent.
Example Call:
_14curl -X POST --data '{_14 "jsonrpc":"2.0",_14 "id" :1,_14 "method" :"avm.export",_14 "params" :{_14 "to":"C-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",_14 "amount": 10,_14 "assetID": "DJT",_14 "from":["X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],_14 "changeAddr":"X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8",_14 "username":"myUsername",_14 "password":"myPassword"_14 }_14}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
Example Response:
_10{_10 "jsonrpc": "2.0",_10 "result": {_10 "txID": "2Eu16yNaepP57XrrJgjKGpiEDandpiGWW8xbUm6wcTYny3fejj",_10 "changeAddr": "X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8"_10 },_10 "id": 1_10}
Export Private Key#
Not recommended for use on Mainnet. See warning notice in Keystore API.
Get the private key that controls a given address. The returned private key can be added to a user
with dvm.importKey
.
Signature:
_10avm.exportKey({_10 username: string,_10 password: string,_10 address: string_10}) -> {privateKey: string}
username
must controladdress
.privateKey
is the string representation of the private key that controlsaddress
.
Example Call:
_10curl -X POST --data '{_10 "jsonrpc":"2.0",_10 "id" :1,_10 "method" :"avm.exportKey",_10 "params" :{_10 "username":"myUsername",_10 "password":"myPassword",_10 "address":"X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"_10 }_10}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
Example Response:
_10{_10 "jsonrpc": "2.0",_10 "id": 1,_10 "result": {_10 "privateKey": "PrivateKey-2w4XiXxPfQK4TypYqnohRL8DRNTz9cGiGmwQ1zmgEqD9c9KWLq"_10 }_10}
Get all Transactions for an Address#
Returns all transactions that change the balance of the given address. A transaction is said to change an address's balance if either is true:
- A UTXO that the transaction consumes was at least partially owned by the address.
- A UTXO that the transaction produces is at least partially owned by the address.
Note: Indexing (index-transactions
) must be enabled in the Value Chain config.
Signature:
_10avm.getAddressTxs({_10 address: string,_10 cursor: uint64, // optional, leave empty to get the first page_10 assetID: string,_10 pageSize: uint64 // optional, defaults to 1024_10}) -> {_10 txIDs: []string,_10 cursor: uint64,_10}
Request Parameters:
address
: The address for which we're fetching related transactionsassetID
: Only return transactions that changed the balance of this asset. Must be an ID or an alias for an asset.pageSize
: Number of items to return per page. Optional. Defaults to 1024.
Response Parameter:
txIDs
: List of transaction IDs that affected the balance of this address.cursor
: Page number or offset. Use this in request to get the next page.
Example Call:
_10curl -X POST --data '{_10 "jsonrpc":"2.0",_10 "id" : 1,_10 "method" :"avm.getAddressTxs",_10 "params" :{_10 "address":"X-local1kpprmfpzzm5lxyene32f6lr7j0aj7gxsu6hp9y",_10 "assetID":"DJT",_10 "pageSize":20_10 }_10}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
Example Response:
_10{_10 "jsonrpc": "2.0",_10 "result": {_10 "txIDs": ["SsJF7KKwxiUJkczygwmgLqo3XVRotmpKP8rMp74cpLuNLfwf6"],_10 "cursor": "1"_10 },_10 "id": 1_10}
dvm.getAllBalances
#
Get the balances of all assets controlled by a given address.
Signature:
_10avm.getAllBalances({address:string}) -> {_10 balances: []{_10 asset: string,_10 balance: int_10 }_10}
Example Call:
_10curl -X POST --data '{_10 "jsonrpc":"2.0",_10 "id" : 1,_10 "method" :"avm.getAllBalances",_10 "params" :{_10 "address":"X-dijets1c79e0dd0susp7dc8udq34jgk2yvve7hapvdyht"_10 }_10}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
Example Response:
_16{_16 "jsonrpc": "2.0",_16 "result": {_16 "balances": [_16 {_16 "asset": "DJT",_16 "balance": "102"_16 },_16 {_16 "asset": "2sdnziCz37Jov3QSNMXcFRGFJ1tgauaj6L7qfk7yUcRPfQMC79",_16 "balance": "10000"_16 }_16 ]_16 },_16 "id": 1_16}
Get an Asset's Description#
Get information about an asset.
Signature:
_10avm.getAssetDescription({assetID: string}) -> {_10 assetId: string,_10 name: string,_10 symbol: string,_10 denomination: int_10}
assetID
is the id of the asset for which the information is requested.name
is the asset’s human-readable, not necessarily unique name.symbol
is the asset’s symbol.denomination
determines how balances of this asset are displayed by user interfaces. If denomination is 0, 100 units of this asset are displayed as 100. If denomination is 1, 100 units of this asset are displayed as 10.0. If denomination is 2, 100 units of this asset are displays as .100, etc.
Example Call:
_10curl -X POST --data '{_10 "jsonrpc":"2.0",_10 "id" :1,_10 "method" :"avm.getAssetDescription",_10 "params" :{_10 "assetID" :"wjcHr7ng1qPXeJm5Mh3HzQxqz2S9AGo9UVP78jxh5zfirZxY7"_10 }_10}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
Example Response:
_10{_10 "jsonrpc": "2.0",_10 "result": {_10 "assetID": "wjcHr7ng1qPXeJm5Mh3HzQxqz2S9AGo9UVP78jxh5zfirZxY7",_10 "name": "Dijets",_10 "symbol": "DJT",_10 "denomination": "9"_10 },_10 "id": 1_10}`
Get balance of an Address#
Get the balance of an asset controlled by a given address.
Signature:
_10avm.getBalance({_10 address: string,_10 assetID: string_10}) -> {balance: int}
address
owner of the assetassetID
id of the asset for which the balance is requested
Example Call:
_10curl -X POST --data '{_10 "jsonrpc":"2.0",_10 "id" : 1,_10 "method" :"avm.getBalance",_10 "params" :{_10 "address":"X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",_10 "assetID": "2pYGetDWyKdHxpFxh2LHeoLNCH6H5vxxCxHQtFnnFaYxLsqtHC"_10 }_10}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
Example Response:
_13{_13 "jsonrpc": "2.0",_13 "id": 1,_13 "result": {_13 "balance": "299999999999900",_13 "utxoIDs": [_13 {_13 "txID": "WPQdyLNqHfiEKp4zcCpayRHYDVYuh1hqs9c1RqgZXS4VPgdvo",_13 "outputIndex": 1_13 }_13 ]_13 }_13}
Get specific Transaction Details#
Returns the specified transaction. The encoding
parameter sets the format of the returned
transaction. Can be either "hex"
or "json"
. Defaults to "hex"
.
Signature:
_10avm.getTx({_10 txID: string,_10 encoding: string, //optional_10}) -> {_10 tx: string,_10 encoding: string,_10}
Example Call:
_10curl -X POST --data '{_10 "jsonrpc":"2.0",_10 "id" :1,_10 "method" :"avm.getTx",_10 "params" :{_10 "txID":"KMcVWV1dJAuWQXfrJgNFFr9uPHqXELQNZoFWoosYVqQV5qGj5",_10 "encoding": "json"_10 }_10}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
Example Response:
_50{_50 "jsonrpc": "2.0",_50 "result": {_50 "tx": {_50 "unsignedTx": {_50 "networkID": 1,_50 "blockchainID": "hgBiUrBJkih9eoPkLtNaJKJQK8Fc2nmR6yuqkh9BmgNY2dJ3Y",_50 "outputs": [_50 {_50 "assetID": "wjcHr7ng1qPXeJm5Mh3HzQxqz2S9AGo9UVP78jxh5zfirZxY7",_50 "fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ",_50 "output": {_50 "addresses": ["X-dijets126rd3w35xwkmj8670zvf7y5r8k36qa9z9803wm"],_50 "amount": 1530084210,_50 "locktime": 0,_50 "threshold": 1_50 }_50 }_50 ],_50 "inputs": [],_50 "memo": "0x",_50 "sourceChain": "11111111111111111111111111111111LpoYY",_50 "importedInputs": [_50 {_50 "txID": "28jfD1CViCz7CKawJBzmHCQRWtk6xwzcBjCVErH6dBo11JLvmw",_50 "outputIndex": 0,_50 "assetID": "wjcHr7ng1qPXeJm5Mh3HzQxqz2S9AGo9UVP78jxh5zfirZxY7",_50 "fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ",_50 "input": {_50 "amount": 1531084210,_50 "signatureIndices": [0]_50 }_50 }_50 ]_50 },_50 "credentials": [_50 {_50 "fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ",_50 "credential": {_50 "signatures": [_50 "0x447ea3c6725add24e240b3179f9cc28ab5410c48f822d32d12459861ca816765297dbfe07e1957e3b470d39e6f56f10269dd7f8c4e108857db874b2c4ba1a22401"_50 ]_50 }_50 }_50 ]_50 },_50 "encoding": "json"_50 },_50 "id": 1_50}
Where:
credentials
is a list of this transaction's credentials. Each credential proves that this transaction's creator is allowed to consume one of this transaction's inputs. Each credential is a list of signatures.unsignedTx
is the non-signature portion of the transaction.networkID
is the ID of the network this transaction happened on. (Dijets Mainnet is1
.)blockchainID
is the ID of the blockchain this transaction happened on. (Dijets Mainnet Value Chain ishgBiUrBJkih9eoPkLtNaJKJQK8Fc2nmR6yuqkh9BmgNY2dJ3Y
.)- Each element of
outputs
is an output (UTXO) of this transaction that is not being exported to another chain. - Each element of
inputs
is an input of this transaction which has not been imported from another chain. - Import Transactions have additional fields
sourceChain
andimportedInputs
, which specify the blockchain ID that assets are being imported from, and the inputs that are being imported. - Export Transactions have additional fields
destinationChain
andexportedOutputs
, which specify the blockchain ID that assets are being exported to, and the UTXOs that are being exported.
An output contains:
assetID
: The ID of the asset being transferred. (The Mainnet Djtx ID iswjcHr7ng1qPXeJm5Mh3HzQxqz2S9AGo9UVP78jxh5zfirZxY7
.)fxID
: The ID of the FX this output uses.output
: The FX-specific contents of this output.
Most outputs use the secp256k1 FX, look like this:
_10{_10 "assetID": "wjcHr7ng1qPXeJm5Mh3HzQxqz2S9AGo9UVP78jxh5zfirZxY7",_10 "fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ",_10 "output": {_10 "addresses": ["X-dijets126rd3w35xwkmj8670zvf7y5r8k36qa9z9803wm"],_10 "amount": 1530084210,_10 "locktime": 0,_10 "threshold": 1_10 }_10}
The above output can be consumed after Unix time locktime
by a transaction that has signatures
from threshold
of the addresses in addresses
.
dvm.getTxStatus
#
Get the status of a transaction sent to the network.
Signature:
_10avm.getTxStatus({txID: string}) -> {status: string}
status
is one of:
Accepted
: The transaction is (or will be) accepted by every nodeProcessing
: The transaction is being voted on by this nodeRejected
: The transaction will never be accepted by any node in the networkUnknown
: The transaction hasn’t been seen by this node
Example Call:
_10curl -X POST --data '{_10 "jsonrpc":"2.0",_10 "id" :1,_10 "method" :"avm.getTxStatus",_10 "params" :{_10 "txID":"2QouvFWUbjuySRxeX5xMbNCuAaKWfbk5FeEa2JmoF85RKLk2dD"_10 }_10}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
Example Response:
_10{_10 "jsonrpc": "2.0",_10 "id": 1,_10 "result": {_10 "status": "Accepted"_10 }_10}
dvm.getUTXOs
#
Gets the UTXOs that reference a given address. If sourceChain
is specified, then it will retrieve
the atomic UTXOs exported from that chain to the X Chain.
Signature:
_19avm.getUTXOs({_19 addresses: []string,_19 limit: int, //optional_19 startIndex: { //optional_19 address: string,_19 utxo: string_19 },_19 sourceChain: string, //optional_19 encoding: string //optional_19}) -> {_19 numFetched: int,_19 utxos: []string,_19 endIndex: {_19 address: string,_19 utxo: string_19 },_19 sourceChain: string, //optional_19 encoding: string_19}
utxos
is a list of UTXOs such that each UTXO references at least one address inaddresses
.- At most
limit
UTXOs are returned. Iflimit
is omitted or greater than 1024, it is set to 1024. - This method supports pagination.
endIndex
denotes the last UTXO returned. To get the next set of UTXOs, use the value ofendIndex
asstartIndex
in the next call. - If
startIndex
is omitted, will fetch all UTXOs up tolimit
. - When using pagination (when
startIndex
is provided), UTXOs are not guaranteed to be unique across multiple calls. That is, a UTXO may appear in the result of the first call, and then again in the second call. - When using pagination, consistency is not guaranteed across multiple calls. That is, the UTXO set of the addresses may have changed between calls.
encoding
sets the format for the returned UTXOs. Can only behex
when a value is provided.
Example
Suppose we want all UTXOs that reference at least one of
X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5
and X-dijets1d09qn852zcy03sfc9hay2llmn9hsgnw4tp3dv6
.
_10curl -X POST --data '{_10 "jsonrpc":"2.0",_10 "id" :1,_10 "method" :"avm.getUTXOs",_10 "params" :{_10 "addresses":["X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5", "X-dijets1d09qn852zcy03sfc9hay2llmn9hsgnw4tp3dv6"],_10 "limit":5,_10 "encoding": "hex"_10 }_10}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
This gives response:
_19{_19 "jsonrpc": "2.0",_19 "result": {_19 "numFetched": "5",_19 "utxos": [_19 "0x0000a195046108a85e60f7a864bb567745a37f50c6af282103e47cc62f036cee404700000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216c1f01765",_19 "0x0000ae8b1b94444eed8de9a81b1222f00f1b4133330add23d8ac288bffa98b85271100000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216473d042a",_19 "0x0000731ce04b1feefa9f4291d869adc30a33463f315491e164d89be7d6d2d7890cfc00000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f21600dd3047",_19 "0x0000b462030cc4734f24c0bc224cf0d16ee452ea6b67615517caffead123ab4fbf1500000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216c71b387e",_19 "0x000054f6826c39bc957c0c6d44b70f961a994898999179cc32d21eb09c1908d7167b00000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f2166290e79d"_19 ],_19 "endIndex": {_19 "address": "X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",_19 "utxo": "kbUThAUfmBXUmRgTpgD6r3nLj7rJUGho6xyht5nouNNypH45j"_19 },_19 "encoding": "hex"_19 },_19 "id": 1_19}
Since numFetched
is the same as limit
, we can tell that there may be more UTXOs that were not
fetched. We call the method again, this time with startIndex
:
_14curl -X POST --data '{_14 "jsonrpc":"2.0",_14 "id" :2,_14 "method" :"avm.getUTXOs",_14 "params" :{_14 "addresses":["X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],_14 "limit":5,_14 "startIndex": {_14 "address": "X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",_14 "utxo": "kbUThAUfmBXUmRgTpgD6r3nLj7rJUGho6xyht5nouNNypH45j"_14 },_14 "encoding": "hex"_14 }_14}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
This gives response:
_18{_18 "jsonrpc": "2.0",_18 "result": {_18 "numFetched": "4",_18 "utxos": [_18 "0x000020e182dd51ee4dcd31909fddd75bb3438d9431f8e4efce86a88a684f5c7fa09300000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f21662861d59",_18 "0x0000a71ba36c475c18eb65dc90f6e85c4fd4a462d51c5de3ac2cbddf47db4d99284e00000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f21665f6f83f",_18 "0x0000925424f61cb13e0fbdecc66e1270de68de9667b85baa3fdc84741d048daa69fa00000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216afecf76a",_18 "0x000082f30327514f819da6009fad92b5dba24d27db01e29ad7541aa8e6b6b554615c00000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216779c2d59"_18 ],_18 "endIndex": {_18 "address": "X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",_18 "utxo": "21jG2RfqyHUUgkTLe2tUp6ETGLriSDTW3th8JXFbPRNiSZ11jK"_18 },_18 "encoding": "hex"_18 },_18 "id": 1_18}
Since numFetched
is less than limit
, we know that we are done fetching UTXOs and don’t need to
call this method again.
Suppose we want to fetch the UTXOs exported from the Method Chain to the Value Chain in order to build an
ImportTx. Then we need to call GetUTXOs with the sourceChain
argument in order to retrieve the
atomic UTXOs:
_11curl -X POST --data '{_11 "jsonrpc":"2.0",_11 "id" :1,_11 "method" :"avm.getUTXOs",_11 "params" :{_11 "addresses":["X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5", "X-dijets1d09qn852zcy03sfc9hay2llmn9hsgnw4tp3dv6"],_11 "limit":5,_11 "sourceChain": "P",_11 "encoding": "hex"_11 }_11}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
This gives response:
_15{_15 "jsonrpc": "2.0",_15 "result": {_15 "numFetched": "1",_15 "utxos": [_15 "0x00001f989ffaf18a18a59bdfbf209342aa61c6a62a67e8639d02bb3c8ddab315c6fa0000000039c33a499ce4c33a3b09cdd2cfa01ae70dbf2d18b2d7d168524440e55d550088000000070011c304cd7eb5c0000000000000000000000001000000013cb7d3842e8cee6a0ebd09f1fe884f6861e1b29c83497819"_15 ],_15 "endIndex": {_15 "address": "X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",_15 "utxo": "2Sz2XwRYqUHwPeiKoRnZ6ht88YqzAF1SQjMYZQQaB5wBFkAqST"_15 },_15 "encoding": "hex"_15 },_15 "id": 1_15}
dvm.import
#
Not recommended for use on Mainnet. See warning notice in Keystore API.
Finalize a transfer of an asset from the Method Chain or Utility Chain to the Value Chain. Before this method is
called, you must call the Method Chain’s platform.exportDJT
or
Utility Chain’s djtx.export
method to initiate the transfer.
Signature:
_10avm.import({_10 to: string,_10 sourceChain: string,_10 username: string,_10 password: string,_10}) -> {txID: string}
to
is the address the DJT is sent to. This must be the same as theto
argument in the corresponding call to the Method Chain’sexportDJT
or Utility Chain'sexport
.sourceChain
is the ID or alias of the chain the DJT is being imported from. To import funds from the Utility Chain, use"C"
.username
is the user that controlsto
.txID
is the ID of the newly created atomic transaction.
Example Call:
_11curl -X POST --data '{_11 "jsonrpc":"2.0",_11 "id" :1,_11 "method" :"avm.import",_11 "params" :{_11 "to":"X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",_11 "sourceChain":"C",_11 "username":"myUsername",_11 "password":"myPassword"_11 }_11}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
Example Response:
_10{_10 "jsonrpc": "2.0",_10 "result": {_10 "txID": "2gXpf4jFoMAWQ3rxBfavgFfSdLkL2eFUYprKsUQuEdB5H6Jo1H"_10 },_10 "id": 1_10}
dvm.importKey
#
Not recommended for use on Mainnet. See warning notice in Keystore API.
Give a user control over an address by providing the private key that controls the address.
Signature:
_10avm.importKey({_10 username: string,_10 password: string,_10 privateKey: string_10}) -> {address: string}
- Add
privateKey
tousername
‘s set of private keys.address
is the addressusername
now controls with the private key.
Example Call:
_10curl -X POST --data '{_10 "jsonrpc":"2.0",_10 "id" :1,_10 "method" :"avm.importKey",_10 "params" :{_10 "username":"myUsername",_10 "password":"myPassword",_10 "privateKey":"PrivateKey-2w4XiXxPfQK4TypYqnohRL8DRNTz9cGiGmwQ1zmgEqD9c9KWLq"_10 }_10}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
Example Response:
_10{_10 "jsonrpc": "2.0",_10 "id": 1,_10 "result": {_10 "address": "X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"_10 }_10}
dvm.issueTx
#
Send a signed transaction to the network. encoding
specifies the format of the signed transaction.
Can only be hex
when a value is provided.
Signature:
_10avm.issueTx({_10 tx: string,_10 encoding: string, //optional_10}) -> {_10 txID: string_10}
Example Call:
_10curl -X POST --data '{_10 "jsonrpc":"2.0",_10 "id" : 1,_10 "method" :"avm.issueTx",_10 "params" :{_10 "tx":"0x00000009de31b4d8b22991d51aa6aa1fc733f23a851a8c9400000000000186a0000000005f041280000000005f9ca900000030390000000000000001fceda8f90fcb5d30614b99d79fc4baa29307762668f16eb0259a57c2d3b78c875c86ec2045792d4df2d926c40f829196e0bb97ee697af71f5b0a966dabff749634c8b729855e937715b0e44303fd1014daedc752006011b730",_10 "encoding": "hex"_10 }_10}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
Example Response:
_10{_10 "jsonrpc": "2.0",_10 "id": 1,_10 "result": {_10 "txID": "NUPLwbt2hsYxpQg4H2o451hmTWQ4JZx2zMzM4SinwtHgAdX1JLPHXvWSXEnpecStLj"_10 }_10}
dvm.listAddresses
#
Not recommended for use on Mainnet. See warning notice in Keystore API.
List addresses controlled by the given user.
Signature:
_10avm.listAddresses({_10 username: string,_10 password: string_10}) -> {addresses: []string}
Example Call:
_10curl -X POST --data '{_10 "jsonrpc": "2.0",_10 "method": "avm.listAddresses",_10 "params": {_10 "username":"myUsername",_10 "password":"myPassword"_10 },_10 "id": 1_10}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
Example Response:
_10{_10 "jsonrpc": "2.0",_10 "result": {_10 "addresses": ["X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"]_10 },_10 "id": 1_10}
dvm.mint
#
Not recommended for use on Mainnet. See warning notice in Keystore API.
Mint units of a variable-cap asset created with
dvm.createVariableCapAsset
.
Signature:
_13avm.mint({_13 amount: int,_13 assetID: string,_13 to: string,_13 from: []string, //optional_13 changeAddr: string, //optional_13 username: string,_13 password: string_13}) ->_13{_13 txID: string,_13 changeAddr: string,_13}
amount
units ofassetID
will be created and controlled by addressto
.from
are the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed.changeAddr
is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.username
is the user that pays the transaction fee.username
must hold keys giving it permission to mint more of this asset. That is, it must control at least threshold keys for one of the minter sets.txID
is this transaction’s ID.changeAddr
in the result is the address where any change was sent.
Example Call:
_14curl -X POST --data '{_14 "jsonrpc":"2.0",_14 "id" : 1,_14 "method" :"avm.mint",_14 "params" :{_14 "amount":10000000,_14 "assetID":"i1EqsthjiFTxunrj8WD2xFSrQ5p2siEKQacmCCB5qBFVqfSL2",_14 "to":"X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",_14 "from":["X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],_14 "changeAddr":"X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8",_14 "username":"myUsername",_14 "password":"myPassword"_14 }_14}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
Example Response:
_10{_10 "jsonrpc": "2.0",_10 "id": 1,_10 "result": {_10 "txID": "2oGdPdfw2qcNUHeqjw8sU2hPVrFyNUTgn6A8HenDra7oLCDtja",_10 "changeAddr": "X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8"_10 }_10}
dvm.mintNFT
#
Not recommended for use on Mainnet. See warning notice in Keystore API.
Mint non-fungible tokens which were created with
dvm.createNFTAsset
.
Signature:
_14avm.mintNFT({_14 assetID: string,_14 payload: string,_14 to: string,_14 encoding: string, //optional_14 from: []string, //optional_14 changeAddr: string, //optional_14 username: string,_14 password: string_14}) ->_14{_14 txID: string,_14 changeAddr: string,_14}
assetID
is the assetID of the newly created NFT asset.payload
is an arbitrary payload of up to 1024 bytes. Its encoding format is specified by theencoding
argument.from
are the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed.changeAddr
is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.username
is the user that pays the transaction fee.username
must hold keys giving it permission to mint more of this asset. That is, it must control at least threshold keys for one of the minter sets.txID
is this transaction’s ID.changeAddr
in the result is the address where any change was sent.encoding
is the encoding format to use for the payload argument. Can only behex
when a value is provided.
Example Call:
_14curl -X POST --data '{_14 "jsonrpc":"2.0",_14 "id" : 1,_14 "method" :"avm.mintNFT",_14 "params" :{_14 "assetID":"2KGdt2HpFKpTH5CtGZjYt5XPWs6Pv9DLoRBhiFfntbezdRvZWP",_14 "payload":"0x415641204c61627338259aed",_14 "to":"X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",_14 "from":["X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],_14 "changeAddr":"X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8",_14 "username":"myUsername",_14 "password":"myPassword"_14 }_14}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
Example Response:
_10{_10 "jsonrpc": "2.0",_10 "id": 1,_10 "result": {_10 "txID": "2oGdPdfw2qcNUHeqjw8sU2hPVrFyNUTgn6A8HenDra7oLCDtja",_10 "changeAddr": "X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8"_10 }_10}
dvm.send
#
Not recommended for use on Mainnet. See warning notice in Keystore API.
Send a quantity of an asset to an address.
Signature:
_10avm.send({_10 amount: int,_10 assetID: string,_10 to: string,_10 memo: string, //optional_10 from: []string, //optional_10 changeAddr: string, //optional_10 username: string,_10 password: string_10}) -> {txID: string, changeAddr: string}
- Sends
amount
units of asset with IDassetID
to addressto
.amount
is denominated in the smallest increment of the asset. For DJT this is 1 nDJT (one billionth of 1 DJT.) to
is the Value Chain address the asset is sent to.from
are the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed.changeAddr
is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.- You can attach a
memo
, whose length can be up to 256 bytes. - The asset is sent from addresses controlled by user
username
. (Of course, that user will need to hold at least the balance of the asset being sent.)
Example Call:
_15curl -X POST --data '{_15 "jsonrpc":"2.0",_15 "id" :1,_15 "method" :"avm.send",_15 "params" :{_15 "assetID" : "DJT",_15 "amount" : 10000,_15 "to" : "X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",_15 "from" : ["X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],_15 "changeAddr": "X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8",_15 "memo" : "PenXenOleFren",_15 "username" : "userNameTest",_15 "password" : "myPassword"_15 }_15}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
Example Response:
_10{_10 "jsonrpc": "2.0",_10 "id": 1,_10 "result": {_10 "txID": "2iXSVLPNVdnFqn65rRvLrsu8WneTFqBJRMqkBJx5vZTwAQb8c1",_10 "changeAddr": "X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8"_10 }_10}
dvm.sendMultiple
#
Not recommended for use on Mainnet. See warning notice in Keystore API.
Sends multiple transfers of amount
of assetID
, to a specified address from a list of owned
addresses.
Signature:
_12avm.sendMultiple({_12 outputs: []{_12 assetID: string,_12 amount: int,_12 to: string_12 },_12 from: []string, //optional_12 changeAddr: string, //optional_12 memo: string, //optional_12 username: string,_12 password: string_12}) -> {txID: string, changeAddr: string}
outputs
is an array of object literals which each contain anassetID
,amount
andto
.memo
is an optional message, whose length can be up to 256 bytes.from
are the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed.changeAddr
is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.- The asset is sent from addresses controlled by user
username
. (Of course, that user will need to hold at least the balance of the asset being sent.)
Example Call:
_24curl -X POST --data '{_24 "jsonrpc":"2.0",_24 "id" :1,_24 "method" :"avm.sendMultiple",_24 "params" :{_24 "outputs": [_24 {_24 "assetID" : "DJT",_24 "to" : "X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",_24 "amount" : 1000000000_24 },_24 {_24 "assetID" : "26aqSTpZuWDAVtRmo44fjCx4zW6PDEx3zy9Qtp2ts1MuMFn9FB",_24 "to" : "X-dijets18knvhxx8uhc0mwlgrfyzjcm2wrd6e60w37xrjq",_24 "amount" : 10_24 }_24 ],_24 "memo" : "PenXenOleFren",_24 "from" : ["X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],_24 "changeAddr": "X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8",_24 "username" : "username",_24 "password" : "myPassword"_24 }_24}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
Example Response:
_10{_10 "jsonrpc": "2.0",_10 "id": 1,_10 "result": {_10 "txID": "2iXSVLPNVdnFqn65rRvLrsu8WneTFqBJRMqkBJx5vZTwAQb8c1",_10 "changeAddr": "X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8"_10 }_10}
dvm.sendNFT
#
Not recommended for use on Mainnet. See warning notice in Keystore API.
Send a non-fungible token.
Signature:
_10avm.sendNFT({_10 assetID: string,_10 groupID: number,_10 to: string,_10 from: []string, //optional_10 changeAddr: string, //optional_10 username: string,_10 password: string_10}) -> {txID: string}
assetID
is the asset ID of the NFT being sent.groupID
is the NFT group from which to send the NFT. NFT creation allows multiple groups under each NFT ID. You can issue multiple NFTs to each group.to
is the Value Chain address the NFT is sent to.from
are the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed.changeAddr
is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.- The asset is sent from addresses controlled by user
username
. (Of course, that user will need to hold at least the balance of the NFT being sent.)
Example Call:
_14curl -X POST --data '{_14 "jsonrpc":"2.0",_14 "id" :1,_14 "method" :"avm.sendNFT",_14 "params" :{_14 "assetID" : "2KGdt2HpFKpTH5CtGZjYt5XPWs6Pv9DLoRBhiFfntbezdRvZWP",_14 "groupID" : 0,_14 "to" : "X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",_14 "from" : ["X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],_14 "changeAddr": "X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8",_14 "username" : "myUsername",_14 "password" : "myPassword"_14 }_14}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V
Example Response:
_10{_10 "jsonrpc": "2.0",_10 "result": {_10 "txID": "DoR2UtG1Trd3Q8gWXVevNxD666Q3DPqSFmBSMPQ9dWTV8Qtuy",_10 "changeAddr": "X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8"_10 },_10 "id": 1_10}
wallet.issueTx
#
Send a signed transaction to the network and assume the TX will be accepted. encoding
specifies
the format of the signed transaction. Can only be hex
when a value is provided.
This call is made to the wallet API endpoint:
/ext/bc/V/wallet
Signature:
_10wallet.issueTx({_10 tx: string,_10 encoding: string, //optional_10}) -> {_10 txID: string_10}
Example Call:
_10curl -X POST --data '{_10 "jsonrpc":"2.0",_10 "id" : 1,_10 "method" :"wallet.issueTx",_10 "params" :{_10 "tx":"0x00000009de31b4d8b22991d51aa6aa1fc733f23a851a8c9400000000000186a0000000005f041280000000005f9ca900000030390000000000000001fceda8f90fcb5d30614b99d79fc4baa29307762668f16eb0259a57c2d3b78c875c86ec2045792d4df2d926c40f829196e0bb97ee697af71f5b0a966dabff749634c8b729855e937715b0e44303fd1014daedc752006011b730",_10 "encoding": "hex"_10 }_10}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V/wallet
Example Response:
_10{_10 "jsonrpc": "2.0",_10 "id": 1,_10 "result": {_10 "txID": "NUPLwbt2hsYxpQg4H2o451hmTWQ4JZx2zMzM4SinwtHgAdX1JLPHXvWSXEnpecStLj"_10 }_10}
wallet.send
#
Not recommended for use on Mainnet. See warning notice in Keystore API.
Send a quantity of an asset to an address and assume the TX will be accepted so that future calls can use the modified UTXO set.
This call is made to the wallet API endpoint:
/ext/bc/V/wallet
Signature:
_10wallet.send({_10 amount: int,_10 assetID: string,_10 to: string,_10 memo: string, //optional_10 from: []string, //optional_10 changeAddr: string, //optional_10 username: string,_10 password: string_10}) -> {txID: string, changeAddr: string}
- Sends
amount
units of asset with IDassetID
to addressto
.amount
is denominated in the smallest increment of the asset. For DJT this is 1 nDJT (one billionth of 1 DJT.) to
is the Value Chain address the asset is sent to.from
are the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed.changeAddr
is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.- You can attach a
memo
, whose length can be up to 256 bytes. - The asset is sent from addresses controlled by user
username
. (Of course, that user will need to hold at least the balance of the asset being sent.)
Example Call:
_15curl -X POST --data '{_15 "jsonrpc":"2.0",_15 "id" :1,_15 "method" :"wallet.send",_15 "params" :{_15 "assetID" : "DJT",_15 "amount" : 10000,_15 "to" : "X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",_15 "memo" : "penXenOleFren",_15 "from" : ["X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],_15 "changeAddr": "X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8",_15 "username" : "userThatControlsAtLeast10000OfThisAsset",_15 "password" : "myPassword"_15 }_15}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V/wallet
Example Response:
_10{_10 "jsonrpc": "2.0",_10 "id": 1,_10 "result": {_10 "txID": "2iXSVLPNVdnFqn65rRvLrsu8WneTFqBJRMqkBJx5vZTwAQb8c1",_10 "changeAddr": "X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8"_10 }_10}
wallet.sendMultiple
#
Not recommended for use on Mainnet. See warning notice in Keystore API.
Send multiple transfers of amount
of assetID
, to a specified address from a list of owned of
addresses and assume the TX will be accepted so that future calls can use the modified UTXO set.
This call is made to the wallet API endpoint:
/ext/bc/V/wallet
Signature:
_12wallet.sendMultiple({_12 outputs: []{_12 assetID: string,_12 amount: int,_12 to: string_12 },_12 from: []string, //optional_12 changeAddr: string, //optional_12 memo: string, //optional_12 username: string,_12 password: string_12}) -> {txID: string, changeAddr: string}
outputs
is an array of object literals which each contain anassetID
,amount
andto
.from
are the addresses that you want to use for this operation. If omitted, uses any of your addresses as needed.changeAddr
is the address any change will be sent to. If omitted, change is sent to one of the addresses controlled by the user.- You can attach a
memo
, whose length can be up to 256 bytes. - The asset is sent from addresses controlled by user
username
. (Of course, that user will need to hold at least the balance of the asset being sent.)
Example Call:
_24curl -X POST --data '{_24 "jsonrpc":"2.0",_24 "id" :1,_24 "method" :"wallet.sendMultiple",_24 "params" :{_24 "outputs": [_24 {_24 "assetID" : "DJT",_24 "to" : "X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",_24 "amount" : 1000000000_24 },_24 {_24 "assetID" : "26aqSTpZuWDAVtRmo44fjCx4zW6PDEx3zy9Qtp2ts1MuMFn9FB",_24 "to" : "X-dijets18knvhxx8uhc0mwlgrfyzjcm2wrd6e60w37xrjq",_24 "amount" : 10_24 }_24 ],_24 "memo" : "PenXenOleFren",_24 "from" : ["X-dijets18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],_24 "changeAddr": "X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8",_24 "username" : "username",_24 "password" : "myPassword"_24 }_24}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/V/wallet
Example Response:
_10{_10 "jsonrpc": "2.0",_10 "id": 1,_10 "result": {_10 "txID": "2iXSVLPNVdnFqn65rRvLrsu8WneTFqBJRMqkBJx5vZTwAQb8c1",_10 "changeAddr": "X-dijets1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8"_10 }_10}
Events#
Listen for transactions on a specified address.
This call is made to the events API endpoint:
/ext/bc/V/events
Golang Example
_75package main_75_75import (_75 "encoding/json"_75 "log"_75 "net"_75 "net/http"_75 "sync"_75_75 "github.com/Dijets-Inc/dijetsnodego/api"_75 "github.com/Dijets-Inc/dijetsnodego/pubsub"_75 "github.com/gorilla/websocket"_75)_75_75func main() {_75 dialer := websocket.Dialer{_75 NetDial: func(netw, addr string) (net.Conn, error) {_75 return net.Dial(netw, addr)_75 },_75 }_75_75 httpHeader := http.Header{}_75 conn, _, err := dialer.Dial("ws://localhost:9650/ext/bc/V/events", httpHeader)_75 if err != nil {_75 panic(err)_75 }_75_75 waitGroup := &sync.WaitGroup{}_75 waitGroup.Add(1)_75_75 readMsg := func() {_75 defer waitGroup.Done()_75_75 for {_75 mt, msg, err := conn.ReadMessage()_75 if err != nil {_75 log.Println(err)_75 return_75 }_75 switch mt {_75 case websocket.TextMessage:_75 log.Println(string(msg))_75 default:_75 log.Println(mt, string(msg))_75 }_75 }_75 }_75_75 go readMsg()_75_75 cmd := &pubsub.Command{NewSet: &pubsub.NewSet{}}_75 cmdmsg, err := json.Marshal(cmd)_75 if err != nil {_75 panic(err)_75 }_75 err = conn.WriteMessage(websocket.TextMessage, cmdmsg)_75 if err != nil {_75 panic(err)_75 }_75_75 var addresses []string_75 addresses = append(addresses, " X-test....")_75 cmd = &pubsub.Command{AddAddresses: &pubsub.AddAddresses{JSONAddresses: api.JSONAddresses{Addresses: addresses}}}_75 cmdmsg, err = json.Marshal(cmd)_75 if err != nil {_75 panic(err)_75 }_75_75 err = conn.WriteMessage(websocket.TextMessage, cmdmsg)_75 if err != nil {_75 panic(err)_75 }_75_75 waitGroup.Wait()_75}
Operations:
Command | Description | Example | Arguments |
---|---|---|---|
NewSet | create a new address map set | {"newSet":{}} | |
NewBloom | create a new bloom set. | {"newBloom":{"maxElements":"1000","collisionProb":"0.0100"}} | maxElements - number of elements in filter must be > 0 collisionProb - allowed collision probability must be > 0 and <= 1 |
AddAddresses | add an address to the set | {"addAddresses":{"addresses":\["X-test..."\]}} | addresses - list of addresses to match |
Calling NewSet or NewBloom resets the filter, and must be followed with AddAddresses. AddAddresses can be called multiple times.
Set details:
- NewSet performs absolute address matches, if the address is in the set you will be sent the transaction.
- NewBloom Bloom filtering can produce false positives, but can allow a greater number of addresses to be filtered. If the addresses is in the filter, you will be sent the transaction.
Example Response:
_102021/05/11 15:59:35 {"txID":"22HWKHrREyXyAiDnVmGp3TQQ79tHSSVxA9h26VfDEzoxvwveyk"}