WitnessOnChain Service

WitnessOnChain is a witness/oracle service for blockchain smart contract.

v1

Endpoint https://witnessonchain.com/v1

Info

Returns greeting messages and public keys of WitnessOnChain service.

GET /info

KeysTypeDescription
messagestringGreeting message
contactstringContact information
public_key/rabinstringRabin public key of WitnessOnChain, little endian hex string, represents an integer

Timestamp

Returns Unix timestamp and UTC time string.

GET /timestamp

Request ParametersRequiredDescription
nonceNoUser nonce, hex string format, will be used in digest of response as bytes, up to 20 bytes
KeysTypeDescription
timestampintUnix timestamp in 10 digits
utcstringUTC time string in format like "2021-06-23 16:13:07"
digeststringThe corresponding hex string to the signed message:
4 bytes timestamp little endian represents an integer
0 ~ 20 bytes user_nonce
signatures/rabin/public_keystringRabin public key of WitnessOnChain, little endian hex string, represents an integer
signatures/rabin/signaturestringRabin signature of digest, little endian hex string, represents an integer
signatures/rabin/paddingstringRabin signature padding, little endian hex string

Exchange Rates

Returns exchange rate of the specific symbol (case insensitive):

GET /rates/<symbol>

Request ParametersRequiredDescription
nonceNoUser nonce, hex string format, will be used in digest of response as bytes, up to 20 bytes
KeysTypeDescription
symbolstringExchange trade pair, all letters are uppercase
ratefloatExchange rate of the specific symbol, up to 4 decimals
timestampintUnix timestamp in 10 digits
digeststringThe corresponding hex string to the signed message:
4 bytes timestamp little endian represents an integer
8 bytes exchange rate little endian represents an integer
1 byte decimal little endian represents an integer
16 bytes symbol.utf-8 with 0x00 right padding
0 ~ 20 bytes user_nonce
signatures/rabin/public_keystringRabin public key of WitnessOnChain, little endian hex string, represents an integer
signatures/rabin/signaturestringRabin signature of digest, little endian hex string, represents an integer
signatures/rabin/paddingstringRabin signature padding, little endian hex string

Bitcoin SV Blockchain Info

Returns current Bitcoin SV blockchain info, including height and median time-past.

GET /bitcoin_sv/info

Request ParametersRequiredDescription
nonceNoUser nonce, hex string format, will be used in digest of response as bytes, up to 20 bytes
KeysTypeDescription
chainstringBlockchain name, fixed string "Bitcoin SV"
heightintCurrent blockchain height
median_time_pastintCurrent blockchain Median Time-Past
timestampintUnix timestamp in 10 digits
digeststringThe corresponding hex string to the signed message:
4 bytes height little endian represents an integer
4 bytes mtp little endian represents an integer
32 bytes block hash little endian
10 bytes 0x426974636f696e205356, which is "Bitcoin SV".utf-8
0 ~ 20 bytes user_nonce
signatures/rabin/public_keystringRabin public key of WitnessOnChain, little endian hex string, represents an integer
signatures/rabin/signaturestringRabin signature of digest, little endian hex string, represents an integer
signatures/rabin/paddingstringRabin signature padding, little endian hex string

Code Example