obyte.js
GitHubDiscord
0.1.5
0.1.5
  • Obyte.js
  • Getting started
    • Quick start
    • Testnet
  • Client
    • Subscribe
    • Just saying
  • API
    • Get witnesses
    • Get peers
    • Get joint
    • Get last MCI
    • Get history
    • Get attestation
    • Get attestations
    • Get bots
    • Get asset metadata
    • Get definition
    • Get balances
    • Get profile units
    • Core
      • Catchup
      • Get hash tree
      • Get light props
      • Post joint
      • Pick divisible coins for amount
      • Heartbeat
  • Post
    • Address definition change
    • Attestation
    • Asset
    • Asset attestors
    • Data
    • Data feed
    • Definition
    • Definition template
    • Payment
    • Poll
    • Vote
    • Profile
    • Text
  • Utils
    • Generate a random address
    • Get definition address
    • Is valid address
    • Keep connection alive
  • About
    • About
    • Links
    • Tutorials
Powered by GitBook
On this page
  • Arguments
  • Returns
  • Examples
  • Learn more
  1. Post

Payment

Arguments

  • asset string optional Hash of unit where the asset was defined.

  • outputs array required Outputs is an array of outputs that say who receives the money.

    • address string required The Byteball address of the recipient.

    • amount integrer required The amount he receives.

Returns

Returns the unit hash.

Examples

Spend bytes

const params = {
  outputs: [
    { address: 'NX2BTV43XN6BOTCYZUUFU6TK7DVOC4LU', amount: 1000 }
  ]
};

client.post.payment(params, wif, function(err, result) {
  console.log(result);
});

Send bytes to multiple recipients

const params = {
  outputs: [
    { address: 'NX2BTV43XN6BOTCYZUUFU6TK7DVOC4LU', amount: 1000 },
    { address: 'ULQA63NGEZACP4N7ZMBUBISH6ZTCUS2Q', amount: 2000 }
  ]
};

client.post.payment(params, wif, function(err, result) {
  console.log(result);
});

Spend asset

const params = {
  asset: 'Hh22Wmd+xAYhgjCBACAxKXWErh/zJuwGc2w2DCB9H24=',
  outputs: [
    { address: 'NX2BTV43XN6BOTCYZUUFU6TK7DVOC4LU', amount: 500 }
  ]
};

client.post.payment(params, wif, function(err, result) {
  console.log(result);
});

Learn more

PreviousDefinition templateNextPoll

Last updated 6 years ago

"12. Unit structure" (page 15)

https://obyte.org/Byteball.pdf