Skip to content

tmp RPC

Tanmay Bhattacharya edited this page Apr 26, 2020 · 38 revisions

Ethereum [eth]

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

Methods:

  • Lock
    • eth.CreateRawExtLock
      • Returns an unsigned oneledger transaction for lock .

Request

{
"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
{ 
"rawTx":"+GyBhoUEqBfIAINmkbaUwI5VibG3qjkvYhwuLhHgabqtPpNkhPg9CLqCCpagOg17y4f5Gq4QBA70WBtYfKmponAxH7UGqyqtLnwiL/KgdZ+Ta/0G4JpAaXpOU/D53kNz/97gFehPIjiLpBE6TRw=",
"Address": "0ltd97c69531169bf142ef40279ff2a00a0802e5df2",
"fee": {
          "currency": "OLT",
          "value": "10000000000"
       },
 "gas": 400000
}
Sample Response
{
"rawTx": "eyJ0eXBlIjoxNDUsImRhdGEiOiJleUpNYjJOclpYSWlPaUl3YkhSa09UZGpOamsxTXpFeE5qbGlaakUwTW1WbU5EQXlOemxtWmpKaE1EQmhNRGd3TW1VMVpHWXlJaXdpUlZSSVZIaHVJam9pSzBkNVFtbFpWVVZ4UW1aSlFVbE9iV3RpWVZWbVZGZ3JXWGRUVnpZMWFETllWRlpyTjBsdE1XcHJhbVJ3TkdScmFGQm5PVU5NY1VORGNHRm5SR3ROVkVSVE1qVm5hbWRGVWs1eFJUQnFOaTlxTVN0emRVaFhjRVU1YkU1eVNUVlFlVGhTVG1SU1pXZGxXVTFzY3psUVl6ZFdVbko2WWsxTFIyZHpSa0pHTWxSVFlVUlRUbUV4TjNreVJXbDBOMkVyY21rd1BTSjkiLCJmZWUiOnsicHJpY2UiOnsiY3VycmVuY3kiOiJPTFQiLCJ2YWx1ZSI6IjEwMDAwMDAwMDAwIn0sImdhcyI6NDAwMDAwfSwibWVtbyI6Ijc2YWNiZjY3LTg3NmYtMTFlYS04NjYyLThjMTY0NTY2YjU3ZiJ9"
}

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

Request

{
"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
{
"userOLTAddress": "0ltd97c69531169bf142ef40279ff2a00a0802e5df2",
"userETHAddress": "0x3760136a6327e6e3f6e6284e2173da2414e89894",
"ethTxn": "+JOBh4UEqBfIAINgdzaUwI5VibG3qjkvYhwuLhHgabqtPpOHI4byb8EAAKTbAGp1AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAqCCpWgOXW9h5ECVid19oikWZgNfPveTE0qKlyCJaurPa8qRjCgUU3Okp2N1YS0dpVqDqLFSLA3pT7Nlp2F+xBOBqmo00s=",
"fee": {
       "currency": "OLT",
        "value": "10000000000"
},
"gas": 400000
}
Sample Response
{
"rawTx": "eyJ0eXBlIjoxNDcsImRhdGEiOiJleUpQZDI1bGNpSTZJakJzZEdRNU4yTTJPVFV6TVRFMk9XSm1NVFF5WldZME1ESTNPV1ptTW1Fd01HRXdPREF5WlRWa1pqSWlMQ0pVYnlJNklqQjRNemMyTURFek5tRTJNekkzWlRabE0yWTJaVFl5T0RSbE1qRTNNMlJoTWpReE5HVTRPVGc1TkNJc0lrVlVTRlI0YmlJNklpdEtUMEpwTkZWRmNVSm1TVUZKVG1ka2VtRlZabFJZSzFsM1UxYzJOV2d6V0ZSV2F6ZEpiVEZxYTJwa2NEUmxTRWswWW5saU9FVkJRVXRVWWtGSGNERkJRVUZCUVVGQlFVRkJRVUZCUVVGQlFVRkJRVUZCUVVGQlFVRkJRVUZCUVVGQlFVRkJRVUZCUVVGeFEwTndWMmRSSzBreVNrSk9Va05WYjBOWWEwcFBkSFY1UXpBM05HZFlNVE16UlVsMWVucDNibTFwUWt4eWMycGhaMWhDWjA4d1NqRXpOVlU1THpCVVdGSjZhMncyTW5rNWRWb3ZRVGxrZUdSNFFXMW9aRkpFZWpSeE9XYzlJbjA9IiwiZmVlIjp7InByaWNlIjp7ImN1cnJlbmN5IjoiT0xUIiwidmFsdWUiOiIxMDAwMDAwMDAwMCJ9LCJnYXMiOjQwMDAwMH0sIm1lbW8iOiJmZjJlZWQ2Ni04NzZmLTExZWEtODY2Mi04YzE2NDU2NmI1N2YifQ=="
}

  • Tracker Status
    • 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.GetFailedTrackerStatus
      • Returns the status of the tracker if it successfully completed ,else returns an error

Request

{
"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
{
"trackerName": "0x68f3193bbbc027e1cd984f024a4c080d4aaab54856cffe58a0e188ffe7259180"
}
Sample response
{
"status": "BusyBroadcasting"
}

Query [query]

  • Public service to query details from the oneledger network . Methods:
  • Balance
    • query.Balance
      • Return the balance of the address provided

Request

{
"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
{
"address": "017548f8774f9602b4e25743050d3a8ab37f1341"
}
Sample response
{
"balance": "500000000 OLT, 1000 VT"
"height" : 252
}
  • ListValidators
    • query.CreateRawExtRedeem
      • Returns a list of all validators in the network

Request

{}

Response

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

Example
Sample Request
{}
Sample response
{
"validators": [
                {
                        "address": "0lt5cd1cb92c8bb66f797fe497b8d13ca1f0d42b837",
                        "stakeAddress": "0lt017548f8774f9602b4e25743050d3a8ab37f1341",
                        "pubKey": {
                                "keyType": "ed25519",
                                "data": "nutsOXOFAwGyInFCkwDGFk6XuK4Z6OkZZozIxg0sO9I="
                        },
                        "ecdsaPubkey": {
                                "keyType": "btcecsecp",
                                "data": "Anhh01SKMFHM/rapk+CgtMyayehsYEgX2kIWsQ0bZjPX"
                        },
                        "power": 1,
                        "name": "2",
                        "staking": "1"
                },
                {
                        "address": "0lt744c4b3ba633b52bb884901d927de8725aa6688b",
                        "stakeAddress": "0ltd97c69531169bf142ef40279ff2a00a0802e5df2",
                        "pubKey": {
                                "keyType": "ed25519",
                                "data": "oDbcG7aaylO0NueBGG7Y+ic8c0RwmJY4cIVdrpBVxG8="
                        },
                        "ecdsaPubkey": {
                                "keyType": "btcecsecp",
                                "data": "AwFv2czgpTvBWePkkX2sASwFlvS8yFIk8hLbzW0voR6y"
                        },
                        "power": 1,
                        "name": "1",
                        "staking": "1"
                },
                {
                        "address": "0lt82212fa90f9e756157deb2a898cbcef0bdfb2894",
                        "stakeAddress": "0ltd97c69531169bf142ef40279ff2a00a0802e5df2",
                        "pubKey": {
                                "keyType": "ed25519",
                                "data": "IDbMxCzm/txrXg/oQw/R6UYEmmr3FIuXLM44z+8mQ7E="
                        },
                        "ecdsaPubkey": {
                                "keyType": "btcecsecp",
                                "data": "AwsE49/9XJMIKMoZXVg8ELsjPa7NRZ/l5we0QSwtLcFp"
                        },
                        "power": 1,
                        "name": "3",
                        "staking": "1"
                },
                {
                        "address": "0lt8836acba073396224db72d0226874a0a3fc6c2a6",
                        "stakeAddress": "0lt017548f8774f9602b4e25743050d3a8ab37f1341",
                        "pubKey": {
                                "keyType": "ed25519",
                                "data": "pZ1gZj638N/8n3Sl/V0eEd2MncMp17IJMTXhZjb1bqM="
                        },
                        "ecdsaPubkey": {
                                "keyType": "btcecsecp",
                                "data": "A0+wv3zy9jxY+E/8VYAgW2wAw42CqLnOZWcLeD5pZp/g"
                        },
                        "power": 1,
                        "name": "0",
                        "staking": "1"
                }
        ],
"height": 448
}

  • List Currencies
    • query.ListCurrencies
      • Returns a list of all the currencies supported by the network.

Request

{}

Response

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

Example
Sample Request
{}
Sample response
{
{
"currencies": [
                {
                        "id": 2,
                        "name": "BTC",
                        "chain": 1,
                        "decimal": 8,
                        "unit": "satoshi"
                },
                {
                        "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"
                }
        ]
}

}
  • Currency Balance
    • query.ListCurrencies
      • Takes an address an a currency as input.
      • Returns the currency balance for that address

Request

{
"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
{
"currency": "OLT",
"address": "0lteee3de610ee134b18a39e52d4cc4420323809f28"
}

Sample response
{
"currency": "OLT",
"balance": "200000000",
"height": 120
}

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

Request

{}

Response

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

Example
Sample Request
{}
Sample response
{
"feeOption": {
                "feeCurrency": {
                        "id": 0,
                        "name": "OLT",
                        "chain": 0,
                        "decimal": 18,
                        "unit": "nue"
                },
                "minFeeDecimal": 9
        }
}

Clone this wiki locally