Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix precompile and system contract address #208

Merged
merged 2 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 11 additions & 19 deletions docs/contract/precompile_contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,87 +18,80 @@ The address precompile contract is described by the last 2 bytes:

| Byte range [0..18] | Byte range [18..20] |
| --- | --- |
| 0000000000000000 | `addr` |
| 000000000000000000000000000000000000 | `addr` |

### EcRecover

| ADDRESS | MINIMUM GAS | INPUT | OUTPUT |
| --- | --- | --- | --- |
| 0x00000000000000000001 | 3000 | hash, v, r, s | publicAddress |
| 0x0000000000000000000000000000000000000001 | 3000 | hash, v, r, s | publicAddress |

EcRecover is a elliptic curve digital signature algorithm (ECDSA) public key recovery function. For details, see [this page](https://www.evm.codes/precompiled#0x01?fork=london).


### SHA2-256

| ADDRESS | MINIMUM GAS | INPUT | OUTPUT |
| --- | --- | --- | --- |
| 0x00000000000000000002 | 60 | data | hash |
| 0x0000000000000000000000000000000000000002 | 60 | data | hash |

SHA2-256 is the hash function used in Bitcoin. For details, see [this page](https://www.evm.codes/precompiled#0x02?fork=london)


### RIPEMD-160

| ADDRESS | MINIMUM GAS | INPUT | OUTPUT |
| --- | --- | --- | --- |
| 0x00000000000000000003 | 600 | data | hash |
| 0x0000000000000000000000000000000000000003 | 600 | data | hash |

A hash function. For details, see [this page](https://www.evm.codes/precompiled#0x03?fork=london).


### Identity

| ADDRESS | MINIMUM GAS | INPUT | OUTPUT |
| --- | --- | --- | --- |
| 0x00000000000000000004 | 15 | data | data |
| 0x0000000000000000000000000000000000000004 | 15 | data | data |

Identity copies and returns input data. For details, see [this page](https://www.evm.codes/precompiled#0x04?fork=london).


### Modexp

| ADDRESS | MINIMUM GAS | INPUT | OUTPUT |
| --- | --- | --- | --- |
| 0x00000000000000000005 | 200 | Bsize, Esize, Msize, B, E, M | value |
| 0x0000000000000000000000000000000000000005 | 200 | Bsize, Esize, Msize, B, E, M | value |

Modexp is an arbitrary-precision exponentiation under modulo. For details, see [this page](https://www.evm.codes/precompiled#0x05?fork=london).


### EcAdd

| ADDRESS | MINIMUM GAS | INPUT | OUTPUT |
| --- | --- | --- | --- |
| 0x00000000000000000006 | 150 | x1, x2, y1, y2 | x, y |
| 0x0000000000000000000000000000000000000006 | 150 | x1, x2, y1, y2 | x, y |

EcAdd is the point addition (ADD) on the elliptic curve alt_bn128. For details, see [this page](https://www.evm.codes/precompiled#0x06?fork=london).


### EcMul

| ADDRESS | MINIMUM GAS | INPUT | OUTPUT |
| --- | --- | --- | --- |
| 0x00000000000000000007 | 6000 | x1, x2, s | x, y |
| 0x0000000000000000000000000000000000000007 | 6000 | x1, x2, s | x, y |

EcMul is the scalar multiplication (MUL) on the elliptic curve alt_bn128. For details, see [this page](https://www.evm.codes/precompiled#0x07?fork=london).

### EcPairing

| ADDRESS | MINIMUM GAS | INPUT | OUTPUT |
| --- | --- | --- | --- |
| 0x00000000000000000008 | 45000 | x1, y1, x2, y2, …, xk, yk | success |
| 0x0000000000000000000000000000000000000008 | 45000 | x1, y1, x2, y2, …, xk, yk | success |

EcPairing is the bilinear function on groups on the elliptic curve `alt_bn128`. For details, see [this page](https://www.evm.codes/precompiled#0x08?fork=london).

### Blake2f

| ADDRESS | MINIMUM GAS | INPUT | OUTPUT |
| --- | --- | --- | --- |
| 0x00000000000000000009 | 0 | rounds, h, m, t, f | h |
| 0x0000000000000000000000000000000000000009 | 0 | rounds, h, m, t, f | h |

Blake2f is the compression function F used in the BLAKE2 cryptographic hashing algorithm. For details, see [this page](https://www.evm.codes/precompiled#0x09?fork=london).


### GetHeader

🚧 Information updates in progress - stay tuned!
Expand All @@ -111,7 +104,7 @@ Blake2f is the compression function F used in the BLAKE2 cryptographic hashing a

| ADDRESS | MINIMUM GAS | INPUT | OUTPUT |
| --- | --- | --- | --- |
| 0x00000000000000000104 | 300 | cell dep, args | big-endian bytes |
| 0x0000000000000000000000000000000000000104 | 300 | cell dep, args | big-endian bytes |

Call a script that runs in CKB-VM and return the execute result.

Expand Down Expand Up @@ -186,4 +179,3 @@ contract CallCkbVm {
### VerifyInCkbVm

🚧 Information updates in progress - stay tuned!

6 changes: 3 additions & 3 deletions docs/contract/system_contacts.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The Metadata Contract records the metadata of the chain, such as validator ident
### Address

```
0x10000000000000000001
0xffffffffffffffffffffffffffffffffffffff01
```

### ABI
Expand Down Expand Up @@ -328,7 +328,7 @@ The CKB Light Client Contract is the light client on Axon for CKB Layer 1. It re
### Address

```
0x10000000000000000003
0xffffffffffffffffffffffffffffffffffffff03
```

### ABI
Expand Down Expand Up @@ -449,7 +449,7 @@ The Image Cell Contract stores the CKB Layer 1 cells in Axon, allowing applicati
### Address

```
0x10000000000000000004
0xffffffffffffffffffffffffffffffffffffff04
```

### ABI
Expand Down
Loading