ABI

JSON

Values

Type

Type Encoding

Value Encoding

Description

Address

"addr"

string

Defines a RenVM address.

B20

"b20"

base64 string

Defines a contiguous array of 20 bytes.

B32

"b32"

base64 string

Defines a contiguous array of 32 bytes.

B

"b"

base64 string

Defines a contiguous array of bytes.

I8

"i8"

number

Defines an 8 bit signed integer.

I16

"i16"

number

Defines a 16 bit signed integer.

I32

"i32"

number

Defines a 32 bit signed integer.

I64

"i64"

number

Defines a 64 bit signed integer.

U8

"u8"

number

Defines an 8 bit unsigned integer.

U16

"u16"

number

Defines a 16 bit unsigned integer.

U32

"u32"

number

Defines a 32 bit unsigned integer.

U64

"u64"

number

Defines a 64 bit unsigned integer.

Formals

{
"description": "A formal defines the expected inputs/outputs of a contract",
"type": "object",
"required": ["name", "type"],
"properties": {
"name": {
"description": "A unique human readable name for the formal",
"type": "string"
},
"type": {
"description": "A valid type encoding for the formal",
"type": "string"
}
}
}

Arguments

{
"description": "An argument defines an actual value passed to/from a contract",
"type": "object",
"required": ["name", "type", "value"],
"properties": {
"name": {
"description": "A unique human readable name that selects a formal",
"type": "string"
},
"type": {
"description": "A type encoding that is the same as the selected formal",
"type": "Type"
},
"value": {
"description": "A value of the type defined by the type property",
"type": "Value"
}
}
}

Transactions

{
"description": "A transaction that is sent to a contract",
"type": "object",
"required": ["hash", "to", "args"],
"properties": {
"hash": {
"description": "The sha3 hash of the contents of the transaction encoded in base64",
"type": "string"
},
"to": {
"description": "The address of the contract to which the transaction must be sent",
"type": "string"
},
"args": {
"description": "The arguments that will be passed to the contract",
"type": "array",
"items": "Argument"
}
}
}

Examples

Contract ABI

The JSON encoding of the BTC0Btc2Eth intrinsic contract ABI:

{
"addr": "BTC0Btc2Eth",
"in": [{
"name": "to",
"type": "b20"
}, {
"name": "amount",
"type": "u64"
}, {
"name": "phash",
"type": "b32"
}, {
"name": "hash",
"type": "b32"
}],
"out": [{
"name": "r",
"type": "b"
}, {
"name": "s",
"type": "b"
}, {
"name": "v",
"type": "b"
}]
}

Transaction ABI

The JSON encoding of a transaction sent to the BTC0Btc2Eth intrinsic contract:

{
"hash": "ZGVhZGJlYWZkZWFkYmVhZmRlYWRiZWVmZGVhZGJlZWY=",
"to": "BTC0Btc2Eth",
"args": [{
"name": "to",
"type": "b20",
"value": "ZGVhZGJlYWZkZWFkYmVhZmRlYWQ="
}, {
"name": "amount",
"type": "u64",
"value": 10
}, {
"name": "phash",
"type": "ZGVhZGJlYWZkZWFkYmVhZmRlYWRiZWVmZGVhZGJlZWY="
}, {
"name": "hash",
"type": "ZGVhZGJlYWZkZWFkYmVhZmRlYWRiZWVmZGVhZGJlZWY="
}]
}