-
Notifications
You must be signed in to change notification settings - Fork 1
Publishing
Aakil Fernandes edited this page Jul 1, 2015
·
12 revisions
Publishing is the act of broadcasting a vendor's data to the Bitcoin blockchain. Once a vendor's data has been published, anyone can retrieve his/her data by supplying the xpubkey
.
At a high level, the vendor data is compressed into a msgpack object, signed, and split into 37-byte chunks called "manifests". Each manifest is given a 3-byte header for a total of 40-bytes.
The following is pseudocode to help understand the publishing process.
//pack the vendor data using the msgpack encoding scheme
vendorDataMsg = msgpack.encode(vendorData)
//sign the vendor data with the vendor's address
signature = sign.(vendorDataMsg,vendor.address)
//compute the number of transactions a broadcast will take
transactionsRequired = ((1+vendorData)/37).roundUp()
//add everything together into a single byte array
manifest = [transactionsRequired] + signature + vendorDataMsg
//split the bytes into chunks of 37
manifestChunks = manifest.splitIntoChunksOfByteSize(37)
//create an OP_RETURN transaction for each chunk and broadcast it to the network
manifestChunks.each(function(vendorDataMsgChunk){
sendrawtransaction('OP_RETURN',header+vendorDataMsgChunk,vendor.address)
})
All fields are to be decoded using UTF-8. Only the product image url is optional.
- Name (n)
- Currency (c)
- Pgp Key Data (k)
- Info (i)
- Array of Products (p)
- Name (n)
- Price (p)
- Image URL (i) (optional)