forked from arein/dapp-smart-account
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ethereum#33 from ropats16/feat/arweave-integration
to add arweave/README + caip2 + caip10 + caip122
- Loading branch information
Showing
4 changed files
with
224 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
namespace-identifier: arweave | ||
title: Blockchain Reference for Arweave Namespace | ||
author: Rohit Pathare (@ropats16), Phil Billingsby (@pbillingsby) | ||
status: Draft | ||
type: Informational | ||
created: 2022-08-27 | ||
requires: ["CAIP-2", "CAIP-10", "CAIP-122"] | ||
--- | ||
|
||
# Namespace for Arweave chains | ||
|
||
This document describes the details of the Arweave network namespace and reference. | ||
|
||
## References | ||
|
||
- [Arweave](https://github.com/ArweaveTeam/arweave-standards) | ||
- [CAIP-2](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md) | ||
- [CAIP-10](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md) | ||
- [CAIP-122](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-122.md) | ||
|
||
## Rights | ||
|
||
Copyright and related rights waived via CC0. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
namespace-identifier: arweave-caip10 | ||
title: Arweave Namespace - Addresses | ||
author: Rohit Pathare (@ropats16), Phil Billingsby (@pbillingsby), Dan MacDonald (@DanMacDonald) | ||
discussions-to: | ||
status: Draft | ||
type: Standard | ||
created: 2022-09-01 | ||
requires: ["CAIP-2", "CAIP-10"] | ||
--- | ||
|
||
# CAIP-10 | ||
|
||
*For context, see the [CAIP-10][] specification.* | ||
|
||
## Abstract | ||
In CAIP-10 an account identification scheme is defined. This is the implementation of CAIP-10 for Arweave network. | ||
|
||
## Rationale | ||
|
||
Particularities of syntax for Arweave "accounts" have been specified. | ||
|
||
## Syntax | ||
|
||
Arweave addresses have a normalization of lowercase letters, uppercase letters, numbers and `-`s. The addresses are encoded in base64Url format. | ||
|
||
### Backwards Compatibility | ||
|
||
Not applicable. | ||
|
||
## Test Cases | ||
|
||
``` | ||
# Arweave mainnet | ||
arweave:7wIU:kY9RAgTJEImkBpiKgVeXrsGV02T-D4dI3ZvSpnn7HSk | ||
``` | ||
|
||
## References | ||
|
||
- [Arweave](https://github.com/ArweaveTeam/arweave-standards) | ||
- [Hash of Genesis Block](https://viewblock.io/arweave/block/0) | ||
- [CAIP-2](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md) | ||
- [CAIP-10](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md) | ||
- [CAIP-122](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-122.md) | ||
|
||
|
||
|
||
## Rights | ||
|
||
Copyright and related rights waived via CC0. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
--- | ||
namespace-identifier: arweave-caip122 | ||
title: Arweave Namespace - SIWx | ||
author: Rohit Pathare (@ropats16), Phil Billingsby (@pbillingsby), Dan MacDonald (@DanMacDonald) | ||
discussions-to: TBA | ||
status: Draft | ||
type: Standard | ||
created: 2022-09-01 | ||
requires: ["CAIP-122", "CAIP-2", "CAIP-10"] | ||
--- | ||
|
||
## CAIP-122 | ||
|
||
For context, see the [CAIP-122](CAIP-122) specification. | ||
|
||
## Rationale | ||
|
||
Arweave signatures are 512 byte arrays which are `Base64URL` encoded for transmission over HTTP. This specification provides the signing algorithm to use, the `type` of the signing algorithm to identify it, and a method for signature creation and verification as required by [CAIP-122](CAIP-122). | ||
|
||
## Specification | ||
|
||
### Signing Algorithm | ||
|
||
Arweave wallets are RSA key pairs and use the private and public keys for signing and verifying signatures. Arweave wallet addresses are the SHA-256 hash of the RSA public key. | ||
|
||
### Signature Type | ||
|
||
Arweave signatures use the RSA-PSS signing algorithm to sign data and verify signatures. Hence, the type of the signature would be represented as `arweave:rsa-pss` in the cacao object. | ||
|
||
### Signature Creation | ||
|
||
The abstract data model must be converted into a string representation in an unambigious format. We use the format as defined in EIP-4361 as reference. | ||
|
||
An informal template of the full message is presented below. The field descriptions are provided in the order they must appear as follows: | ||
- `domain` is the RFC 3986 authority that is requesting the signing. | ||
- `address` is the Arweave address performing the signing. | ||
- `statement` (optional) is a human-readable ASCII assertion that the user will sign, and it must not contain '\n'. | ||
- `uri` is an RFC 3986 URI referring to the resource that is the subject of the signing (as in the subject of a claim). | ||
- `version` is the current version of the message, which MUST be 1 for this specification. | ||
- `chain-id` (optional) is the Arweave Chain ID to which the session is bound, and the network where Contract Accounts MUST be resolved. | ||
- `nonce` (optional) is a randomized token typically chosen by the relying party and used to prevent replay attacks, at least 8 alphanumeric characters. | ||
- `timestamp` (optional) is the unix time stamp of when the request was created. | ||
- `expiration-time` (optional) is the ISO 8601 datetime string that, if present, indicates when the signed authentication message is no longer valid. | ||
- `not-before` (optional) is the ISO 8601 datetime string that, if present, indicates when the signed authentication message will become valid. | ||
- `request-id` (optional) is an system-specific identifier that may be used to uniquely refer to the sign-in request. | ||
- `resources` (optional) is a list of information or references to information the user wishes to have resolved as part of authentication by the relying party. They are expressed as RFC 3986 URIs separated by "\n- " where \n is the byte 0x0a. | ||
- `type` of the signature to be generated, as defined in the namespaces for this CAIP. | ||
- `signature` is the result of concatenation and signing of the other field descriptions by the wallet. | ||
|
||
``` | ||
${domain} wants you to sign in with your Arweave account: | ||
${address} | ||
${statement} | ||
URI: ${uri} | ||
Version: ${version} | ||
Chain ID: ${chain-id} | ||
Nonce: ${nonce} | ||
Issued At: ${timestamp} | ||
Expiration Time: ${expiration-time} | ||
Not Before: ${not-before} | ||
Request ID: ${request-id} | ||
Resources: | ||
- ${resources[0]} | ||
- ${resources[1]} | ||
... | ||
- ${resources[n]} | ||
Type: ${type} | ||
Signature: ${signature} | ||
``` | ||
|
||
The signature creation process on Arweave is done through the `arweave-js` library. The message data model is expressed in string format. This string is signed using the RSA-PSS algorithm through a manual call to the `sign()` method from the `arweave-js` library. The signature is returned as a Uint8Array of bytes which is then Base64Url encoded by calling `arweave.utils.bufferTob64Url()`. | ||
|
||
### Signature Verification | ||
|
||
The signature is encoded in Base64URL format. It must be decoded to an array of bytes before being verified using the RSA algorithm. | ||
|
||
## References | ||
|
||
- [EIP-4361](https://eips.ethereum.org/EIPS/eip-4361) | ||
- [Arweave](https://github.com/ArweaveTeam/arweave-standards) | ||
- [Arweave Transaction Signing](https://docs.arweave.org/developers/server/http-api#transaction-signing) | ||
- [CAIP-2](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md) | ||
- [CAIP-10](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md) | ||
- [CAIP-122](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-122.md) | ||
|
||
|
||
|
||
## Rights | ||
|
||
Copyright and related rights waived via CC0. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
namespace-identifier: arweave-caip2 | ||
title: Arweave Namespace - Chains | ||
author: Rohit Pathare (@ropats16), Phil Billingsby (@pbillingsby), Dan MacDonald (@DanMacDonald) | ||
discussions-to: | ||
status: Draft | ||
type: Standard | ||
created: 2022-09-01 | ||
requires: CAIP-2 | ||
--- | ||
|
||
# CAIP-2 | ||
|
||
*For context, see the [CAIP-2][] specification.* | ||
|
||
## Abstract | ||
In CAIP-2 a general blockchain identification scheme is defined. This is the implementation of CAIP-2 for Arweave network. | ||
|
||
### Arweave Namespace | ||
|
||
The namespace "arweave" refers to the wider Arweave ecosystem. | ||
|
||
#### Reference Definition | ||
|
||
The reference relies on Arweave's current designation of addresses belonging to main network by prefixing them with `7wIU` which is the representation of the [hash of the genesis block](https://viewblock.io/arweave/block/0) truncated to the first 4 characters. | ||
|
||
|
||
## Rationale | ||
|
||
Arweave has one blockchain, the [Blockweave](https://www.arweave.org/technology#blockweaves). | ||
|
||
## Backwards Compatibility | ||
|
||
Not applicable. | ||
|
||
## Test Cases | ||
|
||
This is a manually composed example. | ||
|
||
``` | ||
# Arweave Mainnet | ||
arweave:7wIU | ||
``` | ||
|
||
## References | ||
|
||
- [Arweave](https://github.com/ArweaveTeam/arweave-standards) | ||
- [Hash of Genesis Block](https://viewblock.io/arweave/block/0) | ||
- [CAIP-2](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md) | ||
- [CAIP-10](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md) | ||
- [CAIP-122](https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-122.md) | ||
|
||
|
||
|
||
## Rights | ||
|
||
Copyright and related rights waived via CC0. |