-
Notifications
You must be signed in to change notification settings - Fork 15
tmp RPC
Tanmay Bhattacharya edited this page Apr 26, 2020
·
38 revisions
- 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"
}
- 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
}
}
- List ListTxTypes
-
query.ListTxTypes
- Returns a list of all the transaction types supported by the network.
-
Request
{}
Response
{
"TxTypes : The list of all Transaction types supported by oneledger network
}
Example
Sample Request
{}
Sample response
{
"txTypes": [
{
"TxTypeNum": 1,
"TxTypeString": "SEND"
},
{
"TxTypeNum": 17,
"TxTypeString": "APPLY_VALIDATOR"
},
{
"TxTypeNum": 18,
"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": 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"
}
]
}
- Tx
-
query.Tx
- Takes a oneledger transaction as input.
- Return the details for the transaction
-
Request
{
"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
{
"hash": "8E39280173F7820E6FCD34B7AAD249B0DD4FC2786671D69D7F247F672C644DA5",
"prove": true
}
Sample response
{
"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": "RVRIX0xP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ED40A12",
"data": "eyJ0eXBlIjoxNDUsImRhdGEiOiJleUpNYjJOclpYSWlPaUl3YkhSa09UZGpOamsxTXpFeE5qbGlaakUwTW1WbU5EQXlOemxtWmpKaE1EQmhNRGd3TW1VMVpHWXlJaXdpUlZSSVZIaHVJam9pSzBkNVFteHZWVVZ4UW1aSlFVbE9iV3RpWVZWRFZ6Wm5Ra2QzYVZrMFoxTjBRV0pEU1RJek1HdFVPVXBDYVhScmFGQm5PVU5NY1VORGNHRm5RblZIT0Vvd05IVjNhVkpEVFVKM01FcGlNbk5SUkZnNWQyUXljelZMVHpOdWQyaEtjeTk1TDBWSFpXZGxObE1yZGpGdE9TdEdhMmszYlVKYVRWVk5ZVU0wVVhaV2RVMXhNRWR3YzJSa1YwSlVNVGhVWkM4d1BTSjkiLCJmZWUiOnsicHJpY2UiOnsiY3VycmVuY3kiOiJPTFQiLCJ2YWx1ZSI6IjEwMDAwMDAwMDAwIn0sImdhcyI6NDAwMDAwfSwibWVtbyI6IjQwZjA2ODVlLTg3ODEtMTFlYS04MjYwLThjMTY0NTY2YjU3ZiIsInNpZ25hdHVyZXMiOlt7IlNpZ25lciI6eyJrZXlUeXBlIjoiZWQyNTUxOSIsImRhdGEiOiJ3Vjh4NGRscWRycThBVVRXNUJDeGJLbHltK0RMK3lCb09XODJ0Y3dDbTRrPSJ9LCJTaWduZWQiOiJzRjRxNW83c3krV1p2RUJMOWo0K2lhL3Jxd0JGc0lqbGp4RnFLWlo0SmpCOWpVdVdiZ2tkQ0FUVG9lTEtrK04wSHVzUFpxSVRleGxqT3FldkY4SVFDUT09In1dfQ==",
"proof": {
"total": 1,
"index": 0,
"leaf_hash": "xNzS+y32NobnoWBPVe5EoXXlZVjUfHCSReZXkq7UChI=",
"aunts": null
}
}
}
© OneLedger 2018-2020 Contact Information