aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/crypto.go
diff options
context:
space:
mode:
authorgary rong <garyrong0905@gmail.com>2018-07-24 22:22:03 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-07-24 22:22:03 +0800
commitcab1cff11cbcd4ff60f1a149deb71ec87413b487 (patch)
tree2e7c89b0a541a03e23294d4b444892a9420cbc9c /crypto/crypto.go
parent2909f6d7a2ceb5b1cdeb4cc3966531018a0b8334 (diff)
downloadgo-tangerine-cab1cff11cbcd4ff60f1a149deb71ec87413b487.tar
go-tangerine-cab1cff11cbcd4ff60f1a149deb71ec87413b487.tar.gz
go-tangerine-cab1cff11cbcd4ff60f1a149deb71ec87413b487.tar.bz2
go-tangerine-cab1cff11cbcd4ff60f1a149deb71ec87413b487.tar.lz
go-tangerine-cab1cff11cbcd4ff60f1a149deb71ec87413b487.tar.xz
go-tangerine-cab1cff11cbcd4ff60f1a149deb71ec87413b487.tar.zst
go-tangerine-cab1cff11cbcd4ff60f1a149deb71ec87413b487.zip
core, crypto, params: implement CREATE2 evm instrction (#17196)
* core, crypto, params: implement CREATE2 evm instrction * core/vm: add opcode to string mapping * core: remove past fork checking * core, crypto: use option2 to generate new address
Diffstat (limited to 'crypto/crypto.go')
-rw-r--r--crypto/crypto.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/crypto/crypto.go b/crypto/crypto.go
index 619440e81..dec6e3c19 100644
--- a/crypto/crypto.go
+++ b/crypto/crypto.go
@@ -76,6 +76,12 @@ func CreateAddress(b common.Address, nonce uint64) common.Address {
return common.BytesToAddress(Keccak256(data)[12:])
}
+// CreateAddress2 creates an ethereum address given the address bytes, initial
+// contract code and a salt.
+func CreateAddress2(b common.Address, salt common.Hash, code []byte) common.Address {
+ return common.BytesToAddress(Keccak256([]byte{0xff}, b.Bytes(), salt.Bytes(), code)[12:])
+}
+
// ToECDSA creates a private key with the given D value.
func ToECDSA(d []byte) (*ecdsa.PrivateKey, error) {
return toECDSA(d, true)