Blockchain
Note zachys (atomic units) are 10^6 in X-Cash

Stats

This method gets the stats
Method: GET
Inputs: None.
Results:
  • height - unsigned int; The current block height.
  • hash - string; The current block hash.
  • reward - unsigned long long; The current block reward in zachys (atomic units).
  • size - unsigned long long; The size of the blockchain in bytes.
  • version - unsigned int; The hard fork version.
  • versionBlockHeight - unsigned int; The block height the hard fork version started on.
  • nextVersionBlockHeight - unsigned int; The block height of the next hard fork version.
  • totalPublicTx - unsigned int; The total public tx.
  • totalPrivateTx - unsigned int; The total private tx.
  • circulatingSupply - unsigned long long; The circulating supply in zachys (atomic units).
  • generatedSupply - unsigned long long; The generated supply in zachys (atomic units).
  • totalSupply - unsigned long long; The total supply in zachys (atomic units).
  • emissionReward - unsigned long long; The estimated constant block reward in zachys (atomic units).
  • emissionHeight - unsigned int; The estimated block height that will start the emission (when the constant block reward is hit).
  • emissionTime - unsigned int; The estimated time when the emission will start (when the constant block reward is hit).
  • inflationHeight - unsigned int; The estimated block height that will start the inflation (when the total supply increases).
  • inflationTime - unsigned int; The estimated time when the inflation will start (when the total supply increases).
1
$ curl -X GET https://api.xcash.foundation/v1/xcash/blockchain/unauthorized/stats/ -H 'Accept: application/json'
2
{
3
"height": 810000,
4
"hash":"c7aa6eb38c47e7f013a5f8042477d1734ff9808fdc8608fb088085d624d2d509",
5
"reward": 20000000,
6
"size": 20000,
7
"version": 13,
8
"versionBlockHeight": 1000000,
9
"nextVersionBlockHeight": 0,
10
"totalPublicTx": 100000,
11
"totalPrivateTx": 100000,
12
"circulatingSupply": 10000000,
13
"generatedSupply": 100000000,
14
"totalSupply": 100000000,
15
"emissionReward": 1000000000,
16
"emissionHeight": 1000000000,
17
"emissionTime": 1000000000,
18
"inflationHeight": 1000000000,
19
"inflationTime": 1000000000
20
}
Copied!

Block Data

This method gets the block data
Method: GET
Resources:
  • blockHeight - Not required - The block height (default is current block height).
Inputs: None.
Results:
  • height - unsigned int; The block height.
  • hash - string; The block hash.
  • reward - unsigned long long; The block reward in zachys (atomic units).
  • time - unsigned int; The time the block was produced.
  • xcashDPOPS - bool;
  • delegateName - string; The delegate name who produced the block.
  • tx - an array of transactions; The list of all transactions included in the block.
1
$ curl -X GET https://api.xcash.foundation/v1/xcash/blockchain/unauthorized/blocks/810000/ -H 'Accept: application/json'
2
{
3
"height": 810000,
4
"hash": "c7aa6eb38c47e7f013a5f8042477d1734ff9808fdc8608fb088085d624d2d509",
5
"reward": 47903837995,
6
"time": 1615984630,
7
"xcashDPOPS": false,
8
"delegateName": "",
9
"tx": ["c7aa6eb38c47e7f013a5f8042477d1734ff9808fdc8608fb088085d624d2d509","b7aa6eb38c47e7f013a5f8042477d1734ff9808fdc8608fb088085d624d2d509"]
10
}
Copied!

Transaction Data

This method gets the transaction data
Method: GET
Resources:
  • tx - Required - The tx hash.
Inputs: None.
Results:
  • height - unsigned int; The block height (0 if not added to a block).
  • confirmations - unsigned int; The block confirmations.
  • time - unsigned int; The time.
  • type - string; "private | public".
  • sender - string; The sender, if public.
  • receiver - string; The receiver, if public.
  • amount - unsigned long long; The amount, if public.
1
$ curl -X GET https://api.xcash.foundation/v1/xcash/blockchain/unauthorized/tx/d15005880f5f88b19fc88bdec29faaf57489ba85dd02d41ec87043a5eddf95a9/ -H 'Accept: application/json'
2
{
3
"height": 810000,
4
"confirmations": 100,
5
"time": 10000000,
6
"type": "private",
7
"sender": "",
8
"receiver": "",
9
"amount": 0
10
}
Copied!

Prove Transaction

This method proves a tx and its amount
Method: POST
Inputs (All are required):
  • tx - The tx hash.
  • address - The destination public address.
  • key - The tx key or tx proof.
Results:
  • valid - bool; Confirms that some amount was sent to the destination public address in this tx.
  • amount - unsigned long long; The amount sent to the destination public address.
1
$ curl -X POST https://api.xcash.foundation/v1/xcash/blockchain/unauthorized/tx/prove/ -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"tx":"d15005880f5f88b19fc88bdec29faaf57489ba85dd02d41ec87043a5eddf95a9","address":"XCA1a9usG2UKajV1Dqzp8fL1BbN3hzuaaJMYjCo7qDoC4C3Vvc5owiLAqKbVw2cRbwRqx3mgrau1Z7LkX6cxR2NC4ZmFBLe2Mf","key": "a15005880f5f88b19fc88bdec29faaf57489ba85dd02d41ec87043a5eddf95a9"}'
2
{
3
"valid": true,
4
"amount": 10000000
5
}
Copied!

Prove Balance

This method proves that a wallet has at least a certain balance
Method: POST
Inputs (All are required):
  • address - The public address to prove has a certain balance.
  • signature - The signature.
Results:
  • amount - unsigned long long; The amount that the address has proven that it holds. Note the address can hold more than this amount, but not less than this amount.
1
$ curl -X POST https://api.xcash.foundation/v1/xcash/blockchain/unauthorized/address/prove/ -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"address":"XCA1a9usG2UKajV1Dqzp8fL1BbN3hzuaaJMYjCo7qDoC4C3Vvc5owiLAqKbVw2cRbwRqx3mgrau1Z7LkX6cxR2NC4ZmFBLe2Mf","signature": "ReserveProofV1a15005880f5f88b19fc88bdec29faaf57489ba85dd02d41ec87043a5eddf95a9"}'
2
{
3
"amount": 10000000
4
}
Copied!

Transaction History

This method gets the public transaction history of an address
Method: GET
Resources:
  • type - Required - "sender | receiver".
  • address - Required - The address.
Inputs: None.
Results:
An array of objects with the following structure:
  • tx - string; The tx.
  • key - string; The tx key.
  • sender - string; The sender.
  • receiver - string; The receiver.
  • amount - unsigned long long; The amount.
  • height - unsigned int; The block height.
  • time - unsigned int; The block timestamp.
1
$ curl -X GET https://api.xcash.foundation/v1/xcash/blockchain/unauthorized/address/history/sender/XCA1a9usG2UKajV1Dqzp8fL1BbN3hzuaaJMYjCo7qDoC4C3Vvc5owiLAqKbVw2cRbwRqx3mgrau1Z7LkX6cxR2NC4ZmFBLe2Mf/ -H 'Accept: application/json'
2
[
3
{
4
"tx": "0000000000000000000000000000000000000000000000000000000000000000",
5
"key": "0000000000000000000000000000000000000000000000000000000000000000",
6
"sender": "",
7
"receiver": "",
8
"amount": 0,
9
"height": 0,
10
"time":0
11
},
12
{
13
"tx": "0000000000000000000000000000000000000000000000000000000000000000",
14
"key": "0000000000000000000000000000000000000000000000000000000000000000",
15
"sender": "",
16
"receiver": "",
17
"amount": 0,
18
"height": 0,
19
"time":0
20
}
21
]
Copied!

Validate Address

This method validates an address
Method: GET
Resources:
  • address - Required - The address.
Inputs: None.
Results:
An array of objects with the following structure:
  • valid - bool; The validation status.
1
$ curl -X GET https://api.xcash.foundation/v1/xcash/blockchain/unauthorized/address/validate/XCA1a9usG2UKajV1Dqzp8fL1BbN3hzuaaJMYjCo7qDoC4C3Vvc5owiLAqKbVw2cRbwRqx3mgrau1Z7LkX6cxR2NC4ZmFBLe2Mf/ -H 'Accept: application/json'
2
{
3
"valid": true
4
}
Copied!

Create Integrated Address

This method creates an integrated address
Method: POST
Inputs:
  • address - Required - The public address.
  • paymentId - Not required - The payment id (either encrypted or long format).
Results:
  • integratedAddress - string; The integrated address
  • paymentId - string; The payment id
1
$ curl -X POST https://api.xcash.foundation/v1/xcash/blockchain/unauthorized/address/createIntegrated/ -H 'Accept: application/json' -H 'Content-Type: application/json' -d '{"address":"XCA1a9usG2UKajV1Dqzp8fL1BbN3hzuaaJMYjCo7qDoC4C3Vvc5owiLAqKbVw2cRbwRqx3mgrau1Z7LkX6cxR2NC4ZmFBLe2Mf","paymentId": "0000000000000000"}'
2
{
3
"integratedAddress": "XCB000000000000000000000000000",
4
"paymentId": "0000000000000000"
5
}
Copied!