X-Chain

avm.createAddress

Create a new address controlled by the given user.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc": "2.0",
    "method": "avm.createAddress",
    "params": {
        "username": "myUsername",
        "password": "myPassword"
    },
    "id": 1
}

Example response: 200

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32000,
        "message": "problem retrieving user \"myUsername\": incorrect password: user \"myUsername\"",
        "data": null
    },
    "id": 1
}

avm.createFixedCapAsset

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.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "avm.createFixedCapAsset",
    "params": {
        "name": "myFixedCapAsset",
        "symbol": "MFCA",
        "initialHolders": [
            {
                "address": "X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",
                "amount": 10000
            },
            {
                "address": "X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",
                "amount": 50000
            }
        ],
        "from": [
            "X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"
        ],
        "changeAddr": "X-avax1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8",
        "username": "myUsername",
        "password": "myPassword"
    }
}

Example response: 200

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32000,
        "message": "problem retrieving user \"myUsername\": incorrect password: user \"myUsername\"",
        "data": null
    },
    "id": 1
}

avm.createNFTAsset

Create a new non-fungible asset. No units of the asset exist at initialization. Minters can mint units of this asset using avm.mintNFT.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc":"2.0",
    "id"     : 1,
    "method" :"avm.createNFTAsset",
    "params" :{
        "name":"Coincert",
        "symbol":"TIXX",
        "minterSets":[
            {
                "minters":[
                    "X-avax1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8"
                ],
                "threshold": 1
            }
        ],
        "from": ["X-avax1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8"],
        "changeAddr": "X-avax1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8",
        "username":"myUsername",
        "password":"myPassword"
    }
}

Example response: 200

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32000,
        "message": "problem retrieving user \"myUsername\": incorrect password: user \"myUsername\"",
        "data": null
    },
    "id": 1
}

avm.createVariableCapAsset

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.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc":"2.0",
    "id"     : 1,
    "method" :"avm.createNFTAsset",
    "params" :{
        "name":"Coincert",
        "symbol":"TIXX",
        "minterSets":[
            {
                "minters":[
                    "X-avax1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8"
                ],
                "threshold": 1
            }
        ],
        "from": ["X-avax1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8"],
        "changeAddr": "X-avax1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8",
        "username":"myUsername",
        "password":"myPassword"
    }
}

Example response: 200

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32000,
        "message": "problem retrieving user \"myUsername\": incorrect password: user \"myUsername\"",
        "data": null
    },
    "id": 1
}

avm.export

Send an asset from the X-Chain to the P-Chain or C-Chain.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc":"2.0",
    "id"     :1,
    "method" :"avm.export",
    "params" :{
        "to":"C-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",
        "amount": 10,
        "assetID": "AVAX",
        "from":["X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],
        "changeAddr":"X-avax1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8",
        "username":"myUsername",
        "password":"myPassword"
    }
}

Example response: 200

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32000,
        "message": "problem retrieving user \"myUsername\": incorrect password: user \"myUsername\"",
        "data": null
    },
    "id": 1
}

avm.exportKey

Get the private key that controls a given address. The returned private key can be added to a user with avm.importKey.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc":"2.0",
    "id"     :1,
    "method" :"avm.export",
    "params" :{
        "to":"C-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",
        "amount": 10,
        "assetID": "AVAX",
        "from":["X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],
        "changeAddr":"X-avax1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8",
        "username":"myUsername",
        "password":"myPassword"
    }
}

Example response: 200

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32000,
        "message": "problem retrieving user \"myUsername\": incorrect password: user \"myUsername\"",
        "data": null
    },
    "id": 1
}

avm.getAddressTxs

Returns all transactions that change the balance of the given address.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
  "jsonrpc":"2.0",
  "id"     : 1,
  "method" :"avm.getAddressTxs",
  "params" :{
      "address":"X-local1kpprmfpzzm5lxyene32f6lr7j0aj7gxsu6hp9y",
      "assetID":"AVAX",
      "pageSize":20
  }
}

Example response: 200

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32000,
        "message": "couldn't parse argument 'address' to address: couldn't parse address \"X-local1kpprmfpzzm5lxyene32f6lr7j0aj7gxsu6hp9y\": expected hrp \"avax\" but got \"local\"",
        "data": null
    },
    "id": 1
}

avm.getAllBalances

Get the balances of all assets controlled by a given address.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc":"2.0",
    "id"     : 1,
    "method" :"avm.getAllBalances",
    "params" :{
        "address":"X-avax1c79e0dd0susp7dc8udq34jgk2yvve7hapvdyht"
    }
}

Example response: 200

{
    "jsonrpc": "2.0",
    "result": {
        "balances": []
    },
    "id": 1
}

avm.getAssetDescription

Get information about an asset.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc":"2.0",
    "id"     :1,
    "method" :"avm.getAssetDescription",
    "params" :{
        "assetID" :"FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z"
    }
}

Example response: 200

{
    "jsonrpc": "2.0",
    "result": {
        "assetID": "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z",
        "name": "Avalanche",
        "symbol": "AVAX",
        "denomination": "9"
    },
    "id": 1
}

avm.getBalance

Get the balance of an asset controlled by a given address.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
  "jsonrpc":"2.0",
  "id"     : 1,
  "method" :"avm.getBalance",
  "params" :{
      "address":"X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",
      "assetID": "2pYGetDWyKdHxpFxh2LHeoLNCH6H5vxxCxHQtFnnFaYxLsqtHC"
  }
}

Example response: 200

{
    "jsonrpc": "2.0",
    "result": {
        "balance": "0",
        "utxoIDs": []
    },
    "id": 1
}

avm.getBlock

Returns the block with the given id.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc": "2.0",
    "method": "avm.getBlock",
    "params": {
        "blockID": "tXJ4xwmR8soHE6DzRNMQPtiwQvuYsHn6eLLBzo2moDqBquqy6",
        "encoding": "hex"
    },
    "id": 1
}

Example response: 200

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32000,
        "message": "couldn't get block with id tXJ4xwmR8soHE6DzRNMQPtiwQvuYsHn6eLLBzo2moDqBquqy6: not found",
        "data": null
    },
    "id": 1
}

avm.getBlockByHeight

Returns block at the given height.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc": "2.0",
    "method": "avm.getBlockByHeight",
    "params": {
        "height": "275686313486",
        "encoding": "hex"
    },
    "id": 1
}

Example response: 200

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32000,
        "message": "couldn't get block at height 275686313486: not found",
        "data": null
    },
    "id": 1
}

avm.getHeight

Returns the height of the last accepted block.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc": "2.0",
    "method": "avm.getHeight",
    "params": {},
    "id": 1
}

Example response: 200

{
    "jsonrpc": "2.0",
    "result": {
        "height": "67418"
    },
    "id": 1
}

avm.getTx

Returns the specified transaction. The encoding parameter sets the format of the returned transaction. Can be either "hex" or "json". Defaults to "hex".

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc":"2.0",
    "id"     :1,
    "method" :"avm.getTx",
    "params" :{
        "txID":"2oJCbb8pfdxEHAf9A8CdN4Afj9VSR3xzyzNkf8tDv7aM1sfNFL",
        "encoding": "json"
    }
}

Example response: 200

{
    "jsonrpc": "2.0",
    "result": {
        "tx": {
            "unsignedTx": {
                "networkID": 1,
                "blockchainID": "2oYMBNV4eNHyqk2fjjV5nVQLDbtmNJzq5s3qs3Lo6ftnC6FByM",
                "outputs": [],
                "inputs": [
                    {
                        "txID": "2jbZUvi6nHy3Pgmk8xcMpSg5cW6epkPqdKkHSCweb4eRXtq4k9",
                        "outputIndex": 1,
                        "assetID": "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z",
                        "fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ",
                        "input": {
                            "amount": 2570382395,
                            "signatureIndices": [
                                0
                            ]
                        }
                    }
                ],
                "memo": "0x",
                "destinationChain": "11111111111111111111111111111111LpoYY",
                "exportedOutputs": [
                    {
                        "assetID": "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z",
                        "fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ",
                        "output": {
                            "addresses": [
                                "X-avax1tnuesf6cqwnjw7fxjyk7lhch0vhf0v95wj5jvy"
                            ],
                            "amount": 2569382395,
                            "locktime": 0,
                            "threshold": 1
                        }
                    }
                ]
            },
            "credentials": [
                {
                    "fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ",
                    "credential": {
                        "signatures": [
                            "0x46ebcbcfbee3ece1fd15015204045cf3cb77f42c48d0201fc150341f91f086f177cfca8894ca9b4a0c55d6950218e4ea8c01d5c4aefb85cd7264b47bd57d224400"
                        ]
                    }
                }
            ],
            "id": "2oJCbb8pfdxEHAf9A8CdN4Afj9VSR3xzyzNkf8tDv7aM1sfNFL"
        },
        "encoding": "json"
    },
    "id": 1
}

avm.getTxStatus

Get the status of a transaction sent to the network.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc":"2.0",
    "id"     :1,
    "method" :"avm.getTxStatus",
    "params" :{
        "txID":"2QouvFWUbjuySRxeX5xMbNCuAaKWfbk5FeEa2JmoF85RKLk2dD"
    }
}

Example response: 200

{
    "jsonrpc": "2.0",
    "result": {
        "status": "Unknown"
    },
    "id": 1
}

avm.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.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc":"2.0",
    "id"     :1,
    "method" :"avm.getUTXOs",
    "params" :{
        "addresses":["X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5", "X-avax1d09qn852zcy03sfc9hay2llmn9hsgnw4tp3dv6"],
        "limit":5,
        "encoding": "hex"
    }
}

Example response: 200

{
    "jsonrpc": "2.0",
    "result": {
        "numFetched": "0",
        "utxos": [],
        "endIndex": {
            "address": "X-avax1d09qn852zcy03sfc9hay2llmn9hsgnw4tp3dv6",
            "utxo": "11111111111111111111111111111111LpoYY"
        },
        "encoding": "hex"
    },
    "id": 1
}

avm.import

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.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc":"2.0",
    "id"     :1,
    "method" :"avm.import",
    "params" :{
        "to":"X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",
        "sourceChain":"C",
        "username":"myUsername",
        "password":"myPassword"
    }
}

Example response: 200

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32000,
        "message": "problem retrieving user \"myUsername\": incorrect password: user \"myUsername\"",
        "data": null
    },
    "id": 1
}

avm.importKey

Give a user control over an address by providing the private key that controls the address.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc":"2.0",
    "id"     :1,
    "method" :"avm.importKey",
    "params" :{
        "username":"myUsername",
        "password":"myPassword",
        "privateKey":"PrivateKey-2w4XiXxPfQK4TypYqnohRL8DRNTz9cGiGmwQ1zmgEqD9c9KWLq"
    }
}

Example response: 200

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32000,
        "message": "problem retrieving user \"myUsername\": incorrect password: user \"myUsername\"",
        "data": null
    },
    "id": 1
}

avm.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.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc":"2.0",
    "id"     : 1,
    "method" :"avm.issueTx",
    "params" :{
        "tx":"0x00000009de31b4d8b22991d51aa6aa1fc733f23a851a8c9400000000000186a0000000005f041280000000005f9ca900000030390000000000000001fceda8f90fcb5d30614b99d79fc4baa29307762668f16eb0259a57c2d3b78c875c86ec2045792d4df2d926c40f829196e0bb97ee697af71f5b0a966dabff749634c8b729855e937715b0e44303fd1014daedc752006011b730",
        "encoding": "hex"
    }
}

Example response: 200

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32000,
        "message": "couldn't unmarshal struct: couldn't unmarshal interface: unknown type ID 646705",
        "data": null
    },
    "id": 1
}

avm.listAddresses

List addresses controlled by the given user.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc": "2.0",
    "method": "avm.listAddresses",
    "params": {
        "username":"myUsername",
        "password":"myPassword"
    },
    "id": 1
}

Example response: 200

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32000,
        "message": "problem retrieving user \"myUsername\": incorrect password: user \"myUsername\"",
        "data": null
    },
    "id": 1
}

avm.mint

Mint units of a variable-cap asset created with avm.createVariableCapAsset.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc":"2.0",
    "id"     : 1,
    "method" :"avm.mint",
    "params" :{
        "amount":10000000,
        "assetID":"i1EqsthjiFTxunrj8WD2xFSrQ5p2siEKQacmCCB5qBFVqfSL2",
        "to":"X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",
        "from":["X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],
        "changeAddr":"X-avax1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8",
        "username":"myUsername",
        "password":"myPassword"
    }
}

Example response: 200

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32000,
        "message": "problem retrieving user \"myUsername\": incorrect password: user \"myUsername\"",
        "data": null
    },
    "id": 1
}

avm.mintNFT

Mint non-fungible tokens which were created with avm.createNFTAsset.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc":"2.0",
    "id"     : 1,
    "method" :"avm.mintNFT",
    "params" :{
        "assetID":"2KGdt2HpFKpTH5CtGZjYt5XPWs6Pv9DLoRBhiFfntbezdRvZWP",
        "payload":"0x415641204c61627338259aed",
        "to":"X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",
        "from":["X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],
        "changeAddr":"X-avax1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8",
        "username":"myUsername",
        "password":"myPassword"
    }
}

Example response: 200

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32000,
        "message": "problem retrieving user \"myUsername\": incorrect password: user \"myUsername\"",
        "data": null
    },
    "id": 1
}

avm.send

Send a quantity of an asset to an address.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc":"2.0",
    "id"     :1,
    "method" :"avm.send",
    "params" :{
        "assetID"   : "AVAX",
        "amount"    : 10000,
        "to"        : "X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",
        "from"      : ["X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],
        "changeAddr": "X-avax1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8",
        "memo"      : "hi, mom!",
        "username"  : "userThatControlsAtLeast10000OfThisAsset",
        "password"  : "myPassword"
    }
}

Example response: 200

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32000,
        "message": "problem retrieving user \"userThatControlsAtLeast10000OfThisAsset\": incorrect password: user \"userThatControlsAtLeast10000OfThisAsset\"",
        "data": null
    },
    "id": 1
}

avm.sendMultiple

Sends multiple transfers of amount of assetID, to a specified address from a list of owned addresses.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc":"2.0",
    "id"     :1,
    "method" :"avm.sendMultiple",
    "params" :{
        "outputs": [
            {
                "assetID" : "AVAX",
                "to"      : "X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",
                "amount"  : 1000000000
            },
            {
                "assetID" : "26aqSTpZuWDAVtRmo44fjCx4zW6PDEx3zy9Qtp2ts1MuMFn9FB",
                "to"      : "X-avax18knvhxx8uhc0mwlgrfyzjcm2wrd6e60w37xrjq",
                "amount"  : 10
            }
        ],
        "memo"      : "hi, mom!",
        "from"      : ["X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],
        "changeAddr": "X-avax1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8",
        "username"  : "username",
        "password"  : "myPassword"
    }
}

Example response: 200

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32000,
        "message": "problem retrieving user \"username\": incorrect password: user \"username\"",
        "data": null
    },
    "id": 1
}

avm.sendNFT

Send a non-fungible token.

Method: POST

https://avax.nownodes.io/ext/bc/X

Example body (raw)

{
    "jsonrpc":"2.0",
    "id"     :1,
    "method" :"avm.sendNFT",
    "params" :{
        "assetID"   : "2KGdt2HpFKpTH5CtGZjYt5XPWs6Pv9DLoRBhiFfntbezdRvZWP",
        "groupID"   : 0,
        "to"        : "X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5",
        "from"      : ["X-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"],
        "changeAddr": "X-avax1turszjwn05lflpewurw96rfrd3h6x8flgs5uf8",
        "username"  : "myUsername",
        "password"  : "myPassword"
    }
}

Example response: 200

{
    "jsonrpc": "2.0",
    "error": {
        "code": -32000,
        "message": "problem retrieving user \"myUsername\": incorrect password: user \"myUsername\"",
        "data": null
    },
    "id": 1
}

Last updated