mirror of
https://github.com/status-im/EIPs.git
synced 2025-03-04 00:20:54 +00:00
comment about salt
This commit is contained in:
parent
6985e8cc28
commit
f6775aa3b0
@ -10,10 +10,11 @@ created: 2018-04-20
|
||||
|
||||
### Specification
|
||||
|
||||
Adds a new opcode at 0xf5, which takes 4 stack arguments: endowment, memory_start, memory_length, salt. Behaves identically to CREATE, except using `keccak256( 0xff ++ address ++ salt ++ keccak256(init_code)))` instead of the usual sender-and-nonce-hash as the address where the contract is initialized at.
|
||||
Adds a new opcode at 0xf5, which takes 4 stack arguments: endowment, memory_start, memory_length, salt. Behaves identically to CREATE, except using `keccak256( 0xff ++ address ++ salt ++ keccak256(init_code)))` instead of the usual sender-and-nonce-hash as the address where the contract is initialized at. The `salt` is a 32-byte stack item.
|
||||
|
||||
The coredev-call at 2018-08-10 decided to use the formula above.
|
||||
|
||||
|
||||
### Motivation
|
||||
|
||||
Allows interactions to (actually or counterfactually in channels) be made with addresses that do not exist yet on-chain but can be relied on to only possibly eventually contain code that has been created by a particular piece of init code. Important for state-channel use cases that involve counterfactual interactions with contracts.
|
||||
@ -45,34 +46,40 @@ It should also be noted that `SELFDESTRUCT` has no immediate effect on `nonce` o
|
||||
|
||||
### Examples
|
||||
|
||||
* address `0x0000000000000000000000000000000000000000`
|
||||
* salt `0x0000000000000000000000000000000000000000000000000000000000000000`
|
||||
* code `0x00`
|
||||
* result: `0x4D1A2e2bB4F88F0250f26Ffff098B0b30B26BF38`
|
||||
Example 0
|
||||
* address `0x0000000000000000000000000000000000000000`
|
||||
* salt `0x0000000000000000000000000000000000000000000000000000000000000000`
|
||||
* code `0x00`
|
||||
* result: `0x4D1A2e2bB4F88F0250f26Ffff098B0b30B26BF38`
|
||||
|
||||
* address `0xdeadbeef00000000000000000000000000000000`
|
||||
* salt `0x0000000000000000000000000000000000000000000000000000000000000000`
|
||||
* code `0x00`
|
||||
* result: `0xB928f69Bb1D91Cd65274e3c79d8986362984fDA3`
|
||||
Example 1
|
||||
* address `0xdeadbeef00000000000000000000000000000000`
|
||||
* salt `0x0000000000000000000000000000000000000000000000000000000000000000`
|
||||
* code `0x00`
|
||||
* result: `0xB928f69Bb1D91Cd65274e3c79d8986362984fDA3`
|
||||
|
||||
* address `0xdeadbeef00000000000000000000000000000000`
|
||||
* salt `0x000000000000000000000000feed000000000000000000000000000000000000`
|
||||
* code `0x00`
|
||||
* result: `0xD04116cDd17beBE565EB2422F2497E06cC1C9833`
|
||||
Example 2
|
||||
* address `0xdeadbeef00000000000000000000000000000000`
|
||||
* salt `0x000000000000000000000000feed000000000000000000000000000000000000`
|
||||
* code `0x00`
|
||||
* result: `0xD04116cDd17beBE565EB2422F2497E06cC1C9833`
|
||||
|
||||
* address `0x0000000000000000000000000000000000000000`
|
||||
* salt `0x0000000000000000000000000000000000000000000000000000000000000000`
|
||||
* code `0xdeadbeef`
|
||||
* result: `0x70f2b2914A2a4b783FaEFb75f459A580616Fcb5e`
|
||||
Example 3
|
||||
* address `0x0000000000000000000000000000000000000000`
|
||||
* salt `0x0000000000000000000000000000000000000000000000000000000000000000`
|
||||
* code `0xdeadbeef`
|
||||
* result: `0x70f2b2914A2a4b783FaEFb75f459A580616Fcb5e`
|
||||
|
||||
* address `0x00000000000000000000000000000000deadbeef`
|
||||
* salt `0x00000000000000000000000000000000000000000000000000000000cafebabe`
|
||||
* code `0xdeadbeef`
|
||||
* result: `0x60f3f640a8508fC6a86d45DF051962668E1e8AC7`
|
||||
Example 4
|
||||
* address `0x00000000000000000000000000000000deadbeef`
|
||||
* salt `0x00000000000000000000000000000000000000000000000000000000cafebabe`
|
||||
* code `0xdeadbeef`
|
||||
* result: `0x60f3f640a8508fC6a86d45DF051962668E1e8AC7`
|
||||
|
||||
* address `0x00000000000000000000000000000000deadbeef`
|
||||
* salt `0x00000000000000000000000000000000000000000000000000000000cafebabe`
|
||||
* code `0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef`
|
||||
* result: `0x1d8bfDC5D46DC4f61D6b6115972536eBE6A8854C`
|
||||
Example 5
|
||||
* address `0x00000000000000000000000000000000deadbeef`
|
||||
* salt `0x00000000000000000000000000000000000000000000000000000000cafebabe`
|
||||
* code `0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef`
|
||||
* result: `0x1d8bfDC5D46DC4f61D6b6115972536eBE6A8854C`
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user