Skip to main content

API Contract

Request to the Providers

This is the data that will be passed to the providers, from the meter bus, in order to document the request and label it.

When the MeterBus calls provider’s restful interface, MeterBus needs to set the following headers to pass the server’s authorization:

HeaderDescription
Content-Typeapplication/json;charset=UTF-8
X-Signature-appidAppid, unique code
X-Signature-timestampTimestamp, millisecond
X-Signature-nonceRandom uuid, replace “-” with “”,32 byte length
X-Signature-signatureSignature, check below for sign details

Signature

info

Please note that the signature is optional here. You can still access our API without signature. However, you will be limited to a lower rate. If you foresee your application having a higher rate to the AvengerDAO API, please contact us for a dedicated appid and appSecret.

signature = encodeHexString(HmacSHA256(
appsecret,
appid;
timestamp;
nonce;
method;
uri;
query;
body
))

Where uri is the path, multiple key-value pair in query and header should be sorted alphabetically by key, comma separated, example:

KeyValue
appid13cc90dc5ffa4032acb3
appsecretcd0ec4b1ca934b188996034541d7e810
url/security-api/public/app/v1/detect
queryempty
methodPOST
body
{
"chain_id":"56",
"address":"0x312bc7eaaf93f1c60dc5afc115fccde161055fb0"
}
timestamp1657246234465
nonce791f398e93f14b3e98f916703f777f44

then:

signature = encodeHexString(HmacSHA256(
cd0ec4b1ca934b188996034541d7e810,
‘13cc90dc5ffa4032acb3;
1657246234465;
791f398e93f14b3e98f916703f777f44;
POST;
/security-api/public/app/v1/detect;
{
"address":"1",
"chainId":"56"
}
))

Final header

HeaderDescription
Content-Typeapplication/json;charset=UTF-8
X-Signature-appid13cc90dc5ffa4032acb3
X-Signature-timestamp1657246234465
X-Signature-nonce791f398e93f14b3e98f916703f777f44
X-Signature-signature08850af5a48bbc255137d82ee7ab40e9e850a422dad1af9ca2391f2db8505e47