OpenRelay

Massive

## Massive - Concept * Toolkit for handling serialized orders * JSON Streaming * Command Line Utilities
## JSON Streaming - General * Continuous stream of JSON objects * **Not** encoded as a JSON list * Each object is handled independently * Streams are arbitrarily long
## JSON Streaming - Massive * Line-delimited JSON Objects * Each line is a 0x Order

JSON Streaming - Simple Example (Python)


							for line in sys.stdin:
							  item = json.loads(line)
							  # do stuff to item
							  json.dump(item, sys.stdout)
							  sys.stdout.write("\n")
						
## JSON Streaming - Use Cases * Processing data from a variety of sources * API * Database * Flat files * Generated data set * Use standardized tools across a variety of sources
## Unix pipes * Very common scripting pattern * Goes back to Bell Labs in 1973 * Still incredibly powerful * Example: cat file | grep pattern | sed 's/abc/def/g' > new_file * Creates 3 processes: `cat`, `grep` & `sed` * Output from one stage (stdout) is input to next (stdin) * Highly Parallel

Massive Message - Example


						{
						  "makerAddress": "0x324454186bb728a3ea55750e0618ff1b18ce6cf8",
						  "takerAddress": "0x0000000000000000000000000000000000000000",
						  "makerAssetData": "0xf47261b00000000000000000000000001dad4783cf3fe3085c1426157ab175a6119a04ba",
						  "takerAssetData": "0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c",
						  "feeRecipientAddress": "0xc22d5b2951db72b44cfb8089bb8cd374a3c354ea",
						  "exchangeAddress": "0xa458ec0709468996ef2ef668f5e52f37ceb66627",
						  "senderAddress": "0x0000000000000000000000000000000000000000",
						  "makerAssetAmount": "1000000000000000000",
						  "takerAssetAmount": "1000000000000000000",
						  "makerFee": "0",
						  "takerFee": "200000000000000000",
						  "expirationTimeSeconds": "1536429542",
						  "salt": "0",
						  "signature": "0x1c161ee721e0b7a5f90b5be679014fc7d9e8839e8785b263680d4931e8c811897c0ca3b8a406551197da64b5f66e1fbd91d0b5f772241376da43d2b08e91ac832902"
						}
						
(Would be on one line)
## Types of Massive Tools * **Sources**: Generate messages * **Pipes**: Consume and produce massive messages * **Sinks**: Consume massive messages massive 0x source | massive 0x pipe | massive 0x pipe | 0x massive sink

Source - CSV


							makerAssetData,makerAssetAmount,takerAssetData,takerAssetAmount
							0xf47261b00000000000000000000000001dad4783cf3fe3085c1426157ab175a6119a04ba,1000000000000000000,0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c,1000000000000000000
							0xf47261b0000000000000000000000000d0a1e359811322d97991e03f863a0c30c2cf029c,1000000000000000000,0xf47261b00000000000000000000000001dad4783cf3fe3085c1426157ab175a6119a04ba,1000000000000000000
						
## Alternative Sources * Standard Relayer API * Database Utilities * Arbitrary Scripts
## Pipes * **expiration** — Sets order expiration dates * **getFees** — Gets fees from Standard Relayer API * **setExchange** — Sets Exchange based on network * **setSalt** — Sets Salt — Random Number, timestamp, or specified value * **sign** — Signs 0x Orders using key * **setAllowance** — Enable 0x trading of token
## Future Work (pipes) * Limited Allowances * Sign using RPC server * Salt using Epoch

Complete Example


								massive 0x csv --input=sample.csv | \
								massive 0x expiration --duration 864000 | \
								massive 0x getFees --maker-share .5 --target https://api.openrelay.xyz/ | \
								massive 0x setExchange --ropsten | \
								massive 0x setSalt | \
								massive 0x sign --replace-on-mismatch /path/to/private-key | \
								massive 0x setAllowance --unlimited http://localhost:8545 /path/to/private/key | \
								massive 0x upload --target https://api.openrelay.xyz/
							
## Next Week * NALIT Conference * Special Edition Screenside Chat