Zen Protocol Documentation
WebsiteTelegramBlogForum
  • Zen Protocol Docs
  • Apps
    • Headless Full Node
      • Full Node NPM Package
      • Build from Source
      • CLI
      • API
        • Wallet
        • Contracts
        • General
        • Blockchain
        • AddressDB
      • Deploy
        • Systemd
        • Shell script
        • Docker
      • Technical Model
      • AddressDB
    • Wallet
      • Desktop Wallet
        • Installers
      • Web Wallet
        • Run Locally
      • Wallet User Guide
        • Connect a Wallet
          • Create a Wallet
          • Import a Wallet
          • Watch Mode
        • My Wallet
          • Navigation Bar
          • Portfolio
          • Receive
          • Send / Execute
          • Transaction History
        • Contracts
          • Active Contracts
          • Execute a Contract
            • Message Body Field
          • Extend a Contract
          • Activate a Contract
        • Voting
          • Common Goods Pool
            • Generating a Ballot ID
          • Governance
        • Signer
        • Settings
          • Account Settings
          • Node Connectivity
      • Deprecated Desktop Wallet
        • Executable Installers
        • Wallet Structure
          • Video Tutorials
    • Explorer
    • Zen.js
      • Payment Processing
    • Oracle
      • Oracle GUI
      • Oracle Service
      • Oracle's API
      • Deploy
        • Systemd
        • Docker
      • How the Oracle contract works
      • How to create an Attestation token
    • Dex
      • Dex User Guide
        • Traded Pairs
        • Search Pairs
        • Order Book
        • Operations
        • My Wallet
        • Settings
      • How DEX contract works
    • Fixed Payout
      • Fixed Payout Generator User Guide
        • Issue
        • Redeem
        • Cancel
        • Verify
        • Settings
      • How the FP Contract works
      • How are the asset named?
  • Smart Contracts
  • Contract Structure
  • Contract Cost
  • Contract Activation
  • Contract Examples
  • Smart Contracts SDK
  • Contracts Language ZF*
  • Named Token Tutorial
  • Consensus
  • Common Goods Pool
  • Block Validation
  • Transaction Validation
  • Serialization
  • Use Cases
    • Create Unsigned Transaction
    • Secure Sign Transaction
    • Cold Storage using Full Node
  • Troubleshooting
    • Responsible Disclosure
    • Bug Bounty
    • Known Bugs
  • For Miners
    • Pools
    • GPU Mining
    • GPU Bounties
  • Check Crowdsale Contribution
  • Alpha call option
Powered by GitBook
On this page
  • Wallet Exists?
  • Public Address
  • Asset Balances
  • Received by address
  • Address Output
  • Address Balance
  • Remove Wallet
  • Zen Public Key (XPUB)
  • Resync
  • Transaction Count
  • Transaction History
  • Import Wallet
  • Public Key
  • Send Transaction
  • Sign
  • Check Password
  • Retrive Mnemonic Phrase
  • Create Hex Transaction
  • Create raw transaction
  • Sign Raw Transaction
  • Get Wallet Keys
  • Publish Raw Transaction
  • Import watchonly address
  • Get new address
  • Restore new address
  • Import Zen Public Key
  • Execute Contract
  • Activate Contract
  • Extend Contract
  • Execute CGP Contract
  1. Apps
  2. Headless Full Node
  3. API

Wallet

All of the wallet end points

Wallet Exists?

GET http://127.0.0.1:31567/wallet/exists

Check if wallet has already been created / imported. Used for building a rich wallet client UI.

true

Public Address

GET http://127.0.0.1:31567/wallet/address

Fetch your public key

"tp1q7n4l3dldcv69wfyqm32mpkwvf56q5kjdv7ma5p2668z05ljcv2gsq3ke4q"

Asset Balances

GET http://127.0.0.1:31567/wallet/balance

[
    {
        "asset": "asset",
        "balance": 2147483649
    }
]

Received by address

GET http://127.0.0.1:31567/wallet/receivedbyaddress

Transaction received by address

[
    {
        "address": "tzn1q7fnh47xftwr2zpxtpxepf022l9u5k0kusahactcn099vlumxy58s4kzzx6",
        "asset": "00",
        "amount": "417971197827512"
    }
]

Address Output

GET http://127.0.0.1:31567/wallet/addressoutputs

Query Parameters

Name
Type
Description

address*

string

[
    {
        "outpoint": {
            "txHash": "004ea75d74f2e3ac34634b43c979092b8eb04f9de544b905e5cb8ae8b316b120",
            "index": 2
        },
        "asset": "00",
        "amount": "187500000",
        "confirmations": 266423,
        "spent": true
    }
]
address is missing

Address Balance

GET http://127.0.0.1:31567/wallet/addressbalance

Path Parameters

Name
Type
Description

address*

string

Address you want to check the balance of

[
    {
        "outpoint": {
            "txHash": "004ea75d74f2e3ac34634b43c979092b8eb04f9de544b905e5cb8ae8b316b120",
            "index": 2
        },
        "asset": "00",
        "amount": "187500000",
        "confirmations": 266423,
        "spent": true
    },
    {
        "outpoint": {
            "txHash": "0052a006747ec056de0bf3bc044983a370d6ff5aa4659ebbbe45e03633d21843",
            "index": 2
        },
        "asset": "00",
        "amount": "1000000000",
        "confirmations": 380819,
        "spent": true
    }
]

address is missing

Remove Wallet

GET http://127.0.0.1:31567/wallet/remove

Remove wallet

Request Body

Name
Type
Description

password

string

wallet password

Zen Public Key (XPUB)

GET http://127.0.0.1:31567/wallet/zenpublickey

Return the Zen public key (XPUB)

tpubDDBhhX7DRpypAPZZhVMEtnyzJJrCRgQGSzNwgpqxTxXHdvedtkE2pjjVbY5NHvY6FLL2c8mzQcQnxK4s4pjt5BS6cBUHvan5y6NRtHft2tp

Resync

GET http://127.0.0.1:31567/wallet/resync

Transaction Count

GET http://127.0.0.1:31567/wallet/transactioncount

Get transaction count (used for pagination)

Path Parameters

Name
Type
Description

string

25

Transaction History

GET http://127.0.0.1:31567/wallet/transactions

Retreive the transaction history

Request Body

Name
Type
Description

take

number

skip

number

[
    {
        "txHash": "txHash",
        "asset": "00",
        "amount": 0,
        "confirmations": "someConfrimation"
    }
]
Invalid input

Import Wallet

POST http://127.0.0.1:31567/wallet/import

Path Parameters

Name
Type
Description

words

array

A list of 12 or 24 bip39 compliant words

Request Body

Name
Type
Description

password

string

A password to encrypt your mnemonic phrase

Public Key

POST http://127.0.0.1:31567/wallet/publickey

Get the public key paired with the path

Request Body

Name
Type
Description

password

string

wallet password

path

string

bit44 derivative path

0278e2befe3063f02b01d1f7c08abae7d0669b58be6691baac94e67ad52c540f22

Send Transaction

POST http://127.0.0.1:31567/wallet/send

Send a transaction to another regular wallet address

Request Body

Name
Type
Description

output

string

compose of address, asset and amount

password

string

1234

4f49f18a0575e701661d95cd221feb4399dc25e6f8230d37c4e2860cbd248fb9

Sign

POST http://127.0.0.1:31567/wallet/sign

Path Parameters

Name
Type
Description

password

string

wallet password

message

string

txhash

path

string

bit44 derivative path

fcea0b7537c68117144dd95a801bbb9a2e2628463abd0eaf7e0eed2f5cc48e0219cb883ae22b9117d2a661f61a6a6b5612087fe19afa4576eff7c5fc62e2cdfb

Check Password

POST http://127.0.0.1:31567/wallet/checkpassword

Path Parameters

Name
Type
Description

password

string

wallet password

true

Retrive Mnemonic Phrase

POST http://127.0.0.1:31567/wallet/mnemonicphrase

Path Parameters

Name
Type
Description

password

string

wallet password

child brain left age apart couch napkin balcony lobster retreat situate retreat capital judge arch between cart puzzle truly note abuse violin spell fashion

Create Hex Transaction

POST http://127.0.0.1:31567/wallet/createrawtransaction

Create a hex transaction

Request Body

Name
Type
Description

password

string

wallet password

output

array

composed of address asset and amount

0000000001014f49f18a0575e701661d95cd221feb4399dc25e6f8230d37c4e2860cbd248fb901020220afea2e549bc52e05673396161e175ba8b5d9afca75c658ec3c4739fc4feeca020000370220ecc94205df8142d81f469eb7c62db9b65f58a3e186250908ec855a32c5d1b466007e0001740ca8163200010162010360c63d3a8228f6ba18f10b487bc1e2526479db65b866cd408c9c6f2fe1e423cb2c0e82ef5cf046ad5c814e5404ad7fe2b7edfd76d0cb359a484ddda8e7ca9fd1356150ef28a1d2fc59115510fd38c5125f17f12b80661b168bf342e181df4810

Create raw transaction

POST http://127.0.0.1:31567/wallet/rawtransaction/create

Create an unsigned raw transaction

Path Parameters

Name
Type
Description

outputs*

string

composed of address asset and amount

{
    "txHash": "87f899d158c39c15c73d97126982c735a24cca743a180c5555b104634c0d384c",
    "tx": "000000000101e003c9e673c3e386f40cd06c1d4e9f1ddebaa701393729a94a4ebb62e5e43e3301020220afea2e549bc52e05673396161e175ba8b5d9afca75c658ec3c4739fc4feeca02000037022072a6aa805930d89ba685c7919812209de5bdd9d3c4fb86903930286283db9ced007e000001bef88776000101340103cca577d0e3e738dcd5f90dd7bd76283365498e28455d6aa1e933c0ed5926768c116d2f3434272f323538272f30272f312f30"
}

Sign Raw Transaction

POST http://127.0.0.1:31567/wallet/rawtransaction/sign

Receive a raw transaction and sign it

Request Body

Name
Type
Description

password*

string

wallet password

tx*

string

tx transaction in hex format

{
    "txHash": "87f899d158c39c15c73d97126982c735a24cca743a180c5555b104634c0d384c",
    "tx": "000000000101e003c9e673c3e386f40cd06c1d4e9f1ddebaa701393729a94a4ebb62e5e43e3301020220afea2e549bc52e05673396161e175ba8b5d9afca75c658ec3c4739fc4feeca02000037022072a6aa805930d89ba685c7919812209de5bdd9d3c4fb86903930286283db9ced007e000001bef887760001006401620103cca577d0e3e738dcd5f90dd7bd76283365498e28455d6aa1e933c0ed5926768c5f54068fc75add5135f9a52b965831650912b0ea40ca82d5697ebe4ae01bde1f18851a491fb477014ed29aa5a667da8ed669006806daa416d9492b23348c8de5"
}

Get Wallet Keys

POST http://127.0.0.1:31567/wallet/keys

Get imported public keys

Path Parameters

Name
Type
Description

password

string

wallet password

[
    {
        "publicKey": string,
        "path": "m/44'/258'/0'/1/0"
    }
]

Publish Raw Transaction

POST http://127.0.0.1:31567/wallet/rawtransaction/publish

Parse a transaction from raw, verify that is fully signed and then publish the transaction

Request Body

Name
Type
Description

tx*

string

signed tx in hex format

"87f899d158c39c15c73d97126982c735a24cca743a180c5555b104634c0d384c"

Import watchonly address

POST http://127.0.0.1:31567/wallet/importwatchonlyaddress

Request Body

Name
Type
Description

address

string

Address to add as watchonly

added
Address already exist

Get new address

POST http://127.0.0.1:31567/wallet/getnewaddress

Get a new address

{
    "address": "tzn1qjcvncgt9lgs55983sz3a9ns8jhq3ukua747a7f7c87japw964usslwtgs6",
    "index": 0
}

Restore new address

POST http://127.0.0.1:31567/wallet/restorenewaddresses

Request Body

Name
Type
Description

max*

number

Import Zen Public Key

POST http://127.0.0.1:31567/wallet/importzenpublickey

Import Zen Public Key

Request Body

Name
Type
Description

publicKey

string

public key

zenKey imported 

Execute Contract

POST http://127.0.0.1:31567/wallet/contract/execute

Run a smart contract with parameters

Request Body

Name
Type
Description

sign*

string

path

password*

string

wallet password

returnAddress*

boolean

Execute the contract with some default arguments, such as: - returnAddress - allows the contract to automatically send funds back to in case it needs to. { "returnAddress" : true/false }

message

string

send the contract some data

contractId*

string

The contract address

command*

string

Trigger one of the functions in the contract such as: "buy" / "redeem"

spends*

array

an array of outputs

daed7567b6a1bbcc20b996625fd81384727daf100b794b75726f5d3dd0ce9b5c

Activate Contract

POST http://127.0.0.1:31567/wallet/contract/activate

This how you activate a contract

Request Body

Name
Type
Description

rlimit

string

zebra's rlimit for recording hints

password

string

wallet password

numberOfBlocks

number

The number of blocks you want to activate your contract for

code

string

Send valid fstar code, for example: let main _ _ _ _ _ _ _ _ = Zen.ResultT.failw \"This contract does nothing\"\nlet cf _ _ _ _ _ _ _ = Zen.Cost.ret (1 <: nat)

{
    "address": "ctzn1qqqqqqqym4kfe8y5qg5tazkgjwn4qpesj05x6mqsvd5auwmzkhhs444fnkvwxhahr",
    "contractId": "000000009bad939392804517d1591274ea00e6127d0dad820c6d3bc76c56bde15ad533b3"
}

Extend Contract

POST http://127.0.0.1:31567/wallet/contract/extend

This is to extend a contract

Request Body

Name
Type
Description

password*

string

wallet password

numberOfBlocks*

string

Number of block until when the contract will be active

address*

string

address of the contract

{
    "address": "ctzn1qqqqqqq8gjuu8rz5q9f7jz72p3qh0arjctcstyzgp8ydux7hjt7kz7gkg4v5lec88",
    "contractId": "00000000e89738718a802a7d217941882efe8e585e20b20901391bc37af25fac2f22c8ab",
    "txHash": "725bc205c88944e2b0cbdd5150027511cf91c9d6c0f103a31e61a9c8c6589c5d",
    "numberOfBlocks": "10"
}

Execute CGP Contract

POST http://127.0.0.1:31567/wallet/contract/cgp

Execute the CGP contract at the payout block

Request Body

Name
Type
Description

password

string

wallet password

6bde92400f3ffb52980e22bb821f385b0bf5d710c8c65ff056287521b3b005be
PreviousAPINextContracts

Last updated 1 year ago