1 Introduction

This API Kit is composed by API Rest that allow to interface with (Ethereum) blockchain in order to manage wallets, send transactions and interface with smart contracts. API requests are processed through HTTP requests, using mainly [POST] and [GET] methods. Each API Request has to include a [GET] parameter “apikey” that identifies the user who is interfacing with the API.

Each apikey allows to process up to 100 requests per hour

The network used in this API kit is Rinkeby ( https://rinkeby.etherscan.io).

1.1 API Url

All requests have to be sent to the following URL:

https://api.ownyourbusiness.tech/BLOCKCHAIN_NAME/METHOD?apikey=YOUR_API_KEY

1.2 Request

Any request needs these parameters:

[GET] YOUR_API_KEY

This parameter represents your API key.

[GET] BLOCKCHAIN_NAME

This parameter represents the blockchain you want to use. Actually is available only eth (ethereum)

[GET] METHOD

This parameter is used for representing the methods you can find continuing to read this documentation.

1.3 Response

The API Kit response format is the following:

{
    "error": {
                "code": 1,
                "message": ""
                },
    "message": ""
    "data": {}
}

The error object is fulfilled only in case of errors and it’s composed by:


● code

The code makes your system able to identify the error and choose what to do.

● message

This is a human-readable message that explains what happened here. The message parameter is just a message that explains you what happened. The data object is fulfilled with the useful data you have requested.

2 Request

2.1 Ethereum

2.1.1 Address

[GET] eth/address/balance

This method accepts the following parameters:

(required) address: String

It returns an object containing:

address: String

balance: Decimal

[POST] eth/address/create

This method does not accept any parameters.

It returns an object containing:

address: String

privateKey: String

It’s a private key you have to use to access your new ethereum account.

2.1.2 Transaction

[POST] eth/transaction/send

This method accepts the following parameters:

from: String

The sender address.

privateKey: String

The sender privateKey.

(optional) to: String

The recipient. It’s optional because if you want to push smart contracts into the network through API kit, this field has to be empty.

(optional) data: Object

This represents the data you want to send to your smart contract.

(optional) amount: Decimal

The amount of money you want to move. Again, this is optional just because you will not always need to fill this field if you are dealing with smart contracts.

gas: Number

This specifies how many gas units you are able to spend for this transaction (maximum).

(optional) gasPrice: Number

The gas price in wei.

This method returns:

txAddress: String

The transaction hash.

[GET] eth/transaction/get
This method accepts the following parameters:

address: String

The hash of the transaction you want to get information about it.

This method returns the following parameters:

address: String

hash: String

Hash of the transaction.

nonce: Number

The number of transactions made by the sender prior to this one.

blockHash: String

Hash of the block where this transaction was in. null when it’s pending.

blockNumber: Number

Block number where this transaction was in. null when it’s pending.

transactionIndex: Number

Integer of the transactions index position in the block. null when it’s pending.

from: String

Address of the sender.

to: String

Address of the receiver. null when it’s a contract creation transaction.

value: String

Value transferred in wei.

gasPrice: String

The wei per unit of gas provided by the sender in wei.

gas: Number

Gas provided by the sender.

input: String

The data sent along with the transaction.

2.1.3 Contract

[POST] eth/contract/call

This method accepts the following parameters:

privateKey: String

The sender privateKey.

address: String

The contract's address.

method: String

The method.

params: Array

The parameters.

abi: JSON (String)

The abi of the contract.

gas: Number

The gas.

gasPrice: Number

The price of the gas.

This method returns:

result: mixed

The contract response.

[POST] eth/contract/send

This method accepts the following parameters:

privateKey: String

The sender privateKey.

address: String

The contract's address.

method: String

The method.

params: Array

The parameters.

amount: Number

The amount..

abi: JSON (String)

The abi of the contract.

gas: Number

The gas.

gasPrice: Number

The price of the gas.

This method returns:

txAddress: String

​​The address of the transaction (hash)

[POST] eth/contract/deploy

This method accepts the following parameters:

privateKey: String

The sender privateKey.

bytecode: String

The contract compiled.

abi: JSON (String)

The abi of the contract.

params: Array

The parameters.

gas: Number

The gas.

gasPrice: Number

The price of the gas.

This method returns:

txAddress: String

​​The address of the transaction (hash)

2.2 OYB Utility

The OYB Utility API is a set of functions "off chain" to use for many use cases. OYB provides you the tools for using the blockchain without being an expert blockchain developer. All Utility functions can work only under Ethereum Blockchain and are provided with an integrated Smart Contract.

2.2.1 Document Validation

[POST] utility/eth-docs/validate

This method accepts the following parameters:

(required) hash: String

The hash md5 of your document.

(required) privateKey: String

The private key to use for sending the transaction.

(required) gas: Number

The gas of transaction.

gasPrice: Number

The gas price.

It returns the following parameters:

txAddress: String

The hash of the transaction.

contractAddress: String

The contract address.

[POST] utility/eth-docs/invalidate

This method accepts the following parameters:

(required) oldHash: String

The old md5 hash of your document.

(required) newHash: String

The new md5 hash of your document.

(required) privateKey: String

The private key to use for sending the transaction.

(required) gas: Number

The gas of transaction.

gasPrice: Number

The gas price.

It returns the following parameters:

txAddress: String

The hash of the transaction.

contractAddress: String

The contract address.

[GET] utility/eth-docs/isValid

This method accepts the following parameters:

(required) hash: String

The md5 hash of your document.

(required) privateKey: String

The private key to use for sending the transaction.

(required) gas: Number

The gas of transaction.

gasPrice: Number

The gas price.

It returns the following parameters:

exists: Bool

True if exist, False if doesn't.

owner: EthAddress (String)

The owner's address validated the document.

timestamp: Number

The timestamp of validation.

invalidation_timestamp: Number

The timestamp of invalidation.

invalidated: Bool

True if is invalidated, False if it didn't.

invalidatedBy: EthAddress (String)

The owner's address invalidated the contract.

contractAddress: String

The address contract.

3 Errors

● 0x01

This is a request validation error. It happens when the parameters you have passed inside your request have an invalid format.

● 0x02

Generic validation error; it is reserved for future uses.

● 0x03

This is a generic system error, if it happens please contact us.

● 0x04

This is a signing error; it means that OYB was unable to sign the transaction you were asking to send.

● 0x05

Undefined error during the transaction send.

● 0x06

This happens when you’re API Key is invalid.

● 0x07

This happens when your API Key requests limit has been reached.

● 0x08

This happens when you are calling a method that doesn’t exist.

● 0x09

This happens when you are calling a method that doesn’t exist.

● 0x0A

Invalid contract method

● 0x0B

Transaction not found