Status: idea → rough draft → draft → proposal → final review → stable
Let's get a common way of providing large files by having data spread amongst transactions.
This document describes a protocol named "Bcat" (pronounced B cat
).
Please share inputs and comments.
This protocol is only relevant if the data is larger than the limit of the current transaction size. If data fits within one transaction always use the B:// format for storing your data. With a limit of 100KB per transaction, a Bcat transaction can represent a file with roughly 290 MB of data.
Transactions on the blockchain that includes the bitcom namespace 15DHFxWZJT58f9nhyGnsRBqrgwK4W6h4Up
at the first position after an OP_RETURN
code shall be called a "Bcat" transaction.
The 15DHFxWZJT58f9nhyGnsRBqrgwK4W6h4Up
bitcom namespace must have 7 or more arguments to be valid:
-
A string providing any unstructured
info
the sender finds relevant to share about how the Bcat transaction came to life. No longer than 128 characters (can be an empty string in the transaction data - but please be aware that some frameworks for BSV to create and broadcast transactions will treat an empty string as no data and then not provide any string) -
A string providing the
MIME type
of the content of the file. No longer than 128 characters -
A string providing the
charset
/encoding of the file. No longer than 16 characters (can beNULL
[1]) -
A string providing the
name
of the file. No longer than 256 characters (can beNULL
[1]) -
A string providing a
flag
indicating how to treat data. No longer than 16 characters (can beNULL
[1]) -
32 bytes representing the bytes of the hash of the transaction with the first part of data of the file (
TX1
). -
32 bytes representing the bytes of the hash of the transaction with the second part of data of the file (
TX2
)
Any number of arguments can follow providing a sequence of transaction IDs (TXn
) in the order of how data is to be represented in the file. To be a valid Bcat transaction all transaction IDs (TX1
, TX2
, ... TXn
) must be unique, unless using the creative
flag.
[1] Any string consisting solely of any combination of the following chars will also be regarded as NULL:
- "\0" (NULL)
- "\t" (tab)
- "\n" (new line)
- "\x0B" (vertical tab)
- "\r" (carriage return)
- " " (ordinary white space)
OP_RETURN
15DHFxWZJT58f9nhyGnsRBqrgwK4W6h4Up
'BSV4ever'
'image/jpeg'
0x00
'zebra.jpeg'
0x00
0xe7e3bf38c590d432dcbfa7569b7977093a35755f7e288bef6f678c488e25fb50
0xb09088d68b78bec9b6b39fd5defda5df5963a233609477c0eb73ac54fcd6bee3
A Transaction referenced from a Bcat transaction will be called a Bcat part
. Each Bcat part transaction must follow the B:// specification or the Bcat part
specification as described in the following:
-
Transactions on the blockchain that include the bitcom namespace
1ChDHzdd1H4wSjgGMHyndZm6qxEDGjqpJL
at the first position after anOP_RETURN
code shall be calledBcat part
transactions. -
The
1ChDHzdd1H4wSjgGMHyndZm6qxEDGjqpJL
bitcom namespace must have 1 argument only:- Raw data representing a part of the original file.
Avoid referencing data in the B:// format if the data does not represent a meaningful context by it self ie. if it does not make sense to show a user only this part of the data, use a Bcat part
formatted transaction.
Please note that some flags expand the list of supported formats for transactions referenced.
The 3rd argument to a Bcat transaction is flag
and contains a string with information about how to deal with data. Only one flag can be provided. A content provider is free to choose to implement support for each flag or not. It is recommended to provide a useful error message if a valid but unsupported flag is used.
A content gateway can decide to support Bcat transactions with the gzip
flag by ensuring that
a Bcat transaction with this flag will have its content provided to the requesting client with no further processing of the content and the http response includes Content-Encoding: gzip
as part of the header. Please note that the first argument MIME type
must contain the MIME type of the original data.
Providing the gzip
flag is recommended for all data that is not to be processed or merged with other data on the fly.
A content gateway can decide to support Bcat transactions with the nested-gzip
flag by ensuring that
a Bcat transaction with this flag will be treated as if it had the gzip
flag with the addition that along with the B:// and Bcat part format for referenced transactions any Bcat transaction with the gzip
flag set will also be valid.
An invalid Bcat transaction should return an error to the client. This includes
- Any argument longer than described in the protocol
- Less than 7 arguments provided to a the Bcat transaction
- Reuse of referenced TX's
- Any referenced TX is not in the B:// or Bcat part format (exempt addition described for
nested-gzip
)'
If you provide content from the blockchain you are compatible with the Bcat protocol if
-
A client requesting the content of a Bcat transaction will receive content based on the concatenated data from
TX1
,TX2
...TXn
. -
The concatenation of data from
TX1
,TX2
...TXn
is binary safe. -
The handling of the concatenated data honors the description of the
flag
provided or with information letting the client know that the flag is not supported.
Please share inputs and comments.