Skip to content
This repository has been archived by the owner on May 26, 2023. It is now read-only.

Add ECDSA/Eth signing scheme (v1) #454

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Conversation

n-hutton
Copy link

@n-hutton n-hutton commented Jun 12, 2022

Pairs with PR: Zilliqa/Zilliqa#2806

The example code examples/evm_transaction_ecdsa.js does the following:

  • Moves funds from a genesis address (ZIL) to eth-style
  • Makes a payment with this eth style address + ecdsa TX signing
  • Executes an EVM transaction using eth signing etc.


const code = `608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061065d806100606000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063435ffe94146100465780638da5cb5b146100625780638da9b77214610080575b600080fd5b610060600480360381019061005b91906102fb565b61009e565b005b61006a61012d565b60405161007791906103af565b60405180910390f35b610088610156565b60405161009591906103ca565b60405180910390f35b3373ffffffffffffffffffffffffffffffffffffffff166100bd61012d565b73ffffffffffffffffffffffffffffffffffffffff1614610113576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161010a906103ec565b60405180910390fd5b80600190805190602001906101299291906101e8565b5050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060018054610165906104f2565b80601f0160208091040260200160405190810160405280929190818152602001828054610191906104f2565b80156101de5780601f106101b3576101008083540402835291602001916101de565b820191906000526020600020905b8154815290600101906020018083116101c157829003601f168201915b5050505050905090565b8280546101f4906104f2565b90600052602060002090601f016020900481019282610216576000855561025d565b82601f1061022f57805160ff191683800117855561025d565b8280016001018555821561025d579182015b8281111561025c578251825591602001919060010190610241565b5b50905061026a919061026e565b5090565b5b8082111561028757600081600090555060010161026f565b5090565b600061029e61029984610431565b61040c565b9050828152602081018484840111156102ba576102b96105b8565b5b6102c58482856104b0565b509392505050565b600082601f8301126102e2576102e16105b3565b5b81356102f284826020860161028b565b91505092915050565b600060208284031215610311576103106105c2565b5b600082013567ffffffffffffffff81111561032f5761032e6105bd565b5b61033b848285016102cd565b91505092915050565b61034d8161047e565b82525050565b600061035e82610462565b610368818561046d565b93506103788185602086016104bf565b610381816105c7565b840191505092915050565b6000610399603d8361046d565b91506103a4826105d8565b604082019050919050565b60006020820190506103c46000830184610344565b92915050565b600060208201905081810360008301526103e48184610353565b905092915050565b600060208201905081810360008301526104058161038c565b9050919050565b6000610416610427565b90506104228282610524565b919050565b6000604051905090565b600067ffffffffffffffff82111561044c5761044b610584565b5b610455826105c7565b9050602081019050919050565b600081519050919050565b600082825260208201905092915050565b600061048982610490565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b82818337600083830152505050565b60005b838110156104dd5780820151818401526020810190506104c2565b838111156104ec576000848401525b50505050565b6000600282049050600182168061050a57607f821691505b6020821081141561051e5761051d610555565b5b50919050565b61052d826105c7565b810181811067ffffffffffffffff8211171561054c5761054b610584565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4f776e65727368697020417373657274696f6e3a2043616c6c6572206f66207460008201527f68652066756e6374696f6e206973206e6f7420746865206f776e65722e00000060208201525056fea2646970667358221220ff9b5a27a0147ce10c5b6c950666755848365d7def32aa74d7b825ae2089022e64736f6c63430008070033`;

const init = [
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this for EVM? The API accepts an empty init argument just fine on contract creation (checked). Maybe zilliqa-js might not be happy without some JSON, in that case we should be able to get rid of this in the future.

// If a transaction of contract invocation is sent to a shard and if the shard is not allowed to process it, then the transaction will be dropped.
const newMsg = 'Hello, the time is ' + Date.now();
console.log('Calling setHello transition with msg: ' + newMsg);
const callTx = await hello.call(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work with an EVM contract? The meesage above says it is calling a transition, assuming Scilla?

@inamirandaz
Copy link

@n-hutton why are we merging this to the main branch already?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants