Account Control

From Nxtwiki
Jump to: navigation, search

Get All Phasing Only Controls

Retrieve all accounts subject to phasing control with their respective restrictions.

Request:

  • requestType is getAllPhasingOnlyControls
  • firstIndex is a zero-based index to the first block ID to retrieve (optional)
  • lastIndex is a zero-based index to the last block ID to retrieve (optional)
  • requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
  • requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)

Response:

  • phasingOnlyControls (A) is an array with phasing only controls objects (Refer to Get Phasing Only Control for details)
  • requestProcessingTime (N) is the API request processing time (in millisec)

Get All Phasing Only Controls Example

http://localhost:7876/nxt?
  requestType=getAllPhasingOnlyControls&
  firstIndex=0&
  lastIndex=1
{
 "phasingOnlyControls": [
  {
   "minDuration": 0,
   "votingModel": 0,
   "minBalance": "0",
   "accountRS": "NXT-AVGK-SKJZ-583G-A689A",
   "quorum": "2",
   "maxFees": "0",
   "whitelist": [
    {
     "whitelistedRS": "NXT-EVHD-5FLM-3NMQ-G46NR",
     "whitelisted": "16992224448242675179"
    },
    {
     "whitelistedRS": "NXT-XK4R-7VJU-6EQG-7R335",
     "whitelisted": "5873880488492319831"
    },
    {
     "whitelistedRS": "NXT-SZKV-J8TH-GSM9-9LKV6",
     "whitelisted": "8245583500397018683"
    }
   ],
   "minBalanceModel": 0,
   "account": "9519700060090428881",
   "maxDuration": 0
  },
  {
   "minDuration": 10,
   "votingModel": 0,
   "minBalance": "0",
   "accountRS": "NXT-VSTJ-MHZK-A6N3-CHRRH",
   "quorum": "1",
   "maxFees": "1000000000",
   "whitelist": [
    {
     "whitelistedRS": "NXT-D5A2-7CCE-G35P-BB324",
     "whitelisted": "10448396398360890624"
    },
    {
     "whitelistedRS": "NXT-KGPY-DF8U-HSF9-GQ69A",
     "whitelisted": "16437178058884561598"
    }
   ],
   "minBalanceModel": 0,
   "account": "12096369102442849072",
   "maxDuration": 100
  }
 ],
 "requestProcessingTime": 0
}


Get Phasing Only Control

Retrieve phasing control with their respective restrictions for a specific account.

Request:

  • requestType is getPhasingOnlyControl
  • account is the account ID
  • requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
  • requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)

Response:

  • account (S) is the account number
  • accountRS (S) is the Reed-Solomon address of the account
  • quorum (S) is the minimum number of votes needed to approve the transaction
  • whitelist (A) is an array with the whitelisted accounts including the fields:
    • whitelisted (S) is the account number
    • whitelistedRS (S) is the Reed-Solomon address of the account
  • maxFees (S) is the maximum fees the account can spend per block
  • minDuration (N) is the minimum duration of the phasing period
  • maxDuration (N) is the maximum duration of the phasing period
  • votingModel (N) is an integer code for the method of approval
  • minBalance (S) is the minimum balance (in NQT or QNT) required for voting
  • minBalanceModel (N) is the minimum balance model
  • holding (S) is the asset or currency ID (only included if holding != 0)
  • requestProcessingTime (N) is the API request processing time (in millisec)

Get Phasing Only Control Example

http://localhost:7876/nxt?
  requestType=getPhasingOnlyControl&
  account=NXT-AVGK-SKJZ-583G-A689A
{
 "minDuration": 0,
 "votingModel": 0,
 "minBalance": "0",
 "accountRS": "NXT-AVGK-SKJZ-583G-A689A",
 "quorum": "2",
 "maxFees": "0",
 "whitelist": [
  {
   "whitelistedRS": "NXT-EVHD-5FLM-3NMQ-G46NR",
   "whitelisted": "16992224448242675179"
  },
  {
   "whitelistedRS": "NXT-XK4R-7VJU-6EQG-7R335",
   "whitelisted": "5873880488492319831"
  },
  {
   "whitelistedRS": "NXT-SZKV-J8TH-GSM9-9LKV6",
   "whitelisted": "8245583500397018683"
  }
 ],
 "requestProcessingTime": 1,
 "minBalanceModel": 0,
 "account": "9519700060090428881",
 "maxDuration": 0
}


Set Phasing Only Control

Sets (or removes) phasing control for a specific account. POST only.

Request: Refer to Create Transaction Request for common parameters.

  • requestType is setPhasingOnlyControl
  • controlVotingModel is the voting model or -1 to remove phasing control
  • controlQuorum is the expected quorum (optional)
  • controlMinBalance is the expected minimum balance (optional)
  • controlMinBalanceModel is the expected minimum balance model (optional)
  • controlHolding is the holding ID (optional)
  • controlWhitelisted is the whitelisted accounts (optional, multiple values)
  • controlWhitelisted is the whitelisted accounts (optional, multiple values)

  • controlMaxFees is the maximum allowed accumulated total fees for not yet finished phased transactions (optional)
  • controlMinDuration is the minimum duration in block height (optional)
  • controlMaxDuration is the maximum phasing duration in block height (optional)

Response: Refer to Create Transaction Response.

Set Phasing Only Control Example

http://localhost:7876/nxt?
 requestType=setPhasingOnlyControl&
 controlVotingModel=0&
 controlQuorum=1&
 controlWhitelisted=NXT-5MYN-AP7M-NKMH-CRQJZ&
 secretPhrase=IWontTellYou&
 feeNQT=100000000&
 deadline=60
{
 "signatureHash": "bbb24087ab3639f508da77413a63ed8c45431ec9b7f0413fd574faea0de7e70a",
 "transactionJSON": {
  "senderPublicKey": "373522bcd8904f4707472e590cbb67976d40e7af39650ea11cb2be5734cdf30c",
  "signature": "eacaf3dc98c0e2ddc1b7b546209cecf092f16bb9e2fe9fd09760fb5815573f063...",
  "feeNQT": "100000000",
  "type": 4,
  "fullHash": "b6b7ac7a29f9f638244f1025c39199e8b5f8f7c5415f77ef0ca95c0f206e1e2d",
  "version": 1,
  "phased": false,
  "ecBlockId": "12092908062633562059",
  "signatureHash": "bbb24087ab3639f508da77413a63ed8c45431ec9b7f0413fd574faea0de7e70a",
  "attachment": {
   "version.SetPhasingOnly": 1,
   "controlMaxFees": "0",
   "controlMinDuration": 0,
   "controlMaxDuration": 0,
   "phasingControlParams": {
    "phasingHolding": "0",
    "phasingQuorum": 1,
    "phasingWhitelist": [
     "12664921794733526996"
    ],
    "phasingMinBalance": 0,
    "phasingMinBalanceModel": 0,
    "phasingVotingModel": 0
   }
  },
  "senderRS": "NXT-7A48-47JL-T7LD-D5FS3",
  "subtype": 1,
  "amountNQT": "0",
  "sender": "12745647715474645062",
  "ecBlockHeight": 767270,
  "deadline": 60,
  "transaction": "4104742066941900726",
  "timestamp": 80779288,
  "height": 2147483647
 },
 "unsignedTransactionBytes": "04111898d0043c00373522bcd8904f4707472e590cbb67976d40e7af39650ea...",
 "broadcasted": true,
 "requestProcessingTime": 5,
 "transactionBytes": "04111898d0043c00373522bcd8904f4707472e590cbb67976d40e7af39650ea1...",
 "fullHash": "b6b7ac7a29f9f638244f1025c39199e8b5f8f7c5415f77ef0ca95c0f206e1e2d",
 "transaction": "4104742066941900726"
}