obyte.js
GitHubDiscord
0.1.19
0.1.19
  • Obyte.js
  • Getting started
    • Quick start
    • Testnet
  • 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
    • Get data feed
    • Autonomous Agents
      • Dry run AA
      • Get AA state vars
      • Get AAs by base AAs
      • Get AA responses
      • Get AA response chain
      • Execute AA getter
    • 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
    • Multi
  • Client
    • Subscribe
    • Just saying
    • Requests
  • Utils
    • Sign a message
    • Validate signed message
    • Generate a random address
    • Get definition address
    • Is valid address
    • Keep connection alive
  • About
    • About
    • Links
    • Tutorials
Powered by GitBook
On this page
  • Example
  • Returns
  • Learn more
  1. Utils

Get definition address

Generate address from a definition (or smart contract).

PreviousGenerate a random addressNextIs valid address

Last updated 6 years ago

Example

const { getChash160 } = require('obyte/lib/utils');

const definition = ['and', [
    ["address", "TMWNLXR42CKIP4A774BQGNVBZAPHY7GH"],
    ["in data feed", [["BVVJ2K7ENPZZ3VYZFWQWK7ISPCATFIW3"], "timestamp", ">", 1525593731872]]
]];

const address = getChash160(definition);
console.log(address);

Returns

ETARZZW2G3R3KT4UZKMQUXMWKRZMY7RQ

Learn more

  • "21. Addresses" (page 23)

  • "Smart contracts"

https://obyte.org/Byteball.pdf
https://github.com/byteball/ocore/wiki/Smart-contracts