D://
Bitcoin dynamic content protocol
Benefit
A D:// transaction refers to another transaction/file and thus forms a layer which state can be overwritten. This way, referencing content via D:// links (instead of b:// or c://) has the advantage of keeping the URL while the content can change.
Example B:// (can not be changed once set):
<img src="B://<TxID>"
Example D:// (content can be changed, because the state can be updated):
<img src="D://<OwnerBitcoinAddress>/<key>"
Overwrite D:// State
New transactions with the same key from a sender overwrite the previous state. The Planaria API always outputs only the most current state.
The owner/key combination prevents an unauthorised person from changing the state.
Protocol
- The prefix for D is 19iG3WTYSsbyos3uJ733yK4zEioi1FesNU, generated using Bitcom
The sender of the transaction will always be an "owner" of the state = first input address will be able to change the state again.
D:// transactions comes in 2 variants.
External reference
A D:// transaction with external reference is formatted like:
OP_RETURN
19iG3WTYSsbyos3uJ733yK4zEioi1FesNU
[key]
[value]
[type]
[sequence]
-
keymust have one of the following values:- NULL
- An utf-8 encoded string no longer than 1024 bytes not starting with
/and not including the chars[\x00-\x1F\x7F?#]. It is suggested to simulate a folder like structure in a URI styled manner. Even if (almost) all utf8 chars are allowed it is not to be considered an IRI askeymust be url-escaped to become a valid URI whenever presented to a user. Only using[a-zA-Z0-9_~/@!$&*+,.:;=-]is therefore advisable.
-
valuemust have one of the following values:- NULL
- a string utf8 encoded string no longer than 2086 bytes.
-
typemust have one of the following values:- NULL
- the string
cindicating thatvaluecontains the sha256 hash of the targeted content - the string
bindicating thatvaluecontains the transaction ID of a b:// formatted transaction. For internal referencestypemust be set to the stringbindicating that target transaction is a b:// formatted transaction. - the string
txto indicate thatvaluecontains the transaction ID of a transaction - The string
txtindicating thatvaluecontains the full content of the latest state.
-
sequencemust have one of the following values:- An integer larger than 0 and smaller than 2^53-1. Everything that is not a number or a negative number is considered to be
1. Used to indicate the order of events if multiple updates are provided in the same block to the same key from the same owner.
- An integer larger than 0 and smaller than 2^53-1. Everything that is not a number or a negative number is considered to be
Example:
OP_RETURN
19iG3WTYSsbyos3uJ733yK4zEioi1FesNU
"zebra.jpeg"
0f9e7b6542eba739bd407323f58d75327dd1d68a53d2a535337a4dcf0ddb0edc
tx
1
Internal reference
A D:// transaction with internal reference is piped directly on to a B:// formatted structure (with mandatory fields for encoding and filename). type must always be b and value field will always be ignored.
OP_RETURN
19HxigV4QyBv3tHpQVcUEQyq1pzZVdoAut
[DATA]
[MEDIA TYPE]
[ENCODING] or NULL
[FILENAME] or NULL
|
19iG3WTYSsbyos3uJ733yK4zEioi1FesNU
[key]
NULL
b
[sequence]
Explicit owner
Both transactions with internal and external references can add an explicit owner by piping the AIP protocol that signs all previous fields (API_ALL).
Example A:
OP_RETURN
19iG3WTYSsbyos3uJ733yK4zEioi1FesNU
[key]
[value]
[type]
[sequence]
|
15PciHG22SNLQJXMoSUaWVi7WSqc7hCfva
[Signing Algorithm]
[Signing Address]
[Signature]
Example B:
OP_RETURN
19HxigV4QyBv3tHpQVcUEQyq1pzZVdoAut
[DATA]
[MEDIA TYPE]
[ENCODING] or NULL
[FILENAME] or NULL
|
19iG3WTYSsbyos3uJ733yK4zEioi1FesNU
[key]
NULL
b
[sequence]
|
15PciHG22SNLQJXMoSUaWVi7WSqc7hCfva
[Signing Algorithm]
[Signing Address]
[Signature]
If a transaction includes a valid AIP signature and the signature involves all previous fields (AIP_ALL) both the sender and AIP signing address will create an updated state for key. Effectively this means that you will be able to access the content with both D://<tx sender address>/<key> and D://<AIP signing address>/<key>.
Delete
A key is "removed" by updating the key with a type value set to NULL (0x00). The state of the planaria will provide the string deleted as "type" when a key is removed.
Example:
OP_RETURN
19iG3WTYSsbyos3uJ733yK4zEioi1FesNU
[key]
NULL
NULL
1
Example Tx
This is an example Website with D:// link in it: https://bico.media/0363e9addc3f5de6587b250a07c4bab00f58f54cf780aa5f0f4655a8d3e4cfa5
The image is mapped like
<img src="D://19iG3WTYSsbyos3uJ733yK4zEioi1FesNU/der_wolf_und_die_sieben_geislein.jpeg">`
==> C://c808b8aa7bf72a0732d1a366d530b6ad3cdea1f25cbe075ca075dc1f55006e5e
==> B://efb301edd3a8b2270aea61cdc46bd923130a8c05245f763ff3c3c8fea1f0fc27
State machine D:// tx: https://whatsonchain.com/tx/329eacb2d1ab8770ac01d2daa13a852d72282379ea26caca1729817315fb12b0
Referencing
A D:// transaction is referenced by D://<OwnerBitcoinAddress>/<key> or bit://19iG3WTYSsbyos3uJ733yK4zEioi1FesNU/<OwnerBitcoinAddress>/<key>
-
Key must always be presented as a URL encoded string
-
In case the key is NULL no key is to be provided
-
In case no key is provided the
/is optional -
In case no key is provided, the content will tentatively be derived from the first of the following keys with an existing and none-deleted d:// transaction:
- The key of
NULLvalue (0x00) - The key
index.html - The key
index.htm
- The key of
Links
Future ideas
- An API that resolves D:// links to txids or an API that returns even the file data can be built.
- Get a list of "files" in a directory (find all current tx with a key that starts with
xyz/for a specific owner) - Multiple signatures to share control
- X out of N signatures to share control
- Support D:// piped on any type of transaction
D:// was born as a brainchild of SH and @rangelWulff