Skip to content

Frankenstein Testnet RPC (with EVM support) v0.18.11

manikanta472 edited this page Jan 23, 2022 · 1 revision

JSONRPC Backend

Services

  • broadcast
  • tx
  • query
  • owner
  • node
  • eth

//Request 
{
    "method": [Service Method],
    "params": [Parameter List ...],
    "id": [Caller ID],
    "jsonrpc": "2.0"
}
    
//Response
{
    "jsonrpc":"2.0", 
    "id": [Caller ID], 
    "result": [Method Response]
}

Broadcast [broadcast]

  • Used for broadcasting transactions to other nodes in the network

  • Each method requires:

    • rawTx
    • signature
    • publicKey
  • We authorize the broadcast to be sent in the following way:

    1. De-serialize the rawTx into action.BaseTx structure
    2. Validate whether the signer's address matches the public key
    3. Verify the signature of rawTx using the publicKey
    4. Iff ii. & iii. are true, then add Signer properties to action.baseTx and proceed to broadcast. If any of the above fails, abort broadcasting procedure.

Methods:

broadcast.TxAsync

  • Fastest method, returns almost instantly with the hash
  • Does not guarantee the transaction has entered the Mempool

broadcast.TxSync

  • Returns when the transaction enters the Mempool

broadcast.TxCommit

  • Waits until the transaction to be committed is committed to the block. Does not guarantee a return if the transaction fails

//Parameter List
{
    "rawTx": [Transaction to broadcast]
    "signature": [Signature of transaction]
    "publidKey": [Public key of the signer]
}
//Response
{
    "txHash": [Hash of the transaction]
    "ok": [Broadcast Status]
    "height": [Current Block height]
    "log": [Log message]
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "publicKey":{
            "keyType":"ed25519",
            "data":"e6xQKafqtPNfE45cBOk8LIgRwdp+YatREMej3g9yUgU="
        },
        "rawTx":"eyJ0eXBlIjozNiwiZGF0YSI6ImV5SnVZVzFsSWpvaVltOWlNaTV2YkNJc0ltSjFlV1Z5SWpvaU1HeDBOVFk1T1RsaU1XWXhNRFF5WkRJMU5UZG1ObU5pTkRJM09UbGxNR05rTVdFME0ySmxORFF4TlNJc0ltRmpZMjkxYm5RaU9pSXdiSFExTmprNU9XSXhaakV3TkRKa01qVTFOMlkyWTJJME1qYzVPV1V3WTJReFlUUXpZbVUwTkRFMUlpd2liMlptWlhKcGJtY2lPbnNpWTNWeWNtVnVZM2tpT2lKUFRGUWlMQ0oyWVd4MVpTSTZJakl3TURBd01EQXdNREF3TURBd01EQXdNREF3SW4xOSIsImZlZSI6eyJwcmljZSI6eyJjdXJyZW5jeSI6Ik9MVCIsInZhbHVlIjoiMTAwMDAwMDAwMCJ9LCJnYXMiOjQwMDAwfSwibWVtbyI6ImFjYjg2OTM5LTg4YmMtMTFlYS04ZDdhLWRjZmI0ODE0NTY5MCJ9",
        "signature":"RNic9hIKsTTGKobj+g3r4OHErlHBa9rhvavYHLxV13jAyTr68tOJX6LRYIAHUoFJn4beYEESFiZo3xYSazDFDA=="
    },
    "method":"broadcast.TxCommit",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "txHash":"0lt58d85c7b6078cb9e8c748f13740313668a182571eb83f9763fefe616567ea676",
        "ok":true,
        "height":22,
        "log":""
    }
}

Transaction [tx]

  • Public service for building and retrieving raw transactions which a user can sign locally on their end.
  • Each method returns a rawTx that can be signed by the user.

Methods:

tx.CreateRawSend

  • Creates a transaction that will allow the user to send funds from one address to another.

//Parameter List
{     
    "from":[From Address]
    "to":[To Address]
    "amount":[Amount]
    "gasPrice":[Gas Price]
    "gas":[Gas Limit]
    "data":[Bytecode]
    "nonce":[Address Nonce]
}
//Response
{
    "rawTx":[Raw Send Transaction (Base64 encoded)]
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "from":"0lt7065363c3a4cb58ddfb7f5d12d501a8b6758ed44",
        "to":"0ltea0bf7a235ae8776879bd66ca80f98e2695eb84b",
        "amount":{
            "currency":"OLT",
            "value":"1002345000000000000000"
        },
        "gas":40000,        
        "gasPrice":{
            "currency":"OLT",
            "value":"1000000000"
        }
    },
    "method":"tx.CreateRawSend",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "rawTx":"eyJ0eXBlIjozMywiZGF0YSI6ImV5SnZkMjVsY2lJNklqQnNkQ0lzSW1GalkyOTFiblFpT2lJd2JIUWlMQ0p1WVcxbElqb2lJaXdpZFhKcElqb2lJaXdpWW5WNWFXNW5VSEpwWTJVaU9uc2lZM1Z5Y21WdVkza2lPaUlpTENKMllXeDFaU0k2SWpBaWZYMD0iLCJmZWUiOnsicHJpY2UiOnsiY3VycmVuY3kiOiJPTFQiLCJ2YWx1ZSI6IjEwMDAwMDAwMDAifSwiZ2FzIjo0MDAwMDB9LCJtZW1vIjoiZWUzZTllNGMtODhiMS0xMWVhLWI2NWYtZGNmYjQ4MTQ1NjkwIn0="
    }
}

Sample smart contract deploy request
{
    "jsonrpc":"2.0",
    "params":{
        "from":"0lt7065363c3a4cb58ddfb7f5d12d501a8b6758ed44",
        "to":"",  // skipping to create a contract with vm bytecode
        "amount":{
            "currency":"OLT",
            "value":"1002345000000000000000"
        },
        "data": "[base64 encoded vm data]" // example base64("608060405234801561001057600080fd5b50610233806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80635f76f6ab146100465780636d4ce63c14610076578063cbed952214610096575b600080fd5b6100746004803603602081101561005c57600080fd5b810190808035151590602001909291905050506100a0565b005b61007e61013c565b60405180821515815260200191505060405180910390f35b61009e61018f565b005b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167fab77f9000c19702a713e62164a239e3764dde2ba5265c7551f9a49e0d304530d60405160405180910390a250565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905090565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f68656c6c6f00000000000000000000000000000000000000000000000000000081525060200191505060405180910390fdfea26469706673582212206872039b48bb16fb8cbf559a2e127d91b0af06f0d2d36b97faad6d0f9c335e7864736f6c63430007040033"),
        "nonce": 1, // query.EVMAccount
        "gas":40000,        
        "gasPrice":{
            "currency":"OLT",
            "value":"1000000000"
        }
    },
    "method":"tx.CreateRawSend",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "rawTx":"eyJ0eXBlIjozMywiZGF0YSI6ImV5SnZkMjVsY2lJNklqQnNkQ0lzSW1GalkyOTFiblFpT2lJd2JIUWlMQ0p1WVcxbElqb2lJaXdpZFhKcElqb2lJaXdpWW5WNWFXNW5VSEpwWTJVaU9uc2lZM1Z5Y21WdVkza2lPaUlpTENKMllXeDFaU0k2SWpBaWZYMD0iLCJmZWUiOnsicHJpY2UiOnsiY3VycmVuY3kiOiJPTFQiLCJ2YWx1ZSI6IjEwMDAwMDAwMDAifSwiZ2FzIjo0MDAwMDB9LCJtZW1vIjoiZWUzZTllNGMtODhiMS0xMWVhLWI2NWYtZGNmYjQ4MTQ1NjkwIn0="
    }
}

tx.ApplyValidator

  • Creates a transaction allowing the user's node to apply to become a validator.
  • User needs to provide a staking address and an amount to contribute.

//Parameter List
{
    "address":[Address to get staking amount from as well as fee payment]
    "name":[Name of node]
    "amount":[Amount to stake (VT)]
    "purge":[Flag to remove validator]
    "tmPubKeyType":[Public key type of validator node]
    "tmPubKey":[Public key of validator node base64 encoded]
    "gasPrice":[Gas Price]
    "gas":[Gas Limit]
}
//Response
{
    "rawTx":[Raw Transaction (Base64 encoded)]
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "name":"validator1",
        "tmPubKeyType":"ed25519",
        "tmPubKey":"kA5r3kCZAj6IxpwnMMZOP5SY5by+M1Dr/VMNQvfj8bI=",
        "gas":400000,
        "amount":"10",
        "address":"0lt7065363c3a4cb58ddfb7f5d12d501a8b6758ed44",
        "gasprice":{
            "currency":"OLT",
            "value":"1000000000"
        }
    },
    "method":"tx.ApplyValidator",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "rawTx":"eyJ0eXBlIjoxNywiZGF0YSI6ImV5SlRkR0ZyWlVGa1pISmxjM01pT2lJd2JIUTNNRFkxTXpZell6TmhOR05pTlRoa1pHWmlOMlkxWkRFeVpEVXdNV0U0WWpZM05UaGxaRFEwSWl3aVUzUmhhMlVpT25zaVkzVnljbVZ1WTNraU9pSldWQ0lzSW5aaGJIVmxJam9pTVRBaWZTd2lUbTlrWlU1aGJXVWlPaUoyWVd4cFpHRjBiM0l4SWl3aVZtRnNhV1JoZEc5eVFXUmtjbVZ6Y3lJNklqQnNkREpoTW1KbVpqWmhPVFZsWTJJd05qUmlPRGxoWmpVNVltRXdabVkzT0RRMk5XUmlObUZtWmpNaUxDSldZV3hwWkdGMGIzSlFkV0pMWlhraU9uc2lhMlY1Vkhsd1pTSTZJbVZrTWpVMU1Ua2lMQ0prWVhSaElqb2lhMEUxY2pOclExcEJhalpKZUhCM2JrMU5XazlRTlZOWk5XSjVLMDB4UkhJdlZrMU9VWFptYWpoaVNUMGlmU3dpVm1Gc2FXUmhkRzl5UlVORVUwRlFkV0pMWlhraU9uc2lhMlY1Vkhsd1pTSTZJbk5sWTNBeU5UWnJNU0lzSW1SaGRHRWlPaUkyTVhKd2FIbEZSRVZLZGxKRmVXOTRlbXM0TlM5V1VqSTVTbXB0Y0c5eVFWWlBTR3huU1UxNFRuTjRUWFZ2TDNkMFFXczlJbjBzSWxCMWNtZGxJanBtWVd4elpYMD0iLCJmZWUiOnsicHJpY2UiOnsiY3VycmVuY3kiOiJPTFQiLCJ2YWx1ZSI6IjEwMDAwMDAwMDAifSwiZ2FzIjoxMDAwMDB9LCJtZW1vIjoiZjBhNTczN2MtODhiNC0xMWVhLWI2NWYtZGNmYjQ4MTQ1NjkwIiwic2lnbmF0dXJlcyI6W3siU2lnbmVyIjp7ImtleVR5cGUiOiJlZDI1NTE5IiwiZGF0YSI6Ik9uUkV1VWh3ajZnL2huVU4wOXZLd2VBdFArTmptQWhOL2tqREJKZ0FhMFk9In0sIlNpZ25lZCI6InhGNEh6ZTY0dXZFaFhlb1B3bVhoRGR5OStYbStMSWRyNVU4Ly9CMDlQWC8vaHpMY04xQXR3MVl6bVZnV2FIeDJXK1dsOGcvZVp1SjI2T1VVLzJRTkNnPT0ifV19"
    }
}

tx.WithdrawReward

  • Creates a transaction to withdraw any of the block rewards accumulated by a given validator.
  • User needs to provide an address for the rewards to be sent to.

//Parameter List
{
    "from":[Address of validator node]
    "to":[Address rewards are sent to]
    "gasPrice":[Gas Price]
    "gas":[Gas Limit]
}
//Response
{
    "rawTx":[Raw Transaction (Base64 encoded)]
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "gas":400000,
        "from":"0lt7065363c3a4cb58ddfb7f5d12d501a8b6758ed44",
        "to":"0ltea0bf7a235ae8776879bd66ca80f98e2695eb84b",
        "gasprice":{
            "currency":"OLT",
            "value":"1000000000"
        }
    },
    "method":"tx.WithdrawReward",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "rawTx":"eyJ0eXBlIjoxOCwiZGF0YSI6ImV5Sm1jbTl0SWpvaU1HeDBOekEyTlRNMk0yTXpZVFJqWWpVNFpHUm1ZamRtTldReE1tUTFNREZoT0dJMk56VTRaV1EwTkNJc0luUnZJam9pTUd4MFpXRXdZbVkzWVRJek5XRmxPRGMzTmpnM09XSmtOalpqWVRnd1pqazRaVEkyT1RWbFlqZzBZaUo5IiwiZmVlIjp7InByaWNlIjp7ImN1cnJlbmN5IjoiT0xUIiwidmFsdWUiOiIxMDAwMDAwMDAwIn0sImdhcyI6NDAwMDAwfSwibWVtbyI6ImYxZjE2ZWVmLTg4YjctMTFlYS1iNjVmLWRjZmI0ODE0NTY5MCJ9"
    }
}

tx.PurgeValidator

  • Creates a transaction to purge a validator from the network.
  • This transaction can only be sent by an administrator.

//Parameter List
{
    "admin":[Admin Address]
    "validator":[Validator Address]
    "gasPrice":[Gas Price]
    "gas":[Gas Limit]
}
//Response
{
    "rawTx":[Raw Transaction (Base64 encoded)]
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "admin":"0lt7065363c3a4cb58ddfb7f5d12d501a8b6758ed44",
        "validator":"0ltea0bf7a235ae8776879bd66ca80f98e2695eb84b",
        "gas":400000,
        "gasprice":{
            "currency":"OLT",
            "value":"1000000000"
        }
    },
    "method":"tx.PurgeValidator",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "rawTx":"eyJ0eXBlIjoxOSwiZGF0YSI6ImV5SkJaRzFwYmtGa1pISmxjM01pT2lJd2JIUTNNRFkxTXpZell6TmhOR05pTlRoa1pHWmlOMlkxWkRFeVpEVXdNV0U0WWpZM05UaGxaRFEwSWl3aVZtRnNhV1JoZEc5eVFXUmtjbVZ6Y3lJNklqQnNkR1ZoTUdKbU4yRXlNelZoWlRnM056WTROemxpWkRZMlkyRTRNR1k1T0dVeU5qazFaV0k0TkdJaWZRPT0iLCJmZWUiOnsicHJpY2UiOnsiY3VycmVuY3kiOiJPTFQiLCJ2YWx1ZSI6IjEwMDAwMDAwMDAifSwiZ2FzIjo4MDAwMH0sIm1lbW8iOiI1NjM4ZmE3Ni04OGI5LTExZWEtYjY1Zi1kY2ZiNDgxNDU2OTAifQ=="
    }
}

ONS (Oneledger Name Service)

tx.ONS_CreateRawCreate

  • Creates a transaction that creates a new domain given a beneficiary address.
//Parameter List
{
    "owner":[Owner address of Domain]
    "account":[Beneficiary Account]
    "name":[Domain Name]
    "uri":[Optional link for domain]
    "buyingPrice":[Amount contributed to buying domain]
    "gasPrice":[Gas Price]
    "gas":[Gas Limit]
}
//Response
{
    "rawTx":[Raw Transaction base64 encoded]
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "account":"0lt7065363c3a4cb58ddfb7f5d12d501a8b6758ed44",
        "name":"alice.ol",
        "buyingPrice":{
            "currency":"OLT",
            "value":"1002345000000000000000"
        },
        "gas":40000,
        "owner":"0lt7065363c3a4cb58ddfb7f5d12d501a8b6758ed44",
        "gasPrice":{
            "currency":"OLT",
            "value":"1000000000"
        }
    },
    "method":"tx.ONS_CreateRawCreate",
    "id":123
}
Sample Reponse
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "rawTx":"eyJ0eXBlIjozMywiZGF0YSI6ImV5SnZkMjVsY2lJNklqQnNkRGN3TmpVek5qTmpNMkUwWTJJMU9HUmtabUkzWmpWa01USmtOVEF4WVRoaU5qYzFPR1ZrTkRRaUxDSmhZMk52ZFc1MElqb2lNR3gwTnpBMk5UTTJNMk16WVRSallqVTRaR1JtWWpkbU5XUXhNbVExTURGaE9HSTJOelU0WldRME5DSXNJbTVoYldVaU9pSmhiR2xqWlM1dmJDSXNJblZ5YVNJNklpSXNJbUoxZVdsdVoxQnlhV05sSWpwN0ltTjFjbkpsYm1ONUlqb2lUMHhVSWl3aWRtRnNkV1VpT2lJeE1EQXlNelExTURBd01EQXdNREF3TURBd01EQXdJbjE5IiwiZmVlIjp7InByaWNlIjp7ImN1cnJlbmN5IjoiT0xUIiwidmFsdWUiOiIxMDAwMDAwMDAwIn0sImdhcyI6NDAwMDB9LCJtZW1vIjoiOGRlODIwNGEtODgwYy0xMWVhLTljYTEtZGNmYjQ4MTQ1NjkwIn0="
    }
}

tx.ONS_CreateRawUpdate

  • Creates a transaction to update the domain specified.
//Parameter List
{
    "owner":[Owner address of Domain]
    "account":[Beneficiary Account]
    "name":[Domain Name]
    "active":[Domain Status]
    "uri":[Optional link for domain]
    "gasPrice":[Gas Price]
    "gas":[Gas Limit]
}
//Response
{
    "rawTx":[Raw Transaction base64 encoded]
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "account":"0ltea0bf7a235ae8776879bd66ca80f98e2695eb84b",
        "name":"alic.ol",
        "gas":400000,
        "active":true,
        "owner":"0ltea0bf7a235ae8776879bd66ca80f98e2695eb84b",
        "gasprice":{
            "currency":"OLT",
            "value":"1000000000"
        }
    },
    "method":"tx.ONS_CreateRawUpdate",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "rawTx":"eyJ0eXBlIjozNCwiZGF0YSI6ImV5SnZkMjVsY2lJNklqQnNkR1ZoTUdKbU4yRXlNelZoWlRnM056WTROemxpWkRZMlkyRTRNR1k1T0dVeU5qazFaV0k0TkdJaUxDSmlaVzVsWm1samFXRnllU0k2SWpCc2RHVmhNR0ptTjJFeU16VmhaVGczTnpZNE56bGlaRFkyWTJFNE1HWTVPR1V5TmprMVpXSTROR0lpTENKdVlXMWxJam9pWVd4cFl5NXZiQ0lzSW1GamRHbDJaU0k2ZEhKMVpTd2lkWEpwSWpvaUluMD0iLCJmZWUiOnsicHJpY2UiOnsiY3VycmVuY3kiOiJPTFQiLCJ2YWx1ZSI6IjEwMDAwMDAwMDAifSwiZ2FzIjo0MDAwMDB9LCJtZW1vIjoiZmYyMGQ2YzktODgxZi0xMWVhLWI0NzAtZGNmYjQ4MTQ1NjkwIn0="
    }
}

tx.ONS_CreateRawRenew

  • Creates a transaction to renew a domain by a certain number of blocks.
  • The number of blocks are determined by the amount of OLT contributed in the request.

//Parameter List
{
    "owner":[Owner address of Domain]
    "account":[Beneficiary Account]
    "name":[Domain Name]
    "buyingPrice":[Amount contributed to extending domain]
    "gasPrice":[Gas Price]
    "gas":[Gas Limit]
}
//Response
{
    "rawTx":[Raw Transaction base64 encoded]
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "account":"0lt59662ad64832effb72c457a53e926f70dfe96bbb",
        "name":"renewing.ol",
        "buyingprice":{
            "currency":"OLT",
            "value":"20000000000000000"
        },
        "gas":400000,
        "owner":"0lt59662ad64832effb72c457a53e926f70dfe96bbb",
        "gasprice":{
            "currency":"OLT",
            "value":"1000000000"
        }
    },
    "method":"tx.ONS_CreateRawRenew",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "rawTx":"eyJ0eXBlIjozOSwiZGF0YSI6ImV5SnZkMjVsY2lJNklqQnNkRFU1TmpZeVlXUTJORGd6TW1WbVptSTNNbU0wTlRkaE5UTmxPVEkyWmpjd1pHWmxPVFppWW1JaUxDSnVZVzFsSWpvaWNtVnVaWGRwYm1jdWIyd2lMQ0ppZFhscGJtZFFjbWxqWlNJNmV5SmpkWEp5Wlc1amVTSTZJazlNVkNJc0luWmhiSFZsSWpvaU1qQXdNREF3TURBd01EQXdNREF3TURBaWZYMD0iLCJmZWUiOnsicHJpY2UiOnsiY3VycmVuY3kiOiJPTFQiLCJ2YWx1ZSI6IjEwMDAwMDAwMDAifSwiZ2FzIjo0MDAwMDB9LCJtZW1vIjoiMzNmNGIyMzktODgyMS0xMWVhLWI2N2ItZGNmYjQ4MTQ1NjkwIn0="
    }
}

tx.ONS_CreateRawSale

  • Creates a transaction that changes the status of a domain to be "on sale".
  • Once the domain is put "on sale", other users will be allowed to purchase the domain.

//Parameter List
{
    "owner":[Owner address of Domain]
    "price":[Sale Price]
    "name":[Domain Name]
    "cancelSale":[Cancel Sale of Domain]
    "gasPrice":[Gas Price]
    "gas":[Gas Limit]
}
//Response
{
    "rawTx":[Raw Transaction base64 encoded]
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "name":"bob2.ol",
        "cancelSale":false,
        "price":{
            "currency":"OLT",
            "value":"10543200000000000000"
        },
        "gas":40000,
        "owner":"0lt491620c2e3981fad9157f82d5dbc41548d70ddee",
        "gasPrice":{
            "currency":"OLT",
            "value":"1000000000"
        }
    },
    "method":"tx.ONS_CreateRawSale",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "rawTx":"eyJ0eXBlIjozNSwiZGF0YSI6ImV5SnVZVzFsSWpvaVltOWlNaTV2YkNJc0ltOTNibVZ5UVdSa2NtVnpjeUk2SWpCc2REUTVNVFl5TUdNeVpUTTVPREZtWVdRNU1UVTNaamd5WkRWa1ltTTBNVFUwT0dRM01HUmtaV1VpTENKd2NtbGpaU0k2ZXlKamRYSnlaVzVqZVNJNklrOU1WQ0lzSW5aaGJIVmxJam9pTVRBMU5ETXlNREF3TURBd01EQXdNREF3TURBaWZTd2lZMkZ1WTJWc1UyRnNaU0k2Wm1Gc2MyVjkiLCJmZWUiOnsicHJpY2UiOnsiY3VycmVuY3kiOiJPTFQiLCJ2YWx1ZSI6IjEwMDAwMDAwMDAifSwiZ2FzIjo0MDAwMH0sIm1lbW8iOiIyZjliZjE4ZC04ODIyLTExZWEtYTAzYi1kY2ZiNDgxNDU2OTAifQ=="
    }
}

tx.ONS_CreateRawBuy

  • Creates a transaction that attempts to purchase the domain given in the request.

//Parameter List
{
    "buyer":[Address of buyer]
    "account":[Account of owner]
    "name":[Domain Name]
    "offering":[Amount offered for Domain]
    "gasPrice":[Gas Price]
    "gas":[Gas Limit]
}
//Response
{
    "rawTx":[Raw Transaction base64 encoded]
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "account":"0lt9b69e7bfe6f4af4057fc5ee90132eab973acabf0",
        "name":"bob2.ol",
        "offering":{
            "currency":"OLT",
            "value":"20000000000000000000"
        },
        "gas":40000,
        "buyer":"0lt9b69e7bfe6f4af4057fc5ee90132eab973acabf0",
        "gasPrice":{
            "currency":"OLT",
            "value":"1000000000"
        }
    },
    "method":"tx.ONS_CreateRawBuy",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "rawTx":"eyJ0eXBlIjozNiwiZGF0YSI6ImV5SnVZVzFsSWpvaVltOWlNaTV2YkNJc0ltSjFlV1Z5SWpvaU1HeDBPV0kyT1dVM1ltWmxObVkwWVdZME1EVTNabU0xWldVNU1ERXpNbVZoWWprM00yRmpZV0ptTUNJc0ltRmpZMjkxYm5RaU9pSXdiSFE1WWpZNVpUZGlabVUyWmpSaFpqUXdOVGRtWXpWbFpUa3dNVE15WldGaU9UY3pZV05oWW1Zd0lpd2liMlptWlhKcGJtY2lPbnNpWTNWeWNtVnVZM2tpT2lKUFRGUWlMQ0oyWVd4MVpTSTZJakl3TURBd01EQXdNREF3TURBd01EQXdNREF3SW4xOSIsImZlZSI6eyJwcmljZSI6eyJjdXJyZW5jeSI6Ik9MVCIsInZhbHVlIjoiMTAwMDAwMDAwMCJ9LCJnYXMiOjQwMDAwfSwibWVtbyI6Ijg4OTU3M2I5LTg4MjQtMTFlYS04Njc3LWRjZmI0ODE0NTY5MCJ9"
    }
}

tx.ONS_CreateRawSend

  • Creates a transaction that can send funds from an address to a particular domain.

//Parameter List
{
    "from":[From Address]
    "name":[Domain Name Sent to]
    "amount":[Amount Sent to Domain]
    "gasPrice":[Gas Price]
    "gas":[Gas Limit]
}
//Response
{
    "rawTx":[Raw Transaction base64 encoded]
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "gas":40000,
        "amount":{
            "currency":"OLT",
            "value":"100000000000000000000"
        },
        "from":"0lt491620c2e3981fad9157f82d5dbc41548d70ddee",
        "name":"bob2.ol",
        "gasPrice":{
            "currency":"OLT",
            "value":"1000000000"
        }
    },
    "method":"tx.ONS_CreateRawSend",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "rawTx":"eyJ0eXBlIjozNywiZGF0YSI6ImV5Sm1jbTl0SWpvaU1HeDBORGt4TmpJd1l6SmxNems0TVdaaFpEa3hOVGRtT0RKa05XUmlZelF4TlRRNFpEY3daR1JsWlNJc0ltNWhiV1VpT2lKaWIySXlMbTlzSWl3aVlXMXZkVzUwSWpwN0ltTjFjbkpsYm1ONUlqb2lUMHhVSWl3aWRtRnNkV1VpT2lJeE1EQXdNREF3TURBd01EQXdNREF3TURBd01EQWlmWDA9IiwiZmVlIjp7InByaWNlIjp7ImN1cnJlbmN5IjoiT0xUIiwidmFsdWUiOiIxMDAwMDAwMDAwIn0sImdhcyI6NDAwMDB9LCJtZW1vIjoiMmQ4ZjgxN2MtODgyMi0xMWVhLWEwM2ItZGNmYjQ4MTQ1NjkwIn0="
    }
}

tx.ONS_CreateRawDeleteSub

  • Creates a transaction to delete a subdomain.

//Parameter List
{
    "name":[Domain Name]
    "owner":[Owner of Domain]
    "gasPrice":[Gas Price]
    "gas":[Gas Limit]
}
//Response
{
    "rawTx":[Raw Transaction base64 encoded]
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "owner":"0lted33d3d9b9d247026f0a8cbb2e9a1f08ab17cc70",
        "gas":400000,
        "name":"abc.xyzzz.ol",
        "gasprice":{
            "currency":"OLT",
            "value":"1000000000"
        }
    },
    "method":"tx.ONS_CreateRawDeleteSub",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "rawTx":"eyJ0eXBlIjozOCwiZGF0YSI6ImV5SnVZVzFsSWpvaVlXSmpMbmg1ZW5wNkxtOXNJaXdpYjNkdVpYSWlPaUl3YkhSbFpETXpaRE5rT1dJNVpESTBOekF5Tm1Zd1lUaGpZbUl5WlRsaE1XWXdPR0ZpTVRkall6Y3dJbjA9IiwiZmVlIjp7InByaWNlIjp7ImN1cnJlbmN5IjoiT0xUIiwidmFsdWUiOiIxMDAwMDAwMDAwIn0sImdhcyI6NDAwMDAwfSwibWVtbyI6IjkyMzhmMTQxLTg4MjUtMTFlYS05ZTNiLWRjZmI0ODE0NTY5MCJ9"
    }
}

Query [query]

  • Public service to query details from the oneledger network .

Methods:

query.Balance

  • Return the balance of the address provided

//Parameter List

{
"Address": Oneledger address to query for balance
}

Response

{
"Balance : The balance of the account. Returns an empty balance if the account is not found
"Height" : The height when this balance was recorded
}

Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
       "address": "017548f8774f9602b4e25743050d3a8ab37f1341" 
    },
    "method":"query.Balance",
    "id":123
}
Sample Response
{
    "jsonrpc": "2.0",
    "id": 123,
    "result": {
        "balance": "500000000 OLT, 1000 VT",
        "height": 252
    }
}

query.ListCurrencies

  • Returns a list of all the currencies supported by the network.

//Parameter List

{}

Response

{
"Currencies" : [The list of all currencies supported by oneledger network]
}

Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        
    },
    "method":"query.ListCurrencies",
    "id":123
}
Sample Response
{
    "jsonrpc": "2.0",
    "id": 123,
    "result": {
        "currencies": [
            {
                "id": 3,
                "name": "ETH",
                "chain": 2,
                "decimal": 18,
                "unit": "wei"
            },
            {
                "id": 4,
                "name": "TTC",
                "chain": 3,
                "decimal": 18,
                "unit": "testUnits"
            },
            {
                "id": 0,
                "name": "OLT",
                "chain": 0,
                "decimal": 18,
                "unit": "nue"
            },
            {
                "id": 1,
                "name": "VT",
                "chain": 0,
                "decimal": 0,
                "unit": "vt"
            },
            {
                "id": 2,
                "name": "BTC",
                "chain": 1,
                "decimal": 8,
                "unit": "satoshi"
            }
        ]
    }
}

query.ListValidators

  • Returns a list of all validators in the network

//Parameter List

{}

Response

{
"Validators" : [The list of active validators]
"Height" : Height at which this validator set was active
}

Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        
    },
    "method":"query.ListValidators",
    "id":123
}
Sample Response
{
    "jsonrpc": "2.0",
    "id": 123,
    "result": {
        "validators": [
            {
                "address": "0lt14599f2e9b51c4c6d900259df8afd0a05fb6e5af",
                "stakeAddress": "0lt3980044a3407f82f16f22322ca75b429981a203a",
                "pubKey": {
                    "keyType": "ed25519",
                    "data": "jNDIUggQHzXLOVQKqNaVhpcUI66rTYvVK3Pb2VDxNis="
                },
                "ecdsaPubkey": {
                    "keyType": "btcecsecp",
                    "data": "AmIT/L/PMfuoSBPXe8DcziLkL1IU0o3DEP1RRkTgY6uL"
                },
                "power": 1,
                "name": "2",
                "staking": "1"
            },
            {
                "address": "0lt419fb9a47ac3933b549d385acfa3d398501b841c",
                "stakeAddress": "0ltfbfd640f66edb60761ab0711f6be81064937d649",
                "pubKey": {
                    "keyType": "ed25519",
                    "data": "RXPqcZFZJy30ddToMkxI9q5I1VvyRrseegH0KAdN9a0="
                },
                "ecdsaPubkey": {
                    "keyType": "btcecsecp",
                    "data": "A2e1cRQpwddLURRlQVF1sDLCHUPZwIcyVi9Dw6J9egBg"
                },
                "power": 1,
                "name": "1",
                "staking": "1"
            },
            {
                "address": "0ltdf5e8258889c3fff3de33434afdf596bf2a09127",
                "stakeAddress": "0ltae4eaeb40289a90933fe90cda9e0695da828e9a5",
                "pubKey": {
                    "keyType": "ed25519",
                    "data": "dROO6e33DIOrFG86WFo9Fm1KIY6npDjHjvRINLOSBpU="
                },
                "ecdsaPubkey": {
                    "keyType": "btcecsecp",
                    "data": "Ax0VmGAG3sqTcg7C7JS9WD3uZOHSdEhqyA3kOtcPiNIC"
                },
                "power": 1,
                "name": "3",
                "staking": "1"
            },
            {
                "address": "0ltf5a2dd98d1145f3f7d350b627e8efe52da757281",
                "stakeAddress": "0ltedaaa2a4cddebd0ca19a7e9bdece0478ee87fe0f",
                "pubKey": {
                    "keyType": "ed25519",
                    "data": "hFU+QpII2WYVZEGWYiFhyCpcXqoxopTmpVwm0VwwL1Q="
                },
                "ecdsaPubkey": {
                    "keyType": "btcecsecp",
                    "data": "AnB1iTgyByTm6ksFhmf+mkWIl+o1a2ojyjauV1Xofa6R"
                },
                "power": 1,
                "name": "0",
                "staking": "1"
            }
        ],
        "height": 448,
        "vmap": {
            "0lt14599f2e9b51c4c6d900259df8afd0a05fb6e5af": true,
            "0lt419fb9a47ac3933b549d385acfa3d398501b841c": true,
            "0ltdf5e8258889c3fff3de33434afdf596bf2a09127": true,
            "0ltf5a2dd98d1145f3f7d350b627e8efe52da757281": true
        },
        "fmap": {}
    }
}

query.FeeOptions

  • Returns the fee options ,which includes the currency and decimal points used to pay oneledger fees.

//Parameter List

{}

Response

{
"FeeOption" : The options used to create oneledger trasaction fees
}

Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        
    },
    "method":"query.FeeOptions",
    "id":123
}
Sample Response
{
    "jsonrpc": "2.0",
    "id": 123,
    "result": {
        "feeOption": {
            "feeCurrency": {
                "id": 0,
                "name": "OLT",
                "chain": 0,
                "decimal": 18,
                "unit": "nue"
            },
            "minFeeDecimal": 9
        }
    }
}

query.CurrencyBalance

  • Takes an address and currency as input.
  • Returns the currency balance for that address

//Parameter List

{
"Currency" : The currency whose balance is required 
"Address": The Oneledger address whose balance is required . 
}

Response

{
"Currency" : The currency provided 
"Balance : The balance of the account for the above currency 
"Height" : The height when this balance was recorded
}

Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "currency": "OLT",
        "address": "0lteee3de610ee134b18a39e52d4cc4420323809f28"   
    },
    "method":"query.CurrencyBalance",
    "id":123
}

Sample Response
{
    "jsonrpc": "2.0",
    "id": 123,
    "result": {
        "currency": "OLT",
        "balance": "200000000",
        "height": 120
    }
}

query.ListTxTypes

  • Returns a list of all the transaction types supported by the network.

//Parameter List

{}

Response

{
"TxTypes" : [The list of all Transaction types supported by oneledger network]
}

Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{

    },
    "method":"query.ListTxTypes",
    "id":123
}
Sample Response
{
    "jsonrpc": "2.0",
    "id": 123,
    "result": {
        "txTypes": [
            {
                "TxTypeNum": 1,
                "TxTypeString": "SEND"
            },
            {
                "TxTypeNum": 2,
                "TxTypeString": "SENDPOOL"
            },
            {
                "TxTypeNum": 17,
                "TxTypeString": "STAKE"
            },
            {
                "TxTypeNum": 18,
                "TxTypeString": "UNSTAKE"
            },
            {
                "TxTypeNum": 19,
                "TxTypeString": "WITHDRAW"
            },
            {
                "TxTypeNum": 33,
                "TxTypeString": "DOMAIN_CREATE"
            },
            {
                "TxTypeNum": 34,
                "TxTypeString": "DOMAIN_UPDATE"
            },
            {
                "TxTypeNum": 35,
                "TxTypeString": "DOMAIN_SELL"
            },
            {
                "TxTypeNum": 36,
                "TxTypeString": "DOMAIN_PURCHASE"
            },
            {
                "TxTypeNum": 37,
                "TxTypeString": "DOMAIN_SEND"
            },
            {
                "TxTypeNum": 38,
                "TxTypeString": "DOMAIN_DELETE_SUB"
            },
            {
                "TxTypeNum": 39,
                "TxTypeString": "DOMAIN_RENEW"
            },
            {
                "TxTypeNum": 48,
                "TxTypeString": "PROPOSAL_CREATE"
            },
            {
                "TxTypeNum": 49,
                "TxTypeString": "PROPOSAL_CANCEL"
            },
            {
                "TxTypeNum": 50,
                "TxTypeString": "PROPOSAL_FUND"
            },
            {
                "TxTypeNum": 51,
                "TxTypeString": "PROPOSAL_VOTE"
            },
            {
                "TxTypeNum": 52,
                "TxTypeString": "PROPOSAL_FINALIZE"
            },
            {
                "TxTypeNum": 53,
                "TxTypeString": "EXPIRE_VOTES"
            },
            {
                "TxTypeNum": 54,
                "TxTypeString": "PROPOSAL_WITHDRAW_FUNDS"
            },
            {
                "TxTypeNum": 65,
                "TxTypeString": "WITHDRAW_REWARD"
            },
            {
                "TxTypeNum": 81,
                "TxTypeString": "ADD_NETWORK_DELEGATION"
            },
            {
                "TxTypeNum": 82,
                "TxTypeString": "NETWORK_UNDELEGATE"
            },
            {
                "TxTypeNum": 83,
                "TxTypeString": "REWARDS_WITHDRAW_NETWORK_DELEGATE"
            },
            {
                "TxTypeNum": 84,
                "TxTypeString": "REWARDS_REINVEST_NETWORK_DELEGATE"
            },
            {
                "TxTypeNum": 97,
                "TxTypeString": "ALLEGATION"
            },
            {
                "TxTypeNum": 98,
                "TxTypeString": "ALLEGATION_VOTE"
            },
            {
                "TxTypeNum": 99,
                "TxTypeString": "RELEASE"
            },
            {
                "TxTypeNum": 129,
                "TxTypeString": "BTC_LOCK"
            },
            {
                "TxTypeNum": 130,
                "TxTypeString": "BTC_ADD_SIGNATURE"
            },
            {
                "TxTypeNum": 131,
                "TxTypeString": "BTC_BROADCAST_SUCCESS"
            },
            {
                "TxTypeNum": 132,
                "TxTypeString": "BTC_REPORT_FINALITY_MINT"
            },
            {
                "TxTypeNum": 133,
                "TxTypeString": "BTC_EXT_MINT"
            },
            {
                "TxTypeNum": 134,
                "TxTypeString": "BTC_REDEEM"
            },
            {
                "TxTypeNum": 135,
                "TxTypeString": "BTC_FAILED_BROADCAST_RESET"
            },
            {
                "TxTypeNum": 145,
                "TxTypeString": "ETH_LOCK"
            },
            {
                "TxTypeNum": 146,
                "TxTypeString": "ETH_REPORT_FINALITY_MINT"
            },
            {
                "TxTypeNum": 147,
                "TxTypeString": "ETH_REDEEM"
            },
            {
                "TxTypeNum": 148,
                "TxTypeString": "ERC20_LOCK"
            },
            {
                "TxTypeNum": 149,
                "TxTypeString": "ERC20_REDEEM"
            },
            {
                "TxTypeNum": 113,
                "TxTypeString": "SC_EXECUTE"
            }
        ]
    }
}

query.Tx

  • Takes a oneledger transaction as input.
  • Return the details for the transaction

//Parameter List

{
"Hash": Transaction hash of any oneledger transaction
"Prove": Boolean value for proof
}

Response

{
"Result" : Returns a ResultTX ,which includes Hash,Height,Index,TxResult,Tx and Proof 
}

Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "hash": "8E39280173F7820E6FCD34B7AAD249B0DD4FC2786671D69D7F247F672C644DA5",
        "prove": true
    },
    "method":"query.Tx",
    "id":123
}
Sample Response
{
    "jsonrpc": "2.0",
    "id": 123,
    "result":   
{
"hash": "8E39280173F7820E6FCD34B7AAD249B0DD4FC2786671D69D7F247F672C644DA5",
"height": 87,
"index": 0,
"tx_result": {
		"code": 0,
		"data": null,
		"log": "",
		"info": "",
		"gasWanted": "400000",
		"gasUsed": "255320",
		"events": [
			{
				"type": "eth_lock",
				"attributes": [
					{
						"key": "dHgudHlwZQ==",
						"value": "RVRIX0xPQ0s="
					},
					{
						"key": "dHgubG9ja2Vy",
						"value": "2XxpUxFpvxQu9AJ5/yoAoIAuXfI="
					},
					{
						"key": "dHgudHJhY2tlcg==",
						"value": "e6S+v1m9+Fki7mBZMUMaC4QvVuMq0GpsddWBT18Td/0="
					}
				]
			}
		],
		"codespace": ""
	},
"tx": "eyJ0eXBlIjoxNDUsImRhdGEiOiJleUpNYjJOclpYSWlPaUl3YkhSa09UZGpOamsxTXpFeE5qbGlaakUwTW1WbU5EQXlOemxtWmpKaE1EQmhNRGd3TW1VMVpHWXlJaXdpUlZSSVZIaHVJam9pSzBkNVFteHZWVVZ4UW1aSlFVbE9iV3RpWVZWRFZ6Wm5Ra2QzYVZrMFoxTjBRV0pEU1RJek1HdFVPVXBDYVhScmFGQm5PVU5NY1VORGNHRm5RblZIT0Vvd05IVjNhVkpEVFVKM01FcGlNbk5SUkZnNWQyUXljelZMVHpOdWQyaEtjeTk1TDBWSFpXZGxObE1yZGpGdE9TdEdhMmszYlVKYVRWVk5ZVU0wVVhaV2RVMXhNRWR3YzJSa1YwSlVNVGhVWkM4d1BTSjkiLCJmZWUiOnsicHJpY2UiOnsiY3VycmVuY3kiOiJPTFQiLCJ2YWx1ZSI6IjEwMDAwMDAwMDAwIn0sImdhcyI6NDAwMDAwfSwibWVtbyI6IjQwZjA2ODVlLTg3ODEtMTFlYS04MjYwLThjMTY0NTY2YjU3ZiIsInNpZ25hdHVyZXMiOlt7IlNpZ25lciI6eyJrZXlUeXBlIjoiZWQyNTUxOSIsImRhdGEiOiJ3Vjh4NGRscWRycThBVVRXNUJDeGJLbHltK0RMK3lCb09XODJ0Y3dDbTRrPSJ9LCJTaWduZWQiOiJzRjRxNW83c3krV1p2RUJMOWo0K2lhL3Jxd0JGc0lqbGp4RnFLWlo0SmpCOWpVdVdiZ2tkQ0FUVG9lTEtrK04wSHVzUFpxSVRleGxqT3FldkY4SVFDUT09In1dfQ==",
"proof": {
		"root_hash": "C4DCD2FB2DF63686E7A1604F55EE44A175E56558D47C709245E65792AED40A12",
		"data": "eyJ0eXBlIjoxNDUsImRhdGEiOiJleUpNYjJOclpYSWlPaUl3YkhSa09UZGpOamsxTXpFeE5qbGlaakUwTW1WbU5EQXlOemxtWmpKaE1EQmhNRGd3TW1VMVpHWXlJaXdpUlZSSVZIaHVJam9pSzBkNVFteHZWVVZ4UW1aSlFVbE9iV3RpWVZWRFZ6Wm5Ra2QzYVZrMFoxTjBRV0pEU1RJek1HdFVPVXBDYVhScmFGQm5PVU5NY1VORGNHRm5RblZIT0Vvd05IVjNhVkpEVFVKM01FcGlNbk5SUkZnNWQyUXljelZMVHpOdWQyaEtjeTk1TDBWSFpXZGxObE1yZGpGdE9TdEdhMmszYlVKYVRWVk5ZVU0wVVhaV2RVMXhNRWR3YzJSa1YwSlVNVGhVWkM4d1BTSjkiLCJmZWUiOnsicHJpY2UiOnsiY3VycmVuY3kiOiJPTFQiLCJ2YWx1ZSI6IjEwMDAwMDAwMDAwIn0sImdhcyI6NDAwMDAwfSwibWVtbyI6IjQwZjA2ODVlLTg3ODEtMTFlYS04MjYwLThjMTY0NTY2YjU3ZiIsInNpZ25hdHVyZXMiOlt7IlNpZ25lciI6eyJrZXlUeXBlIjoiZWQyNTUxOSIsImRhdGEiOiJ3Vjh4NGRscWRycThBVVRXNUJDeGJLbHltK0RMK3lCb09XODJ0Y3dDbTRrPSJ9LCJTaWduZWQiOiJzRjRxNW83c3krV1p2RUJMOWo0K2lhL3Jxd0JGc0lqbGp4RnFLWlo0SmpCOWpVdVdiZ2tkQ0FUVG9lTEtrK04wSHVzUFpxSVRleGxqT3FldkY4SVFDUT09In1dfQ==",
		"proof": {
			"total": 1,
			"index": 0,
			"leaf_hash": "xNzS+y32NobnoWBPVe5EoXXlZVjUfHCSReZXkq7UChI=",
			"aunts": null
		}
	}
   }
}

query.EVMCall

  • Simulate a VM execution and show the obtained result (or error).

//Parameter List
{     
    "from":[From Address]
    "to":[To Address]
    "amount":[Amount]
    "gasPrice":[Gas Price]
    "gas":[Gas Limit]
    "data":[Bytecode]
    "nonce":[Address Nonce]
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "from":"0lt7065363c3a4cb58ddfb7f5d12d501a8b6758ed44",
        "to":"",  // skipping to create a contract with vm bytecode
        "amount":{
            "currency":"OLT",
            "value":"1002345000000000000000"
        },
        "data": "[base64 encoded vm data]" // example base64("608060405234801561001057600080fd5b50610233806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80635f76f6ab146100465780636d4ce63c14610076578063cbed952214610096575b600080fd5b6100746004803603602081101561005c57600080fd5b810190808035151590602001909291905050506100a0565b005b61007e61013c565b60405180821515815260200191505060405180910390f35b61009e61018f565b005b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167fab77f9000c19702a713e62164a239e3764dde2ba5265c7551f9a49e0d304530d60405160405180910390a250565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905090565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f68656c6c6f00000000000000000000000000000000000000000000000000000081525060200191505060405180910390fdfea26469706673582212206872039b48bb16fb8cbf559a2e127d91b0af06f0d2d36b97faad6d0f9c335e7864736f6c63430007040033")
        "nonce": 1, // query.EVMAccount
        "gas":40000,        
        "gasPrice":{
            "currency":"OLT",
            "value":"1000000000"
        }
    },
    "method":"query.EVMCall",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "result":"0x000000000000000000000000000000000000000000000000000000000007e3a10000000000000000000000000000000000000000000000000000000000000005"
    }
}

query.EVMAccount

  • Account info of OLT address by state.

{     
    "address":[OLT Address]
    "blockTag":[tag for the block] // "latest", "earliest", "pending" or block height number
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "address":"0lt7065363c3a4cb58ddfb7f5d12d501a8b6758ed44",
        "blockTag":"latest",
    },
    "method":"query.EVMAccount",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "address":"0lt7065363c3a4cb58ddfb7f5d12d501a8b6758ed44",
        "nonce": 1,
        "codeHash": "[hash of bytes]" // of the contract,
        "balance": "0",
    }
}

query.EVMEstimateGas

  • Approx gas estimator for vm execution.

//Parameter List
{     
    "from":[From Address]
    "to":[To Address]
    "amount":[Amount]
    "gasPrice":[Gas Price]
    "gas":[Gas Limit]
    "data":[Bytecode]
    "nonce":[Address Nonce]
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "from":"0lt7065363c3a4cb58ddfb7f5d12d501a8b6758ed44",
        "to":"",  // skipping to create a contract with vm bytecode
        "amount":{
            "currency":"OLT",
            "value":"1002345000000000000000"
        },
        "data": "[base64 encoded vm data]" // example base64("608060405234801561001057600080fd5b50610233806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80635f76f6ab146100465780636d4ce63c14610076578063cbed952214610096575b600080fd5b6100746004803603602081101561005c57600080fd5b810190808035151590602001909291905050506100a0565b005b61007e61013c565b60405180821515815260200191505060405180910390f35b61009e61018f565b005b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167fab77f9000c19702a713e62164a239e3764dde2ba5265c7551f9a49e0d304530d60405160405180910390a250565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905090565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260058152602001807f68656c6c6f00000000000000000000000000000000000000000000000000000081525060200191505060405180910390fdfea26469706673582212206872039b48bb16fb8cbf559a2e127d91b0af06f0d2d36b97faad6d0f9c335e7864736f6c63430007040033")
        "nonce": 1, // query.EVMAccount
        "gas":40000,        
        "gasPrice":{
            "currency":"OLT",
            "value":"1000000000"
        }
    },
    "method":"query.EVMEstimateGas",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "gasUsed":100000
    }
}

query.EVMTransactionLogs

  • Retrieve a logs of the transaction which was triggered in the smart contract.

//Parameter List
{     
    "transactionHash":[Hash]
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "transactionHash":"9B9288EC22D46F521012B42F92CA173F0EF5D9CFEBDDDD1C34EF046CABB4BDD5"
    },
    "method":"query.EVMTransactionLogs",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "logs": [{
            "transactionHash": "9B9288EC22D46F521012B42F92CA173F0EF5D9CFEBDDDD1C34EF046CABB4BDD5",
            "blockHeight": 1,
            "blockHash": "",
            "address": "0lt7065363c3a4cb58ddfb7f5d12d501a8b6758ed44",
            "data": "0x000000000000000000000000000000000000000000000000000000000007e3a10000000000000000000000000000000000000000000000000000000000000005",
            "topics": [0xc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62]
        }]
    }
}

Owner [owner]

  • Private service to maintain accounts on the current node.
  • Provides service to sign transactions using specific accounts.

Methods:

owner.NewAccount

  • Creates new account by generating a new key pair and setting the name provided in the request.

//Parameter List
{
    "name":[Name of Account]
}
//Response
{
    "account":{
        "type":[Chain Type]
        "name":[Account Name]
        "publicKey":[Public Key base64 encoded]
        "privateKey":[Private Key base64 encoded]
    }
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "name":"Alice"
    },
    "method":"owner.NewAccount",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "account":{
            "type":0,
            "name":"Alice",
            "publicKey":{
                "keyType":"ed25519",
                "data":"5kXw4aaYZArqltewGJIBkXQj4QCY9Qbl8RnJTAbRhwI="
            },
            "privateKey":{
                "keyType": "ed25519",
                "data": "null" (This will create new Private Key, For security reasons we are showing null.)
        }
     }
  }
}

owner.AddAccount

  • You need Public and Private keys which Adds an account with address to the node wallet.

//Parameter List
{
    "type":[Chain Type]
    "name":[Account Name]
    "publicKey":[Public Key base64 encoded]
    "privateKey":[Private Key base64 encoded]
}
//Response
{
    "account":{
        "type":[Chain Type]
        "name":[Account Name]
        "publicKey":[Public Key base64 encoded]
        "privateKey":[Private Key base64 encoded]
    }
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "privateKey":{
            "keyType":"ed25519",
            "data":"LDaBO2Ddf3/8+KdTOPVUSHkKMA/EHeI1Q7+r1Q8LhpExvJbpebaGkWLK/i6Q7bnuJEP01kJMtcACeFH2H9T/IQ=="
        },
        "publicKey":{
            "keyType":"ed25519",
            "data":"MbyW6Xm2hpFiyv4ukO257iRD9NZCTLXAAnhR9h/U/yE="
        },
        "type":0,
        "name":"Alice"
    },
    "method":"owner.AddAccount",
    "id":123
}
Sample Response
{
    "jsonrpc": "2.0",
    "id": 123,
    "result": {
        "account": {
            "type": 0,
            "name": "Alice",
            "publicKey": {
                "keyType": "ed25519",
                "data": "MbyW6Xm2hpFiyv4ukO257iRD9NZCTLXAAnhR9h/U/yE="
            },
            "privateKey": null
        }
    }
}

owner.GenerateNewAccount

  • Generates new account on the node wallet given a name.
  • An address will be generated internally.

//Parameter List
{
    "name":[Name of Account]
}
//Response
{
    "account":{
        "type":[Chain Type]
        "name":[Account Name]
        "publicKey":[Public Key base64 encoded]
        "privateKey":[Private Key base64 encoded]
    }
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "name":"Alice"
    },
    "method":"owner.GenerateNewAccount",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "account":{
            "type":0,
            "name":"Alice",
            "publicKey":{
                "keyType":"ed25519",
                "data":"5kXw4aaYZArqltewGJIBkXQj4QCY9Qbl8RnJTAbRhwI="
            },
            "privateKey":null
        }
    }
}

owner.DeleteAccount

  • Deletes an account from the node wallet.

//Parameter List
{
    "address":[Address of Account]
}
//Response
{
    "deleted":[Status - true/false]
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "address":"0lt7065363c3a4cb58ddfb7f5d12d501a8b6758ed44"
    },
    "method":"owner.DeleteAccount",
    "id":123
}
Sample Response
{
    "jsonrpc": "2.0",
    "id": 123,
    "result": {
        "deleted": true
    }
}

owner.ListAccounts

  • Lists all accounts currently on the node wallet.

//Parameter List
{}
//Response
{
    "result": {
        "accounts":[]
    }
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{

    },
    "method":"owner.ListAccounts",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "accounts":[
            {
                "type":0,
                "name":"0",
                "publicKey":{
                    "keyType":"ed25519",
                    "data":"qWjjdQD5KrMZM93k0hLnbEEmy+zkY3uTdYcyxNl554U="
                },
                "privateKey":null
            },
            {
                "type":0,
                "name":"Alice",
                "publicKey":{
                    "keyType":"ed25519",
                    "data":"5kXw4aaYZArqltewGJIBkXQj4QCY9Qbl8RnJTAbRhwI="
                },
                "privateKey":null
            },
            {
                "type":0,
                "name":"Alice",
                "publicKey":{
                    "keyType":"ed25519",
                    "data":"JnEOwZmKUS55b6ln5CMcrQjAG+T3Ug+Y+Ud4SsNsdr4="
                },
                "privateKey":null
            },
            {
                "type":0,
                "name":"Alice",
                "publicKey":{
                    "keyType":"ed25519",
                    "data":"2FDM9isgF2NMNLkB9/J9vlVleFhfl+Gj2Gq8k41KXUQ="
                },
                "privateKey":null
            }
        ]
    }
}

owner.ListAccountAddresses

  • Lists the addresses of each account currently on the node wallet.

//Parameter List
{}
//Response
{
    "result": {
        "addresses" = []
    }
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{

    },
    "method":"owner.ListAccountAddresses",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "addresses":[
            "0lt39328c7d6ebbc1c237aee69ccb8ff5ce5abed382",
            "0lt7a9e364e2eb0de3a210247c37c1a01747eafde4c",
            "0lt6ae1d62146b860c2b9798b9f1ade98054c2af193",
            "0ltc2988d58501b1850b6fc96e58217cf7ad16989ae",
            "0lt8412db7f99ce0ac0ec19f29865dad410d12746e0"
        ]
    }
}

owner.SignWithAddress

  • Signs a raw transaction provided in the request and returns the signature and public key of the account used to sign.

//Parameter List
{
    "rawTx": [Raw Transaction]
    "address": [Account used to sign]
}
//Response
{
        "signature":{
            "Signer":{
                "keyType": [Encryption curve type]
                "data": [Public Key data]
            },
            "Signed": [Signature Data]
        }
 
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "rawTx":"eyJ0eXBlIjozNSwiZGF0YSI6ImV5SnVZVzFsSWpvaVltOWlNaTV2YkNJc0ltOTNibVZ5UVdSa2NtVnpjeUk2SWpCc2RHVmhObUV5T0RobU1ESmhNVGxqWmpWbE9EVXdPVFV6WVdSa1ltRmlOelkyTXpSaE5UUmxaVEVpTENKd2NtbGpaU0k2ZXlKamRYSnlaVzVqZVNJNklrOU1WQ0lzSW5aaGJIVmxJam9pT1Rrek1qUXlNREF3TURBd01EQXdNREF3TURBaWZTd2lZMkZ1WTJWc1UyRnNaU0k2Wm1Gc2MyVjkiLCJmZWUiOnsicHJpY2UiOnsiY3VycmVuY3kiOiJPTFQiLCJ2YWx1ZSI6IjEwMDAwMDAwMDAifSwiZ2FzIjo0MDAwMH0sIm1lbW8iOiI1MzYyNTI0MC04OTgyLTExZWEtOTMxYy1kY2ZiNDgxNDU2OTAifQ==",
        "address":"0ltea6a288f02a19cf5e850953addbab76634a54ee1"
    },
    "method":"owner.SignWithAddress",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "signature":{
            "Signer":{
                "keyType":"ed25519",
                "data":"7Srm6xY7BOlYyqj535jZziSvKG32O3V26FgBqdcAFpw="
            },
            "Signed":"dHXdEV0yb1zf9KxQOQ799/su51mJOhgUNQxqSjIrv/XaBx38alN32YDth/TJWzeFOVYafU+ANlnEP3H4KF2PBg=="
        }
    }
}

Node [node]

  • Public service for querying public information about the current node

Methods:

node.NodeName

  • Returns the name of the current node.

//Parameter List
{}
//Response
{
    "name":[Node Name]
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{

    },
    "method":"node.NodeName",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "name":"0"
    }
}

node.Address

  • Returns the address of the current node.

//Parameter List
{}
//Response
{
    "address":[Node Address]
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{

    },
    "method":"node.Address",
    "id":123
}
Sample Response
{
    "jsonrpc":"2.0",
    "id":123,
    "result":{
        "address":"0lt9b5b132418aea63df78c3d52fac83a4a9db924e4"
    }
}

node.ID

  • Returns the ID of the current node.
  • This will be retrieved internally using the tendermint node key.

//Parameter List
{
    "shouldShowIP":[Optional, flag to display IP address]
}
//Response
{
    "publicKey": [Public Key]
    "id":[Node ID]
}
//Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{

    },
    "method":"node.ID",
    "id":123
}
Sample Response
{
    "jsonrpc": "2.0",
    "id": 123,
    "result": {
        "publicKey": "NJ5wnqGwp47lNyyns6lx8DLVVVOvgEaA4wb8VZgly5k=",
        "id": "9b5b132418aea63df78c3d52fac83a4a9db924e4"
    }
}

Ethereum [eth]

  • Public service for inter-op transactions (Lock and Redeem ) with the ethereum network .

Methods:

eth.CreateRawExtLock

  • Returns an unsigned oneledger transaction for lock .

//Parameter List

{
"RawTx": Signed Ethereum transaction which for calling lock() function in smart contract
"Address": Locking address to get Ethereum on Oneledger network .
"Fee": Fee for this Oneledger transaction paid in olt
"Gas": Gas for this Oneledger transaction
}

Response

{
"RawTX : Unsigned Oneledger transaction which can be signed and broadcast for lock
}

Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "rawTx":"+GyBhoUEqBfIAINmkbaUwI5VibG3qjkvYhwuLhHgabqtPpNkhPg9CLqCCpagOg17y4f5Gq4QBA70WBtYfKmponAxH7UGqyqtLnwiL/KgdZ+Ta/0G4JpAaXpOU/D53kNz/97gFehPIjiLpBE6TRw=",
        "Address": "0ltd97c69531169bf142ef40279ff2a00a0802e5df2",
        "fee": {
          "currency": "OLT",
          "value": "10000000000"
       },
        "gas": 400000
    },
    "method":"eth.CreateRawExtLock",
    "id":123
}

Sample Response
{
    "jsonrpc": "2.0",
    "id": 123,
    "result": {
        "rawTx": "eyJ0eXBlIjoxNDUsImRhdGEiOiJleUpNYjJOclpYSWlPaUl3YkhSa09UZGpOamsxTXpFeE5qbGlaakUwTW1WbU5EQXlOemxtWmpKaE1EQmhNRGd3TW1VMVpHWXlJaXdpUlZSSVZIaHVJam9pSzBkNVFtbFpWVVZ4UW1aSlFVbE9iV3RpWVZWbVZGZ3JXWGRUVnpZMWFETllWRlpyTjBsdE1XcHJhbVJ3TkdScmFGQm5PVU5NY1VORGNHRm5SR3ROVkVSVE1qVm5hbWRGVWs1eFJUQnFOaTlxTVN0emRVaFhjRVU1YkU1eVNUVlFlVGhTVG1SU1pXZGxXVTFzY3psUVl6ZFdVbko2WWsxTFIyZHpSa0pHTWxSVFlVUlRUbUV4TjNreVJXbDBOMkVyY21rd1BTSjkiLCJmZWUiOnsicHJpY2UiOnsiY3VycmVuY3kiOiJPTFQiLCJ2YWx1ZSI6IjEwMDAwMDAwMDAwIn0sImdhcyI6NDAwMDAwfSwibWVtbyI6Ijc2YWNiZjY3LTg3NmYtMTFlYS04NjYyLThjMTY0NTY2YjU3ZiJ9"
    }
}


eth.CreateRawExtRedeem

  • Takes a signed Ethereum redeem transaction as input .
  • Create and returns a raw oneledger transaction for redeem .

//Parameter List

{
"UserOLTaddress": Oneledger address from which ether will be deducted on Onledger network .
"UserETHaddress": Ethereum address which receives ether on Ethereum network.
"ETHTxn": Broadcasted Ethereum transaction for calling redeem() function in smart contract .
"Fee": Fee for this Oneledger transaction paid in olt .
"Gas": Gas for this Oneledger transaction.
}

Response

{
"RawTX : Unsigned Oneledger transaction which can be signed and broadcast for lock
}

Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
	"userOLTAddress": "0ltd97c69531169bf142ef40279ff2a00a0802e5df2",
	"userETHAddress": "0x3760136a6327e6e3f6e6284e2173da2414e89894",
	"ethTxn": 		"+JOBh4UEqBfIAINgdzaUwI5VibG3qjkvYhwuLhHgabqtPpOHI4byb8EAAKTbAGp1AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAqCCpWgOXW9h5ECVid19oikWZgNfPveTE0qKlyCJaurPa8qRjCgUU3Okp2N1YS0dpVqDqLFSLA3pT7Nlp2F+xBOBqmo00s=",
	"fee": {
       		"currency": "OLT",
        	"value": "10000000000"
		},
	"gas": 400000
    },
    "method":"eth.CreateRawExtRedeem",
    "id":123
}
Sample Response
{
    "jsonrpc": "2.0",
    "id": 123,
    "result": {
        "rawTx": "eyJ0eXBlIjoxNDcsImRhdGEiOiJleUpQZDI1bGNpSTZJakJzZEdRNU4yTTJPVFV6TVRFMk9XSm1NVFF5WldZME1ESTNPV1ptTW1Fd01HRXdPREF5WlRWa1pqSWlMQ0pVYnlJNklqQjRNemMyTURFek5tRTJNekkzWlRabE0yWTJaVFl5T0RSbE1qRTNNMlJoTWpReE5HVTRPVGc1TkNJc0lrVlVTRlI0YmlJNklpdEtUMEpwTkZWRmNVSm1TVUZKVG1ka2VtRlZabFJZSzFsM1UxYzJOV2d6V0ZSV2F6ZEpiVEZxYTJwa2NEUmxTRWswWW5saU9FVkJRVXRVWWtGSGNERkJRVUZCUVVGQlFVRkJRVUZCUVVGQlFVRkJRVUZCUVVGQlFVRkJRVUZCUVVGQlFVRkJRVUZCUVVGeFEwTndWMmRSSzBreVNrSk9Va05WYjBOWWEwcFBkSFY1UXpBM05HZFlNVE16UlVsMWVucDNibTFwUWt4eWMycGhaMWhDWjA4d1NqRXpOVlU1THpCVVdGSjZhMncyTW5rNWRWb3ZRVGxrZUdSNFFXMW9aRkpFZWpSeE9XYzlJbjA9IiwiZmVlIjp7InByaWNlIjp7ImN1cnJlbmN5IjoiT0xUIiwidmFsdWUiOiIxMDAwMDAwMDAwMCJ9LCJnYXMiOjQwMDAwMH0sIm1lbW8iOiJmZjJlZWQ2Ni04NzZmLTExZWEtODY2Mi04YzE2NDU2NmI1N2YifQ=="
    }
}


eth.GetTrackerStatus

  • Returns the status of the tracker provided.

eth.GetFailedTrackerStatus

  • Returns the status of the tracker if it failed ,else returns an error

eth.GetSuccessTrackerStatus

  • Returns the status of the tracker if it successfully completed ,else returns an error

//Parameter List

{
"TrackerName": Name of the etehreum tracker ,which is the hash of the Ethereum transaction (lock or redeem)
}

Response

{
"Status : Status of the tracker 
}

Example
Sample Request
{
    "jsonrpc":"2.0",
    "params":{
        "trackerName": "0x68f3193bbbc027e1cd984f024a4c080d4aaab54856cffe58a0e188ffe7259180"
    },
    "method":"eth.GetTrackerStatus",
    "id":123
}

Sample response
{
    "jsonrpc": "2.0",
    "id": 123,
    "result": {
	"status": "BusyBroadcasting"
    }
}

Clone this wiki locally