Transaction Format
A transaction is the smallest unit of execution in Newrl. It can be of varying complexity from just a one way transfer of funds to a complex smart contract calling another.
A transaction is a json with the below structure
{
"transaction": {
"timestamp": <timestamp_ms>,
"trans_code": <string: 40 digit unique code>,
"type": <integer: transaction type code>,
"currency": <string: fee payment token>,
"fee": <integer: fee>,
"descr": <string: description metadata>,
"valid": <integer: typically 1>,
"specific_data": <dict: specific attributes of token>
},
"signatures": <array: signatures>
}
Field Descriptions
timestamp
Timestamp of the transaction at creation. This is an arbitrary integer provided by the Dapp even though the reccomendation is to use the current milliseconds since epoch. In future, this field maybe used to flush out stale transactions.
trans_code
A unique uuid of 40 digit hex generated by the Dapp. A transaction with an existing transaction code on the chain will be removed by the validators without processing. Newrl SDK can create this automatically.
type
An integer representing the type of transaction. Possible values are
type | usage |
---|---|
1 | add wallet |
2 | add token |
3 | smart contract call |
4 | one way token transfer |
5 | two way token transfer |
6 | trust score update |
7 | validator keepalive |
8 | internal smart contract |
currency
A string representing the token used to pay fees.
At present allowed currencies are NWRL
and NUSD
tip
tokens for paying fee can be purchased from Newrl dex/wallet. Grants are also available for developers.
fee
Integer amount of fee payable for the transaction. Currently 0 fee transactions are allowed but used to prioritise during network congestion.
descr
A string used as metadata for a transaction. This can be useful for Dapps when it needs to listen for specific transactions in blocks to create events. Newrl - Ethereum bridge uses this field to query for transactions.
valid
An integer reserved for future use cases. Right now this field has to be 1.
Specific data
A dictionary with necessary information for the transaction execution. Each transaction type expect it's specific data in a format specified in the later section.
signatures
An array with the signaturs of signers.
Example:
Below represents a transaction for creating a new wallet:
{
"transaction": {
"timestamp": 1663764440000,
"trans_code": "5fa9191ebb8284c0663cd12a186b65a1dd95a9e2",
"type": 1,
"currency": "NWRL",
"fee": 0.0,
"descr": "New wallet",
"valid": 1,
"specific_data": {
"custodian_wallet": "0xbc54ef523d92b6acaf16a49b328cfffca84503ca",
"kyc_docs": [
{
"type": 1,
"hash": "686f72957d4da564e405923d5ce8311b6567cedca434d252888cb566a5b4c401"
}
],
"ownertype": "1",
"jurisd": "910",
"specific_data": {},
"wallet_address": "0x7ab5ed7a098a53362439e7da7ccdf41767215546",
"wallet_public": "d76641f21e3d71ce80bd8b748e34690b85f9d4379d2f3296e7ca03d6f143e559785d5ac804fc2f0c3ffb064cea672b42e166278fe8bdbf60e8d5ffc706db951b"
}
},
"signatures": [
{
"wallet_address": "0xbc54ef523d92b6acaf16a49b328cfffca84503ca",
"msgsign": "0d0644e18b08415874734d307a740629dd98d02ffa1a3219da96b288594dbf990df2d82e752e7c53babb604296951d6f33e9386cc069548e5e659d7ff7179c11"
}
]
}